com.microsoft.azure.AzureResponseBuilder Java Examples

The following examples show how to use com.microsoft.azure.AzureResponseBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GettingSqlServerMetrics.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Main entry point.
 * @param args the parameters
 */
public static void main(String[] args) {
    try {
        final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));


        ApplicationTokenCredentials credentials = ApplicationTokenCredentials.fromFile(credFile);
        RestClient restClient = new RestClient.Builder()
            .withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
            .withReadTimeout(150, TimeUnit.SECONDS)
            .withLogLevel(LogLevel.BODY)
            .withCredentials(credentials).build();
        Azure azure = Azure.authenticate(restClient, credentials.domain(), credentials.defaultSubscriptionId()).withDefaultSubscription();

        // Print selected subscription
        System.out.println("Selected subscription: " + azure.subscriptionId());

        runSample(azure);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
}
 
Example #2
Source File: ManageSqlServerDnsAliases.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Main entry point.
 * @param args the parameters
 */
public static void main(String[] args) {
    try {
        final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));


        ApplicationTokenCredentials credentials = ApplicationTokenCredentials.fromFile(credFile);
        RestClient restClient = new RestClient.Builder()
            .withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
            .withReadTimeout(150, TimeUnit.SECONDS)
            .withLogLevel(LogLevel.BODY)
            .withCredentials(credentials).build();
        Azure azure = Azure.authenticate(restClient, credentials.domain(), credentials.defaultSubscriptionId()).withDefaultSubscription();

        // Print selected subscription
        System.out.println("Selected subscription: " + azure.subscriptionId());

        runSample(azure);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
}
 
Example #3
Source File: ManageSqlServerKeysWithAzureKeyVaultKey.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Main entry point.
 * @param args the parameters
 */
public static void main(String[] args) {
    try {
        final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));


        ApplicationTokenCredentials credentials = ApplicationTokenCredentials.fromFile(credFile);
        RestClient restClient = new RestClient.Builder()
            .withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
            .withReadTimeout(150, TimeUnit.SECONDS)
            .withLogLevel(LogLevel.BODY)
            .withCredentials(credentials).build();
        Azure azure = Azure.authenticate(restClient, credentials.domain(), credentials.defaultSubscriptionId()).withDefaultSubscription();

        // Print selected subscription
        System.out.println("Selected subscription: " + azure.subscriptionId());

        runSample(azure, credentials.clientId());
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
}
 
Example #4
Source File: ManageSqlDatabaseInElasticPool.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Main entry point.
 * @param args the parameters
 */
public static void main(String[] args) {
    try {
        final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));


        ApplicationTokenCredentials credentials = ApplicationTokenCredentials.fromFile(credFile);
        RestClient restClient = new RestClient.Builder()
                .withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER)
                .withSerializerAdapter(new AzureJacksonAdapter())
                .withReadTimeout(150, TimeUnit.SECONDS)
                .withLogLevel(LogLevel.BODY)
                .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
                .withCredentials(credentials).build();
        Azure azure = Azure.authenticate(restClient, credentials.domain(), credentials.defaultSubscriptionId()).withDefaultSubscription();

        // Print selected subscription
        System.out.println("Selected subscription: " + azure.subscriptionId());

        runSample(azure);
   } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
}
 
Example #5
Source File: ManageSqlDatabase.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Main entry point.
 * @param args the parameters
 */
public static void main(String[] args) {
    try {

        final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));

        ApplicationTokenCredentials credentials = ApplicationTokenCredentials.fromFile(credFile);
        RestClient restClient = new RestClient.Builder()
                .withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER)
                .withSerializerAdapter(new AzureJacksonAdapter())
                .withReadTimeout(150, TimeUnit.SECONDS)
                .withLogLevel(LogLevel.BODY)
                .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
                .withCredentials(credentials).build();
        Azure azure = Azure.authenticate(restClient, credentials.domain(), credentials.defaultSubscriptionId()).withDefaultSubscription();

        // Print selected subscription
        System.out.println("Selected subscription: " + azure.subscriptionId());

        runSample(azure);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
}
 
Example #6
Source File: ManageSqlServerSecurityAlertPolicy.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Main entry point.
 * @param args the parameters
 */
