KuduClient(WebAppBase webAppBase) { if (webAppBase.defaultHostName() == null) { throw new UnsupportedOperationException("Cannot initialize kudu client before web app is created"); } String host = webAppBase.defaultHostName().toLowerCase() .replace("http://", "") .replace("https://", ""); String[] parts = host.split("\\.", 2); host = Joiner.on('.').join(parts[0], "scm", parts[1]); service = webAppBase.manager().restClient().newBuilder() .withBaseUrl("https://" + host) .withConnectionTimeout(3, TimeUnit.MINUTES) .withReadTimeout(3, TimeUnit.MINUTES) .build() .retrofit().create(KuduService.class); }
private void initializeFunctionService() { if (functionService == null) { HttpUrl defaultHostName = HttpUrl.parse(defaultHostName()); if (defaultHostName == null) { defaultHostName = new HttpUrl.Builder().host(defaultHostName()).scheme("http").build(); } functionService = manager().restClient().newBuilder() .withBaseUrl(defaultHostName.toString()) .withCredentials(new FunctionCredentials(this)) .withLogLevel(LogLevel.BODY_AND_HEADERS) .build() .retrofit().create(FunctionService.class); } }
VaultImpl(String key, VaultInner innerObject, KeyVaultManager manager, GraphRbacManager graphRbacManager) { super(key, innerObject, manager); this.graphRbacManager = graphRbacManager; this.accessPolicies = new ArrayList<>(); if (innerObject != null && innerObject.properties() != null && innerObject.properties().accessPolicies() != null) { for (AccessPolicyEntry entry : innerObject.properties().accessPolicies()) { this.accessPolicies.add(new AccessPolicyImpl(entry, this)); } } this.client = new KeyVaultClient( manager.inner().restClient().newBuilder().withBaseUrl("https://{vaultBaseUrl}").build()); }
VaultImpl(String key, VaultInner innerObject, KeyVaultManager manager, GraphRbacManager graphRbacManager) { super(key, innerObject, manager); this.graphRbacManager = graphRbacManager; this.accessPolicies = new ArrayList<>(); if (innerObject != null && innerObject.properties() != null && innerObject.properties().accessPolicies() != null) { for (AccessPolicyEntry entry : innerObject.properties().accessPolicies()) { this.accessPolicies.add(new AccessPolicyImpl(entry, this)); } } this.client = new KeyVaultClient( manager.inner().restClient().newBuilder().withBaseUrl("https://{vaultBaseUrl}").build()); }
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; }