Class CfnAlarm
- All Implemented Interfaces:
IConstruct
,IDependable
,IInspectable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
AWS::Lightsail::Alarm
.
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();
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionThe name of the alarm.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 theALARM
state.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.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
setAlarmName
(String value) The name of the alarm.void
setComparisonOperator
(String value) The arithmetic operation to use when comparing the specified statistic and threshold.void
setContactProtocols
(List<String> value) The contact protocols for the alarm, such asEmail
,SMS
(text messaging), or both.void
setDatapointsToAlarm
(Number value) The number of data points within the evaluation periods that must be breaching to cause the alarm to go to theALARM
state.void
setEvaluationPeriods
(Number value) The number of periods over which data is compared to the specified threshold.void
setMetricName
(String value) The name of the metric associated with the alarm.void
setMonitoredResourceName
(String value) The name of the Lightsail resource that the alarm monitors.void
setNotificationEnabled
(Boolean value) A Boolean value indicating whether the alarm is enabled.void
A Boolean value indicating whether the alarm is enabled.void
setNotificationTriggers
(List<String> value) The alarm states that trigger a notification.void
setThreshold
(Number value) The value against which the specified statistic is compared.void
setTreatMissingData
(String value) Specifies how the alarm handles missing data points.Methods inherited from class software.amazon.awscdk.core.CfnResource
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.core.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.core.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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 Construct scope, @NotNull String id, @NotNull CfnAlarmProps props) Create a newAWS::Lightsail::Alarm
.- Parameters:
scope
-- scope in which this resource is defined.
id
-- scoped id of the resource.
props
-- resource properties.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- Parameters:
inspector
-- tree inspector to collect and process attributes.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderProperties
in classCfnResource
- Parameters:
props
- This parameter is required.
-
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:
getCfnProperties
in 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.Allowed Values :
Email
|SMS
-
setContactProtocols
The contact protocols for the alarm, such asEmail
,SMS
(text messaging), or both.Allowed Values :
Email
|SMS
-
getDatapointsToAlarm
The number of data points within the evaluation periods that must be breaching to cause the alarm to go to theALARM
state. -
setDatapointsToAlarm
The number of data points within the evaluation periods that must be breaching to cause the alarm to go to theALARM
state. -
getNotificationEnabled
A Boolean value indicating whether the alarm is enabled. -
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.To specify the
OK
andINSUFFICIENT_DATA
values, you must also specifyContactProtocols
values. Otherwise, theOK
andINSUFFICIENT_DATA
values will not take effect and the stack will drift.Allowed Values :
OK
|ALARM
|INSUFFICIENT_DATA
-
setNotificationTriggers
The alarm states that trigger a notification.To specify the
OK
andINSUFFICIENT_DATA
values, you must also specifyContactProtocols
values. Otherwise, theOK
andINSUFFICIENT_DATA
values will not take effect and the stack will drift.Allowed Values :
OK
|ALARM
|INSUFFICIENT_DATA
-
getTreatMissingData
Specifies how the alarm handles missing data points.An alarm can treat missing data in the following ways:
breaching
- Assumes the missing data is not within the threshold. Missing data counts towards the number of times that the metric is not within the threshold.notBreaching
- Assumes the missing data is within the threshold. Missing data does not count towards the number of times that the metric is not within the threshold.ignore
- Ignores the missing data. Maintains the current alarm state.missing
- Missing data is treated as missing.
-
setTreatMissingData
Specifies how the alarm handles missing data points.An alarm can treat missing data in the following ways:
breaching
- Assumes the missing data is not within the threshold. Missing data counts towards the number of times that the metric is not within the threshold.notBreaching
- Assumes the missing data is within the threshold. Missing data does not count towards the number of times that the metric is not within the threshold.ignore
- Ignores the missing data. Maintains the current alarm state.missing
- Missing data is treated as missing.
-