Class CfnSchedule

java.lang.Object
software.amazon.jsii.JsiiObject
All Implemented Interfaces:
IConstruct, IDependable, IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:35.716Z") @Stability(Stable) public class CfnSchedule extends CfnResource implements IInspectable
A CloudFormation AWS::Scheduler::Schedule.

A schedule is the main resource you create, configure, and manage using Amazon EventBridge Scheduler.

Every schedule has a schedule expression that determines when, and with what frequency, the schedule runs. EventBridge Scheduler supports three types of schedules: rate, cron, and one-time schedules. For more information about different schedule types, see Schedule types in the EventBridge Scheduler User Guide .

When you create a schedule, you configure a target for the schedule to invoke. A target is an API operation that EventBridge Scheduler calls on your behalf every time your schedule runs. EventBridge Scheduler supports two types of targets: templated targets invoke common API operations across a core groups of services, and customizeable universal targets that you can use to call more than 6,000 operations across over 270 services. For more information about configuring targets, see Managing targets in the EventBridge Scheduler User Guide .

For more information about managing schedules, changing the schedule state, setting up flexible time windows, and configuring a dead-letter queue for a schedule, see Managing a schedule in the EventBridge Scheduler User Guide .

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.scheduler.*;
 Object tags;
 CfnSchedule cfnSchedule = CfnSchedule.Builder.create(this, "MyCfnSchedule")
         .flexibleTimeWindow(FlexibleTimeWindowProperty.builder()
                 .mode("mode")
                 // the properties below are optional
                 .maximumWindowInMinutes(123)
                 .build())
         .scheduleExpression("scheduleExpression")
         .target(TargetProperty.builder()
                 .arn("arn")
                 .roleArn("roleArn")
                 // the properties below are optional
                 .deadLetterConfig(DeadLetterConfigProperty.builder()
                         .arn("arn")
                         .build())
                 .ecsParameters(EcsParametersProperty.builder()
                         .taskDefinitionArn("taskDefinitionArn")
                         // the properties below are optional
                         .capacityProviderStrategy(List.of(CapacityProviderStrategyItemProperty.builder()
                                 .capacityProvider("capacityProvider")
                                 // the properties below are optional
                                 .base(123)
                                 .weight(123)
                                 .build()))
                         .enableEcsManagedTags(false)
                         .enableExecuteCommand(false)
                         .group("group")
                         .launchType("launchType")
                         .networkConfiguration(NetworkConfigurationProperty.builder()
                                 .awsvpcConfiguration(AwsVpcConfigurationProperty.builder()
                                         .subnets(List.of("subnets"))
                                         // the properties below are optional
                                         .assignPublicIp("assignPublicIp")
                                         .securityGroups(List.of("securityGroups"))
                                         .build())
                                 .build())
                         .placementConstraints(List.of(PlacementConstraintProperty.builder()
                                 .expression("expression")
                                 .type("type")
                                 .build()))
                         .placementStrategy(List.of(PlacementStrategyProperty.builder()
                                 .field("field")
                                 .type("type")
                                 .build()))
                         .platformVersion("platformVersion")
                         .propagateTags("propagateTags")
                         .referenceId("referenceId")
                         .tags(tags)
                         .taskCount(123)
                         .build())
                 .eventBridgeParameters(EventBridgeParametersProperty.builder()
                         .detailType("detailType")
                         .source("source")
                         .build())
                 .input("input")
                 .kinesisParameters(KinesisParametersProperty.builder()
                         .partitionKey("partitionKey")
                         .build())
                 .retryPolicy(RetryPolicyProperty.builder()
                         .maximumEventAgeInSeconds(123)
                         .maximumRetryAttempts(123)
                         .build())
                 .sageMakerPipelineParameters(SageMakerPipelineParametersProperty.builder()
                         .pipelineParameterList(List.of(SageMakerPipelineParameterProperty.builder()
                                 .name("name")
                                 .value("value")
                                 .build()))
                         .build())
                 .sqsParameters(SqsParametersProperty.builder()
                         .messageGroupId("messageGroupId")
                         .build())
                 .build())
         // the properties below are optional
         .description("description")
         .endDate("endDate")
         .groupName("groupName")
         .kmsKeyArn("kmsKeyArn")
         .name("name")
         .scheduleExpressionTimezone("scheduleExpressionTimezone")
         .startDate("startDate")
         .state("state")
         .build();
 
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnSchedule

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

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

      @Stability(Stable) public CfnSchedule(@NotNull Construct scope, @NotNull String id, @NotNull CfnScheduleProps props)
      Create a new AWS::Scheduler::Schedule.

      Parameters:
      scope -
      • scope in which this resource is defined.
      This parameter is required.
      id -
      • scoped id of the resource.
      This parameter is required.
      props -
      • resource properties.
      This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector -
      • tree inspector to collect and process attributes.
      This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrArn

      @Stability(Stable) @NotNull public String getAttrArn()
      The Amazon Resource Name (ARN) for the Amazon EventBridge Scheduler schedule.
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getFlexibleTimeWindow

      @Stability(Stable) @NotNull public Object getFlexibleTimeWindow()
      Allows you to configure a time window during which EventBridge Scheduler invokes the schedule.
    • setFlexibleTimeWindow

      @Stability(Stable) public void setFlexibleTimeWindow(@NotNull CfnSchedule.FlexibleTimeWindowProperty value)
      Allows you to configure a time window during which EventBridge Scheduler invokes the schedule.
    • setFlexibleTimeWindow

      @Stability(Stable) public void setFlexibleTimeWindow(@NotNull IResolvable value)
      Allows you to configure a time window during which EventBridge Scheduler invokes the schedule.
    • getScheduleExpression

      @Stability(Stable) @NotNull public String getScheduleExpression()
      The expression that defines when the schedule runs. The following formats are supported.

      • at expression - at(yyyy-mm-ddThh:mm:ss)
      • rate expression - rate(value unit)
      • cron expression - cron(fields)

      You can use at expressions to create one-time schedules that invoke a target once, at the time and in the time zone, that you specify. You can use rate and cron expressions to create recurring schedules. Rate-based schedules are useful when you want to invoke a target at regular intervals, such as every 15 minutes or every five days. Cron-based schedules are useful when you want to invoke a target periodically at a specific time, such as at 8:00 am (UTC+0) every 1st day of the month.

      A cron expression consists of six fields separated by white spaces: (minutes hours day_of_month month day_of_week year) .

      A rate expression consists of a value as a positive integer, and a unit with the following options: minute | minutes | hour | hours | day | days

      For more information and examples, see Schedule types on EventBridge Scheduler in the EventBridge Scheduler User Guide .

    • setScheduleExpression

      @Stability(Stable) public void setScheduleExpression(@NotNull String value)
      The expression that defines when the schedule runs. The following formats are supported.

      • at expression - at(yyyy-mm-ddThh:mm:ss)
      • rate expression - rate(value unit)
      • cron expression - cron(fields)

      You can use at expressions to create one-time schedules that invoke a target once, at the time and in the time zone, that you specify. You can use rate and cron expressions to create recurring schedules. Rate-based schedules are useful when you want to invoke a target at regular intervals, such as every 15 minutes or every five days. Cron-based schedules are useful when you want to invoke a target periodically at a specific time, such as at 8:00 am (UTC+0) every 1st day of the month.

      A cron expression consists of six fields separated by white spaces: (minutes hours day_of_month month day_of_week year) .

      A rate expression consists of a value as a positive integer, and a unit with the following options: minute | minutes | hour | hours | day | days

      For more information and examples, see Schedule types on EventBridge Scheduler in the EventBridge Scheduler User Guide .

    • getTarget

      @Stability(Stable) @NotNull public Object getTarget()
      The schedule's target details.
    • setTarget

      @Stability(Stable) public void setTarget(@NotNull IResolvable value)
      The schedule's target details.
    • setTarget

      @Stability(Stable) public void setTarget(@NotNull CfnSchedule.TargetProperty value)
      The schedule's target details.
    • getDescription

      @Stability(Stable) @Nullable public String getDescription()
      The description you specify for the schedule.
    • setDescription

      @Stability(Stable) public void setDescription(@Nullable String value)
      The description you specify for the schedule.
    • getEndDate

      @Stability(Stable) @Nullable public String getEndDate()
      The date, in UTC, before which the schedule can invoke its target.

      Depending on the schedule's recurrence expression, invocations might stop on, or before, the EndDate you specify. EventBridge Scheduler ignores EndDate for one-time schedules.

    • setEndDate

      @Stability(Stable) public void setEndDate(@Nullable String value)
      The date, in UTC, before which the schedule can invoke its target.

      Depending on the schedule's recurrence expression, invocations might stop on, or before, the EndDate you specify. EventBridge Scheduler ignores EndDate for one-time schedules.

    • getGroupName

      @Stability(Stable) @Nullable public String getGroupName()
      The name of the schedule group associated with this schedule.
    • setGroupName

      @Stability(Stable) public void setGroupName(@Nullable String value)
      The name of the schedule group associated with this schedule.
    • getKmsKeyArn

      @Stability(Stable) @Nullable public String getKmsKeyArn()
      The Amazon Resource Name (ARN) for the customer managed KMS key that EventBridge Scheduler will use to encrypt and decrypt your data.
    • setKmsKeyArn

      @Stability(Stable) public void setKmsKeyArn(@Nullable String value)
      The Amazon Resource Name (ARN) for the customer managed KMS key that EventBridge Scheduler will use to encrypt and decrypt your data.
    • getName

      @Stability(Stable) @Nullable public String getName()
      The name of the schedule.
    • setName

      @Stability(Stable) public void setName(@Nullable String value)
      The name of the schedule.
    • getScheduleExpressionTimezone

      @Stability(Stable) @Nullable public String getScheduleExpressionTimezone()
      The timezone in which the scheduling expression is evaluated.
    • setScheduleExpressionTimezone

      @Stability(Stable) public void setScheduleExpressionTimezone(@Nullable String value)
      The timezone in which the scheduling expression is evaluated.
    • getStartDate

      @Stability(Stable) @Nullable public String getStartDate()
      The date, in UTC, after which the schedule can begin invoking its target.

      Depending on the schedule's recurrence expression, invocations might occur on, or after, the StartDate you specify. EventBridge Scheduler ignores StartDate for one-time schedules.

    • setStartDate

      @Stability(Stable) public void setStartDate(@Nullable String value)
      The date, in UTC, after which the schedule can begin invoking its target.

      Depending on the schedule's recurrence expression, invocations might occur on, or after, the StartDate you specify. EventBridge Scheduler ignores StartDate for one-time schedules.

    • getState

      @Stability(Stable) @Nullable public String getState()
      Specifies whether the schedule is enabled or disabled.

      Allowed Values : ENABLED | DISABLED

    • setState

      @Stability(Stable) public void setState(@Nullable String value)
      Specifies whether the schedule is enabled or disabled.

      Allowed Values : ENABLED | DISABLED