AlarmWidget Class
Display the metric associated with an alarm, including the alarm line.
Example
ts
declare const dashboard: cloudwatch.Dashboard;
declare const errorAlarm: cloudwatch.Alarm;
dashboard.addWidgets(new cloudwatch.AlarmWidget({
title: "Errors",
alarm: errorAlarm,
}));
python
# dashboard: cloudwatch.Dashboard
# error_alarm: cloudwatch.Alarm
dashboard.add_widgets(cloudwatch.AlarmWidget(
title="Errors",
alarm=error_alarm
))
java
Dashboard dashboard;
Alarm errorAlarm;
dashboard.addWidgets(AlarmWidget.Builder.create()
.title("Errors")
.alarm(errorAlarm)
.build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
Dashboard dashboard;
Alarm errorAlarm;
dashboard.AddWidgets(new AlarmWidget(new AlarmWidgetProps {
Title = "Errors",
Alarm = errorAlarm
}));
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var dashboard Dashboard
var errorAlarm Alarm
dashboard.AddWidgets(cloudwatch.NewAlarmWidget(&AlarmWidgetProps{
Title: jsii.String("Errors"),
Alarm: errorAlarm,
}))
Initializer
ts
new AlarmWidget(props: AlarmWidgetProps)
python
AlarmWidget(props: AlarmWidgetProps)
java
new AlarmWidget(AlarmWidgetProps props)
csharp
new AlarmWidget(AlarmWidgetProps props)
go
NewAlarmWidget(Props AlarmWidgetProps)
Properties
The amount of vertical grid units the widget will take up.
warningsmay be undefinedstring[]warningsmay be undefinedtyping.List[str]warningsmay be undefinedList<String>Warningsmay be undefinedstring[]Warningsmay be undefined*[]*string#Any warnings that are produced as a result of putting together this widget.
warningsV2may be undefined{ [key: string]: string }warnings_v2may be undefinedtyping.Mapping[str, str]warningsV2may be undefinedMap<String, String>WarningsV2may be undefinedIDictionary<string, string>WarningsV2may be undefined*map[string]*string#Any warnings that are produced as a result of putting together this widget.
The amount of horizontal grid units the widget will take up.
Methods
position(x: number, y: number): voiddef position(self, x: int | float, y: int | float) -> Nonepublic void position(Number x, Number y)public void Position(double x, double y)func Position(X *float64, Y *float64)#Place the widget at a given position.
toJson(): any[]def to_json(self, ) -> typing.List[Any]public List<Object> toJson()public object[] ToJson()func ToJson() *[]interface{}#Return the widget JSON for use in the dashboard.