Example usage for com.amazonaws.services.cloudwatch AmazonCloudWatchAsyncClientBuilder standard

List of usage examples for com.amazonaws.services.cloudwatch AmazonCloudWatchAsyncClientBuilder standard

Introduction

In this page you can find the example usage for com.amazonaws.services.cloudwatch AmazonCloudWatchAsyncClientBuilder standard.

Prototype

public static AmazonCloudWatchAsyncClientBuilder standard() 

Source Link

Usage

From source file:com.kurtraschke.nyctrtproxy.services.CloudwatchProxyDataListener.java

License:Apache License

@PostConstruct
public void init() {
    if (_secretKey == null || _accessKey == null || _namespace == null) {
        _log.info("No AWS credentials supplied, disabling cloudwatch");
        _disabled = true;/*  w  w  w  .ja va  2  s .  c o m*/
        return;
    }
    BasicAWSCredentials cred = new BasicAWSCredentials(_accessKey, _secretKey);
    _client = AmazonCloudWatchAsyncClientBuilder.standard()
            .withCredentials(new AWSStaticCredentialsProvider(cred)).build();
    _handler = new AsyncHandler<PutMetricDataRequest, PutMetricDataResult>() {
        @Override
        public void onError(Exception e) {
            _log.error("Error sending to cloudwatch: " + e);
        }

        @Override
        public void onSuccess(PutMetricDataRequest request, PutMetricDataResult putMetricDataResult) {
            // do nothing
        }
    };
}

From source file:org.springframework.cloud.stream.binder.kinesis.config.KinesisBinderConfiguration.java

License:Apache License

@Bean
@ConditionalOnMissingBean/*from   w ww .ja v a 2  s. com*/
@ConditionalOnProperty(name = "spring.cloud.stream.kinesis.binder.kpl-kcl-enabled")
public AmazonCloudWatchAsync cloudWatch(AWSCredentialsProvider awsCredentialsProvider,
        RegionProvider regionProvider) {

    return AmazonCloudWatchAsyncClientBuilder.standard().withCredentials(awsCredentialsProvider)
            .withRegion(regionProvider.getRegion().getName()).build();
}