java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-08T21:35:09.450Z") @Stability(Stable) public class CfnAlarm extends CfnResource implements IInspectable
The AWS::Lightsail::Alarm resource specifies an alarm that can be used to monitor a single metric for one of your Lightsail resources.

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.lightsail.*;
 CfnAlarm cfnAlarm = CfnAlarm.Builder.create(this, "MyCfnAlarm")
         .alarmName("alarmName")
         .comparisonOperator("comparisonOperator")
         .evaluationPeriods(123)
         .metricName("metricName")
         .monitoredResourceName("monitoredResourceName")
         .threshold(123)
         // the properties below are optional
         .contactProtocols(List.of("contactProtocols"))
         .datapointsToAlarm(123)
         .notificationEnabled(false)
         .notificationTriggers(List.of("notificationTriggers"))
         .treatMissingData("treatMissingData")
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnAlarm

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

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

      @Stability(Stable) public CfnAlarm(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnAlarmProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrAlarmArn

      @Stability(Stable) @NotNull public String getAttrAlarmArn()
      The Amazon Resource Name (ARN) of the alarm.
    • getAttrState

      @Stability(Stable) @NotNull public String getAttrState()
      The current state of the alarm.

      An alarm has the following possible states:

      • ALARM - The metric is outside of the defined threshold.
      • INSUFFICIENT_DATA - The alarm has recently started, the metric is not available, or not enough data is available for the metric to determine the alarm state.
      • OK - The metric is within the defined threshold.
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getAlarmName

      @Stability(Stable) @NotNull public String getAlarmName()
      The name of the alarm.
    • setAlarmName

      @Stability(Stable) public void setAlarmName(@NotNull String value)
      The name of the alarm.
    • getComparisonOperator

      @Stability(Stable) @NotNull public String getComparisonOperator()
      The arithmetic operation to use when comparing the specified statistic and threshold.
    • setComparisonOperator

      @Stability(Stable) public void setComparisonOperator(@NotNull String value)
      The arithmetic operation to use when comparing the specified statistic and threshold.
    • getEvaluationPeriods

      @Stability(Stable) @NotNull public Number getEvaluationPeriods()
      The number of periods over which data is compared to the specified threshold.
    • setEvaluationPeriods

      @Stability(Stable) public void setEvaluationPeriods(@NotNull Number value)
      The number of periods over which data is compared to the specified threshold.
    • getMetricName

      @Stability(Stable) @NotNull public String getMetricName()
      The name of the metric associated with the alarm.
    • setMetricName

      @Stability(Stable) public void setMetricName(@NotNull String value)
      The name of the metric associated with the alarm.
    • getMonitoredResourceName

      @Stability(Stable) @NotNull public String getMonitoredResourceName()
      The name of the Lightsail resource that the alarm monitors.
    • setMonitoredResourceName

      @Stability(Stable) public void setMonitoredResourceName(@NotNull String value)
      The name of the Lightsail resource that the alarm monitors.
    • getThreshold

      @Stability(Stable) @NotNull public Number getThreshold()
      The value against which the specified statistic is compared.
    • setThreshold

      @Stability(Stable) public void setThreshold(@NotNull Number value)
      The value against which the specified statistic is compared.
    • getContactProtocols

      @Stability(Stable) @Nullable public List<String> getContactProtocols()
      The contact protocols for the alarm, such as Email , SMS (text messaging), or both.
    • setContactProtocols

      @Stability(Stable) public void setContactProtocols(@Nullable List<String> value)
      The contact protocols for the alarm, such as Email , SMS (text messaging), or both.
    • getDatapointsToAlarm

      @Stability(Stable) @Nullable public Number getDatapointsToAlarm()
      The number of data points within the evaluation periods that must be breaching to cause the alarm to go to the ALARM state.
    • setDatapointsToAlarm

      @Stability(Stable) public void setDatapointsToAlarm(@Nullable Number value)
      The number of data points within the evaluation periods that must be breaching to cause the alarm to go to the ALARM state.
    • getNotificationEnabled

      @Stability(Stable) @Nullable public Object getNotificationEnabled()
      A Boolean value indicating whether the alarm is enabled.
    • setNotificationEnabled

      @Stability(Stable) public void setNotificationEnabled(@Nullable Boolean value)
      A Boolean value indicating whether the alarm is enabled.
    • setNotificationEnabled

      @Stability(Stable) public void setNotificationEnabled(@Nullable IResolvable value)
      A Boolean value indicating whether the alarm is enabled.
    • getNotificationTriggers

      @Stability(Stable) @Nullable public List<String> getNotificationTriggers()
      The alarm states that trigger a notification.
    • setNotificationTriggers

      @Stability(Stable) public void setNotificationTriggers(@Nullable List<String> value)
      The alarm states that trigger a notification.
    • getTreatMissingData

      @Stability(Stable) @Nullable public String getTreatMissingData()
      Specifies how the alarm handles missing data points.
    • setTreatMissingData

      @Stability(Stable) public void setTreatMissingData(@Nullable String value)
      Specifies how the alarm handles missing data points.