awscdkscheduleralpha

package module
v2.144.0-alpha.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

README

Amazon EventBridge Scheduler Construct Library

---

The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.


Amazon EventBridge Scheduler is a feature from Amazon EventBridge that allows you to create, run, and manage scheduled tasks at scale. With EventBridge Scheduler, you can schedule one-time or recurrently tens of millions of tasks across many AWS services without provisioning or managing underlying infrastructure.

  1. 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. When you create a schedule, you configure a target for the schedule to invoke.
  2. Targets: 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 and universal targets. Templated targets invoke common API operations across a core groups of services. For example, EventBridge Scheduler supports templated targets for invoking AWS Lambda Function or starting execution of Step Function state machine. For API operations that are not supported by templated targets you can use customizable universal targets. Universal targets support calling more than 6,000 API operations across over 270 AWS services.
  3. Schedule Group: A schedule group is an Amazon EventBridge Scheduler resource that you use to organize your schedules. Your AWS account comes with a default scheduler group. A new schedule will always be added to a scheduling group. If you do not provide a scheduling group to add to, it will be added to the default scheduling group. You can create up to 500 schedule groups in your AWS account. Groups can be used to organize the schedules logically, access the schedule metrics and manage permissions at group granularity (see details below). Scheduling groups support tagging: with EventBridge Scheduler, you apply tags to schedule groups, not to individual schedules to organize your resources.

This module is part of the AWS Cloud Development Kit project. It allows you to define Event Bridge Schedules.

This module is in active development. Some features may not be implemented yet.

Defining a schedule

var fn function


target := targets.NewLambdaInvoke(fn, &ScheduleTargetBaseProps{
	Input: awscdkscheduleralpha.ScheduleTargetInput_FromObject(map[string]*string{
		"payload": jsii.String("useful"),
	}),
})

schedule := awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(10))),
	Target: Target,
	Description: jsii.String("This is a test schedule that invokes lambda function every 10 minutes."),
})
Schedule Expressions

You can choose from three schedule types when configuring your schedule: rate-based, cron-based, and one-time schedules.

Both rate-based and cron-based schedules are recurring schedules. You can configure each recurring schedule type using a schedule expression. For cron-based schedule you can specify a time zone in which EventBridge Scheduler evaluates the expression.

var target lambdaInvoke


rateBasedSchedule := awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(10))),
	Target: Target,
	Description: jsii.String("This is a test rate-based schedule"),
})

cronBasedSchedule := awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Cron(&CronOptionsWithTimezone{
		Minute: jsii.String("0"),
		Hour: jsii.String("23"),
		Day: jsii.String("20"),
		Month: jsii.String("11"),
		TimeZone: awscdk.TimeZone_AMERICA_NEW_YORK(),
	}),
	Target: Target,
	Description: jsii.String("This is a test cron-based schedule that will run at 11:00 PM, on day 20 of the month, only in November in New York timezone"),
})

A one-time schedule is a schedule that invokes a target only once. You configure a one-time schedule when by specifying the time of the day, date, and time zone in which EventBridge Scheduler evaluates the schedule.

var target lambdaInvoke


oneTimeSchedule := awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_At(
	NewDate(jsii.Number(2022), jsii.Number(10), jsii.Number(20), jsii.Number(19), jsii.Number(20), jsii.Number(23)), awscdk.TimeZone_AMERICA_NEW_YORK()),
	Target: Target,
	Description: jsii.String("This is a one-time schedule in New York timezone"),
})
Grouping Schedules

Your AWS account comes with a default scheduler group. You can access default group in CDK with:

defaultGroup := awscdkscheduleralpha.Group_FromDefaultGroup(this, jsii.String("DefaultGroup"))

If not specified a schedule is added to the default group. However, you can also add the schedule to a custom scheduling group managed by you:

var target lambdaInvoke


group := awscdkscheduleralpha.NewGroup(this, jsii.String("Group"), &GroupProps{
	GroupName: jsii.String("MyGroup"),
})

awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(10))),
	Target: Target,
	Group: Group,
})
Disabling Schedules

By default, a schedule will be enabled. You can disable a schedule by setting the enabled property to false:

var target lambdaInvoke


awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(10))),
	Target: target,
	Enabled: jsii.Boolean(false),
})
Configuring a start and end time of the Schedule

If you choose a recurring schedule, you can set the start and end time of the Schedule by specifying the start and end.

var target lambdaInvoke


awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(cdk.Duration_Hours(jsii.Number(12))),
	Target: target,
	Start: NewDate(jsii.String("2023-01-01T00:00:00.000Z")),
	End: NewDate(jsii.String("2023-02-01T00:00:00.000Z")),
})

Scheduler Targets

The @aws-cdk/aws-scheduler-targets-alpha module includes classes that implement the IScheduleTarget interface for various AWS services. EventBridge Scheduler supports two types of targets: templated targets invoke common API operations across a core groups of services, and customizable universal targets that you can use to call more than 6,000 operations across over 270 services. A list of supported targets can be found at @aws-cdk/aws-scheduler-targets-alpha.

Input