public static void main(String[] args) {
    try {
        final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));


        ApplicationTokenCredentials credentials = ApplicationTokenCredentials.fromFile(credFile);
        RestClient restClient = new RestClient.Builder()
            .withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
            .withReadTimeout(150, TimeUnit.SECONDS)
            .withLogLevel(LogLevel.BODY)
            .withCredentials(credentials).build();
        Azure azure = Azure.authenticate(restClient, credentials.domain(), credentials.defaultSubscriptionId()).withDefaultSubscription();

        // Print selected subscription
        System.out.println("Selected subscription: " + azure.subscriptionId());

        runSample(azure);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
}
 
Example #7
Source File: ManageSqlImportExportDatabase.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Main entry point.
 * @param args the parameters
 */
public static void main(String[] args) {
    try {

        final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));

        ApplicationTokenCredentials credentials = ApplicationTokenCredentials.fromFile(credFile);
        RestClient restClient = new RestClient.Builder()
            .withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withReadTimeout(150, TimeUnit.SECONDS)
            .withLogLevel(LogLevel.BODY)
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
            .withCredentials(credentials).build();
        Azure azure = Azure.authenticate(restClient, credentials.domain(), credentials.defaultSubscriptionId()).withDefaultSubscription();

        // Print selected subscription
        System.out.println("Selected subscription: " + azure.subscriptionId());

        runSample(azure);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
}
 
Example #8
Source File: ManageSqlVirtualNetworkRules.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Main entry point.
 * @param args the parameters
 */
public static void main(String[] args) {
    try {
        final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));


        ApplicationTokenCredentials credentials = ApplicationTokenCredentials.fromFile(credFile);
        RestClient restClient = new RestClient.Builder()
            .withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
            .withReadTimeout(150, TimeUnit.SECONDS)
            .withLogLevel(LogLevel.BODY)
            .withCredentials(credentials).build();
        Azure azure = Azure.authenticate(restClient, credentials.domain(), credentials.defaultSubscriptionId()).withDefaultSubscription();

        // Print selected subscription
        System.out.println("Selected subscription: " + azure.subscriptionId());

        runSample(azure);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
}
 
Example #9
Source File: ManageSqlWithRecoveredOrRestoredDatabase.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Main entry point.
 * @param args the parameters
 */
public static void main(String[] args) {
    try {

        final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));

        ApplicationTokenCredentials credentials = ApplicationTokenCredentials.fromFile(credFile);
        RestClient restClient = new RestClient.Builder()
            .withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withReadTimeout(150, TimeUnit.SECONDS)
            .withLogLevel(LogLevel.BODY)
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
            .withCredentials(credentials).build();
        Azure azure = Azure.authenticate(restClient, credentials.domain(), credentials.defaultSubscriptionId()).withDefaultSubscription();

        // Print selected subscription
        System.out.println("Selected subscription: " + azure.subscriptionId());

        runSample(azure);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
}
 
Example #10
Source File: ManageSqlFirewallRules.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Main entry point.
 * @param args the parameters
 */
public static void main(String[] args) {
    try {
        final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));


        ApplicationTokenCredentials credentials = ApplicationTokenCredentials.fromFile(credFile);
        RestClient restClient = new RestClient.Builder()
                .withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER)
                .withSerializerAdapter(new AzureJacksonAdapter())
                .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
                .withReadTimeout(150, TimeUnit.SECONDS)
                .withLogLevel(LogLevel.BODY)
                .withCredentials(credentials).build();
        Azure azure = Azure.authenticate(restClient, credentials.domain(), credentials.defaultSubscriptionId()).withDefaultSubscription();

        // Print selected subscription
        System.out.println("Selected subscription: " + azure.subscriptionId());

        runSample(azure);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
}
 
Example #11
Source File: ManageSqlDatabasesAcrossDifferentDataCenters.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Main entry point.
 * @param args the parameters
 */
public static void main(String[] args) {
    try {

        final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));

        ApplicationTokenCredentials credentials = ApplicationTokenCredentials.fromFile(credFile);
        RestClient restClient = new RestClient.Builder()
                .withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER)
                .withSerializerAdapter(new AzureJacksonAdapter())
                .withReadTimeout(150, TimeUnit.SECONDS)
                .withLogLevel(LogLevel.BODY)
                .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
                .withCredentials(credentials).build();
        Azure azure = Azure.authenticate(restClient, credentials.domain(), credentials.defaultSubscriptionId()).withDefaultSubscription();

        // Print selected subscription
        System.out.println("Selected subscription: " + azure.subscriptionId());

        runSample(azure);
   } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
}
 
