Interface MetricProps
- All Superinterfaces:
CommonMetricOptions,software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
MetricProps.Jsii$Proxy
@Generated(value="jsii-pacmak/1.104.0 (build e79254c)",
date="2024-11-21T06:34:04.954Z")
@Stability(Stable)
public interface MetricProps
extends software.amazon.jsii.JsiiSerializable, CommonMetricOptions
Properties for a metric.
Example:
import software.amazon.awscdk.services.cloudwatch.*;
Metric metric = Metric.Builder.create()
.namespace("MyNamespace")
.metricName("MyMetric")
.dimensionsMap(Map.of("MyDimension", "MyDimensionValue"))
.build();
Alarm alarm = Alarm.Builder.create(this, "MyAlarm")
.metric(metric)
.threshold(100)
.evaluationPeriods(3)
.datapointsToAlarm(2)
.build();
TopicRule topicRule = TopicRule.Builder.create(this, "TopicRule")
.sql(IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id FROM 'device/+/data'"))
.actions(List.of(
CloudWatchSetAlarmStateAction.Builder.create(alarm)
.reason("AWS Iot Rule action is triggered")
.alarmStateToSet(AlarmState.ALARM)
.build()))
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forMetricPropsstatic final classAn implementation forMetricProps -
Method Summary
Modifier and TypeMethodDescriptionstatic MetricProps.Builderbuilder()Name of the metric.Namespace of the metric.Methods inherited from interface software.amazon.awscdk.services.cloudwatch.CommonMetricOptions
getAccount, getColor, getDimensionsMap, getLabel, getPeriod, getRegion, getStatistic, getUnitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getMetricName
Name of the metric. -
getNamespace
Namespace of the metric. -
builder
- Returns:
- a
MetricProps.BuilderofMetricProps
-