Target can be invoked with a custom input. Class ScheduleTargetInput supports free form text input and JSON-formatted object input:

input := awscdkscheduleralpha.ScheduleTargetInput_FromObject(map[string]*string{
	"QueueName": jsii.String("MyQueue"),
})

You can include context attributes in your target payload. EventBridge Scheduler will replace each keyword with its respective value and deliver it to the target. See full list of supported context attributes:

  1. ContextAttribute.scheduleArn() – The ARN of the schedule.
  2. ContextAttribute.scheduledTime() – The time you specified for the schedule to invoke its target, for example, 2022-03-22T18:59:43Z.
  3. ContextAttribute.executionId() – The unique ID that EventBridge Scheduler assigns for each attempted invocation of a target, for example, d32c5kddcf5bb8c3.
  4. ContextAttribute.attemptNumber() – A counter that identifies the attempt number for the current invocation, for example, 1.
text := fmt.Sprintf("Attempt number: %v", awscdkscheduleralpha.ContextAttribute_AttemptNumber())
input := awscdkscheduleralpha.ScheduleTargetInput_FromText(text)
Specifying Execution Role

An execution role is an IAM role that EventBridge Scheduler assumes in order to interact with other AWS services on your behalf.

The classes for templated schedule targets automatically create an IAM role with all the minimum necessary permissions to interact with the templated target. If you wish you may specify your own IAM role, then the templated targets will grant minimal required permissions. For example: for invoking Lambda function target LambdaInvoke will grant execution IAM role permission to lambda:InvokeFunction.

var fn function


role := iam.NewRole(this, jsii.String("Role"), &RoleProps{
	AssumedBy: iam.NewServicePrincipal(jsii.String("scheduler.amazonaws.com")),
})

target := targets.NewLambdaInvoke(fn, &ScheduleTargetBaseProps{
	Input: awscdkscheduleralpha.ScheduleTargetInput_FromObject(map[string]*string{
		"payload": jsii.String("useful"),
	}),
	Role: Role,
})
Cross-account and cross-region targets

Executing cross-account and cross-region targets are not supported yet.

Specifying Encryption key

EventBridge Scheduler integrates with AWS Key Management Service (AWS KMS) to encrypt and decrypt your data using an AWS KMS key. EventBridge Scheduler supports two types of KMS keys: AWS owned keys, and customer managed keys.

By default, all events in Scheduler are encrypted with a key that AWS owns and manages. If you wish you can also provide a customer managed key to encrypt and decrypt the payload that your schedule delivers to its target using the key property. Target classes will automatically add AWS KMS Decrypt permission to your schedule's execution role permissions policy.

var key key
var fn function


target := targets.NewLambdaInvoke(fn, &ScheduleTargetBaseProps{
	Input: awscdkscheduleralpha.ScheduleTargetInput_FromObject(map[string]*string{
		"payload": jsii.String("useful"),
	}),
})

schedule := awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(10))),
	Target: Target,
	Key: Key,
})

Visit Data protection in Amazon EventBridge Scheduler for more details.

Configuring flexible time windows

You can configure flexible time windows by specifying the timeWindow property. Flexible time windows is disabled by default.

var target lambdaInvoke


schedule := awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Hours(jsii.Number(12))),
	Target: Target,
	TimeWindow: awscdkscheduleralpha.TimeWindow_Flexible(awscdk.Duration_*Hours(jsii.Number(10))),
})

Visit Configuring flexible time windows for more details.

Error-handling

You can configure how your schedule handles failures, when EventBridge Scheduler is unable to deliver an event successfully to a target, by using two primary mechanisms: a retry policy, and a dead-letter queue (DLQ).

A retry policy determines the number of times EventBridge Scheduler must retry a failed event, and how long to keep an unprocessed event.

A DLQ is a standard Amazon SQS queue EventBridge Scheduler uses to deliver failed events to, after the retry policy has been exhausted. You can use a DLQ to troubleshoot issues with your schedule or its downstream target. If you've configured a retry policy for your schedule, EventBridge Scheduler delivers the dead-letter event after exhausting the maximum number of retries you set in the retry policy.

var fn function


dlq := sqs.NewQueue(this, jsii.String("DLQ"), &QueueProps{
	QueueName: jsii.String("MyDLQ"),
})

target := targets.NewLambdaInvoke(fn, &ScheduleTargetBaseProps{
	DeadLetterQueue: dlq,
	MaxEventAge: awscdk.Duration_Minutes(jsii.Number(1)),
	RetryAttempts: jsii.Number(3),
})

Overriding Target Properties

If you wish to reuse the same target in multiple schedules, you can override target properties like input, retryAttempts and maxEventAge when creating a Schedule using the targetOverrides parameter:

var target lambdaInvoke


oneTimeSchedule := awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(cdk.Duration_Hours(jsii.Number(12))),
	Target: Target,
	TargetOverrides: &ScheduleTargetProps{
		Input: awscdkscheduleralpha.ScheduleTargetInput_FromText(jsii.String("Overriding Target Input")),
		MaxEventAge: awscdk.Duration_Seconds(jsii.Number(180)),
		RetryAttempts: jsii.Number(5),
	},
})

Monitoring

