Example usage for com.amazonaws.services.cloudwatch AmazonCloudWatchAsyncClient setRegion

List of usage examples for com.amazonaws.services.cloudwatch AmazonCloudWatchAsyncClient setRegion

Introduction

In this page you can find the example usage for com.amazonaws.services.cloudwatch AmazonCloudWatchAsyncClient setRegion.

Prototype

@Deprecated
void setRegion(Region region);

Source Link

Document

An alternative to AmazonCloudWatch#setEndpoint(String) , sets the regional endpoint for this client's service calls.

Usage

From source file:com.vmware.photon.controller.model.adapters.awsadapter.AWSUtils.java

License:Open Source License

public static AmazonCloudWatchAsyncClient getStatsAsyncClient(AuthCredentialsServiceState credentials,
        String region, ExecutorService executorService, boolean isMockRequest) {
    AmazonCloudWatchAsyncClient client = new AmazonCloudWatchAsyncClient(
            new BasicAWSCredentials(credentials.privateKeyId, credentials.privateKey), executorService);

    client.setRegion(Region.getRegion(Regions.fromName(region)));
    // make a call to validate credentials
    if (!isMockRequest) {
        client.describeAlarms();//from w  ww .j  a v  a2  s.  com
    }
    return client;
}

From source file:org.springframework.cloud.aws.autoconfigure.actuate.CloudWatchMetricAutoConfiguration.java

License:Apache License

@Bean
@ConditionalOnMissingAmazonClient(AmazonCloudWatchAsync.class)
public AmazonCloudWatchAsync amazonCloudWatchAsync(AWSCredentialsProvider credentialsProvider) {
    AmazonCloudWatchAsyncClient serviceClient = new AmazonCloudWatchAsyncClient(credentialsProvider);
    if (this.regionProvider != null) {
        serviceClient.setRegion(this.regionProvider.getRegion());
    }/*w  ww. j  av  a2s .  co  m*/
    return serviceClient;
}