@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:40.628Z") @Stability(value=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();
| Modifier and Type | Class and Description |
|---|---|
static class |
CfnAlarm.Builder
A fluent builder for
CfnAlarm. |
software.amazon.jsii.JsiiObject.InitializationModeIInspectable.Jsii$Default, IInspectable.Jsii$Proxy| Modifier and Type | Field and Description |
|---|---|
static String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
| Modifier | Constructor and Description |
|---|---|
|
CfnAlarm(software.constructs.Construct scope,
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 |
|---|---|
String |
getAlarmName()
The name of the alarm.
|
String |
getAttrAlarmArn()
The Amazon Resource Name (ARN) of the alarm.
|
String |
getAttrState()
The current state of the alarm.
|
protected Map<String,Object> |
getCfnProperties() |
String |
getComparisonOperator()
The arithmetic operation to use when comparing the specified statistic and threshold.
|
List<String> |
getContactProtocols()
The contact protocols for the alarm, such as `Email` , `SMS` (text messaging), or both.
|
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.
|
Number |
getEvaluationPeriods()
The number of periods over which data is compared to the specified threshold.
|
String |
getMetricName()
The name of the metric associated with the alarm.
|
String |
getMonitoredResourceName()
The name of the Lightsail resource that the alarm monitors.
|
Object |
getNotificationEnabled()
A Boolean value indicating whether the alarm is enabled.
|
List<String> |
getNotificationTriggers()
The alarm states that trigger a notification.
|
Number |
getThreshold()
The value against which the specified statistic is compared.
|
String |
getTreatMissingData()
Specifies how the alarm handles missing data points.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected Map<String,Object> |
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 as `Email` , `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 the `ALARM` 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 |
setNotificationEnabled(IResolvable value)
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.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, shouldSynthesize, toString, validatePropertiesgetRefgetCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet@Stability(value=Stable) public static final String CFN_RESOURCE_TYPE_NAME
protected CfnAlarm(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnAlarm(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public CfnAlarm(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
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.@Stability(value=Stable)
public void inspect(@NotNull
TreeInspector inspector)
inspect in interface IInspectableinspector - - tree inspector to collect and process attributes. This parameter is required.@Stability(value=Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
renderProperties in class CfnResourceprops - This parameter is required.@Stability(value=Stable) @NotNull public String getAttrAlarmArn()
@Stability(value=Stable) @NotNull public 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.@Stability(value=Stable) @NotNull protected Map<String,Object> getCfnProperties()
getCfnProperties in class CfnResource@Stability(value=Stable) @NotNull public String getAlarmName()
@Stability(value=Stable)
public void setAlarmName(@NotNull
String value)
@Stability(value=Stable) @NotNull public String getComparisonOperator()
@Stability(value=Stable)
public void setComparisonOperator(@NotNull
String value)
@Stability(value=Stable) @NotNull public Number getEvaluationPeriods()
@Stability(value=Stable)
public void setEvaluationPeriods(@NotNull
Number value)
@Stability(value=Stable) @NotNull public String getMetricName()
@Stability(value=Stable)
public void setMetricName(@NotNull
String value)
@Stability(value=Stable) @NotNull public String getMonitoredResourceName()
@Stability(value=Stable)
public void setMonitoredResourceName(@NotNull
String value)
@Stability(value=Stable) @NotNull public Number getThreshold()
@Stability(value=Stable)
public void setThreshold(@NotNull
Number value)
@Stability(value=Stable) @Nullable public List<String> getContactProtocols()
Allowed Values : Email | SMS
@Stability(value=Stable)
public void setContactProtocols(@Nullable
List<String> value)
Allowed Values : Email | SMS
@Stability(value=Stable) @Nullable public Number getDatapointsToAlarm()
@Stability(value=Stable)
public void setDatapointsToAlarm(@Nullable
Number value)
@Stability(value=Stable) @Nullable public Object getNotificationEnabled()
@Stability(value=Stable)
public void setNotificationEnabled(@Nullable
Boolean value)
@Stability(value=Stable)
public void setNotificationEnabled(@Nullable
IResolvable value)
@Stability(value=Stable) @Nullable public List<String> getNotificationTriggers()
To specify the
OKandINSUFFICIENT_DATAvalues, you must also specifyContactProtocolsvalues. Otherwise, theOKandINSUFFICIENT_DATAvalues will not take effect and the stack will drift.
Allowed Values : OK | ALARM | INSUFFICIENT_DATA
@Stability(value=Stable)
public void setNotificationTriggers(@Nullable
List<String> value)
To specify the
OKandINSUFFICIENT_DATAvalues, you must also specifyContactProtocolsvalues. Otherwise, theOKandINSUFFICIENT_DATAvalues will not take effect and the stack will drift.
Allowed Values : OK | ALARM | INSUFFICIENT_DATA
@Stability(value=Stable) @Nullable public 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.@Stability(value=Stable)
public void setTreatMissingData(@Nullable
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.Copyright © 2022. All rights reserved.