Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update geo-redundancy code sample and readme #8

Prev Previous commit
Next Next commit
Some updates from review
  • Loading branch information
pauljewellmsft committed Sep 7, 2022
commit 71a679a834e5d02582cda37b2ac4f277562344ed
31 changes: 31 additions & 0 deletions v12/storage-dotnet-redundancy-ha-ra-grs/PipelinePolicy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Azure.Core;
using Azure.Core.Pipeline;

namespace StorageRedundancy
{
internal class ShowRequestInfoPolicy : HttpPipelinePolicy
{
public override void Process(
HttpMessage message, ReadOnlyMemory<HttpPipelinePolicy> pipeline)
{
ProcessMessage(message);
ProcessNext(message, pipeline);
}
public override async ValueTask ProcessAsync(
HttpMessage message, ReadOnlyMemory<HttpPipelinePolicy> pipeline)
{
ProcessMessage(message);
await ProcessNextAsync(message, pipeline);
}

private void ProcessMessage(HttpMessage message)
{
string? host = message.Request.Uri.Host;
if (host is not null)
{
string region = host.Contains("-secondary") ? "secondary" : "primary";
Console.WriteLine($"Request sent to {region} region endpoint");
}
}
}
}
Loading