CronOptions Struct
Options to configure a cron expression.
All fields are strings so you can use complex expressions. Absence of a field implies '*'.
| Source | aws-cloudwatch/lib/alarm-mute-rule.ts |
|---|---|
| Type last changed |
Example
ts
declare const alarm1: cloudwatch.Alarm;
declare const alarm2: cloudwatch.Alarm;
const alarmMuteRule = new cloudwatch.AlarmMuteRule(this, 'AlarmMuteRule', {
alarms: [alarm1],
// Defines the mute period begins at 0:00 everyday in UTC
schedule: cloudwatch.ScheduleExpression.cron({ minute: '0', hour: '0' }),
// Specifies the mute rule lasts 1 hour.
duration: Duration.hours(1),
})
// The mute target can be added after construction.
alarmMuteRule.addAlarm(alarm2);
python
# alarm1: cloudwatch.Alarm
# alarm2: cloudwatch.Alarm
alarm_mute_rule = cloudwatch.AlarmMuteRule(self, "AlarmMuteRule",
alarms=[alarm1],
# Defines the mute period begins at 0:00 everyday in UTC
schedule=cloudwatch.ScheduleExpression.cron(minute="0", hour="0"),
# Specifies the mute rule lasts 1 hour.
duration=Duration.hours(1)
)
# The mute target can be added after construction.
alarm_mute_rule.add_alarm(alarm2)
java
Alarm alarm1;
Alarm alarm2;
AlarmMuteRule alarmMuteRule = AlarmMuteRule.Builder.create(this, "AlarmMuteRule")
.alarms(List.of(alarm1))
// Defines the mute period begins at 0:00 everyday in UTC
.schedule(ScheduleExpression.cron(CronOptions.builder().minute("0").hour("0").build()))
// Specifies the mute rule lasts 1 hour.
.duration(Duration.hours(1))
.build();
// The mute target can be added after construction.
alarmMuteRule.addAlarm(alarm2);
csharp
// Install: dotnet add package Amazon.CDK.Lib
Alarm alarm1;
Alarm alarm2;
var alarmMuteRule = new AlarmMuteRule(this, "AlarmMuteRule", new AlarmMuteRuleProps {
Alarms = new [] { alarm1 },
// Defines the mute period begins at 0:00 everyday in UTC
Schedule = ScheduleExpression.Cron(new CronOptions { Minute = "0", Hour = "0" }),
// Specifies the mute rule lasts 1 hour.
Duration = Duration.Hours(1)
});
// The mute target can be added after construction.
alarmMuteRule.AddAlarm(alarm2);
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var alarm1 Alarm
var alarm2 Alarm
alarmMuteRule := cloudwatch.NewAlarmMuteRule(this, jsii.String("AlarmMuteRule"), &AlarmMuteRuleProps{
Alarms: []IAlarmRef{
alarm1,
},
// Defines the mute period begins at 0:00 everyday in UTC
Schedule: cloudwatch.ScheduleExpression_Cron(&CronOptions{
Minute: jsii.String("0"),
Hour: jsii.String("0"),
}),
// Specifies the mute rule lasts 1 hour.
Duration: awscdk.Duration_Hours(jsii.Number(1)),
})
// The mute target can be added after construction.
alarmMuteRule.AddAlarm(alarm2)
Properties
The day of the month to run this rule at.
Default: Every day of the month
The hour to run this rule at.
Default: Every hour
The minute to run this rule at.
The month to run this rule at.
Default: Every month
timeZoneoptionalTimeZonetime_zoneoptionalTimeZonetimeZoneoptionalTimeZoneTimeZoneoptionalTimeZoneTimeZoneoptionalTimeZone = TimeZone.ETC_UTC #The timezone to run the schedule in.
weekDayoptionalstringweek_dayoptionalstrweekDayoptionalStringWeekDayoptionalstringWeekDayoptional*string #The day of the week to run this rule at.
Default: Any day of the week