CfnAlertProps Struct Added in v2.277.0
Properties for defining a CfnAlert.
Example
ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_cloudwatch as cloudwatch } from 'aws-cdk-lib';
const cfnAlertProps: cloudwatch.CfnAlertProps = {
name: 'name',
profileId: 'profileId',
rule: {
telemetryRule: {
condition: {
comparator: 'comparator',
criticalThreshold: 123,
thresholdField: 'thresholdField',
thresholdMode: 'thresholdMode',
warningThreshold: 123,
},
evaluation: {
intervalSeconds: 123,
// the properties below are optional
pendingDurationSeconds: 123,
recoveryDurationSeconds: 123,
},
query: {
expression: 'expression',
language: 'language',
},
// the properties below are optional
noData: {
treatAs: 'treatAs',
},
},
},
spaceId: 'spaceId',
// the properties below are optional
description: 'description',
notificationRules: [{
target: {
arn: 'arn',
type: 'type',
// the properties below are optional
metadata: {
metadataKey: 'metadata',
},
},
trigger: {
stateValues: ['stateValues'],
},
}],
notificationsEnabled: false,
tags: [{
key: 'key',
value: 'value',
}],
};
python
from aws_cdk import CfnTag
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_cloudwatch as cloudwatch
cfn_alert_props = cloudwatch.CfnAlertProps(
name="name",
profile_id="profileId",
rule=cloudwatch.CfnAlert.RuleProperty(
telemetry_rule=cloudwatch.CfnAlert.TelemetryRuleProperty(
condition=cloudwatch.CfnAlert.ConditionProperty(
comparator="comparator",
critical_threshold=123,
threshold_field="thresholdField",
threshold_mode="thresholdMode",
warning_threshold=123
),
evaluation=cloudwatch.CfnAlert.EvaluationProperty(
interval_seconds=123,
# the properties below are optional
pending_duration_seconds=123,
recovery_duration_seconds=123
),
query=cloudwatch.CfnAlert.QueryProperty(
expression="expression",
language="language"
),
# the properties below are optional
no_data=cloudwatch.CfnAlert.NoDataProperty(
treat_as="treatAs"
)
)
),
space_id="spaceId",
# the properties below are optional
description="description",
notification_rules=[cloudwatch.CfnAlert.NotificationRuleProperty(
target=cloudwatch.CfnAlert.TargetProperty(
arn="arn",
type="type",
# the properties below are optional
metadata={
"metadata_key": "metadata"
}
),
trigger=cloudwatch.CfnAlert.TriggerProperty(
state_values=["stateValues"]
)
)],
notifications_enabled=False,
tags=[CfnTag(
key="key",
value="value"
)]
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.cloudwatch.*;
CfnAlertProps cfnAlertProps = CfnAlertProps.builder()
.name("name")
.profileId("profileId")
.rule(RuleProperty.builder()
.telemetryRule(TelemetryRuleProperty.builder()
.condition(ConditionProperty.builder()
.comparator("comparator")
.criticalThreshold(123)
.thresholdField("thresholdField")
.thresholdMode("thresholdMode")
.warningThreshold(123)
.build())
.evaluation(EvaluationProperty.builder()
.intervalSeconds(123)
// the properties below are optional
.pendingDurationSeconds(123)
.recoveryDurationSeconds(123)
.build())
.query(QueryProperty.builder()
.expression("expression")
.language("language")
.build())
// the properties below are optional
.noData(NoDataProperty.builder()
.treatAs("treatAs")
.build())
.build())
.build())
.spaceId("spaceId")
// the properties below are optional
.description("description")
.notificationRules(List.of(NotificationRuleProperty.builder()
.target(TargetProperty.builder()
.arn("arn")
.type("type")
// the properties below are optional
.metadata(Map.of(
"metadataKey", "metadata"))
.build())
.trigger(TriggerProperty.builder()
.stateValues(List.of("stateValues"))
.build())
.build()))
.notificationsEnabled(false)
.tags(List.of(CfnTag.builder()
.key("key")
.value("value")
.build()))
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.CloudWatch;
var cfnAlertProps = new CfnAlertProps {
Name = "name",
ProfileId = "profileId",
Rule = new RuleProperty {
TelemetryRule = new TelemetryRuleProperty {
Condition = new ConditionProperty {
Comparator = "comparator",
CriticalThreshold = 123,
ThresholdField = "thresholdField",
ThresholdMode = "thresholdMode",
WarningThreshold = 123
},
Evaluation = new EvaluationProperty {
IntervalSeconds = 123,
// the properties below are optional
PendingDurationSeconds = 123,
RecoveryDurationSeconds = 123
},
Query = new QueryProperty {
Expression = "expression",
Language = "language"
},
// the properties below are optional
NoData = new NoDataProperty {
TreatAs = "treatAs"
}
}
},
SpaceId = "spaceId",
// the properties below are optional
Description = "description",
NotificationRules = new [] { new NotificationRuleProperty {
Target = new TargetProperty {
Arn = "arn",
Type = "type",
// the properties below are optional
Metadata = new Dictionary<string, string> {
{ "metadataKey", "metadata" }
}
},
Trigger = new TriggerProperty {
StateValues = new [] { "stateValues" }
}
} },
NotificationsEnabled = false,
Tags = new [] { new CfnTag {
Key = "key",
Value = "value"
} }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
cfnAlertProps := &CfnAlertProps{
Name: jsii.String("name"),
ProfileId: jsii.String("profileId"),
Rule: &RuleProperty{
TelemetryRule: &TelemetryRuleProperty{
Condition: &ConditionProperty{
Comparator: jsii.String("comparator"),
CriticalThreshold: jsii.Number(123),
ThresholdField: jsii.String("thresholdField"),
ThresholdMode: jsii.String("thresholdMode"),
WarningThreshold: jsii.Number(123),
},
Evaluation: &EvaluationProperty{
IntervalSeconds: jsii.Number(123),
// the properties below are optional
PendingDurationSeconds: jsii.Number(123),
RecoveryDurationSeconds: jsii.Number(123),
},
Query: &QueryProperty{
Expression: jsii.String("expression"),
Language: jsii.String("language"),
},
// the properties below are optional
NoData: &NoDataProperty{
TreatAs: jsii.String("treatAs"),
},
},
},
SpaceId: jsii.String("spaceId"),
// the properties below are optional
Description: jsii.String("description"),
NotificationRules: []interface{}{
&NotificationRuleProperty{
Target: &TargetProperty{
Arn: jsii.String("arn"),
Type: jsii.String("type"),
// the properties below are optional
Metadata: map[string]*string{
"metadataKey": jsii.String("metadata"),
},
},
Trigger: &TriggerProperty{
StateValues: []*string{
jsii.String("stateValues"),
},
},
},
},
NotificationsEnabled: jsii.Boolean(false),
Tags: []CfnTag{
&CfnTag{
Key: jsii.String("key"),
Value: jsii.String("value"),
},
},
}
Properties
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string#A description of the alert.
The display name of the alert.
Names don't need to be unique within a space; the alert is identified by AlertId.
notificationRulesoptionalIResolvable | IResolvable | CfnAlert.NotificationRuleProperty[]notification_rulesoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, NotificationRuleProperty]]]notificationRulesoptionalIResolvableNotificationRulesoptionalIResolvableNotificationRulesoptionalinterface{}#The notification rules that determine when and where notifications are sent.
notificationsEnabledoptionalboolean | IResolvablenotifications_enabledoptionaltyping.Union[bool, IResolvable]notificationsEnabledoptionalBooleanNotificationsEnabledoptionalboolNotificationsEnabledoptionalinterface{}#Whether the alert sends notifications.
When false, the alert is still evaluated and records its state, but sends nothing. Defaults to true.
The ID of the access profile the alert uses to run its query and send notifications.
ruleIResolvable | CfnAlert.RulePropertyruletyping.Union[IResolvable, RuleProperty]ruleIResolvableRuleIResolvableRuleinterface{}required#The rule that defines how the alert is evaluated.
The ID of the space to create the alert in.
Changing this value replaces the alert.