@Generated(value="jsii-pacmak/1.63.2 (build a8a8833)", date="2022-08-09T19:16:35.566Z") public class Alarm extends AlarmBase
Example:
import software.amazon.awscdk.services.cloudwatch.*; Alias alias; // or add alarms to an existing group Alias blueGreenAlias; Alarm alarm = Alarm.Builder.create(this, "Errors") .comparisonOperator(ComparisonOperator.GREATER_THAN_THRESHOLD) .threshold(1) .evaluationPeriods(1) .metric(alias.metricErrors()) .build(); LambdaDeploymentGroup deploymentGroup = LambdaDeploymentGroup.Builder.create(this, "BlueGreenDeployment") .alias(alias) .deploymentConfig(LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE) .alarms(List.of(alarm)) .build(); deploymentGroup.addAlarm(Alarm.Builder.create(this, "BlueGreenErrors") .comparisonOperator(ComparisonOperator.GREATER_THAN_THRESHOLD) .threshold(1) .evaluationPeriods(1) .metric(blueGreenAlias.metricErrors()) .build());
Modifier and Type | Class and Description |
---|---|
static class |
Alarm.Builder
A fluent builder for
Alarm . |
IAlarm.Jsii$Default
Modifier | Constructor and Description |
---|---|
protected |
Alarm(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Alarm(software.amazon.jsii.JsiiObjectRef objRef) |
|
Alarm(software.constructs.Construct scope,
java.lang.String id,
AlarmProps props) |
Modifier and Type | Method and Description |
---|---|
void |
addAlarmAction(IAlarmAction... actions)
Trigger this action if the alarm fires.
|
static IAlarm |
fromAlarmArn(software.constructs.Construct scope,
java.lang.String id,
java.lang.String alarmArn)
Import an existing CloudWatch alarm provided an ARN.
|
java.lang.String |
getAlarmArn()
ARN of this alarm.
|
java.lang.String |
getAlarmName()
Name of this alarm.
|
IMetric |
getMetric()
The metric object this alarm was based on.
|
HorizontalAnnotation |
toAnnotation()
Turn this alarm into a horizontal annotation.
|
addInsufficientDataAction, addOkAction, getAlarmActionArns, getInsufficientDataActionArns, getOkActionArns, renderAlarmRule, setAlarmActionArns, setInsufficientDataActionArns, setOkActionArns
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applyRemovalPolicy, getEnv, getStack
getNode
protected Alarm(software.amazon.jsii.JsiiObjectRef objRef)
protected Alarm(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public Alarm(software.constructs.Construct scope, java.lang.String id, AlarmProps props)
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.public static IAlarm fromAlarmArn(software.constructs.Construct scope, java.lang.String id, java.lang.String alarmArn)
scope
- The parent creating construct (usually `this`). This parameter is required.id
- The construct's name. This parameter is required.alarmArn
- Alarm ARN (i.e. arn:aws:cloudwatch:public void addAlarmAction(IAlarmAction... actions)
Typically the ARN of an SNS topic or ARN of an AutoScaling policy.
addAlarmAction
in class AlarmBase
actions
- This parameter is required.public HorizontalAnnotation toAnnotation()
This is useful if you want to represent an Alarm in a non-AlarmWidget.
An AlarmWidget
can directly show an alarm, but it can only show a
single alarm and no other metrics. Instead, you can convert the alarm to
a HorizontalAnnotation and add it as an annotation to another graph.
This might be useful if:
public java.lang.String getAlarmArn()
getAlarmArn
in interface IAlarm
getAlarmArn
in class AlarmBase
public java.lang.String getAlarmName()
getAlarmName
in interface IAlarm
getAlarmName
in class AlarmBase
public IMetric getMetric()