Class Schedule
Schedule for EventBridge Scheduler.
Namespace: Amazon.CDK.AWS.StepFunctions.Tasks
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class Schedule : DeputyBase
Syntax (vb)
Public Class Schedule Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.Scheduler;
using Amazon.CDK.AWS.KMS;
Key key;
CfnScheduleGroup scheduleGroup;
Queue targetQueue;
Queue deadLetterQueue;
var schedulerRole = new Role(this, "SchedulerRole", new RoleProps {
AssumedBy = new ServicePrincipal("scheduler.amazonaws.com")
});
// To send the message to the queue
// This policy changes depending on the type of target.
schedulerRole.AddToPrincipalPolicy(new PolicyStatement(new PolicyStatementProps {
Actions = new [] { "sqs:SendMessage" },
Resources = new [] { targetQueue.QueueArn }
}));
var createScheduleTask1 = new EventBridgeSchedulerCreateScheduleTask(this, "createSchedule", new EventBridgeSchedulerCreateScheduleTaskProps {
ScheduleName = "TestSchedule",
ActionAfterCompletion = ActionAfterCompletion.NONE,
ClientToken = "testToken",
Description = "TestDescription",
StartDate = new Date(),
EndDate = new Date(new Date().GetTime() + 1000 * 60 * 60),
FlexibleTimeWindow = Duration.Minutes(5),
GroupName = scheduleGroup.Ref,
KmsKey = key,
Schedule = Schedule.Rate(Duration.Minutes(5)),
Timezone = "UTC",
Enabled = true,
Target = new EventBridgeSchedulerTarget(new EventBridgeSchedulerTargetProps {
Arn = targetQueue.QueueArn,
Role = schedulerRole,
RetryPolicy = new RetryPolicy {
MaximumRetryAttempts = 2,
MaximumEventAge = Duration.Minutes(5)
},
DeadLetterQueue = deadLetterQueue
})
});
Synopsis
Properties
| ExpressionString | The Schedule expression. |
Methods
| Cron(ICronOptions) | Create a cron-based schedule from a set of cron fields. |
| OneTime(DateTime) | Construct a one-time schedule from a Date. |
| Rate(Duration) | Construct a rate-based schedule from an interval. |
Properties
ExpressionString
The Schedule expression.
public virtual string ExpressionString { get; }
Property Value
Remarks
ExampleMetadata: infused
Methods
Cron(ICronOptions)
Create a cron-based schedule from a set of cron fields.
public static Schedule Cron(ICronOptions options)
Parameters
- options ICronOptions
Returns
Remarks
ExampleMetadata: infused
OneTime(DateTime)
Construct a one-time schedule from a Date.
public static Schedule OneTime(DateTime time)
Parameters
- time DateTime
Returns
Remarks
ExampleMetadata: infused