Example #12
Source File: ManageSqlFailoverGroups.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Main entry point.
 * @param args the parameters
 */
public static void main(String[] args) {
    try {
        final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));


        ApplicationTokenCredentials credentials = ApplicationTokenCredentials.fromFile(credFile);
        RestClient restClient = new RestClient.Builder()
            .withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
            .withReadTimeout(150, TimeUnit.SECONDS)
            .withLogLevel(LogLevel.BODY)
            .withCredentials(credentials).build();
        Azure azure = Azure.authenticate(restClient, credentials.domain(), credentials.defaultSubscriptionId()).withDefaultSubscription();

        // Print selected subscription
        System.out.println("Selected subscription: " + azure.subscriptionId());

        runSample(azure);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
}
 
Example #13
Source File: NetworkManager.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Creates an instance of NetworkManager that exposes network resource management API entry points.
 *
 * @param credentials the credentials to use
 * @param subscriptionId the subscription UUID
 * @return the NetworkManager
 */
public static NetworkManager authenticate(AzureTokenCredentials credentials, String subscriptionId) {
    return new NetworkManager(new RestClient.Builder()
            .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER)
            .withCredentials(credentials)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
            .withInterceptor(new ProviderRegistrationInterceptor(credentials))
            .withInterceptor(new ResourceManagerThrottlingInterceptor())
            .build(), subscriptionId);
}
 
Example #14
Source File: ContainerInstanceManager.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Creates an instance of ContainerInstanceManager that exposes resource management API entry points.
 *
 * @param credentials the credentials to use
 * @param subscriptionId the subscription
 * @return the ContainerInstanceManager
 */
public static ContainerInstanceManager authenticate(AzureTokenCredentials credentials, String subscriptionId) {
    return new ContainerInstanceManager(new RestClient.Builder()
        .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER)
        .withCredentials(credentials)
        .withSerializerAdapter(new AzureJacksonAdapter())
        .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
        .withInterceptor(new ProviderRegistrationInterceptor(credentials))
        .withInterceptor(new ResourceManagerThrottlingInterceptor())
        .build(), subscriptionId);
}
 
Example #15
Source File: CdnManager.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Creates an instance of CDN Manager that exposes CDN manager management API entry points.
 *
 * @param credentials the credentials to use
 * @param subscriptionId the subscription UUID
 * @return the CDN Manager
 */
public static CdnManager authenticate(AzureTokenCredentials credentials, String subscriptionId) {
    return new CdnManager(new RestClient.Builder()
            .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER)
            .withCredentials(credentials)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
            .withInterceptor(new ProviderRegistrationInterceptor(credentials))
            .withInterceptor(new ResourceManagerThrottlingInterceptor())
            .build(), subscriptionId);
}
 
Example #16
Source File: DnsZoneManager.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Creates an instance of DnsZoneManager that exposes DNS zone management API entry points.
 *
 * @param credentials the credentials to use
 * @param subscriptionId the subscription UUID
 * @return the DnsZoneManager
 */
public static DnsZoneManager authenticate(AzureTokenCredentials credentials, String subscriptionId) {
    return new DnsZoneManager(new RestClient.Builder()
            .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER)
            .withCredentials(credentials)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
            .withInterceptor(new ProviderRegistrationInterceptor(credentials))
            .withInterceptor(new ResourceManagerThrottlingInterceptor())
            .build(), subscriptionId);
}
 
Example #17
Source File: KeyVaultManager.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Creates an instance of KeyVaultManager that exposes KeyVault resource management API entry points.
 *
 * @param credentials the credentials to use
 * @param subscriptionId the subscription UUID
 * @return the KeyVaultManager
 */
public static KeyVaultManager authenticate(AzureTokenCredentials credentials, String subscriptionId) {
    return new KeyVaultManager(new RestClient.Builder()
            .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER)
            .withCredentials(credentials)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
            .withInterceptor(new ProviderRegistrationInterceptor(credentials))
            .withInterceptor(new ResourceManagerThrottlingInterceptor())
            .build(), credentials.domain(), subscriptionId);
}
 
Example #18
Source File: CosmosDBManager.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Creates an instance of ComputeManager that exposes Compute resource management API entry points.
 *
 * @param credentials the credentials to use
 * @param subscriptionId the subscription
 * @return the ComputeManager
 */
