diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample7_ConfiguringPipeline.cs b/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample7_ConfiguringPipeline.cs index 312c44d16ec5e..cd39a96fc2cf5 100644 --- a/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample7_ConfiguringPipeline.cs +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample7_ConfiguringPipeline.cs @@ -35,10 +35,10 @@ public void ConfiguringPipeline() options.Retry.Delay = TimeSpan.FromSeconds(1); // add a policy (custom behavior) that executes once per client call - options.AddPolicy(HttpPipelinePosition.PerCall, new AddHeaderPolicy()); + options.AddPolicy(new AddHeaderPolicy(), HttpPipelinePosition.PerCall); // add a policy that executes once per retry - options.AddPolicy(HttpPipelinePosition.PerRetry, new CustomLogPolicy()); + options.AddPolicy(new CustomLogPolicy(), HttpPipelinePosition.PerRetry); var connectionString = Environment.GetEnvironmentVariable("APPCONFIGURATION_CONNECTION_STRING"); // pass the policy options to the client diff --git a/sdk/core/Azure.Core/src/Pipeline/HttpPipelineOptions.cs b/sdk/core/Azure.Core/src/Pipeline/HttpPipelineOptions.cs index f508853b58b0a..99e389cfe02af 100644 --- a/sdk/core/Azure.Core/src/Pipeline/HttpPipelineOptions.cs +++ b/sdk/core/Azure.Core/src/Pipeline/HttpPipelineOptions.cs @@ -27,7 +27,7 @@ public HttpPipelineTransport Transport public RetryOptions Retry { get; } - public void AddPolicy(HttpPipelinePosition position, HttpPipelinePolicy policy) + public void AddPolicy(HttpPipelinePolicy policy, HttpPipelinePosition position) { switch (position) { diff --git a/sdk/core/Azure.Core/tests/HttpPipelineBuilderTest.cs b/sdk/core/Azure.Core/tests/HttpPipelineBuilderTest.cs index dd563506a76e7..52112f22da2c0 100644 --- a/sdk/core/Azure.Core/tests/HttpPipelineBuilderTest.cs +++ b/sdk/core/Azure.Core/tests/HttpPipelineBuilderTest.cs @@ -23,7 +23,7 @@ public async Task CanAddCustomPolicy(HttpPipelinePosition position, int expected var transport = new MockTransport(new MockResponse(503), new MockResponse(200)); var options = new TestOptions(); - options.AddPolicy(position, policy); + options.AddPolicy(policy, position); options.Transport = transport; HttpPipeline pipeline = HttpPipelineBuilder.Build(options); diff --git a/sdk/core/Microsoft.Extensions.Azure/samples/Startup.cs b/sdk/core/Microsoft.Extensions.Azure/samples/Startup.cs index 683a82aebd25c..358dfd00a3de4 100644 --- a/sdk/core/Microsoft.Extensions.Azure/samples/Startup.cs +++ b/sdk/core/Microsoft.Extensions.Azure/samples/Startup.cs @@ -48,7 +48,7 @@ public void ConfigureServices(IServiceCollection services) builder.ConfigureDefaults(options => options.Retry.Mode = RetryMode.Exponential); // Advanced configure global defaults - builder.ConfigureDefaults((options, provider) => options.AddPolicy(HttpPipelinePosition.PerCall, provider.GetService())); + builder.ConfigureDefaults((options, provider) => options.AddPolicy(provider.GetService(), HttpPipelinePosition.PerCall)); builder.AddBlobServiceClient(Configuration.GetSection("Storage")) .WithVersion(BlobClientOptions.ServiceVersion.V2018_11_09); diff --git a/sdk/storage/Azure.Storage.Blobs/tests/BlobTestBase.cs b/sdk/storage/Azure.Storage.Blobs/tests/BlobTestBase.cs index 914b9b0720860..f20e84a728afc 100644 --- a/sdk/storage/Azure.Storage.Blobs/tests/BlobTestBase.cs +++ b/sdk/storage/Azure.Storage.Blobs/tests/BlobTestBase.cs @@ -57,7 +57,7 @@ public BlobClientOptions GetFaultyBlobConnectionOptions( { raise = raise ?? new Exception("Simulated connection fault"); var options = this.GetOptions(); - options.AddPolicy(HttpPipelinePosition.PerCall, new FaultyDownloadPipelinePolicy(raiseAt, raise)); + options.AddPolicy(new FaultyDownloadPipelinePolicy(raiseAt, raise), HttpPipelinePosition.PerCall); return options; } diff --git a/sdk/storage/Azure.Storage.Files/tests/FileTestBase.cs b/sdk/storage/Azure.Storage.Files/tests/FileTestBase.cs index 5d86a0df0217d..454de4e19cc46 100644 --- a/sdk/storage/Azure.Storage.Files/tests/FileTestBase.cs +++ b/sdk/storage/Azure.Storage.Files/tests/FileTestBase.cs @@ -72,7 +72,7 @@ public FileClientOptions GetFaultyFileConnectionOptions( { raise = raise ?? new IOException("Simulated connection fault"); var options = this.GetOptions(); - options.AddPolicy(HttpPipelinePosition.PerCall, new FaultyDownloadPipelinePolicy(raiseAt, raise)); + options.AddPolicy(new FaultyDownloadPipelinePolicy(raiseAt, raise), HttpPipelinePosition.PerCall); return options; }