Search in sources :

Example 1 with CloudWatchClient

use of software.amazon.awssdk.services.cloudwatch.CloudWatchClient in project beam by apache.

the class KinesisSource method createClient.

private SimplifiedKinesisClient createClient(PipelineOptions options) {
    AwsOptions awsOptions = options.as(AwsOptions.class);
    KinesisClient kinesis;
    CloudWatchClient cloudWatch;
    if (spec.getAWSClientsProvider() != null) {
        kinesis = spec.getAWSClientsProvider().getKinesisClient();
        cloudWatch = spec.getAWSClientsProvider().getCloudWatchClient();
    } else {
        ClientConfiguration config = spec.getClientConfiguration();
        kinesis = ClientBuilderFactory.buildClient(awsOptions, KinesisClient.builder(), config);
        cloudWatch = ClientBuilderFactory.buildClient(awsOptions, CloudWatchClient.builder(), config);
    }
    return new SimplifiedKinesisClient(kinesis, cloudWatch, spec.getRequestRecordsLimit(), Instant::now);
}
Also used : CloudWatchClient(software.amazon.awssdk.services.cloudwatch.CloudWatchClient) Instant(org.joda.time.Instant) KinesisClient(software.amazon.awssdk.services.kinesis.KinesisClient) AwsOptions(org.apache.beam.sdk.io.aws2.options.AwsOptions) ClientConfiguration(org.apache.beam.sdk.io.aws2.common.ClientConfiguration)

Example 2 with CloudWatchClient

use of software.amazon.awssdk.services.cloudwatch.CloudWatchClient in project aws-doc-sdk-examples by awsdocs.

the class DeleteAlarm method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "  <alarmName>\n\n" + "Where:\n" + "  alarmName - an alarm name to delete (for example, MyAlarm).\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String alarmName = args[0];
    Region region = Region.US_EAST_2;
    CloudWatchClient cw = CloudWatchClient.builder().region(region).build();
    deleteCWAlarm(cw, alarmName);
    cw.close();
}
Also used : CloudWatchClient(software.amazon.awssdk.services.cloudwatch.CloudWatchClient) Region(software.amazon.awssdk.regions.Region)

Example 3 with CloudWatchClient

use of software.amazon.awssdk.services.cloudwatch.CloudWatchClient in project aws-doc-sdk-examples by awsdocs.

the class DescribeAlarms method main.

public static void main(String[] args) {
    Region region = Region.US_EAST_1;
    CloudWatchClient cw = CloudWatchClient.builder().region(region).build();
    desCWAlarms(cw);
    cw.close();
}
Also used : CloudWatchClient(software.amazon.awssdk.services.cloudwatch.CloudWatchClient) Region(software.amazon.awssdk.regions.Region)

Example 4 with CloudWatchClient

use of software.amazon.awssdk.services.cloudwatch.CloudWatchClient in project aws-doc-sdk-examples by awsdocs.

the class GetMetricData method main.

public static void main(String[] args) {
    Region region = Region.US_EAST_1;
    CloudWatchClient cw = CloudWatchClient.builder().region(region).build();
    getMetData(cw);
    cw.close();
}
Also used : CloudWatchClient(software.amazon.awssdk.services.cloudwatch.CloudWatchClient) Region(software.amazon.awssdk.regions.Region)

Example 5 with CloudWatchClient

use of software.amazon.awssdk.services.cloudwatch.CloudWatchClient in project aws-doc-sdk-examples by awsdocs.

the class EnableAlarmActions method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "  EnableAlarmActions <alarmName>\n\n" + "Where:\n" + "  alarmName - an alarm name to enable (for example, MyAlarm).\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String alarm = args[0];
    Region region = Region.US_EAST_1;
    CloudWatchClient cw = CloudWatchClient.builder().region(region).build();
    enableActions(cw, alarm);
    cw.close();
}
Also used : CloudWatchClient(software.amazon.awssdk.services.cloudwatch.CloudWatchClient) Region(software.amazon.awssdk.regions.Region)

Aggregations

CloudWatchClient (software.amazon.awssdk.services.cloudwatch.CloudWatchClient)9 Region (software.amazon.awssdk.regions.Region)8 ClientConfiguration (org.apache.beam.sdk.io.aws2.common.ClientConfiguration)1 AwsOptions (org.apache.beam.sdk.io.aws2.options.AwsOptions)1 Instant (org.joda.time.Instant)1 KinesisClient (software.amazon.awssdk.services.kinesis.KinesisClient)1