public static CosmosDBManager authenticate(AzureTokenCredentials credentials, String subscriptionId) {
    return new CosmosDBManager(new RestClient.Builder()
            .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER)
            .withCredentials(credentials)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
            .withInterceptor(new ProviderRegistrationInterceptor(credentials))
            .withInterceptor(new ResourceManagerThrottlingInterceptor())
            .build(), subscriptionId);
}
 
Example #19
Source File: BatchAIManager.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
* Creates an instance of BatchAIManager that exposes BatchAI resource management API entry points.
*
* @param credentials the credentials to use
* @param subscriptionId the subscription UUID
* @return the BatchAIManager
*/
public static BatchAIManager authenticate(AzureTokenCredentials credentials, String subscriptionId) {
    return new BatchAIManager(new RestClient.Builder()
        .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER)
        .withCredentials(credentials)
        .withSerializerAdapter(new AzureJacksonAdapter())
        .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
        .withInterceptor(new ProviderRegistrationInterceptor(credentials))
        .build(), subscriptionId);
}
 
Example #20
Source File: GraphRbacManager.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Creates an instance of GraphRbacManager that exposes Graph RBAC management API entry points.
 *
 * @param credentials the credentials to use
 * @return the GraphRbacManager instance
 */
public static GraphRbacManager authenticate(AzureTokenCredentials credentials) {
    return new GraphRbacManager(new RestClient.Builder()
            .withBaseUrl(credentials.environment().graphEndpoint())
            .withInterceptor(new RequestIdHeaderInterceptor())
            .withCredentials(credentials)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
            .withInterceptor(new ProviderRegistrationInterceptor(credentials))
            .withInterceptor(new ResourceManagerThrottlingInterceptor())
            .build(), credentials.domain());
}
 
Example #21
Source File: AppServiceManager.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Creates an instance of StorageManager that exposes storage resource management API entry points.
 *
 * @param credentials the credentials to use
 * @param subscriptionId the subscription UUID
 * @return the StorageManager
 */
public static AppServiceManager authenticate(AzureTokenCredentials credentials, String subscriptionId) {
    return new AppServiceManager(new RestClient.Builder()
            .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER)
            .withCredentials(credentials)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
            .withInterceptor(new ProviderRegistrationInterceptor(credentials))
            .withInterceptor(new ResourceManagerThrottlingInterceptor())
            .build(), credentials.domain(), subscriptionId);
}
 
Example #22
Source File: ServiceBusManager.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Creates an instance of ServiceBusManager that exposes servicebus management API entry points.
 *
 * @param credentials the credentials to use
 * @param subscriptionId the subscription UUID
 * @return the ServiceBusManager
 */
public static ServiceBusManager authenticate(AzureTokenCredentials credentials, String subscriptionId) {
    return new ServiceBusManager(new RestClient.Builder()
            .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER)
            .withCredentials(credentials)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
            .withInterceptor(new ProviderRegistrationInterceptor(credentials))
            .withInterceptor(new ResourceManagerThrottlingInterceptor())
            .build(), subscriptionId);
}
 
