Search in sources :

Example 1 with MetricAlarm

use of com.amazonaws.services.cloudwatch.model.MetricAlarm in project aws-doc-sdk-examples by awsdocs.

the class DescribeAlarms method main.

public static void main(String[] args) {
    final AmazonCloudWatch cw = AmazonCloudWatchClientBuilder.defaultClient();
    boolean done = false;
    while (!done) {
        DescribeAlarmsRequest request = new DescribeAlarmsRequest();
        DescribeAlarmsResult response = cw.describeAlarms(request);
        for (MetricAlarm alarm : response.getMetricAlarms()) {
            System.out.printf("Retrieved alarm %s", alarm.getAlarmName());
        }
        request.setNextToken(response.getNextToken());
        if (response.getNextToken() == null) {
            done = true;
        }
    }
}
Also used : MetricAlarm(com.amazonaws.services.cloudwatch.model.MetricAlarm) DescribeAlarmsResult(com.amazonaws.services.cloudwatch.model.DescribeAlarmsResult) AmazonCloudWatch(com.amazonaws.services.cloudwatch.AmazonCloudWatch) DescribeAlarmsRequest(com.amazonaws.services.cloudwatch.model.DescribeAlarmsRequest)

Aggregations

AmazonCloudWatch (com.amazonaws.services.cloudwatch.AmazonCloudWatch)1 DescribeAlarmsRequest (com.amazonaws.services.cloudwatch.model.DescribeAlarmsRequest)1 DescribeAlarmsResult (com.amazonaws.services.cloudwatch.model.DescribeAlarmsResult)1 MetricAlarm (com.amazonaws.services.cloudwatch.model.MetricAlarm)1