From e044bcadf9de5d93e7ed896d6e188d01b6b09e57 Mon Sep 17 00:00:00 2001 From: Tanyi Chen Date: Mon, 21 Sep 2020 17:11:38 +0800 Subject: [PATCH] Mgmt: update Azure in docs (#15416) * update Azure in docs * fix some error --- sdk/resourcemanager/README.md | 6 +++--- sdk/resourcemanager/docs/AUTH.md | 12 ++++++------ sdk/resourcemanager/docs/MIGRATION_GUIDE.md | 4 ++-- sdk/resourcemanager/docs/SAMPLE.md | 4 ++-- sdk/resourcemanager/docs/THROTTLING.md | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/sdk/resourcemanager/README.md b/sdk/resourcemanager/README.md index 7cf3963fc5aa6..9397c6b1fd064 100644 --- a/sdk/resourcemanager/README.md +++ b/sdk/resourcemanager/README.md @@ -82,7 +82,7 @@ AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); TokenCredential credential = new DefaultAzureCredentialBuilder() .authorityHost(profile.environment().getActiveDirectoryEndpoint()) .build(); -Azure azure = Azure +AzureResourceManager azure = AzureResourceManager .authenticate(credential, profile) .withDefaultSubscription(); ``` @@ -253,7 +253,7 @@ azure.virtualMachines().listByResourceGroupAsync(rgName) You can customize various aspects of the client. ```java -Azure azure = Azure +AzureResourceManager azure = AzureResourceManager .configure() .withHttpClient(customizedHttpClient) .withPolicy(additionalPolicy) @@ -301,7 +301,7 @@ locate the root issue. View the [logging][logging] wiki for guidance about enabl Sample code to enable logging in Azure Management Libraries. ```java -Azure azure = Azure +AzureResourceManager azure = AzureResourceManager .configure() .withLogLevel(HttpLogDetailLevel.BASIC) .authenticate(credential, profile) diff --git a/sdk/resourcemanager/docs/AUTH.md b/sdk/resourcemanager/docs/AUTH.md index a7409fd4cb1e7..08cb82e258cf7 100644 --- a/sdk/resourcemanager/docs/AUTH.md +++ b/sdk/resourcemanager/docs/AUTH.md @@ -75,15 +75,15 @@ EnvironmentCredential credential = new EnvironmentCredentialBuilder() Once the `TokenCredential` and `AzureProfile` are ready, you can move forward with below authenticating code. It helps build http pipeline internally with [default configuration](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluentcore/utils/HttpPipelineProvider.java#L43). ```java -Azure azure = Azure.authenticate(credential, profile).withDefaultSubscription(); +AzureResourceManager azure = AzureResourceManager.authenticate(credential, profile).withDefaultSubscription(); ``` The `Authenticated` class provides access to a subset of Azure APIs that do not require a specific subscription. If the profile does not contain a subscription, you can select a subscription via [`Authenticated::subscriptions`](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/azure-resourcemanager/src/main/java/com/azure/resourcemanager/AzureResourceManager.java#L200). Similarly, you can select a tenant via [`Authenticated::tenants`](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/azure-resourcemanager/src/main/java/com/azure/resourcemanager/AzureResourceManager.java#L207). ```java -Azure.Authenticated authenticated = Azure.authenticate(credential, profile); +AzureResourceManager.Authenticated authenticated = AzureResourceManager.authenticate(credential, profile); String subscriptionId = authenticated.subscriptions().list().iterator().next().subscriptionId(); -Azure azure = authenticated.withSubscription(subscriptionId); +AzureResourceManager azure = authenticated.withSubscription(subscriptionId); ``` ## Advanced Authentication @@ -117,13 +117,13 @@ HttpPipeline httpPipeline = new HttpPipelineBuilder() Once your custom configurations are ready, you can move forward with below authenticating code. It would execute the settings you apply in the custom HttpPipeline. ```java -Azure azure = Azure.authenticate(httpPipeline, profile).withDefaultSubscription(); +AzureResourceManager azure = AzureResourceManager.authenticate(httpPipeline, profile).withDefaultSubscription(); ``` -If you want to configure part of http pipeline instead of building new one, you may set via `Azure::configure`. +If you want to configure part of http pipeline instead of building new one, you may set via `AzureResourceManager::configure`. ```java -Azure azure = Azure.configure() +AzureResourceManager azure = AzureResourceManager.configure() .withPolicy(customPolicy) .withRetryPolicy(customRetryPolicy) .withHttpClient(httpClient) diff --git a/sdk/resourcemanager/docs/MIGRATION_GUIDE.md b/sdk/resourcemanager/docs/MIGRATION_GUIDE.md index 060301ebff724..729885f0c4727 100644 --- a/sdk/resourcemanager/docs/MIGRATION_GUIDE.md +++ b/sdk/resourcemanager/docs/MIGRATION_GUIDE.md @@ -94,7 +94,7 @@ Azure azure = Azure.configure() **Equivalent in new version (`com.azure.resourcemanager.**`)** ```java -Azure azure = Azure.configure() +AzureResourceManager azure = AzureResourceManager.configure() .withPolicy(new CustomizedPolicy()) .authenticate(credential, profile) .withDefaultSubscription(); @@ -123,7 +123,7 @@ HttpClient client = new OkHttpAsyncHttpClientBuilder() .proxy(new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("127.0.0.1", 8888))) .build(); -Azure azure = Azure.configure() +AzureResourceManager azure = AzureResourceManager.configure() .withHttpClient(client) .authenticate(credential, profile) .withDefaultSubscription(); diff --git a/sdk/resourcemanager/docs/SAMPLE.md b/sdk/resourcemanager/docs/SAMPLE.md index e0486ee0a4483..bbdd32c8b47fd 100644 --- a/sdk/resourcemanager/docs/SAMPLE.md +++ b/sdk/resourcemanager/docs/SAMPLE.md @@ -2,14 +2,14 @@ ### Azure Authentication -The `Azure` class is the simplest entry point for creating and interacting with Azure resources. +The `AzureResourceManager` class is the simplest entry point for creating and interacting with Azure resources. ```java AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); TokenCredential credential = new DefaultAzureCredentialBuilder() .authorityHost(profile.environment().getActiveDirectoryEndpoint()) .build(); -Azure azure = Azure +AzureResourceManager azure = AzureResourceManager .authenticate(credential, profile) .withDefaultSubscription(); ``` diff --git a/sdk/resourcemanager/docs/THROTTLING.md b/sdk/resourcemanager/docs/THROTTLING.md index 546cb42df97e4..62de3e24555d4 100644 --- a/sdk/resourcemanager/docs/THROTTLING.md +++ b/sdk/resourcemanager/docs/THROTTLING.md @@ -13,7 +13,7 @@ By default, `RetryPolicy` is added to the HTTP pipeline. It will automatically r HTTP policy `ResourceManagerThrottlingPolicy` can be added to HTTP pipeline, to provide real-time information on remaining requests, before throttling kick-in. ```java -Azure azure = Azure.configure() +AzureResourceManager azure = AzureResourceManager.configure() .withPolicy(new ResourceManagerThrottlingPolicy((response, throttlingInfo) -> { // throttlingInfo.getRateLimit() }))