Skip to content

Commit 7a804c5

Browse files
authored
Link to proxy doc on Learn (Azure#47241)
1 parent 50441a5 commit 7a804c5

File tree

2 files changed

+4
-45
lines changed

2 files changed

+4
-45
lines changed

sdk/core/Azure.Core/samples/Configuration.md

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ SecretClientOptions options = new SecretClientOptions()
2222

2323
## Setting a custom retry policy
2424

25-
Using `RetryOptions` to configure retry behavior is sufficient for the vast majority of scenarios. For more advanced scenarios, it's possible to use a custom retry policy by setting the `RetryPolicy` property of client options class. This can be accomplished by implementing a retry policy that derives from the `RetryPolicy` class, or by passing in a `DelayStrategy` into the existing `RetryPolicy` constructor. The `RetryPolicy` class contains hooks to determine if a request should be retried and how long to wait before retrying.
25+
Using `RetryOptions` to configure retry behavior is sufficient for the vast majority of scenarios. For more advanced scenarios, it's possible to use a custom retry policy by setting the `RetryPolicy` property of client options class. This can be accomplished by implementing a retry policy that derives from the `RetryPolicy` class, or by passing in a `DelayStrategy` into the existing `RetryPolicy` constructor. The `RetryPolicy` class contains hooks to determine if a request should be retried and how long to wait before retrying.
2626

2727
In the following example, we implement a policy that will prevent retries from taking place if the overall processing time has exceeded a configured threshold. Notice that the policy takes in `RetryOptions` as one of the constructor parameters and passes it to the base constructor. By doing this, we are able to delegate to the base `RetryPolicy` as needed (either by explicitly invoking the base methods, or by not overriding methods that we do not need to customize) which will respect the `RetryOptions`.
2828

@@ -68,7 +68,7 @@ SecretClientOptions options = new SecretClientOptions()
6868
};
6969
```
7070

71-
Another scenario where it may be helpful to use a custom retry policy is when you need to customize the delay behavior, but don't need to adjust the logic used to determine whether a request should be retried or not. In this case, it isn't necessary to create a custom `RetryPolicy` class - instead, you can pass in a `DelayStrategy` into the `RetryPolicy` constructor.
71+
Another scenario where it may be helpful to use a custom retry policy is when you need to customize the delay behavior, but don't need to adjust the logic used to determine whether a request should be retried or not. In this case, it isn't necessary to create a custom `RetryPolicy` class - instead, you can pass in a `DelayStrategy` into the `RetryPolicy` constructor.
7272

7373
In the below example, we create a customized delay strategy that uses a fixed sequence of delays that are iterated through as the number of retries increases. We then pass the strategy into the `RetryPolicy` constructor and set the constructed policy in our options.
7474
```C# Snippet:SequentialDelayStrategy
@@ -153,7 +153,7 @@ SecretClientOptions options = new SecretClientOptions()
153153
```
154154

155155
> **_A note to library authors:_**
156-
Library-specific response classifiers _will_ be respected if a user sets a custom policy deriving from `RetryPolicy` as long as they call into the base `ShouldRetry` method. If a user doesn't call the base method, or sets a `HttpPipelinePolicy` in the `RetryPolicy` property, then the library-specific response classifiers _will not_ be respected.
156+
Library-specific response classifiers _will_ be respected if a user sets a custom policy deriving from `RetryPolicy` as long as they call into the base `ShouldRetry` method. If a user doesn't call the base method, or sets a `HttpPipelinePolicy` in the `RetryPolicy` property, then the library-specific response classifiers _will not_ be respected.
157157

158158
## User provided HttpClient instance
159159

@@ -168,25 +168,4 @@ SecretClientOptions options = new SecretClientOptions
168168

169169
## Configuring a proxy
170170

171-
```C# Snippet:HttpClientProxyConfiguration
172-
using HttpClientHandler handler = new HttpClientHandler()
173-
{
174-
Proxy = new WebProxy(new Uri("http://example.com"))
175-
};
176-
177-
SecretClientOptions options = new SecretClientOptions
178-
{
179-
Transport = new HttpClientTransport(handler)
180-
};
181-
```
182-
183-
## Configuring a proxy using environment variables
184-
185-
You can also configure a proxy using the following environment variables:
186-
187-
* `HTTP_PROXY`: the proxy server used on HTTP requests.
188-
* `HTTPS_PROXY`: the proxy server used on HTTPS requests.
189-
* `ALL_PROXY`: the proxy server used on HTTP and HTTPS requests in case `HTTP_PROXY` or `HTTPS_PROXY` are not defined.
190-
* `NO_PROXY`: a comma-separated list of hostnames that should be excluded from proxying.
191-
192-
**Warning:** setting these environment variables will affect every new client created within the current process.
171+
This guidance has moved to [Configure a proxy when using the Azure SDK for .NET](https://learn.microsoft.com/dotnet/azure/sdk/configure-proxy).

sdk/core/Azure.Core/tests/samples/ConfigurationSamples.cs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
// Licensed under the MIT License.
33

44
using System;
5-
using System.Net;
65
using System.Net.Http;
7-
using System.Threading.Tasks;
86
using Azure.Core.Pipeline;
97
using Azure.Identity;
108
using Azure.Security.KeyVault.Secrets;
@@ -71,24 +69,6 @@ public void SettingHttpClient()
7169
#endregion
7270
}
7371

74-
[Test]
75-
public void HttpClientProxyConfiguration()
76-
{
77-
#region Snippet:HttpClientProxyConfiguration
78-
79-
using HttpClientHandler handler = new HttpClientHandler()
80-
{
81-
Proxy = new WebProxy(new Uri("http://example.com"))
82-
};
83-
84-
SecretClientOptions options = new SecretClientOptions
85-
{
86-
Transport = new HttpClientTransport(handler)
87-
};
88-
89-
#endregion
90-
}
91-
9272
[Test]
9373
public void SetPollyRetryPolicy()
9474
{

0 commit comments

Comments
 (0)