Class CfnAlarm
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.lightsail.CfnAlarm
- All Implemented Interfaces:
IInspectable,IAlarmRef,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.116.0 (build 0eddcff)",
date="2025-10-24T13:34:41.549Z")
@Stability(Stable)
public class CfnAlarm
extends CfnResource
implements IInspectable, IAlarmRef
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:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.lightsail.IAlarmRef
IAlarmRef.Jsii$Default, IAlarmRef.Jsii$ProxyNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnAlarm(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnAlarm(software.amazon.jsii.JsiiObjectRef objRef) CfnAlarm(software.constructs.Construct scope, String id, CfnAlarmProps props) -
Method Summary
Modifier and TypeMethodDescriptionThe name of the alarm.A reference to a Alarm resource.The Amazon Resource Name (ARN) of the alarm.The current state of the alarm.The arithmetic operation to use when comparing the specified statistic and threshold.The contact protocols for the alarm, such asEmail,SMS(text messaging), or both.The number of data points within the evaluation periods that must be breaching to cause the alarm to go to theALARMstate.The number of periods over which data is compared to the specified threshold.The name of the metric associated with the alarm.The name of the Lightsail resource that the alarm monitors.A Boolean value indicating whether the alarm is enabled.The alarm states that trigger a notification.The value against which the specified statistic is compared.Specifies how the alarm handles missing data points.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidsetAlarmName(String value) The name of the alarm.voidsetComparisonOperator(String value) The arithmetic operation to use when comparing the specified statistic and threshold.voidsetContactProtocols(List<String> value) The contact protocols for the alarm, such asEmail,SMS(text messaging), or both.voidsetDatapointsToAlarm(Number value) The number of data points within the evaluation periods that must be breaching to cause the alarm to go to theALARMstate.voidsetEvaluationPeriods(Number value) The number of periods over which data is compared to the specified threshold.voidsetMetricName(String value) The name of the metric associated with the alarm.voidsetMonitoredResourceName(String value) The name of the Lightsail resource that the alarm monitors.voidsetNotificationEnabled(Boolean value) A Boolean value indicating whether the alarm is enabled.voidA Boolean value indicating whether the alarm is enabled.voidsetNotificationTriggers(List<String> value) The alarm states that trigger a notification.voidsetThreshold(Number value) The value against which the specified statistic is compared.voidsetTreatMissingData(String value) Specifies how the alarm handles missing data points.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
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
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- 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:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getAlarmRef
A reference to a Alarm resource.- Specified by:
getAlarmRefin interfaceIAlarmRef
-
getAttrAlarmArn
The Amazon Resource Name (ARN) of the alarm. -
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
- Overrides:
getCfnPropertiesin classCfnResource
-
getAlarmName
The name of the alarm. -
setAlarmName
The name of the alarm. -
getComparisonOperator
The arithmetic operation to use when comparing the specified statistic and threshold. -
setComparisonOperator
The arithmetic operation to use when comparing the specified statistic and threshold. -
getEvaluationPeriods
The number of periods over which data is compared to the specified threshold. -
setEvaluationPeriods
The number of periods over which data is compared to the specified threshold. -
getMetricName
The name of the metric associated with the alarm. -
setMetricName
The name of the metric associated with the alarm. -
getMonitoredResourceName
The name of the Lightsail resource that the alarm monitors. -
setMonitoredResourceName
The name of the Lightsail resource that the alarm monitors. -
getThreshold
The value against which the specified statistic is compared. -
setThreshold
The value against which the specified statistic is compared. -
getContactProtocols
The contact protocols for the alarm, such asEmail,SMS(text messaging), or both. -
setContactProtocols
The contact protocols for the alarm, such asEmail,SMS(text messaging), or both. -
getDatapointsToAlarm
The number of data points within the evaluation periods that must be breaching to cause the alarm to go to theALARMstate. -
setDatapointsToAlarm
The number of data points within the evaluation periods that must be breaching to cause the alarm to go to theALARMstate. -
getNotificationEnabled
A Boolean value indicating whether the alarm is enabled.Returns union: either
BooleanorIResolvable -
setNotificationEnabled
A Boolean value indicating whether the alarm is enabled. -
setNotificationEnabled
A Boolean value indicating whether the alarm is enabled. -
getNotificationTriggers
The alarm states that trigger a notification. -
setNotificationTriggers
The alarm states that trigger a notification. -
getTreatMissingData
Specifies how the alarm handles missing data points. -
setTreatMissingData
Specifies how the alarm handles missing data points.
-