Skip to content
v2.277.0

RuleProperty Struct Added in v2.277.0 ​

The rule that defines how the alert is evaluated.

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 ruleProperty: cloudwatch.CfnAlert.RuleProperty = {
  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',
    },
  },
};
python
# 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

rule_property = 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"
        )
    )
)
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.*;

RuleProperty ruleProperty = 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();
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 ruleProperty = 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"
        }
    }
};
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"

ruleProperty := &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"),
		},
	},
}

Properties ​

telemetryRuleIResolvable | CfnAlert.TelemetryRulePropertytelemetry_ruletyping.Union[IResolvable, TelemetryRuleProperty]telemetryRuleIResolvableTelemetryRuleIResolvableTelemetryRuleinterface{}required#
A rule that queries telemetry, evaluates the result against a condition, and sets how missing data is handled.