You can monitor Amazon EventBridge Scheduler using CloudWatch, which collects raw data and processes it into readable, near real-time metrics. EventBridge Scheduler emits a set of metrics for all schedules, and an additional set of metrics for schedules that have an associated dead-letter queue (DLQ). If you configure a DLQ for your schedule, EventBridge Scheduler publishes additional metrics when your schedule exhausts its retry policy.

Metrics for all schedules

Class Schedule provides static methods for accessing all schedules metrics with default configuration, such as metricAllErrors for viewing errors when executing targets.

cloudwatch.NewAlarm(this, jsii.String("SchedulesErrorAlarm"), &AlarmProps{
	Metric: awscdkscheduleralpha.Schedule_MetricAllErrors(),
	Threshold: jsii.Number(0),
	EvaluationPeriods: jsii.Number(1),
})
Metrics for a Group

To view metrics for a specific group you can use methods on class Group:

group := awscdkscheduleralpha.NewGroup(this, jsii.String("Group"), &GroupProps{
	GroupName: jsii.String("MyGroup"),
})

cloudwatch.NewAlarm(this, jsii.String("MyGroupErrorAlarm"), &AlarmProps{
	Metric: group.metricTargetErrors(),
	EvaluationPeriods: jsii.Number(1),
	Threshold: jsii.Number(0),
})

// Or use default group
defaultGroup := awscdkscheduleralpha.Group_FromDefaultGroup(this, jsii.String("DefaultGroup"))
cloudwatch.NewAlarm(this, jsii.String("DefaultGroupErrorAlarm"), &AlarmProps{
	Metric: defaultGroup.MetricTargetErrors(),
	EvaluationPeriods: jsii.Number(1),
	Threshold: jsii.Number(0),
})

See full list of metrics and their description at Monitoring Using CloudWatch Metrics in the AWS Event Bridge Scheduler User Guide.

Documentation

Overview

The CDK Construct Library for Amazon Scheduler

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextAttribute_AttemptNumber

func ContextAttribute_AttemptNumber() *string

func ContextAttribute_ExecutionId

func ContextAttribute_ExecutionId() *string

func ContextAttribute_FromName

func ContextAttribute_FromName(name *string) *string

Escape hatch for other ContextAttribute that might be resolved in future. Experimental.

func ContextAttribute_ScheduleArn

func ContextAttribute_ScheduleArn() *string

func ContextAttribute_ScheduledTime

func ContextAttribute_ScheduledTime() *string

func Group_IsConstruct

func Group_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.

func Group_IsOwnedResource

func Group_IsOwnedResource(construct constructs.IConstruct) *bool

Returns true if the construct was created by CDK, and false otherwise. Experimental.

func Group_IsResource

func Group_IsResource(construct constructs.IConstruct) *bool

Check whether the given construct is a Resource. Experimental.

func NewGroup_Override

func NewGroup_Override(g Group, scope constructs.Construct, id *string, props *GroupProps)

Experimental.

func NewScheduleExpression_Override

func NewScheduleExpression_Override(s ScheduleExpression)

Experimental.

func NewScheduleTargetInput_Override

func NewScheduleTargetInput_Override(s ScheduleTargetInput)

Experimental.

func NewSchedule_Override

func NewSchedule_Override(s Schedule, scope constructs.Construct, id *string, props *ScheduleProps)

Experimental.

func Schedule_IsConstruct

func Schedule_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.

func Schedule_IsOwnedResource

func Schedule_IsOwnedResource(construct constructs.IConstruct) *bool

Returns true if the construct was created by CDK, and false otherwise. Experimental.

func Schedule_IsResource

func Schedule_IsResource(construct constructs.IConstruct) *bool

Check whether the given construct is a Resource. Experimental.

func Schedule_MetricAll

