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

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

Introduction

In this page you can find the example usage for com.amazonaws.services.cloudwatch AmazonCloudWatchClient 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.kixeye.chassis.support.metrics.aws.DefaultCloudWatchFactory.java

License:Apache License

@Override
public AmazonCloudWatchClient getCloudWatchClient() {
    AmazonCloudWatchClient client;
    if (StringUtils.isBlank(accessKeyId) || StringUtils.isBlank(secretKey)) {
        LOGGER.debug(//  www .java 2s  .c o m
                "Constructing AmazonCloudWatchClient using DefaultAWSCredentialsProviderChain for region {}.",
                region);
        client = new AmazonCloudWatchClient(new DefaultAWSCredentialsProviderChain());
    } else {
        LOGGER.debug("Constructing AmazonCloudWatchClient from given credentials for region {}.", region);
        client = new AmazonCloudWatchClient(new BasicAWSCredentials(accessKeyId, secretKey));
    }
    client.setRegion(region);
    return client;
}