Refine search
/** * @return the Retrofit instance. */ public Retrofit retrofit() { return restClient.retrofit(); }
private ServiceResponse<PageImpl1<SubscriptionInner>> listNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl1<SubscriptionInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl1<SubscriptionInner>>() { }.getType()) .registerError(CloudException.class) .build(response); }
/** * Try to extract the environment the client is authenticated to based * on the information on the rest client. * @param restClient the RestClient instance * @return the non-null AzureEnvironment */ public static AzureEnvironment extractAzureEnvironment(RestClient restClient) { AzureEnvironment environment = null; if (restClient.credentials() instanceof AzureTokenCredentials) { environment = ((AzureTokenCredentials) restClient.credentials()).environment(); } else { String baseUrl = restClient.retrofit().baseUrl().toString(); for (AzureEnvironment env : AzureEnvironment.knownEnvironments()) { if (env.resourceManagerEndpoint().toLowerCase().contains(baseUrl.toLowerCase())) { environment = env; break; } } if (environment == null) { throw new IllegalArgumentException("Unknown resource manager endpoint " + baseUrl); } } return environment; }
private ServiceResponse<Boolean> checkExistenceDelegate(Response<Void> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<Boolean, CloudException>newInstance(this.client.serializerAdapter()) .register(204, new TypeToken<Void>() { }.getType()) .register(404, new TypeToken<Void>() { }.getType()) .registerError(CloudException.class) .buildEmpty(response); }
MicrosoftAppCredentials appCredentials = (MicrosoftAppCredentials) client.restClient().credentials();
private GraphRbacManager(RestClient restClient, String tenantId) { String graphEndpoint = AzureEnvironment.AZURE.graphEndpoint(); if (restClient.credentials() instanceof AzureTokenCredentials) { graphEndpoint = ((AzureTokenCredentials) restClient.credentials()).environment().graphEndpoint(); } this.graphRbacManagementClient = new GraphRbacManagementClientImpl( restClient.newBuilder().withBaseUrl(graphEndpoint).build()).withTenantID(tenantId); this.authorizationManagementClient = new AuthorizationManagementClientImpl(restClient); this.tenantId = tenantId; }
/** * @return the HTTP client. */ public OkHttpClient httpClient() { return this.restClient.httpClient(); }
private ServiceResponse<Boolean> checkExistenceDelegate(Response<Void> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<Boolean, CloudException>newInstance(this.client.serializerAdapter()) .register(204, new TypeToken<Void>() { }.getType()) .register(404, new TypeToken<Void>() { }.getType()) .registerError(CloudException.class) .buildEmpty(response); }
MicrosoftAppCredentials appCredentials = (MicrosoftAppCredentials) client.restClient().credentials();
protected RestClient buildRestClient(AzureTokenCredentials credentials, AzureEnvironment.Endpoint endpoint) { RestClient client = restClientBuilder .withBaseUrl(credentials.environment(), endpoint) .withCredentials(credentials) .withInterceptor(new ResourceManagerThrottlingInterceptor()) .build(); if (client.httpClient().proxy() != null) { credentials.withProxy(client.httpClient().proxy()); } return client; }
private ServiceResponse<PolicySetDefinitionInner> getBuiltInDelegate(Response<ResponseBody> response) throws ErrorResponseException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PolicySetDefinitionInner, ErrorResponseException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PolicySetDefinitionInner>() { }.getType()) .registerError(ErrorResponseException.class) .build(response); }
protected void initialize() { this.apiVersion = "2016-11-01"; this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; this.accounts = new AccountsImpl(restClient().retrofit(), this); this.firewallRules = new FirewallRulesImpl(restClient().retrofit(), this); this.trustedIdProviders = new TrustedIdProvidersImpl(restClient().retrofit(), this); this.operations = new OperationsImpl(restClient().retrofit(), this); this.locations = new LocationsImpl(restClient().retrofit(), this); this.azureClient = new AzureClient(this); }
private ServiceResponse<Boolean> checkExistenceByIdDelegate(Response<Void> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<Boolean, CloudException>newInstance(this.client.serializerAdapter()) .register(204, new TypeToken<Void>() { }.getType()) .register(404, new TypeToken<Void>() { }.getType()) .registerError(CloudException.class) .buildEmpty(response); }
/** * Try to extract the environment the client is authenticated to based * on the information on the rest client. * @param restClient the RestClient instance * @return the non-null AzureEnvironment */ public static AzureEnvironment extractAzureEnvironment(RestClient restClient) { AzureEnvironment environment = null; if (restClient.credentials() instanceof AzureTokenCredentials) { environment = ((AzureTokenCredentials) restClient.credentials()).environment(); } else { String baseUrl = restClient.retrofit().baseUrl().toString(); for (AzureEnvironment env : AzureEnvironment.knownEnvironments()) { if (env.resourceManagerEndpoint().toLowerCase().contains(baseUrl.toLowerCase())) { environment = env; break; } } if (environment == null) { throw new IllegalArgumentException("Unknown resource manager endpoint " + baseUrl); } } return environment; }
MicrosoftAppCredentials appCredentials = (MicrosoftAppCredentials) client.restClient().credentials();
protected RestClient buildRestClient(AzureTokenCredentials credentials, AzureEnvironment.Endpoint endpoint) { RestClient client = restClientBuilder .withBaseUrl(credentials.environment(), endpoint) .withCredentials(credentials) .withInterceptor(new ProviderRegistrationInterceptor(credentials)) .withInterceptor(new ResourceManagerThrottlingInterceptor()) .build(); if (client.httpClient().proxy() != null) { credentials.withProxy(client.httpClient().proxy()); } return client; }
private ServiceResponse<PageImpl<PolicySetDefinitionInner>> listBuiltInDelegate(Response<ResponseBody> response) throws ErrorResponseException, IOException { return this.client.restClient().responseBuilderFactory().<PageImpl<PolicySetDefinitionInner>, ErrorResponseException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<PolicySetDefinitionInner>>() { }.getType()) .registerError(ErrorResponseException.class) .build(response); }
protected void initialize() { this.apiVersion = "2015-07-01"; this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; this.classicAdministrators = new ClassicAdministratorsInner(restClient().retrofit(), this); this.permissions = new PermissionsInner(restClient().retrofit(), this); this.providerOperationsMetadatas = new ProviderOperationsMetadatasInner(restClient().retrofit(), this); this.roleAssignments = new RoleAssignmentsInner(restClient().retrofit(), this); this.roleDefinitions = new RoleDefinitionsInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); }
AzureEnvironment environment() { RestClient restClient = this.manager().inner().restClient(); AzureEnvironment environment = null; if (restClient.credentials() instanceof AzureTokenCredentials) { environment = ((AzureTokenCredentials) restClient.credentials()).environment(); } String baseUrl = restClient.retrofit().baseUrl().toString(); for (AzureEnvironment env : AzureEnvironment.knownEnvironments()) { if (env.resourceManagerEndpoint().toLowerCase().contains(baseUrl.toLowerCase())) { environment = env; break; } } if (environment != null) { return environment; } throw new IllegalArgumentException("Unknown environment"); }
private MSIManager(RestClient restClient, String subscriptionId) { super(restClient, subscriptionId, new ManagedServiceIdentityClientImpl(restClient).withSubscriptionId(subscriptionId)); rbacManager = GraphRbacManager.authenticate(restClient, ((AzureTokenCredentials) (restClient.credentials())).domain()); }