func Schedule_MetricAll(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric

Return the given named metric for all schedules. Default: - sum over 5 minutes.

Experimental.

func Schedule_MetricAllAttempts

func Schedule_MetricAllAttempts(props *awscloudwatch.MetricOptions) awscloudwatch.Metric

Metric for all invocation attempts across all schedules. Default: - sum over 5 minutes.

Experimental.

func Schedule_MetricAllDropped

func Schedule_MetricAllDropped(props *awscloudwatch.MetricOptions) awscloudwatch.Metric

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. Default: - sum over 5 minutes.

Experimental.

func Schedule_MetricAllErrors

func Schedule_MetricAllErrors(props *awscloudwatch.MetricOptions) awscloudwatch.Metric

Emitted when the target returns an exception after EventBridge Scheduler calls the target API across all schedules. Default: - sum over 5 minutes.

Experimental.

func Schedule_MetricAllFailedToBeSentToDLQ

func Schedule_MetricAllFailedToBeSentToDLQ(errorCode *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric

Metric for failed invocations that also failed to deliver to DLQ across all schedules. Default: - sum over 5 minutes.

Experimental.

func Schedule_MetricAllSentToDLQ

func Schedule_MetricAllSentToDLQ(props *awscloudwatch.MetricOptions) awscloudwatch.Metric

Metric for invocations delivered to the DLQ across all schedules. Default: - sum over 5 minutes.

Experimental.

func Schedule_MetricAllSentToDLQTruncated

func Schedule_MetricAllSentToDLQTruncated(props *awscloudwatch.MetricOptions) awscloudwatch.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.

Metric is calculated for all schedules. Default: - sum over 5 minutes.

Experimental.

func Schedule_MetricAllTargetThrottled

func Schedule_MetricAllTargetThrottled(props *awscloudwatch.MetricOptions) awscloudwatch.Metric

Metric for invocation failures due to API throttling by the target across all schedules. Default: - sum over 5 minutes.

Experimental.

func Schedule_MetricAllThrottled

func Schedule_MetricAllThrottled(props *awscloudwatch.MetricOptions) awscloudwatch.Metric

Metric for the number of invocations that were throttled across all schedules. See: https://docs.aws.amazon.com/scheduler/latest/UserGuide/scheduler-quotas.html

Default: - sum over 5 minutes.

Experimental.

Types

type ContextAttribute

type ContextAttribute interface {
	// Experimental.
	Name() *string
	// Convert the path to the field in the event pattern to JSON.
	// Experimental.
	ToString() *string
}

Represents a field in the event pattern. See: https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-schedule-context-attributes.html

Experimental.

type CronOptionsWithTimezone

type CronOptionsWithTimezone struct {
	// The day of the month to run this rule at.
	// Default: - Every day of the month.
	//
	// Experimental.
	Day *string `field:"optional" json:"day" yaml:"day"`
	// The hour to run this rule at.
	// Default: - Every hour.
	//
	// Experimental.
	Hour *string `field:"optional" json:"hour" yaml:"hour"`
	// The minute to run this rule at.
	// Default: - Every minute.
	//
	// Experimental.
	Minute *string `field:"optional" json:"minute" yaml:"minute"`
	// The month to run this rule at.
	// Default: - Every month.
	//
	// Experimental.
	Month *string `field:"optional" json:"month" yaml:"month"`
	// The day of the week to run this rule at.
	// Default: - Any day of the week.
	//
	// Experimental.
	WeekDay *string `field:"optional" json:"weekDay" yaml:"weekDay"`
	// The year to run this rule at.
	// Default: - Every year.
	//
	// Experimental.
	Year *string `field:"optional" json:"year" yaml:"year"`
	// The timezone to run the schedule in.
	// Default: - TimeZone.ETC_UTC
	//
	// Experimental.
	TimeZone awscdk.TimeZone `field:"optional" json:"timeZone" yaml:"timeZone"`
}

Options to configure a cron expression.

All fields are strings so you can use complex expressions. Absence of a field implies '*' or '?', whichever one is appropriate.

Example:

var target lambdaInvoke

rateBasedSchedule := awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(10))),
	Target: Target,
	Description: jsii.String("This is a test rate-based schedule"),
})

cronBasedSchedule := awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Cron(&CronOptionsWithTimezone{
		Minute: jsii.String("0"),
		Hour: jsii.String("23"),
		Day: jsii.String("20"),
		Month: jsii.String("11"),
		TimeZone: awscdk.TimeZone_AMERICA_NEW_YORK(),
	}),
	Target: Target,
	Description: jsii.String("This is a test cron-based schedule that will run at 11:00 PM, on day 20 of the month, only in November in New York timezone"),
})

See: https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions

Experimental.

type Group

