Class ScheduleExpression

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.cloudwatch.ScheduleExpression
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.138.0 (build 0ca7ee8)", date="2026-08-10T14:50:59.415Z") @Stability(Stable) public abstract class ScheduleExpression extends software.amazon.jsii.JsiiObject
Schedule expression for CloudWatch alarm mute rule.

You can choose from three schedule types when configuring your schedule: cron-based and one-time schedules. Cron-based schedule is recurring schedule.

Example:

 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);
 

See Also:
  • Constructor Details

    • ScheduleExpression

      protected ScheduleExpression(software.amazon.jsii.JsiiObjectRef objRef)
    • ScheduleExpression

      protected ScheduleExpression(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • ScheduleExpression

      @Stability(Stable) protected ScheduleExpression()
  • Method Details

    • at

      @Stability(Stable) @NotNull public static ScheduleExpression at(@NotNull CalendarDateTime date, @Nullable TimeZone timeZone)
      Construct a one-time schedule from a date.

      Parameters:
      date - The date and time to use. This parameter is required.
      timeZone - The time zone to use for interpreting the date.
    • at

      @Stability(Stable) @NotNull public static ScheduleExpression at(@NotNull CalendarDateTime date)
      Construct a one-time schedule from a date.

      Parameters:
      date - The date and time to use. This parameter is required.
    • cron

      @Stability(Stable) @NotNull public static ScheduleExpression cron(@NotNull CronOptions options)
      Create a recurring schedule from a set of cron fields and time zone.

      Parameters:
      options - This parameter is required.
    • expression

      @Stability(Stable) @NotNull public static ScheduleExpression expression(@NotNull String expression, @Nullable TimeZone timeZone)
      Construct a schedule from a literal schedule expression.

      Parameters:
      expression - The expression to use. This parameter is required.
      timeZone - The time zone to use for interpreting the expression.
    • expression

      @Stability(Stable) @NotNull public static ScheduleExpression expression(@NotNull String expression)
      Construct a schedule from a literal schedule expression.

      Parameters:
      expression - The expression to use. This parameter is required.
    • getExpressionString

      @Stability(Stable) @NotNull public abstract String getExpressionString()
      Retrieve the expression for this schedule.
    • getTimeZone

      @Stability(Stable) @Nullable public abstract TimeZone getTimeZone()
      Retrieve the expression for this schedule.