Class CloudWatchSetAlarmStateAction

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.iot.actions.alpha.CloudWatchSetAlarmStateAction
All Implemented Interfaces:
IAction, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-12-06T14:43:29.570Z") @Stability(Experimental) public class CloudWatchSetAlarmStateAction extends software.amazon.jsii.JsiiObject implements IAction
(experimental) The action to change the state of an Amazon CloudWatch alarm.

Example:

 import software.amazon.awscdk.services.cloudwatch.*;
 Metric metric = Metric.Builder.create()
         .namespace("MyNamespace")
         .metricName("MyMetric")
         .dimensionsMap(Map.of("MyDimension", "MyDimensionValue"))
         .build();
 Alarm alarm = Alarm.Builder.create(this, "MyAlarm")
         .metric(metric)
         .threshold(100)
         .evaluationPeriods(3)
         .datapointsToAlarm(2)
         .build();
 TopicRule topicRule = TopicRule.Builder.create(this, "TopicRule")
         .sql(IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id FROM 'device/+/data'"))
         .actions(List.of(
             CloudWatchSetAlarmStateAction.Builder.create(alarm)
                     .reason("AWS Iot Rule action is triggered")
                     .alarmStateToSet(AlarmState.ALARM)
                     .build()))
         .build();
 
  • Constructor Details

    • CloudWatchSetAlarmStateAction

      protected CloudWatchSetAlarmStateAction(software.amazon.jsii.JsiiObjectRef objRef)
    • CloudWatchSetAlarmStateAction

      protected CloudWatchSetAlarmStateAction(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CloudWatchSetAlarmStateAction

      @Stability(Experimental) public CloudWatchSetAlarmStateAction(@NotNull IAlarm alarm, @NotNull CloudWatchSetAlarmStateActionProps props)
      Parameters:
      alarm - This parameter is required.
      props - This parameter is required.