type Group interface {
	awscdk.Resource
	IGroup
	// 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.
	// Experimental.
	Env() *awscdk.ResourceEnvironment
	// The arn of the schedule group.
	// Experimental.
	GroupArn() *string
	// The name of the schedule group.
	// Experimental.
	GroupName() *string
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//   cross-environment scenarios.
	// Experimental.
	PhysicalName() *string
	// The stack in which this resource is defined.
	// Experimental.
	Stack() awscdk.Stack
	// 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`).
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// Experimental.
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	// Experimental.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	// Experimental.
	GetResourceNameAttribute(nameAttr *string) *string
	// Grant the indicated permissions on this group to the given principal.
	// Experimental.
	Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant
	// Grant delete schedule permission for schedules in this group to the given principal.
	// Experimental.
	GrantDeleteSchedules(identity awsiam.IGrantable) awsiam.Grant
	// Grant list and get schedule permissions for schedules in this group to the given principal.
	// Experimental.
	GrantReadSchedules(identity awsiam.IGrantable) awsiam.Grant
	// Grant create and update schedule permissions for schedules in this group to the given principal.
	// Experimental.
	GrantWriteSchedules(identity awsiam.IGrantable) awsiam.Grant
	// Return the given named metric for this group schedules.
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	Metric(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for all invocation attempts.
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	MetricAttempts(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for dropped invocations when EventBridge Scheduler stops attempting to invoke the target after a schedule's retry policy has been exhausted.
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	MetricDropped(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for failed invocations that also failed to deliver to DLQ.
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	MetricFailedToBeSentToDLQ(errorCode *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for invocations delivered to the DLQ.
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	MetricSentToDLQ(props *awscloudwatch.MetricOptions) awscloudwatch.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.
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	MetricSentToDLQTruncated(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Emitted when the target returns an exception after EventBridge Scheduler calls the target API.
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	MetricTargetErrors(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for invocation failures due to API throttling by the target.
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	MetricTargetThrottled(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of invocations that were throttled because it exceeds your service quotas.
	// See: https://docs.aws.amazon.com/scheduler/latest/UserGuide/scheduler-quotas.html
	//
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	MetricThrottled(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

Example:

var target lambdaInvoke

group := awscdkscheduleralpha.NewGroup(this, jsii.String("Group"), &GroupProps{
	GroupName: jsii.String("MyGroup"),
})

awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(10))),
	Target: Target,
	Group: Group,
})

Experimental.

func NewGroup

func NewGroup(scope constructs.Construct, id *string, props *GroupProps) Group

Experimental.

type GroupProps

type GroupProps struct {
	// The name of the schedule group.
	//
	// Up to 64 letters (uppercase and lowercase), numbers, hyphens, underscores and dots are allowed.
	// Default: - A unique name will be generated.
	//
	// Experimental.
	GroupName *string `field:"optional" json:"groupName" yaml:"groupName"`
	// The removal policy for the group.
	//
	// If the group is removed also all schedules are removed.
	// Default: RemovalPolicy.RETAIN
	//
	// Experimental.
	RemovalPolicy awscdk.RemovalPolicy `field:"optional" json:"removalPolicy" yaml:"removalPolicy"`
}

Example:

var target lambdaInvoke

group := awscdkscheduleralpha.NewGroup(this, jsii.String("Group"), &GroupProps{
	GroupName: jsii.String("MyGroup"),
})

awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(10))),
	Target: Target,
	Group: Group,
})

Experimental.

type IGroup

type IGroup interface {
	awscdk.IResource
	// Grant the indicated permissions on this group to the given principal.
	// Experimental.
	Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant
	// Grant delete schedule permission for schedules in this group to the given principal.
	// Experimental.
	GrantDeleteSchedules(identity awsiam.IGrantable) awsiam.Grant
	// Grant list and get schedule permissions for schedules in this group to the given principal.
	// Experimental.
	GrantReadSchedules(identity awsiam.IGrantable) awsiam.Grant
	// Grant create and update schedule permissions for schedules in this group to the given principal.
	// Experimental.
	GrantWriteSchedules(identity awsiam.IGrantable) awsiam.Grant
	// Return the given named metric for this group schedules.
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	Metric(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for all invocation attempts.
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	MetricAttempts(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for dropped invocations when EventBridge Scheduler stops attempting to invoke the target after a schedule's retry policy has been exhausted.
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	MetricDropped(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for failed invocations that also failed to deliver to DLQ.
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	MetricFailedToBeSentToDLQ(errorCode *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for invocations delivered to the DLQ.
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	MetricSentToDLQ(props *awscloudwatch.MetricOptions) awscloudwatch.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.
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	MetricSentToDLQTruncated(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Emitted when the target returns an exception after EventBridge Scheduler calls the target API.
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	MetricTargetErrors(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for invocation failures due to API throttling by the target.
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	MetricTargetThrottled(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of invocations that were throttled because it exceeds your service quotas.
	// See: https://docs.aws.amazon.com/scheduler/latest/UserGuide/scheduler-quotas.html
	//
	// Default: - sum over 5 minutes.
	//
	// Experimental.
	MetricThrottled(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The arn of the schedule group.
	// Experimental.
	GroupArn() *string
	// The name of the schedule group.
	// Experimental.
	GroupName() *string
}

Experimental.

func Group_FromDefaultGroup

func Group_FromDefaultGroup(scope constructs.Construct, id *string) IGroup

Import a default schedule group. Experimental.

func Group_FromGroupArn

func Group_FromGroupArn(scope constructs.Construct, id *string, groupArn *string) IGroup

Import an external group by ARN. Experimental.

func Group_FromGroupName

func Group_FromGroupName(scope constructs.Construct, id *string, groupName *string) IGroup

Import an existing group with a given name. Experimental.

type ISchedule

type ISchedule interface {
	awscdk.IResource
	// The schedule group associated with this schedule.
	// Experimental.
	Group() IGroup
	// The customer managed KMS key that EventBridge Scheduler will use to encrypt and decrypt your data.
	// Experimental.
	Key() awskms.IKey
	// The arn of the schedule.
	// Experimental.
	ScheduleArn() *string
	// The name of the schedule.
	// Experimental.
	ScheduleName() *string
}

Interface representing a created or an imported `Schedule`. Experimental.

type IScheduleTarget

type IScheduleTarget interface {
	// Returns the schedule target specification.
	// Experimental.
	Bind(_schedule ISchedule) *ScheduleTargetConfig
}

Interface representing a Event Bridge Schedule Target. Experimental.

type Schedule

type Schedule interface {
	awscdk.Resource
	ISchedule
	// 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.
	// Experimental.
	Env() *awscdk.ResourceEnvironment
	// The schedule group associated with this schedule.
	// Experimental.
	Group() IGroup
	// The customer managed KMS key that EventBridge Scheduler will use to encrypt and decrypt your data.
	// Experimental.
	Key() awskms.IKey
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//   cross-environment scenarios.
	// Experimental.
	PhysicalName() *string
	// The arn of the schedule.
	// Experimental.
	ScheduleArn() *string
	// The name of the schedule.
	// Experimental.
	ScheduleName() *string
	// The stack in which this resource is defined.
	// Experimental.
	Stack() awscdk.Stack
	// 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`).
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// Experimental.
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	// Experimental.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	// Experimental.
	GetResourceNameAttribute(nameAttr *string) *string
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

An EventBridge Schedule.

Example:

import firehose "github.com/aws/aws-cdk-go/awscdk"
var deliveryStream cfnDeliveryStream

payload := map[string]*string{
	"Data": jsii.String("record"),
}

awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(60))),
	Target: targets.NewKinesisDataFirehosePutRecord(deliveryStream, &ScheduleTargetBaseProps{
		Input: awscdkscheduleralpha.ScheduleTargetInput_FromObject(payload),
	}),
})

Experimental.

func NewSchedule

func NewSchedule(scope constructs.Construct, id *string, props *ScheduleProps) Schedule

Experimental.

type ScheduleExpression

type ScheduleExpression interface {
	// Retrieve the expression for this schedule.
	// Experimental.
	ExpressionString() *string
	// Retrieve the expression for this schedule.
	// Experimental.
	TimeZone() awscdk.TimeZone
}

ScheduleExpression for EventBridge Schedule.

You can choose from three schedule types when configuring your schedule: rate-based, cron-based, and one-time schedules. Both rate-based and cron-based schedules are recurring schedules.

Example:

import firehose "github.com/aws/aws-cdk-go/awscdk"
var deliveryStream cfnDeliveryStream

payload := map[string]*string{
	"Data": jsii.String("record"),
}

awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(60))),
	Target: targets.NewKinesisDataFirehosePutRecord(deliveryStream, &ScheduleTargetBaseProps{
		Input: awscdkscheduleralpha.ScheduleTargetInput_FromObject(payload),
	}),
})

See: https://docs.aws.amazon.com/scheduler/latest/UserGuide/schedule-types.html

Experimental.

func ScheduleExpression_At

func ScheduleExpression_At(date *time.Time, timeZone awscdk.TimeZone) ScheduleExpression

Construct a one-time schedule from a date. Experimental.

func ScheduleExpression_Cron

func ScheduleExpression_Cron(options *CronOptionsWithTimezone) ScheduleExpression

Create a recurring schedule from a set of cron fields and time zone. Experimental.

func ScheduleExpression_Expression

func ScheduleExpression_Expression(expression *string, timeZone awscdk.TimeZone) ScheduleExpression

Construct a schedule from a literal schedule expression. Experimental.

func ScheduleExpression_Rate

func ScheduleExpression_Rate(duration awscdk.Duration) ScheduleExpression

Construct a recurring 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. Experimental.

type ScheduleProps

type ScheduleProps struct {
	// The expression that defines when the schedule runs.
	//
	// Can be either a `at`, `rate`
	// or `cron` expression.
	// Experimental.
	Schedule ScheduleExpression `field:"required" json:"schedule" yaml:"schedule"`
	// The schedule's target details.
	// Experimental.
	Target IScheduleTarget `field:"required" json:"target" yaml:"target"`
	// The description you specify for the schedule.
	// Default: - no value.
	//
	// Experimental.
	Description *string `field:"optional" json:"description" yaml:"description"`
	// Indicates whether the schedule is enabled.
	// Default: true.
	//
	// Experimental.
	Enabled *bool `field:"optional" json:"enabled" yaml:"enabled"`
	// The date, in UTC, before which the schedule can invoke its target.
	//
	// EventBridge Scheduler ignores end for one-time schedules.
	// Default: - no value.
	//
	// Experimental.
	End *time.Time `field:"optional" json:"end" yaml:"end"`
	// The schedule's group.
	// Default: - By default a schedule will be associated with the `default` group.
	//
	// Experimental.
	Group IGroup `field:"optional" json:"group" yaml:"group"`
	// The customer managed KMS key that EventBridge Scheduler will use to encrypt and decrypt your data.
	// Default: - All events in Scheduler are encrypted with a key that AWS owns and manages.
	//
	// Experimental.
	Key awskms.IKey `field:"optional" json:"key" yaml:"key"`
	// The name of the schedule.
	//
	// Up to 64 letters (uppercase and lowercase), numbers, hyphens, underscores and dots are allowed.
	// Default: - A unique name will be generated.
	//
	// Experimental.
	ScheduleName *string `field:"optional" json:"scheduleName" yaml:"scheduleName"`
	// The date, in UTC, after which the schedule can begin invoking its target.
	//
	// EventBridge Scheduler ignores start for one-time schedules.
	// Default: - no value.
	//
	// Experimental.
	Start *time.Time `field:"optional" json:"start" yaml:"start"`
	// Allows to override target properties when creating a new schedule.
	// Experimental.
	TargetOverrides *ScheduleTargetProps `field:"optional" json:"targetOverrides" yaml:"targetOverrides"`
	// A time window during which EventBridge Scheduler invokes the schedule.
	// See: https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-schedule-flexible-time-windows.html
	//
	// Default: TimeWindow.off()
	//
	// Experimental.
	TimeWindow TimeWindow `field:"optional" json:"timeWindow" yaml:"timeWindow"`
}

Construction properties for `Schedule`.

Example:

import firehose "github.com/aws/aws-cdk-go/awscdk"
var deliveryStream cfnDeliveryStream

payload := map[string]*string{
	"Data": jsii.String("record"),
}

awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(60))),
	Target: targets.NewKinesisDataFirehosePutRecord(deliveryStream, &ScheduleTargetBaseProps{
		Input: awscdkscheduleralpha.ScheduleTargetInput_FromObject(payload),
	}),
})

