UNPKG

1.96 kBTypeScriptView Raw
1import { Duration } from '@aws-cdk/core';
2import { Construct } from '@aws-cdk/core';
3/**
4 * Schedule for scheduled event rules
5 */
6export declare abstract class Schedule {
7 /**
8 * Construct a schedule from a literal schedule expression
9 *
10 * @param expression The expression to use. Must be in a format that EventBridge will recognize
11 */
12 static expression(expression: string): Schedule;
13 /**
14 * Construct a schedule from an interval and a time unit
15 */
16 static rate(duration: Duration): Schedule;
17 /**
18 * Create a schedule from a set of cron fields
19 */
20 static cron(options: CronOptions): Schedule;
21 /**
22 * Retrieve the expression for this schedule
23 */
24 abstract readonly expressionString: string;
25 protected constructor();
26 /**
27 *
28 * @internal
29 */
30 abstract _bind(scope: Construct): void;
31}
32/**
33 * Options to configure a cron expression
34 *
35 * All fields are strings so you can use complex expressions. Absence of
36 * a field implies '*' or '?', whichever one is appropriate.
37 *
38 * @see https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions
39 */
40export interface CronOptions {
41 /**
42 * The minute to run this rule at
43 *
44 * @default - Every minute
45 */
46 readonly minute?: string;
47 /**
48 * The hour to run this rule at
49 *
50 * @default - Every hour
51 */
52 readonly hour?: string;
53 /**
54 * The day of the month to run this rule at
55 *
56 * @default - Every day of the month
57 */
58 readonly day?: string;
59 /**
60 * The month to run this rule at
61 *
62 * @default - Every month
63 */
64 readonly month?: string;
65 /**
66 * The year to run this rule at
67 *
68 * @default - Every year
69 */
70 readonly year?: string;
71 /**
72 * The day of the week to run this rule at
73 *
74 * @default - Any day of the week
75 */
76 readonly weekDay?: string;
77}