Schedule Class
Schedule for scheduled event rules.
Note that rates cannot be defined in fractions of minutes.
Example
ts
import * as redshiftserverless from 'aws-cdk-lib/aws-redshiftserverless'
declare const workgroup: redshiftserverless.CfnWorkgroup;
const rule = new events.Rule(this, 'Rule', {
schedule: events.Schedule.rate(cdk.Duration.hours(1)),
});
const dlq = new sqs.Queue(this, 'DeadLetterQueue');
rule.addTarget(new targets.RedshiftQuery(workgroup.attrWorkgroupWorkgroupArn, {
database: 'dev',
deadLetterQueue: dlq,
sql: ['SELECT * FROM foo','SELECT * FROM baz'],
}));
Initializer
ts
new Schedule()
python
Schedule()
java
new Schedule()
csharp
new Schedule()
go
NewSchedule()
Properties
expressionStringstringexpression_stringstrexpressionStringStringExpressionStringstringExpressionString*stringrequired#Retrieve the expression for this schedule.
Methods
cron(options: CronOptions): Schedule // chainable@staticmethod def cron(options: CronOptions) -> Schedulepublic static Schedule cron(CronOptions options)public static Schedule Cron(CronOptions options)func Cron(Options CronOptions) Schedulestatic#Create a schedule from a set of cron fields.
expression(expression: string): Schedule // chainable@staticmethod def expression(expression: str) -> Schedulepublic static Schedule expression(String expression)public static Schedule Expression(string expression)func Expression(Expression *string) Schedulestatic#Construct a schedule from a literal schedule expression.
1 parameter
Parameters
expressionexpressionexpressionexpressionExpression— The expression to use.
rate(duration: Duration): Schedule // chainable@staticmethod def rate(duration: Duration) -> Schedulepublic static Schedule rate(Duration duration)public static Schedule Rate(Duration duration)func Rate(Duration Duration) Schedulestatic#Construct a schedule from an interval and a time unit.
Rates may be defined with any unit of time, but when converted into minutes, the duration must be a positive whole number of minutes.