diff --git a/azure-mgmt-batch/pom.xml b/azure-mgmt-batch/pom.xml index bf03ba8820a57..c4107e56d64be 100644 --- a/azure-mgmt-batch/pom.xml +++ b/azure-mgmt-batch/pom.xml @@ -49,7 +49,6 @@ com.microsoft.azure azure-client-runtime - 1.0.0-beta4-SNAPSHOT com.microsoft.azure @@ -64,7 +63,6 @@ com.microsoft.azure azure-client-authentication - 1.0.0-beta4-SNAPSHOT test diff --git a/azure-mgmt-batch/src/test/java/com/microsoft/azure/management/batch/BatchManagementTestBase.java b/azure-mgmt-batch/src/test/java/com/microsoft/azure/management/batch/BatchManagementTestBase.java index b02b00585eb65..12188a12f860e 100644 --- a/azure-mgmt-batch/src/test/java/com/microsoft/azure/management/batch/BatchManagementTestBase.java +++ b/azure-mgmt-batch/src/test/java/com/microsoft/azure/management/batch/BatchManagementTestBase.java @@ -7,9 +7,6 @@ import com.microsoft.azure.management.resources.implementation.ResourceManager; import okhttp3.logging.HttpLoggingInterceptor; -import java.io.File; -import java.io.IOException; - public abstract class BatchManagementTestBase { protected static ResourceManager resourceManager; protected static BatchManager batchManager; @@ -21,7 +18,8 @@ public static void createClients() { System.getenv("secret"), AzureEnvironment.AZURE); - RestClient restClient = AzureEnvironment.AZURE.newRestClientBuilder() + RestClient restClient = new RestClient.Builder() + .withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER) .withCredentials(credentials) .withLogLevel(HttpLoggingInterceptor.Level.BODY) .build(); diff --git a/azure-mgmt-compute/pom.xml b/azure-mgmt-compute/pom.xml index 79d817252e9f0..3f019bf0a2167 100644 --- a/azure-mgmt-compute/pom.xml +++ b/azure-mgmt-compute/pom.xml @@ -49,7 +49,6 @@ com.microsoft.azure azure-client-runtime - 1.0.0-beta4-SNAPSHOT com.microsoft.azure @@ -74,7 +73,6 @@ com.microsoft.azure azure-client-authentication - 1.0.0-beta4-SNAPSHOT test diff --git a/azure-mgmt-compute/src/test/java/com/microsoft/azure/management/compute/ComputeManagementTestBase.java b/azure-mgmt-compute/src/test/java/com/microsoft/azure/management/compute/ComputeManagementTestBase.java index e75941fa34099..60f249f2db48b 100644 --- a/azure-mgmt-compute/src/test/java/com/microsoft/azure/management/compute/ComputeManagementTestBase.java +++ b/azure-mgmt-compute/src/test/java/com/microsoft/azure/management/compute/ComputeManagementTestBase.java @@ -22,7 +22,8 @@ public static void createClients() { System.getenv("secret"), AzureEnvironment.AZURE); - RestClient restClient = AzureEnvironment.AZURE.newRestClientBuilder() + RestClient restClient = new RestClient.Builder() + .withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER) .withCredentials(credentials) .withLogLevel(HttpLoggingInterceptor.Level.BODY) .build(); diff --git a/azure-mgmt-datalake-store/src/test/java/com/microsoft/azure/management/datalake/store/DataLakeStoreManagementTestBase.java b/azure-mgmt-datalake-store/src/test/java/com/microsoft/azure/management/datalake/store/DataLakeStoreManagementTestBase.java index ab5f99b139d2b..4c2ce2a9b7c61 100644 --- a/azure-mgmt-datalake-store/src/test/java/com/microsoft/azure/management/datalake/store/DataLakeStoreManagementTestBase.java +++ b/azure-mgmt-datalake-store/src/test/java/com/microsoft/azure/management/datalake/store/DataLakeStoreManagementTestBase.java @@ -20,7 +20,7 @@ public static void createClients() { AzureEnvironment.AZURE); RestClient restClient = new RestClient.Builder() - .withDefaultBaseUrl(com.microsoft.azure.AzureEnvironment.AZURE) + .withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER) .withCredentials(credentials) .withLogLevel(HttpLoggingInterceptor.Level.BODY) .build(); diff --git a/azure-mgmt-graph-rbac/pom.xml b/azure-mgmt-graph-rbac/pom.xml index 54d5dd010df65..56bc4ceeaf61a 100644 --- a/azure-mgmt-graph-rbac/pom.xml +++ b/azure-mgmt-graph-rbac/pom.xml @@ -49,7 +49,6 @@ com.microsoft.azure azure-client-runtime - 1.0.0-beta4-SNAPSHOT com.microsoft.azure @@ -64,7 +63,6 @@ com.microsoft.azure azure-client-authentication - 1.0.0-beta4-SNAPSHOT test diff --git a/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/GraphRbacManager.java b/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/GraphRbacManager.java index 93dad05aca0d0..d8dd38078e9f2 100644 --- a/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/GraphRbacManager.java +++ b/azure-mgmt-graph-rbac/src/main/java/com/microsoft/azure/management/graphrbac/implementation/GraphRbacManager.java @@ -77,14 +77,10 @@ public interface Configurable extends AzureConfigurable { * The implementation for Configurable interface. */ private static class ConfigurableImpl extends AzureConfigurableImpl implements Configurable { - protected ConfigurableImpl() { - super.restClientBuilder = new RestClient.Builder() - .withBaseUrl(AzureEnvironment.AZURE.getGraphEndpoint()) // default to public cloud - .withInterceptor(new RequestIdHeaderInterceptor()); - } - public GraphRbacManager authenticate(AzureTokenCredentials credentials) { - return GraphRbacManager.authenticate(buildRestClientForGraph(credentials), credentials.getDomain()); + return GraphRbacManager.authenticate( + buildRestClient(credentials, AzureEnvironment.Endpoint.GRAPH), + credentials.getDomain()); } } diff --git a/azure-mgmt-keyvault/pom.xml b/azure-mgmt-keyvault/pom.xml index cd03fd6d663fc..d9d6e609b6956 100644 --- a/azure-mgmt-keyvault/pom.xml +++ b/azure-mgmt-keyvault/pom.xml @@ -49,7 +49,6 @@ com.microsoft.azure azure-client-runtime - 1.0.0-beta4-SNAPSHOT com.microsoft.azure @@ -69,7 +68,6 @@ com.microsoft.azure azure-client-authentication - 1.0.0-beta4-SNAPSHOT test diff --git a/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/implementation/KeyVaultManager.java b/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/implementation/KeyVaultManager.java index a1929e53cbbb1..020ac5a4a6bcc 100644 --- a/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/implementation/KeyVaultManager.java +++ b/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/implementation/KeyVaultManager.java @@ -7,7 +7,6 @@ package com.microsoft.azure.management.keyvault.implementation; import com.microsoft.azure.AzureEnvironment; -import com.microsoft.azure.RequestIdHeaderInterceptor; import com.microsoft.azure.RestClient; import com.microsoft.azure.credentials.AzureTokenCredentials; import com.microsoft.azure.management.graphrbac.implementation.GraphRbacManager; @@ -44,7 +43,8 @@ public static Configurable configure() { * @return the StorageManager */ public static KeyVaultManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { - return new KeyVaultManager(credentials.getEnvironment().newRestClientBuilder() + return new KeyVaultManager(credentials.getEnvironment() + .newRestClientBuilder() .withCredentials(credentials) .build(), credentials.getDomain(), subscriptionId); } @@ -81,7 +81,9 @@ public interface Configurable extends AzureConfigurable { */ private static final class ConfigurableImpl extends AzureConfigurableImpl implements Configurable { public KeyVaultManager authenticate(AzureTokenCredentials credentials, String tenantId, String subscriptionId) { - return KeyVaultManager.authenticate(buildRestClient(credentials), tenantId, subscriptionId); + return KeyVaultManager.authenticate( + buildRestClient(credentials, AzureEnvironment.Endpoint.RESOURCE_MANAGER), + tenantId, subscriptionId); } } @@ -94,10 +96,8 @@ private KeyVaultManager(final RestClient restClient, String tenantId, String sub if (restClient.credentials() instanceof AzureTokenCredentials) { graphEndpoint = ((AzureTokenCredentials) restClient.credentials()).getEnvironment().getGraphEndpoint(); } - graphRbacManager = GraphRbacManager.authenticate(new RestClient.Builder() + graphRbacManager = GraphRbacManager.authenticate(restClient.newBuilder() .withBaseUrl(graphEndpoint) - .withInterceptor(new RequestIdHeaderInterceptor()) - .withCredentials(restClient.credentials()) .build(), tenantId); this.tenantId = tenantId; } diff --git a/azure-mgmt-keyvault/src/test/java/com/microsoft/azure/management/keyvault/KeyVaultManagementTestBase.java b/azure-mgmt-keyvault/src/test/java/com/microsoft/azure/management/keyvault/KeyVaultManagementTestBase.java index a55f9c6e85061..640d07111e121 100644 --- a/azure-mgmt-keyvault/src/test/java/com/microsoft/azure/management/keyvault/KeyVaultManagementTestBase.java +++ b/azure-mgmt-keyvault/src/test/java/com/microsoft/azure/management/keyvault/KeyVaultManagementTestBase.java @@ -27,7 +27,8 @@ protected static void createClients() { System.getenv("secret"), AzureEnvironment.AZURE); - RestClient restClient = AzureEnvironment.AZURE.newRestClientBuilder() + RestClient restClient = new RestClient.Builder() + .withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER) .withCredentials(credentials) .withLogLevel(HttpLoggingInterceptor.Level.BODY) .build(); diff --git a/azure-mgmt-network/pom.xml b/azure-mgmt-network/pom.xml index db141c096911d..ad01c8ee19b59 100644 --- a/azure-mgmt-network/pom.xml +++ b/azure-mgmt-network/pom.xml @@ -49,7 +49,6 @@ com.microsoft.azure azure-client-runtime - 1.0.0-beta4-SNAPSHOT com.microsoft.azure @@ -64,7 +63,6 @@ com.microsoft.azure azure-client-authentication - 1.0.0-beta4-SNAPSHOT test diff --git a/azure-mgmt-network/src/test/java/com/microsoft/azure/management/network/NetworkManagementTestBase.java b/azure-mgmt-network/src/test/java/com/microsoft/azure/management/network/NetworkManagementTestBase.java index b9995111b0de7..23863382f6bb3 100644 --- a/azure-mgmt-network/src/test/java/com/microsoft/azure/management/network/NetworkManagementTestBase.java +++ b/azure-mgmt-network/src/test/java/com/microsoft/azure/management/network/NetworkManagementTestBase.java @@ -1,10 +1,10 @@ package com.microsoft.azure.management.network; import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.RestClient; import com.microsoft.azure.credentials.ApplicationTokenCredentials; import com.microsoft.azure.management.network.implementation.NetworkManager; import com.microsoft.azure.management.resources.implementation.ResourceManager; -import com.microsoft.azure.RestClient; public abstract class NetworkManagementTestBase { protected static ResourceManager resourceManager; @@ -17,7 +17,8 @@ public static void createClients() { System.getenv("secret"), null); - RestClient restClient = AzureEnvironment.AZURE.newRestClientBuilder() + RestClient restClient = new RestClient.Builder() + .withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER) .withCredentials(credentials) //.withLogLevel(HttpLoggingInterceptor.Level.BASIC) .build(); diff --git a/azure-mgmt-redis/pom.xml b/azure-mgmt-redis/pom.xml index 051464c6bf7a1..cec7bec26e89f 100644 --- a/azure-mgmt-redis/pom.xml +++ b/azure-mgmt-redis/pom.xml @@ -48,7 +48,6 @@ com.microsoft.azure azure-client-runtime - 1.0.0-beta4-SNAPSHOT com.microsoft.azure @@ -63,7 +62,6 @@ com.microsoft.azure azure-client-authentication - 1.0.0-beta4-SNAPSHOT test diff --git a/azure-mgmt-redis/src/test/java/com/microsoft/azure/management/redis/RedisManagementTestBase.java b/azure-mgmt-redis/src/test/java/com/microsoft/azure/management/redis/RedisManagementTestBase.java index 5131da03d7b13..7cce1c04370da 100644 --- a/azure-mgmt-redis/src/test/java/com/microsoft/azure/management/redis/RedisManagementTestBase.java +++ b/azure-mgmt-redis/src/test/java/com/microsoft/azure/management/redis/RedisManagementTestBase.java @@ -30,7 +30,8 @@ protected static void createClients() { System.getenv("secret"), AzureEnvironment.AZURE); - RestClient restClient = AzureEnvironment.AZURE.newRestClientBuilder() + RestClient restClient = new RestClient.Builder() + .withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER) .withCredentials(credentials) .withLogLevel(HttpLoggingInterceptor.Level.BODY) // uncomment for Fiddler tracing diff --git a/azure-mgmt-resources/pom.xml b/azure-mgmt-resources/pom.xml index 4724f4d44538f..f92f136ac1ec2 100644 --- a/azure-mgmt-resources/pom.xml +++ b/azure-mgmt-resources/pom.xml @@ -49,7 +49,6 @@ com.microsoft.azure azure-client-runtime - 1.0.0-beta4-SNAPSHOT junit @@ -63,7 +62,6 @@ com.microsoft.azure azure-client-authentication - 1.0.0-beta4-SNAPSHOT test diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/implementation/AzureConfigurableImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/implementation/AzureConfigurableImpl.java index 54bcc179472ea..d4c053989268b 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/implementation/AzureConfigurableImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/implementation/AzureConfigurableImpl.java @@ -13,7 +13,6 @@ import okhttp3.Interceptor; import okhttp3.logging.HttpLoggingInterceptor; -import java.lang.reflect.Field; import java.net.Proxy; import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; @@ -26,10 +25,10 @@ */ public class AzureConfigurableImpl> implements AzureConfigurable { - protected RestClient.Builder.Buildable restClientBuilder; + protected RestClient.Builder restClientBuilder; protected AzureConfigurableImpl() { - this.restClientBuilder = AzureEnvironment.AZURE.newRestClientBuilder(); // default to public cloud + this.restClientBuilder = new RestClient.Builder(); // default to public cloud } @SuppressWarnings("unchecked") @@ -88,28 +87,12 @@ public T withProxy(Proxy proxy) { return (T) this; } - protected RestClient buildRestClient(AzureTokenCredentials credentials) { - restClientBuilder = modifyBaseUrl(restClientBuilder, credentials.getEnvironment().getBaseUrl()); + protected RestClient buildRestClient(AzureTokenCredentials credentials, AzureEnvironment.Endpoint endpoint) { + restClientBuilder = restClientBuilder.withBaseUrl(credentials.getEnvironment(), endpoint); return restClientBuilder.withCredentials(credentials).build(); } - protected RestClient buildRestClientForGraph(AzureTokenCredentials credentials) { - restClientBuilder = modifyBaseUrl(restClientBuilder, credentials.getEnvironment().getGraphEndpoint()); - return restClientBuilder.withCredentials(credentials).build(); - } - - private RestClient.Builder.Buildable modifyBaseUrl(RestClient.Builder.Buildable builder, String baseUrl) { - try { - // This reflection will be removed in next version of client runtime - Field enclosed = builder.getClass().getDeclaredField("this$0"); - enclosed.setAccessible(true); - Object enclosedObj = enclosed.get(builder); - Field url = enclosedObj.getClass().getDeclaredField("baseUrl"); - url.setAccessible(true); - url.set(enclosedObj, baseUrl); - } catch (IllegalAccessException | NoSuchFieldException ex) { - // swallow it to use default base url - } - return builder; + protected RestClient buildRestClient(AzureTokenCredentials credentials) { + return buildRestClient(credentials, AzureEnvironment.Endpoint.RESOURCE_MANAGER); } } diff --git a/azure-mgmt-search/pom.xml b/azure-mgmt-search/pom.xml index b177e63792d34..a64c61f545da8 100644 --- a/azure-mgmt-search/pom.xml +++ b/azure-mgmt-search/pom.xml @@ -50,7 +50,6 @@ com.microsoft.azure azure-client-runtime - 1.0.0-beta4-SNAPSHOT com.microsoft.azure @@ -65,7 +64,6 @@ com.microsoft.azure azure-client-authentication - 1.0.0-beta4-SNAPSHOT test diff --git a/azure-mgmt-storage/pom.xml b/azure-mgmt-storage/pom.xml index b338680cba6d6..8e39ce46e12ac 100644 --- a/azure-mgmt-storage/pom.xml +++ b/azure-mgmt-storage/pom.xml @@ -49,7 +49,6 @@ com.microsoft.azure azure-client-runtime - 1.0.0-beta4-SNAPSHOT com.microsoft.azure @@ -64,7 +63,6 @@ com.microsoft.azure azure-client-authentication - 1.0.0-beta4-SNAPSHOT test diff --git a/azure-mgmt-storage/src/test/java/com/microsoft/azure/management/storage/StorageManagementTestBase.java b/azure-mgmt-storage/src/test/java/com/microsoft/azure/management/storage/StorageManagementTestBase.java index 975ed2ee34c4c..1980634a7681a 100644 --- a/azure-mgmt-storage/src/test/java/com/microsoft/azure/management/storage/StorageManagementTestBase.java +++ b/azure-mgmt-storage/src/test/java/com/microsoft/azure/management/storage/StorageManagementTestBase.java @@ -27,9 +27,10 @@ protected static void createClients() { System.getenv("secret"), AzureEnvironment.AZURE); - RestClient restClient = AzureEnvironment.AZURE.newRestClientBuilder() + RestClient restClient = new RestClient.Builder() + .withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER) .withCredentials(credentials) - .withLogLevel(HttpLoggingInterceptor.Level.BODY) + .withLogLevel(HttpLoggingInterceptor.Level.BASIC) .build(); resourceManager = ResourceManager diff --git a/azure-mgmt-website/pom.xml b/azure-mgmt-website/pom.xml index cb5785ba6bfe4..b2e76d14f6f71 100644 --- a/azure-mgmt-website/pom.xml +++ b/azure-mgmt-website/pom.xml @@ -50,7 +50,6 @@ com.microsoft.azure azure-client-runtime - 1.0.0-beta4-SNAPSHOT com.microsoft.azure diff --git a/azure/pom.xml b/azure/pom.xml index fb411b5bdcdae..994ff7b32880b 100644 --- a/azure/pom.xml +++ b/azure/pom.xml @@ -49,12 +49,10 @@ com.microsoft.azure azure-client-runtime - 1.0.0-beta4-SNAPSHOT com.microsoft.azure azure-client-authentication - 1.0.0-beta4-SNAPSHOT com.microsoft.azure diff --git a/pom.xml b/pom.xml index 701dfaa71b65e..e8e546bde3cf0 100644 --- a/pom.xml +++ b/pom.xml @@ -92,12 +92,12 @@ com.microsoft.azure azure-client-runtime - 1.0.0-beta4-SNAPSHOT + 1.0.0-beta4-20161011.232453-5 com.microsoft.azure azure-client-authentication - 1.0.0-beta4-SNAPSHOT + 1.0.0-beta4-20161011.232500-5