Search in sources :

Example 1 with EnableAlarmActionsRequest

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

the class EnableAlarmActions method enableActions.

// snippet-start:[cloudwatch.java2.enable_alarm_actions.main]
public static void enableActions(CloudWatchClient cw, String alarm) {
    try {
        EnableAlarmActionsRequest request = EnableAlarmActionsRequest.builder().alarmNames(alarm).build();
        cw.enableAlarmActions(request);
        System.out.printf("Successfully enabled actions on alarm %s", alarm);
    } catch (CloudWatchException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
}
Also used : EnableAlarmActionsRequest(software.amazon.awssdk.services.cloudwatch.model.EnableAlarmActionsRequest) CloudWatchException(software.amazon.awssdk.services.cloudwatch.model.CloudWatchException)

Aggregations

CloudWatchException (software.amazon.awssdk.services.cloudwatch.model.CloudWatchException)1 EnableAlarmActionsRequest (software.amazon.awssdk.services.cloudwatch.model.EnableAlarmActionsRequest)1