Experimental.

type ScheduleTargetConfig

type ScheduleTargetConfig struct {
	// The Amazon Resource Name (ARN) of the target.
	// Experimental.
	Arn *string `field:"required" json:"arn" yaml:"arn"`
	// Role to use to invoke this event target.
	// Experimental.
	Role awsiam.IRole `field:"required" json:"role" yaml:"role"`
	// An object that contains information about an Amazon SQS queue that EventBridge Scheduler uses as a dead-letter queue for your schedule.
	//
	// If specified, EventBridge Scheduler delivers failed events that could not be successfully delivered to a target to the queue.\
	// Experimental.
	DeadLetterConfig *awsscheduler.CfnSchedule_DeadLetterConfigProperty `field:"optional" json:"deadLetterConfig" yaml:"deadLetterConfig"`
	// The templated target type for the Amazon ECS RunTask API Operation.
	// Experimental.
	EcsParameters *awsscheduler.CfnSchedule_EcsParametersProperty `field:"optional" json:"ecsParameters" yaml:"ecsParameters"`
	// The templated target type for the EventBridge PutEvents API operation.
	// Experimental.
	EventBridgeParameters *awsscheduler.CfnSchedule_EventBridgeParametersProperty `field:"optional" json:"eventBridgeParameters" yaml:"eventBridgeParameters"`
	// What input to pass to the target.
	// Experimental.
	Input ScheduleTargetInput `field:"optional" json:"input" yaml:"input"`
	// The templated target type for the Amazon Kinesis PutRecord API operation.
	// Experimental.
	KinesisParameters *awsscheduler.CfnSchedule_KinesisParametersProperty `field:"optional" json:"kinesisParameters" yaml:"kinesisParameters"`
	// A `RetryPolicy` object that includes information about the retry policy settings, including the maximum age of an event, and the maximum number of times EventBridge Scheduler will try to deliver the event to a target.
	// Experimental.
	RetryPolicy *awsscheduler.CfnSchedule_RetryPolicyProperty `field:"optional" json:"retryPolicy" yaml:"retryPolicy"`
	// The templated target type for the Amazon SageMaker StartPipelineExecution API operation.
	// Experimental.
	SageMakerPipelineParameters *awsscheduler.CfnSchedule_SageMakerPipelineParametersProperty `field:"optional" json:"sageMakerPipelineParameters" yaml:"sageMakerPipelineParameters"`
	// The templated target type for the Amazon SQS SendMessage API Operation.
	// Experimental.
	SqsParameters *awsscheduler.CfnSchedule_SqsParametersProperty `field:"optional" json:"sqsParameters" yaml:"sqsParameters"`
}