Example #23
Source File: KeyVaultClientIntegrationTestBase.java    From azure-keyvault-java with MIT License 5 votes vote down vote up
protected void initializeClients(RestClient restClient, String s, String s1) throws IOException {
	try {
		RestClient restClientWithTimeout = buildRestClient(new RestClient.Builder()
				.withBaseUrl("https://{vaultBaseUrl}").withSerializerAdapter(new AzureJacksonAdapter())
				.withResponseBuilderFactory(new AzureResponseBuilder.Factory())
				.withCredentials(createTestCredentials()).withLogLevel(LogLevel.BODY_AND_HEADERS)
				.withNetworkInterceptor(interceptorManager.initInterceptor()));
		createTestCredentials();
		keyVaultClient = new KeyVaultClient(restClientWithTimeout);

		// keyVaultClient = new KeyVaultClient(restClient);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
Example #24
Source File: ITManagedStorageAccountKey.java    From azure-keyvault-java with MIT License 5 votes vote down vote up
protected RestClient buildPlaybackRestClient(ServiceClientCredentials credentials, String baseUrl)
        throws IOException {
    return new RestClient.Builder().withBaseUrl(baseUrl)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory()).withCredentials(credentials)
            .withLogLevel(LogLevel.NONE).withNetworkInterceptor(new LoggingInterceptor(LogLevel.BODY_AND_HEADERS))
            .withNetworkInterceptor(interceptorManager.initInterceptor())
            .withInterceptor(new ResourceManagerThrottlingInterceptor()).build();
}
 
Example #25
Source File: KeyVaultClientIntegrationTestBase.java    From azure-keyvault-java with MIT License 5 votes vote down vote up
protected RestClient buildPlaybackRestClient(ServiceClientCredentials credentials, String baseUrl) throws IOException {
	return buildRestClient(new RestClient.Builder().withBaseUrl(baseUrl)
				.withSerializerAdapter(new AzureJacksonAdapter())
				.withResponseBuilderFactory(new AzureResponseBuilder.Factory()).withCredentials(credentials)
				.withLogLevel(LogLevel.NONE)
				.withNetworkInterceptor(new LoggingInterceptor(LogLevel.BODY_AND_HEADERS))
				.withNetworkInterceptor(interceptorManager.initInterceptor())
				.withInterceptor(new ResourceManagerThrottlingInterceptor()));
}
 
Example #26
Source File: RedisManager.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Creates an instance of RedisManager that exposes Redis resource management API entry points.
 *
 * @param credentials    the credentials to use
 * @param subscriptionId the subscription UUID
 * @return the RedisManager
 */
public static RedisManager authenticate(AzureTokenCredentials credentials, String subscriptionId) {
    return new RedisManager(new RestClient.Builder()
            .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER)
            .withCredentials(credentials)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
            .withInterceptor(new ProviderRegistrationInterceptor(credentials))
            .withInterceptor(new ResourceManagerThrottlingInterceptor())
            .build(), subscriptionId);
}
 
Example #27
Source File: MSIManager.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Creates an instance of MSIManager that exposes Managed Service Identity (MSI) resource management API entry points.
 *
 * @param credentials the credentials to use
 * @param subscriptionId the subscription UUID
 * @return the MSIManager
 */
public static MSIManager authenticate(AzureTokenCredentials credentials, String subscriptionId) {
    return new MSIManager(new RestClient.Builder()
            .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER)
            .withCredentials(credentials)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
            .withInterceptor(new ProviderRegistrationInterceptor(credentials))
            .withInterceptor(new ResourceManagerThrottlingInterceptor())
            .build(), subscriptionId);
}
 
Example #28
Source File: StorageManager.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Creates an instance of StorageManager that exposes storage resource management API entry points.
 *
 * @param credentials the credentials to use
 * @param subscriptionId the subscription UUID
 * @return the StorageManager
 */
public static StorageManager authenticate(AzureTokenCredentials credentials, String subscriptionId) {
    return new StorageManager(new RestClient.Builder()
            .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER)
            .withCredentials(credentials)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
            .withInterceptor(new ProviderRegistrationInterceptor(credentials))
            .withInterceptor(new ResourceManagerThrottlingInterceptor())
            .build(), subscriptionId);
}
 
Example #29
Source File: AuthorizationManager.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
* Creates an instance of AuthorizationManager that exposes Authorization resource management API entry points.
*
* @param credentials the credentials to use
* @param subscriptionId the subscription UUID
* @return the AuthorizationManager
*/
public static AuthorizationManager authenticate(AzureTokenCredentials credentials, String subscriptionId) {
    return new AuthorizationManager(new RestClient.Builder()
        .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER)
        .withCredentials(credentials)
        .withSerializerAdapter(new AzureJacksonAdapter())
        .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
        .withInterceptor(new ProviderRegistrationInterceptor(credentials))
        .build(), subscriptionId);
}
 
Example #30
Source File: ContainerRegistryManager.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Creates an instance of ContainerRegistryManager that exposes Registry resource management API entry points.
 *
 * @param credentials the credentials to use
 * @param subscriptionId the subscription
 * @return the ContainerRegistryManager
 */
public static ContainerRegistryManager authenticate(AzureTokenCredentials credentials, String subscriptionId) {
    return new ContainerRegistryManager(new RestClient.Builder()
            .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER)
            .withCredentials(credentials)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
            .withInterceptor(new ProviderRegistrationInterceptor(credentials))
            .withInterceptor(new ResourceManagerThrottlingInterceptor())
            .build(), subscriptionId);
}