Interface AlarmProps

All Superinterfaces:
CreateAlarmOptions, software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
AlarmProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:36.767Z") @Stability(Stable) public interface AlarmProps extends software.amazon.jsii.JsiiSerializable, CreateAlarmOptions
Properties for Alarms.

Example:

 import software.amazon.awscdk.services.cloudwatch.*;
 Alias alias;
 // or add alarms to an existing group
 Alias blueGreenAlias;
 Alarm alarm = Alarm.Builder.create(this, "Errors")
         .comparisonOperator(ComparisonOperator.GREATER_THAN_THRESHOLD)
         .threshold(1)
         .evaluationPeriods(1)
         .metric(alias.metricErrors())
         .build();
 LambdaDeploymentGroup deploymentGroup = LambdaDeploymentGroup.Builder.create(this, "BlueGreenDeployment")
         .alias(alias)
         .deploymentConfig(LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE)
         .alarms(List.of(alarm))
         .build();
 deploymentGroup.addAlarm(Alarm.Builder.create(this, "BlueGreenErrors")
         .comparisonOperator(ComparisonOperator.GREATER_THAN_THRESHOLD)
         .threshold(1)
         .evaluationPeriods(1)
         .metric(blueGreenAlias.metricErrors())
         .build());
 
  • Method Details

    • getMetric

      @Stability(Stable) @NotNull IMetric getMetric()
      The metric to add the alarm on.

      Metric objects can be obtained from most resources, or you can construct custom Metric objects by instantiating one.

    • builder

      @Stability(Stable) static AlarmProps.Builder builder()
      Returns:
      a AlarmProps.Builder of AlarmProps