@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:37.209Z") @Stability(value=Stable) 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. |
software.amazon.jsii.JsiiObject.InitializationModeIAlarm.Jsii$Default| Modifier | Constructor and Description |
|---|---|
|
Alarm(software.constructs.Construct scope,
String id,
AlarmProps props) |
protected |
Alarm(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Alarm(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAlarmAction(IAlarmAction... actions)
Trigger this action if the alarm fires.
|
static IAlarm |
fromAlarmArn(software.constructs.Construct scope,
String id,
String alarmArn)
Import an existing CloudWatch alarm provided an ARN.
|
String |
getAlarmArn()
ARN of this alarm.
|
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, setOkActionArnsapplyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourcejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitapplyRemovalPolicy, getEnv, getStackprotected Alarm(software.amazon.jsii.JsiiObjectRef objRef)
protected Alarm(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public Alarm(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
AlarmProps props)
scope - This parameter is required.id - This parameter is required.props - This parameter is required.@Stability(value=Stable) @NotNull public static IAlarm fromAlarmArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull 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:@Stability(value=Stable)
public void addAlarmAction(@NotNull
IAlarmAction... actions)
Typically the ARN of an SNS topic or ARN of an AutoScaling policy.
addAlarmAction in class AlarmBaseactions - This parameter is required.@Stability(value=Stable) @NotNull 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:
@Stability(value=Stable) @NotNull public String getAlarmArn()
getAlarmArn in interface IAlarmgetAlarmArn in class AlarmBase@Stability(value=Stable) @NotNull public String getAlarmName()
getAlarmName in interface IAlarmgetAlarmName in class AlarmBase@Stability(value=Stable) @NotNull public IMetric getMetric()
Copyright © 2022. All rights reserved.