Config of a Schedule Target used during initialization of Schedule.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import scheduler_alpha "github.com/aws/aws-cdk-go/awscdkscheduleralpha"
import "github.com/aws/aws-cdk-go/awscdk"

var role role
var scheduleTargetInput scheduleTargetInput
var tags interface{}

scheduleTargetConfig := &ScheduleTargetConfig{
	Arn: jsii.String("arn"),
	Role: role,

	// the properties below are optional
	DeadLetterConfig: &DeadLetterConfigProperty{
		Arn: jsii.String("arn"),
	},
	EcsParameters: &EcsParametersProperty{
		TaskDefinitionArn: jsii.String("taskDefinitionArn"),

		// the properties below are optional
		CapacityProviderStrategy: []interface{}{
			&CapacityProviderStrategyItemProperty{
				CapacityProvider: jsii.String("capacityProvider"),

				// the properties below are optional
				Base: jsii.Number(123),
				Weight: jsii.Number(123),
			},
		},
		EnableEcsManagedTags: jsii.Boolean(false),
		EnableExecuteCommand: jsii.Boolean(false),
		Group: jsii.String("group"),
		LaunchType: jsii.String("launchType"),
		NetworkConfiguration: &NetworkConfigurationProperty{
			AwsvpcConfiguration: &AwsVpcConfigurationProperty{
				Subnets: []*string{
					jsii.String("subnets"),
				},

				// the properties below are optional
				AssignPublicIp: jsii.String("assignPublicIp"),
				SecurityGroups: []*string{
					jsii.String("securityGroups"),
				},
			},
		},
		PlacementConstraints: []interface{}{
			&PlacementConstraintProperty{
				Expression: jsii.String("expression"),
				Type: jsii.String("type"),
			},
		},
		PlacementStrategy: []interface{}{
			&PlacementStrategyProperty{
				Field: jsii.String("field"),
				Type: jsii.String("type"),
			},
		},
		PlatformVersion: jsii.String("platformVersion"),
		PropagateTags: jsii.String("propagateTags"),
		ReferenceId: jsii.String("referenceId"),
		Tags: tags,
		TaskCount: jsii.Number(123),
	},
	EventBridgeParameters: &EventBridgeParametersProperty{
		DetailType: jsii.String("detailType"),
		Source: jsii.String("source"),
	},
	Input: scheduleTargetInput,
	KinesisParameters: &KinesisParametersProperty{
		PartitionKey: jsii.String("partitionKey"),
	},
	RetryPolicy: &RetryPolicyProperty{
		MaximumEventAgeInSeconds: jsii.Number(123),
		MaximumRetryAttempts: jsii.Number(123),
	},
	SageMakerPipelineParameters: &SageMakerPipelineParametersProperty{
		PipelineParameterList: []interface{}{
			&SageMakerPipelineParameterProperty{
				Name: jsii.String("name"),
				Value: jsii.String("value"),
			},
		},
	},
	SqsParameters: &SqsParametersProperty{
		MessageGroupId: jsii.String("messageGroupId"),
	},
}

