class Schedule (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Scheduler.Alpha.Schedule |
Go | github.com/aws/aws-cdk-go/awscdkscheduleralpha/v2#Schedule |
Java | software.amazon.awscdk.services.scheduler.alpha.Schedule |
Python | aws_cdk.aws_scheduler_alpha.Schedule |
TypeScript (source) | @aws-cdk/aws-scheduler-alpha ยป Schedule |
Implements
IConstruct
, IDependable
, IResource
, ISchedule
An EventBridge Schedule.
Example
import * as firehose from '@aws-cdk/aws-kinesisfirehose-alpha';
declare const deliveryStream: firehose.IDeliveryStream;
const payload = {
Data: "record",
};
new Schedule(this, 'Schedule', {
schedule: ScheduleExpression.rate(Duration.minutes(60)),
target: new targets.KinesisDataFirehosePutRecord(deliveryStream, {
input: ScheduleTargetInput.fromObject(payload),
}),
});
Initializer
new Schedule(scope: Construct, id: string, props: ScheduleProps)
Parameters
- scope
Construct
- id
string
- props
Schedule
Props
Construct Props
Name | Type | Description |
---|---|---|
schedule | Schedule | The expression that defines when the schedule runs. |
target | ISchedule | The schedule's target details. |
description? | string | The description you specify for the schedule. |
enabled? | boolean | Indicates whether the schedule is enabled. |
end? | date | The date, in UTC, before which the schedule can invoke its target. |
group? | IGroup | The schedule's group. |
key? | IKey | The customer managed KMS key that EventBridge Scheduler will use to encrypt and decrypt your data. |
schedule | string | The name of the schedule. |
start? | date | The date, in UTC, after which the schedule can begin invoking its target. |
time | Time | A time window during which EventBridge Scheduler invokes the schedule. |
schedule
Type:
Schedule
The expression that defines when the schedule runs.
Can be either a at
, rate
or cron
expression.
target
Type:
ISchedule
The schedule's target details.
description?
Type:
string
(optional, default: no value)
The description you specify for the schedule.
enabled?
Type:
boolean
(optional, default: true)
Indicates whether the schedule is enabled.
end?
Type:
date
(optional, default: no value)
The date, in UTC, before which the schedule can invoke its target.
EventBridge Scheduler ignores end for one-time schedules.
group?
Type:
IGroup
(optional, default: By default a schedule will be associated with the default
group.)
The schedule's group.
key?
Type:
IKey
(optional, default: All events in Scheduler are encrypted with a key that AWS owns and manages.)
The customer managed KMS key that EventBridge Scheduler will use to encrypt and decrypt your data.
scheduleName?
Type:
string
(optional, default: A unique name will be generated)
The name of the schedule.
Up to 64 letters (uppercase and lowercase), numbers, hyphens, underscores and dots are allowed.
start?
Type:
date
(optional, default: no value)
The date, in UTC, after which the schedule can begin invoking its target.
EventBridge Scheduler ignores start for one-time schedules.
timeWindow?
Type:
Time
(optional, default: TimeWindow.off())
A time window during which EventBridge Scheduler invokes the schedule.
Properties
Name | Type | Description |
---|---|---|
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
schedule | string | The arn of the schedule. |
schedule | string | The name of the schedule. |
stack | Stack | The stack in which this resource is defined. |
group? | IGroup | The schedule group associated with this schedule. |
key? | IKey | The customer managed KMS key that EventBridge Scheduler will use to encrypt and decrypt your data. |
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
node
Type:
Node
The tree node.
scheduleArn
Type:
string
The arn of the schedule.
scheduleName
Type:
string
The name of the schedule.
stack
Type:
Stack
The stack in which this resource is defined.
group?
Type:
IGroup
(optional)
The schedule group associated with this schedule.
key?
Type:
IKey
(optional)
The customer managed KMS key that EventBridge Scheduler will use to encrypt and decrypt your data.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static metric | Return the given named metric for all schedules. |
static metric | Metric for all invocation attempts across all schedules. |
static metric | Metric for dropped invocations when EventBridge Scheduler stops attempting to invoke the target after a schedule's retry policy has been exhausted. |
static metric | Emitted when the target returns an exception after EventBridge Scheduler calls the target API across all schedules. |
static metric | Metric for failed invocations that also failed to deliver to DLQ across all schedules. |
static metric | Metric for invocations delivered to the DLQ across all schedules. |
static metric | Metric for delivery of failed invocations to DLQ when the payload of the event sent to the DLQ exceeds the maximum size allowed by Amazon SQS. |
static metric | Metric for invocation failures due to API throttling by the target across all schedules. |
static metric | Metric for the number of invocations that were throttled across all schedules. |
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
All(metricName, props?)
static metricpublic static metricAll(metricName: string, props?: MetricOptions): Metric
Parameters
- metricName
string
- props
Metric
Options
Returns
Return the given named metric for all schedules.
AllAttempts(props?)
static metricpublic static metricAllAttempts(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for all invocation attempts across all schedules.
AllDropped(props?)
static metricpublic static metricAllDropped(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for dropped invocations when EventBridge Scheduler stops attempting to invoke the target after a schedule's retry policy has been exhausted.
Metric is calculated for all schedules.
AllErrors(props?)
static metricpublic static metricAllErrors(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Emitted when the target returns an exception after EventBridge Scheduler calls the target API across all schedules.
AllFailedToBeSentToDLQ(errorCode?, props?)
static metricpublic static metricAllFailedToBeSentToDLQ(errorCode?: string, props?: MetricOptions): Metric
Parameters
- errorCode
string
- props
Metric
Options
Returns
Metric for failed invocations that also failed to deliver to DLQ across all schedules.
AllSentToDLQ(props?)
static metricpublic static metricAllSentToDLQ(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for invocations delivered to the DLQ across all schedules.
AllSentToDLQTruncated(props?)
static metricpublic static metricAllSentToDLQTruncated(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for delivery of failed invocations to DLQ when the payload of the event sent to the DLQ exceeds the maximum size allowed by Amazon SQS.
Metric is calculated for all schedules.
AllTargetThrottled(props?)
static metricpublic static metricAllTargetThrottled(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for invocation failures due to API throttling by the target across all schedules.
AllThrottled(props?)
static metricpublic static metricAllThrottled(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the number of invocations that were throttled across all schedules.
See also: https://docs.aws.amazon.com/scheduler/latest/UserGuide/scheduler-quotas.html