@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-22T19:35:38.363Z") 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();
Modifier and Type | Class and Description |
---|---|
static class |
CfnAlarm.Builder
A fluent builder for
CfnAlarm . |
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
IConstruct.Jsii$Default
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
Modifier | Constructor and Description |
---|---|
|
CfnAlarm(Construct scope,
java.lang.String id,
CfnAlarmProps props)
Create a new `AWS::Lightsail::Alarm`.
|
protected |
CfnAlarm(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnAlarm(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAlarmName()
The name of the alarm.
|
java.lang.String |
getAttrAlarmArn()
The Amazon Resource Name (ARN) of the alarm.
|
java.lang.String |
getAttrState()
The current state of the alarm.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getCfnProperties() |
java.lang.String |
getComparisonOperator()
The arithmetic operation to use when comparing the specified statistic and threshold.
|
java.util.List<java.lang.String> |
getContactProtocols()
The contact protocols for the alarm, such as `Email` , `SMS` (text messaging), or both.
|
java.lang.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.
|
java.lang.Number |
getEvaluationPeriods()
The number of periods over which data is compared to the specified threshold.
|
java.lang.String |
getMetricName()
The name of the metric associated with the alarm.
|
java.lang.String |
getMonitoredResourceName()
The name of the Lightsail resource that the alarm monitors.
|
java.lang.Object |
getNotificationEnabled()
A Boolean value indicating whether the alarm is enabled.
|
java.util.List<java.lang.String> |
getNotificationTriggers()
The alarm states that trigger a notification.
|
java.lang.Number |
getThreshold()
The value against which the specified statistic is compared.
|
java.lang.String |
getTreatMissingData()
Specifies how the alarm handles missing data points.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
renderProperties(java.util.Map<java.lang.String,java.lang.Object> props) |
void |
setAlarmName(java.lang.String value)
The name of the alarm.
|
void |
setComparisonOperator(java.lang.String value)
The arithmetic operation to use when comparing the specified statistic and threshold.
|
void |
setContactProtocols(java.util.List<java.lang.String> value)
The contact protocols for the alarm, such as `Email` , `SMS` (text messaging), or both.
|
void |
setDatapointsToAlarm(java.lang.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.
|
void |
setEvaluationPeriods(java.lang.Number value)
The number of periods over which data is compared to the specified threshold.
|
void |
setMetricName(java.lang.String value)
The name of the metric associated with the alarm.
|
void |
setMonitoredResourceName(java.lang.String value)
The name of the Lightsail resource that the alarm monitors.
|
void |
setNotificationEnabled(java.lang.Boolean value)
A Boolean value indicating whether the alarm is enabled.
|
void |
setNotificationEnabled(IResolvable value)
A Boolean value indicating whether the alarm is enabled.
|
void |
setNotificationTriggers(java.util.List<java.lang.String> value)
The alarm states that trigger a notification.
|
void |
setThreshold(java.lang.Number value)
The value against which the specified statistic is compared.
|
void |
setTreatMissingData(java.lang.String value)
Specifies how the alarm handles missing data points.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
getRef
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
public static final java.lang.String CFN_RESOURCE_TYPE_NAME
protected CfnAlarm(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnAlarm(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public CfnAlarm(Construct scope, java.lang.String id, CfnAlarmProps props)
scope
- - scope in which this resource is defined. This parameter is required.id
- - scoped id of the resource. This parameter is required.props
- - resource properties. This parameter is required.public void inspect(TreeInspector inspector)
inspect
in interface IInspectable
inspector
- - tree inspector to collect and process attributes. This parameter is required.protected java.util.Map<java.lang.String,java.lang.Object> renderProperties(java.util.Map<java.lang.String,java.lang.Object> props)
renderProperties
in class CfnResource
props
- This parameter is required.public java.lang.String getAttrAlarmArn()
public java.lang.String getAttrState()
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.protected java.util.Map<java.lang.String,java.lang.Object> getCfnProperties()
getCfnProperties
in class CfnResource
public java.lang.String getAlarmName()
public void setAlarmName(java.lang.String value)
public java.lang.String getComparisonOperator()
public void setComparisonOperator(java.lang.String value)
public java.lang.Number getEvaluationPeriods()
public void setEvaluationPeriods(java.lang.Number value)
public java.lang.String getMetricName()
public void setMetricName(java.lang.String value)
public java.lang.String getMonitoredResourceName()
public void setMonitoredResourceName(java.lang.String value)
public java.lang.Number getThreshold()
public void setThreshold(java.lang.Number value)
public java.util.List<java.lang.String> getContactProtocols()
Allowed Values : Email
| SMS
public void setContactProtocols(java.util.List<java.lang.String> value)
Allowed Values : Email
| SMS
public java.lang.Number getDatapointsToAlarm()
public void setDatapointsToAlarm(java.lang.Number value)
public java.lang.Object getNotificationEnabled()
public void setNotificationEnabled(java.lang.Boolean value)
public void setNotificationEnabled(IResolvable value)
public java.util.List<java.lang.String> getNotificationTriggers()
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
public void setNotificationTriggers(java.util.List<java.lang.String> value)
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
public java.lang.String getTreatMissingData()
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.public void setTreatMissingData(java.lang.String value)
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.