Experimental.

type ScheduleTargetInput

type ScheduleTargetInput interface {
	// Return the input properties for this input object.
	// Experimental.
	Bind(schedule ISchedule) *string
}

The text, or well-formed JSON, passed to the target of the schedule.

Example:

import sns "github.com/aws/aws-cdk-go/awscdk"

topic := sns.NewTopic(this, jsii.String("Topic"))

payload := map[string]*string{
	"message": jsii.String("Hello scheduler!"),
}

target := targets.NewSnsPublish(topic, &ScheduleTargetBaseProps{
	Input: awscdkscheduleralpha.ScheduleTargetInput_FromObject(payload),
})

awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Hours(jsii.Number(1))),
	Target: Target,
})

Experimental.

func ScheduleTargetInput_FromObject

func ScheduleTargetInput_FromObject(obj interface{}) ScheduleTargetInput

Pass a JSON object to the target, it is possible to embed `ContextAttributes` and other cdk references. Experimental.

func ScheduleTargetInput_FromText

func ScheduleTargetInput_FromText(text *string) ScheduleTargetInput

Pass text to the target, it is possible to embed `ContextAttributes` that will be resolved to actual values while the CloudFormation is deployed or cdk Tokens that will be resolved when the CloudFormation templates are generated by CDK.

The target input value will be a single string that you pass. For passing complex values like JSON object to a target use method `ScheduleTargetInput.fromObject()` instead. Experimental.

type ScheduleTargetProps

type ScheduleTargetProps struct {
	// The text, or well-formed JSON, passed to the target.
	//
	// If you are configuring a templated Lambda, AWS Step Functions, or Amazon EventBridge target,
	// the input must be a well-formed JSON. For all other target types, a JSON is not required.
	// Default: - The target's input is used.
	//
	// Experimental.
	Input ScheduleTargetInput `field:"optional" json:"input" yaml:"input"`
	// The maximum amount of time, in seconds, to continue to make retry attempts.
	// Default: - The target's maximumEventAgeInSeconds is used.
	//
	// Experimental.
	MaxEventAge awscdk.Duration `field:"optional" json:"maxEventAge" yaml:"maxEventAge"`
	// The maximum number of retry attempts to make before the request fails.
	// Default: - The target's maximumRetryAttempts is used.
	//
	// Experimental.
	RetryAttempts *float64 `field:"optional" json:"retryAttempts" yaml:"retryAttempts"`
}

Example:

var target lambdaInvoke

oneTimeSchedule := awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(cdk.Duration_Hours(jsii.Number(12))),
	Target: Target,
	TargetOverrides: &ScheduleTargetProps{
		Input: awscdkscheduleralpha.ScheduleTargetInput_FromText(jsii.String("Overriding Target Input")),
		MaxEventAge: awscdk.Duration_Seconds(jsii.Number(180)),
		RetryAttempts: jsii.Number(5),
	},
})

Experimental.

type TimeWindow

type TimeWindow interface {
	// The maximum time window during which the schedule can be invoked.
	//
	// Must be between 1 to 1440 minutes.
	// Default: - no value.
	//
	// Experimental.
	MaxWindow() awscdk.Duration
	// Determines whether the schedule is invoked within a flexible time window.
	// Experimental.
	Mode() *string
}

A time window during which EventBridge Scheduler invokes the schedule.

Example:

var target lambdaInvoke

schedule := awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Hours(jsii.Number(12))),
	Target: Target,
	TimeWindow: awscdkscheduleralpha.TimeWindow_Flexible(awscdk.Duration_*Hours(jsii.Number(10))),
})

Experimental.

func TimeWindow_Flexible

func TimeWindow_Flexible(maxWindow awscdk.Duration) TimeWindow

TimeWindow is enabled. Experimental.

func TimeWindow_Off

func TimeWindow_Off() TimeWindow

TimeWindow is disabled. Experimental.

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL