awscdkschedulertargetsalpha

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

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

README

Amazon EventBridge Scheduler Construct Library

---

The APIs of higher level constructs in this module are in developer preview before they become stable. We will only make breaking changes to address unforeseen API issues. Therefore, these APIs are not subject to Semantic Versioning, and breaking changes will be announced in 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 millions of one-time or recurring tasks across various AWS services without provisioning or managing underlying infrastructure.

This library contains integration classes for Amazon EventBridge Scheduler to call any number of supported AWS Services.

The following targets are supported:

  1. targets.LambdaInvoke: Invoke an AWS Lambda function
  2. targets.StepFunctionsStartExecution: Start an AWS Step Function
  3. targets.CodeBuildStartBuild: Start a CodeBuild job
  4. targets.SqsSendMessage: Send a Message to an Amazon SQS Queue
  5. targets.SnsPublish: Publish messages to an Amazon SNS topic
  6. targets.EventBridgePutEvents: Put Events on EventBridge
  7. targets.InspectorStartAssessmentRun: Start an Amazon Inspector assessment run
  8. targets.KinesisStreamPutRecord: Put a record to an Amazon Kinesis Data Stream
  9. targets.KinesisDataFirehosePutRecord: Put a record to a Kinesis Data Firehose
  10. targets.CodePipelineStartPipelineExecution: Start a CodePipeline execution
  11. targets.SageMakerStartPipelineExecution: Start a SageMaker pipeline execution

Invoke a Lambda function

Use the LambdaInvoke target to invoke a lambda function.

The code snippet below creates an event rule with a Lambda function as a target called every hour by EventBridge Scheduler with a custom payload. You can optionally attach a dead letter queue.

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


fn := lambda.NewFunction(this, jsii.String("MyFunc"), &FunctionProps{
	Runtime: lambda.Runtime_NODEJS_LATEST(),
	Handler: jsii.String("index.handler"),
	Code: lambda.Code_FromInline(jsii.String("exports.handler = handler.toString()")),
})

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),
	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_Hours(jsii.Number(1))),
	Target: Target,
})

Start an AWS Step Function

Use the StepFunctionsStartExecution target to start a new execution on a StepFunction.

The code snippet below creates an event rule with a Step Function as a target called every hour by EventBridge Scheduler with a custom payload.

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


payload := map[string]*string{
	"Name": jsii.String("MyParameter"),
	"Value": jsii.String("🌥️"),
}

putParameterStep := tasks.NewCallAwsService(this, jsii.String("PutParameter"), &CallAwsServiceProps{
	Service: jsii.String("ssm"),
	Action: jsii.String("putParameter"),
	IamResources: []*string{
		jsii.String("*"),
	},
	Parameters: map[string]interface{}{
		"Name.$": jsii.String("$.Name"),
		"Value.$": jsii.String("$.Value"),
		"Type": jsii.String("String"),
		"Overwrite": jsii.Boolean(true),
	},
})

stateMachine := sfn.NewStateMachine(this, jsii.String("StateMachine"), &StateMachineProps{
	DefinitionBody: sfn.DefinitionBody_FromChainable(putParameterStep),
})

awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Hours(jsii.Number(1))),
	Target: targets.NewStepFunctionsStartExecution(stateMachine, &ScheduleTargetBaseProps{
		Input: awscdkscheduleralpha.ScheduleTargetInput_FromObject(payload),
	}),
})

Start a CodeBuild job

Use the CodeBuildStartBuild target to start a new build run on a CodeBuild project.

The code snippet below creates an event rule with a CodeBuild project as target which is called every hour by EventBridge Scheduler.

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

var project project


awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(60))),
	Target: targets.NewCodeBuildStartBuild(project),
})

Send a Message To an SQS Queue

Use the SqsSendMessage target to send a message to an SQS Queue.

The code snippet below creates an event rule with an SQS Queue as a target called every hour by EventBridge Scheduler with a custom payload.

Contains the messageGroupId to use when the target is a FIFO queue. If you specify a FIFO queue as a target, the queue must have content-based deduplication enabled.

payload := "test"
messageGroupId := "id"
queue := sqs.NewQueue(this, jsii.String("MyQueue"), &QueueProps{
	Fifo: jsii.Boolean(true),
	ContentBasedDeduplication: jsii.Boolean(true),
})

target := targets.NewSqsSendMessage(queue, &SqsSendMessageProps{
	Input: awscdkscheduleralpha.ScheduleTargetInput_FromText(payload),
	MessageGroupId: jsii.String(MessageGroupId),
})

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

Publish messages to an Amazon SNS topic

Use the SnsPublish target to publish messages to an Amazon SNS topic.

The code snippets below create an event rule with a Amazon SNS topic as a target. It's called every hour by Amazon EventBridge Scheduler with a custom payload.

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,
})

Send events to an EventBridge event bus

Use the EventBridgePutEvents target to send events to an EventBridge event bus.

The code snippet below creates an event rule with an EventBridge event bus as a target called every hour by EventBridge Scheduler with a custom event payload.

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


eventBus := events.NewEventBus(this, jsii.String("EventBus"), &EventBusProps{
	EventBusName: jsii.String("DomainEvents"),
})

eventEntry := &EventBridgePutEventsEntry{
	EventBus: EventBus,
	Source: jsii.String("PetService"),
	Detail: awscdkscheduleralpha.ScheduleTargetInput_FromObject(map[string]*string{
		"Name": jsii.String("Fluffy"),
	}),
	DetailType: jsii.String("🐶"),
}

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

Start an Amazon Inspector assessment run

Use the InspectorStartAssessmentRun target to start an Inspector assessment run.

The code snippet below creates an event rule with an assessment template as the target which is called every hour by EventBridge Scheduler.

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

var assessmentTemplate cfnAssessmentTemplate


awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(60))),
	Target: targets.NewInspectorStartAssessmentRun(assessmentTemplate),
})

Put a record to an Amazon Kinesis Data Stream

Use the KinesisStreamPutRecord target to put a record to an Amazon Kinesis Data Stream.

The code snippet below creates an event rule with a stream as the target which is called every hour by EventBridge Scheduler.

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


stream := kinesis.NewStream(this, jsii.String("MyStream"))

awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(60))),
	Target: targets.NewKinesisStreamPutRecord(stream, &KinesisStreamPutRecordProps{
		PartitionKey: jsii.String("key"),
	}),
})

Put a record to a Kinesis Data Firehose

Use the KinesisDataFirehosePutRecord target to put a record to a Kinesis Data Firehose delivery stream.

The code snippet below creates an event rule with a delivery stream as a target called every hour by EventBridge Scheduler with a custom payload.

import firehose "github.com/aws/aws-cdk-go/awscdkkinesisfirehosealpha"
var deliveryStream iDeliveryStream


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),
	}),
})

Start a CodePipeline execution

Use the CodePipelineStartPipelineExecution target to start a new execution for a CodePipeline pipeline.

The code snippet below creates an event rule with a CodePipeline pipeline as the target which is called every hour by EventBridge Scheduler.

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

var pipeline pipeline


awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(60))),
	Target: targets.NewCodePipelineStartPipelineExecution(pipeline),
})

Start a SageMaker pipeline execution

Use the SageMakerStartPipelineExecution target to start a new execution for a SageMaker pipeline.

The code snippet below creates an event rule with a SageMaker pipeline as the target which is called every hour by EventBridge Scheduler.

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

var pipeline iPipeline


awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(60))),
	Target: targets.NewSageMakerStartPipelineExecution(pipeline, &SageMakerStartPipelineExecutionProps{
		PipelineParameterList: []sageMakerPipelineParameter{
			&sageMakerPipelineParameter{
				Name: jsii.String("parameter-name"),
				Value: jsii.String("parameter-value"),
			},
		},
	}),
})

Documentation

Overview

The CDK Construct Library for Amazon Scheduler Targets

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCodeBuildStartBuild_Override

func NewCodeBuildStartBuild_Override(c CodeBuildStartBuild, project awscodebuild.IProject, props *ScheduleTargetBaseProps)

Experimental.

func NewCodePipelineStartPipelineExecution_Override

func NewCodePipelineStartPipelineExecution_Override(c CodePipelineStartPipelineExecution, pipeline awscodepipeline.IPipeline, props *ScheduleTargetBaseProps)

Experimental.

func NewEventBridgePutEvents_Override

func NewEventBridgePutEvents_Override(e EventBridgePutEvents, entry *EventBridgePutEventsEntry, props *ScheduleTargetBaseProps)

Experimental.

func NewInspectorStartAssessmentRun_Override

func NewInspectorStartAssessmentRun_Override(i InspectorStartAssessmentRun, template awsinspector.CfnAssessmentTemplate, props *ScheduleTargetBaseProps)

Experimental.

func NewKinesisDataFirehosePutRecord_Override

func NewKinesisDataFirehosePutRecord_Override(k KinesisDataFirehosePutRecord, deliveryStream awscdkkinesisfirehosealpha.IDeliveryStream, props *ScheduleTargetBaseProps)

Experimental.

func NewKinesisStreamPutRecord_Override

func NewKinesisStreamPutRecord_Override(k KinesisStreamPutRecord, stream awskinesis.IStream, props *KinesisStreamPutRecordProps)

Experimental.

func NewLambdaInvoke_Override

func NewLambdaInvoke_Override(l LambdaInvoke, func_ awslambda.IFunction, props *ScheduleTargetBaseProps)

Experimental.

func NewSageMakerStartPipelineExecution_Override

func NewSageMakerStartPipelineExecution_Override(s SageMakerStartPipelineExecution, pipeline awssagemaker.IPipeline, props *SageMakerStartPipelineExecutionProps)

Experimental.

func NewScheduleTargetBase_Override

func NewScheduleTargetBase_Override(s ScheduleTargetBase, baseProps *ScheduleTargetBaseProps, targetArn *string)

Experimental.

func NewSnsPublish_Override

func NewSnsPublish_Override(s SnsPublish, topic awssns.ITopic, props *ScheduleTargetBaseProps)

Experimental.

func NewSqsSendMessage_Override

func NewSqsSendMessage_Override(s SqsSendMessage, queue awssqs.IQueue, props *SqsSendMessageProps)

Experimental.

func NewStepFunctionsStartExecution_Override

func NewStepFunctionsStartExecution_Override(s StepFunctionsStartExecution, stateMachine awsstepfunctions.IStateMachine, props *ScheduleTargetBaseProps)

Experimental.

Types

type CodeBuildStartBuild

type CodeBuildStartBuild interface {
	ScheduleTargetBase
	awscdkscheduleralpha.IScheduleTarget
	// Experimental.
	TargetArn() *string
	// Experimental.
	AddTargetActionToRole(role awsiam.IRole)
	// Create a return a Schedule Target Configuration for the given schedule.
	//
	// Returns: a Schedule Target Configuration.
	// Experimental.
	Bind(schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
	// Experimental.
	BindBaseTargetConfig(_schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
}

Use an AWS CodeBuild as a target for AWS EventBridge Scheduler.

Example:

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

var project project

awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(60))),
	Target: targets.NewCodeBuildStartBuild(project),
})

Experimental.

func NewCodeBuildStartBuild

func NewCodeBuildStartBuild(project awscodebuild.IProject, props *ScheduleTargetBaseProps) CodeBuildStartBuild

Experimental.

type CodePipelineStartPipelineExecution

type CodePipelineStartPipelineExecution interface {
	ScheduleTargetBase
	awscdkscheduleralpha.IScheduleTarget
	// Experimental.
	TargetArn() *string
	// Experimental.
	AddTargetActionToRole(role awsiam.IRole)
	// Create a return a Schedule Target Configuration for the given schedule.
	//
	// Returns: a Schedule Target Configuration.
	// Experimental.
	Bind(schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
	// Experimental.
	BindBaseTargetConfig(_schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
}

Use an AWS CodePipeline pipeline as a target for AWS EventBridge Scheduler.

Example:

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

var pipeline pipeline

awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(60))),
	Target: targets.NewCodePipelineStartPipelineExecution(pipeline),
})

Experimental.

func NewCodePipelineStartPipelineExecution

func NewCodePipelineStartPipelineExecution(pipeline awscodepipeline.IPipeline, props *ScheduleTargetBaseProps) CodePipelineStartPipelineExecution

Experimental.

type EventBridgePutEvents

type EventBridgePutEvents interface {
	ScheduleTargetBase
	awscdkscheduleralpha.IScheduleTarget
	// Experimental.
	TargetArn() *string
	// Experimental.
	AddTargetActionToRole(role awsiam.IRole)
	// Create a return a Schedule Target Configuration for the given schedule.
	//
	// Returns: a Schedule Target Configuration.
	// Experimental.
	Bind(schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
	// Experimental.
	BindBaseTargetConfig(_schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
}

Send an event to an AWS EventBridge by AWS EventBridge Scheduler.

Example:

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

eventBus := events.NewEventBus(this, jsii.String("EventBus"), &EventBusProps{
	EventBusName: jsii.String("DomainEvents"),
})

eventEntry := &EventBridgePutEventsEntry{
	EventBus: EventBus,
	Source: jsii.String("PetService"),
	Detail: awscdkscheduleralpha.ScheduleTargetInput_FromObject(map[string]*string{
		"Name": jsii.String("Fluffy"),
	}),
	DetailType: jsii.String("🐶"),
}

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

Experimental.

func NewEventBridgePutEvents

func NewEventBridgePutEvents(entry *EventBridgePutEventsEntry, props *ScheduleTargetBaseProps) EventBridgePutEvents

Experimental.

type EventBridgePutEventsEntry

type EventBridgePutEventsEntry struct {
	// The event body.
	//
	// Can either be provided as an object or as a JSON-serialized string.
	//
	// Example:
	//   awscdkscheduleralpha.ScheduleTargetInput_FromText(jsii.String("{\"instance-id\": \"i-1234567890abcdef0\", \"state\": \"terminated\"}"))
	//   awscdkscheduleralpha.ScheduleTargetInput_FromObject(map[string]*string{
	//   	"Message": jsii.String("Hello from a friendly event :)"),
	//   })
	//
	// Experimental.
	Detail awscdkscheduleralpha.ScheduleTargetInput `field:"required" json:"detail" yaml:"detail"`
	// Used along with the source field to help identify the fields and values expected in the detail field.
	//
	// For example, events by CloudTrail have detail type "AWS API Call via CloudTrail".
	// See: https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-events.html
	//
	// Experimental.
	DetailType *string `field:"required" json:"detailType" yaml:"detailType"`
	// The event bus the entry will be sent to.
	// Experimental.
	EventBus awsevents.IEventBus `field:"required" json:"eventBus" yaml:"eventBus"`
	// The service or application that caused this event to be generated.
	//
	// Example value: `com.example.service`
	// See: https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-events.html
	//
	// Experimental.
	Source *string `field:"required" json:"source" yaml:"source"`
}

An entry to be sent to EventBridge.

Example:

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

eventBus := events.NewEventBus(this, jsii.String("EventBus"), &EventBusProps{
	EventBusName: jsii.String("DomainEvents"),
})

eventEntry := &EventBridgePutEventsEntry{
	EventBus: EventBus,
	Source: jsii.String("PetService"),
	Detail: awscdkscheduleralpha.ScheduleTargetInput_FromObject(map[string]*string{
		"Name": jsii.String("Fluffy"),
	}),
	DetailType: jsii.String("🐶"),
}

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

See: https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_PutEventsRequestEntry.html

Experimental.

type InspectorStartAssessmentRun

type InspectorStartAssessmentRun interface {
	ScheduleTargetBase
	awscdkscheduleralpha.IScheduleTarget
	// Experimental.
	TargetArn() *string
	// Experimental.
	AddTargetActionToRole(role awsiam.IRole)
	// Create a return a Schedule Target Configuration for the given schedule.
	//
	// Returns: a Schedule Target Configuration.
	// Experimental.
	Bind(schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
	// Experimental.
	BindBaseTargetConfig(_schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
}

Use an Amazon Inspector as a target for AWS EventBridge Scheduler.

Example:

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

var assessmentTemplate cfnAssessmentTemplate

awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(60))),
	Target: targets.NewInspectorStartAssessmentRun(assessmentTemplate),
})

Experimental.

func NewInspectorStartAssessmentRun

func NewInspectorStartAssessmentRun(template awsinspector.CfnAssessmentTemplate, props *ScheduleTargetBaseProps) InspectorStartAssessmentRun

Experimental.

type KinesisDataFirehosePutRecord

type KinesisDataFirehosePutRecord interface {
	ScheduleTargetBase
	awscdkscheduleralpha.IScheduleTarget
	// Experimental.
	TargetArn() *string
	// Experimental.
	AddTargetActionToRole(role awsiam.IRole)
	// Create a return a Schedule Target Configuration for the given schedule.
	//
	// Returns: a Schedule Target Configuration.
	// Experimental.
	Bind(schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
	// Experimental.
	BindBaseTargetConfig(_schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
}

Use an Amazon Kinesis Data Firehose as a target for AWS EventBridge Scheduler.

Example:

import firehose "github.com/aws/aws-cdk-go/awscdkkinesisfirehosealpha"
var deliveryStream iDeliveryStream

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 NewKinesisDataFirehosePutRecord

func NewKinesisDataFirehosePutRecord(deliveryStream awscdkkinesisfirehosealpha.IDeliveryStream, props *ScheduleTargetBaseProps) KinesisDataFirehosePutRecord

Experimental.

type KinesisStreamPutRecord

type KinesisStreamPutRecord interface {
	ScheduleTargetBase
	awscdkscheduleralpha.IScheduleTarget
	// Experimental.
	TargetArn() *string
	// Experimental.
	AddTargetActionToRole(role awsiam.IRole)
	// Create a return a Schedule Target Configuration for the given schedule.
	//
	// Returns: a Schedule Target Configuration.
	// Experimental.
	Bind(schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
	// Experimental.
	BindBaseTargetConfig(_schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
}

Use an Amazon Kinesis Data Streams as a target for AWS EventBridge Scheduler.

Example:

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

stream := kinesis.NewStream(this, jsii.String("MyStream"))

awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(60))),
	Target: targets.NewKinesisStreamPutRecord(stream, &KinesisStreamPutRecordProps{
		PartitionKey: jsii.String("key"),
	}),
})

Experimental.

func NewKinesisStreamPutRecord

func NewKinesisStreamPutRecord(stream awskinesis.IStream, props *KinesisStreamPutRecordProps) KinesisStreamPutRecord

Experimental.

type KinesisStreamPutRecordProps

type KinesisStreamPutRecordProps struct {
	// The SQS queue to be used as deadLetterQueue.
	//
	// The events not successfully delivered are automatically retried for a specified period of time,
	// depending on the retry policy of the target.
	// If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue.
	// Default: - no dead-letter queue.
	//
	// Experimental.
	DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"`
	// Input passed to the target.
	// Default: - no input.
	//
	// Experimental.
	Input awscdkscheduleralpha.ScheduleTargetInput `field:"optional" json:"input" yaml:"input"`
	// The maximum age of a request that Scheduler sends to a target for processing.
	//
	// Minimum value of 60.
	// Maximum value of 86400.
	// Default: Duration.hours(24)
	//
	// Experimental.
	MaxEventAge awscdk.Duration `field:"optional" json:"maxEventAge" yaml:"maxEventAge"`
	// The maximum number of times to retry when the target returns an error.
	//
	// Minimum value of 0.
	// Maximum value of 185.
	// Default: 185.
	//
	// Experimental.
	RetryAttempts *float64 `field:"optional" json:"retryAttempts" yaml:"retryAttempts"`
	// An execution role is an IAM role that EventBridge Scheduler assumes in order to interact with other AWS services on your behalf.
	//
	// If none provided templates target will 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.
	// Default: - created by target.
	//
	// Experimental.
	Role awsiam.IRole `field:"optional" json:"role" yaml:"role"`
	// The shard to which EventBridge Scheduler sends the event.
	//
	// The length must be between 1 and 256.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-scheduler-schedule-kinesisparameters.html
	//
	// Experimental.
	PartitionKey *string `field:"required" json:"partitionKey" yaml:"partitionKey"`
}

Properties for a Kinesis Data Streams Target.

Example:

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

stream := kinesis.NewStream(this, jsii.String("MyStream"))

awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(60))),
	Target: targets.NewKinesisStreamPutRecord(stream, &KinesisStreamPutRecordProps{
		PartitionKey: jsii.String("key"),
	}),
})

Experimental.

type LambdaInvoke

type LambdaInvoke interface {
	ScheduleTargetBase
	awscdkscheduleralpha.IScheduleTarget
	// Experimental.
	TargetArn() *string
	// Experimental.
	AddTargetActionToRole(role awsiam.IRole)
	// Create a return a Schedule Target Configuration for the given schedule.
	//
	// Returns: a Schedule Target Configuration.
	// Experimental.
	Bind(schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
	// Experimental.
	BindBaseTargetConfig(_schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
}

Use an AWS Lambda function as a target for AWS EventBridge Scheduler.

Example:

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 a lambda function every 10 minutes."),
})

Experimental.

func NewLambdaInvoke

func NewLambdaInvoke(func_ awslambda.IFunction, props *ScheduleTargetBaseProps) LambdaInvoke

Experimental.

type SageMakerPipelineParameter

type SageMakerPipelineParameter struct {
	// Name of parameter to start execution of a SageMaker Model Building Pipeline.
	// Experimental.
	Name *string `field:"required" json:"name" yaml:"name"`
	// Value of parameter to start execution of a SageMaker Model Building Pipeline.
	// Experimental.
	Value *string `field:"required" json:"value" yaml:"value"`
}

Properties for a pipeline parameter.

Example:

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

sageMakerPipelineParameter := &SageMakerPipelineParameter{
	Name: jsii.String("name"),
	Value: jsii.String("value"),
}

Experimental.

type SageMakerStartPipelineExecution

type SageMakerStartPipelineExecution interface {
	ScheduleTargetBase
	awscdkscheduleralpha.IScheduleTarget
	// Experimental.
	TargetArn() *string
	// Experimental.
	AddTargetActionToRole(role awsiam.IRole)
	// Create a return a Schedule Target Configuration for the given schedule.
	//
	// Returns: a Schedule Target Configuration.
	// Experimental.
	Bind(schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
	// Experimental.
	BindBaseTargetConfig(schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
}

Use a SageMaker pipeline as a target for AWS EventBridge Scheduler.

Example:

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

var pipeline iPipeline

awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(60))),
	Target: targets.NewSageMakerStartPipelineExecution(pipeline, &SageMakerStartPipelineExecutionProps{
		PipelineParameterList: []sageMakerPipelineParameter{
			&sageMakerPipelineParameter{
				Name: jsii.String("parameter-name"),
				Value: jsii.String("parameter-value"),
			},
		},
	}),
})

Experimental.

func NewSageMakerStartPipelineExecution

func NewSageMakerStartPipelineExecution(pipeline awssagemaker.IPipeline, props *SageMakerStartPipelineExecutionProps) SageMakerStartPipelineExecution

Experimental.

type SageMakerStartPipelineExecutionProps

type SageMakerStartPipelineExecutionProps struct {
	// The SQS queue to be used as deadLetterQueue.
	//
	// The events not successfully delivered are automatically retried for a specified period of time,
	// depending on the retry policy of the target.
	// If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue.
	// Default: - no dead-letter queue.
	//
	// Experimental.
	DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"`
	// Input passed to the target.
	// Default: - no input.
	//
	// Experimental.
	Input awscdkscheduleralpha.ScheduleTargetInput `field:"optional" json:"input" yaml:"input"`
	// The maximum age of a request that Scheduler sends to a target for processing.
	//
	// Minimum value of 60.
	// Maximum value of 86400.
	// Default: Duration.hours(24)
	//
	// Experimental.
	MaxEventAge awscdk.Duration `field:"optional" json:"maxEventAge" yaml:"maxEventAge"`
	// The maximum number of times to retry when the target returns an error.
	//
	// Minimum value of 0.
	// Maximum value of 185.
	// Default: 185.
	//
	// Experimental.
	RetryAttempts *float64 `field:"optional" json:"retryAttempts" yaml:"retryAttempts"`
	// An execution role is an IAM role that EventBridge Scheduler assumes in order to interact with other AWS services on your behalf.
	//
	// If none provided templates target will 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.
	// Default: - created by target.
	//
	// Experimental.
	Role awsiam.IRole `field:"optional" json:"role" yaml:"role"`
	// List of parameter names and values to use when executing the SageMaker Model Building Pipeline.
	//
	// The length must be between 0 and 200.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-scheduler-schedule-sagemakerpipelineparameters.html#cfn-scheduler-schedule-sagemakerpipelineparameters-pipelineparameterlist
	//
	// Default: - no pipeline parameter list.
	//
	// Experimental.
	PipelineParameterList *[]*SageMakerPipelineParameter `field:"optional" json:"pipelineParameterList" yaml:"pipelineParameterList"`
}

Properties for a SageMaker Target.

Example:

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

var pipeline iPipeline

awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(60))),
	Target: targets.NewSageMakerStartPipelineExecution(pipeline, &SageMakerStartPipelineExecutionProps{
		PipelineParameterList: []sageMakerPipelineParameter{
			&sageMakerPipelineParameter{
				Name: jsii.String("parameter-name"),
				Value: jsii.String("parameter-value"),
			},
		},
	}),
})

Experimental.

type ScheduleTargetBase

type ScheduleTargetBase interface {
	// Experimental.
	TargetArn() *string
	// Experimental.
	AddTargetActionToRole(role awsiam.IRole)
	// Create a return a Schedule Target Configuration for the given schedule.
	//
	// Returns: a Schedule Target Configuration.
	// Experimental.
	Bind(schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
	// Experimental.
	BindBaseTargetConfig(_schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
}

Base class for Schedule Targets. Experimental.

type ScheduleTargetBaseProps

type ScheduleTargetBaseProps struct {
	// The SQS queue to be used as deadLetterQueue.
	//
	// The events not successfully delivered are automatically retried for a specified period of time,
	// depending on the retry policy of the target.
	// If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue.
	// Default: - no dead-letter queue.
	//
	// Experimental.
	DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"`
	// Input passed to the target.
	// Default: - no input.
	//
	// Experimental.
	Input awscdkscheduleralpha.ScheduleTargetInput `field:"optional" json:"input" yaml:"input"`
	// The maximum age of a request that Scheduler sends to a target for processing.
	//
	// Minimum value of 60.
	// Maximum value of 86400.
	// Default: Duration.hours(24)
	//
	// Experimental.
	MaxEventAge awscdk.Duration `field:"optional" json:"maxEventAge" yaml:"maxEventAge"`
	// The maximum number of times to retry when the target returns an error.
	//
	// Minimum value of 0.
	// Maximum value of 185.
	// Default: 185.
	//
	// Experimental.
	RetryAttempts *float64 `field:"optional" json:"retryAttempts" yaml:"retryAttempts"`
	// An execution role is an IAM role that EventBridge Scheduler assumes in order to interact with other AWS services on your behalf.
	//
	// If none provided templates target will 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.
	// Default: - created by target.
	//
	// Experimental.
	Role awsiam.IRole `field:"optional" json:"role" yaml:"role"`
}

Base properties for a Schedule Target.

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.

type SnsPublish

type SnsPublish interface {
	ScheduleTargetBase
	awscdkscheduleralpha.IScheduleTarget
	// Experimental.
	TargetArn() *string
	// Experimental.
	AddTargetActionToRole(role awsiam.IRole)
	// Create a return a Schedule Target Configuration for the given schedule.
	//
	// Returns: a Schedule Target Configuration.
	// Experimental.
	Bind(schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
	// Experimental.
	BindBaseTargetConfig(_schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
}

Use an Amazon SNS topic as a target for AWS EventBridge Scheduler.

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 NewSnsPublish

func NewSnsPublish(topic awssns.ITopic, props *ScheduleTargetBaseProps) SnsPublish

Experimental.

type SqsSendMessage

type SqsSendMessage interface {
	ScheduleTargetBase
	awscdkscheduleralpha.IScheduleTarget
	// Experimental.
	TargetArn() *string
	// Experimental.
	AddTargetActionToRole(role awsiam.IRole)
	// Create a return a Schedule Target Configuration for the given schedule.
	//
	// Returns: a Schedule Target Configuration.
	// Experimental.
	Bind(schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
	// Experimental.
	BindBaseTargetConfig(_schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
}

Use an Amazon SQS Queue as a target for AWS EventBridge Scheduler.

Example:

payload := "test"
messageGroupId := "id"
queue := sqs.NewQueue(this, jsii.String("MyQueue"), &QueueProps{
	Fifo: jsii.Boolean(true),
	ContentBasedDeduplication: jsii.Boolean(true),
})

target := targets.NewSqsSendMessage(queue, &SqsSendMessageProps{
	Input: awscdkscheduleralpha.ScheduleTargetInput_FromText(payload),
	MessageGroupId: jsii.String(MessageGroupId),
})

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

Experimental.

func NewSqsSendMessage

func NewSqsSendMessage(queue awssqs.IQueue, props *SqsSendMessageProps) SqsSendMessage

Experimental.

type SqsSendMessageProps

type SqsSendMessageProps struct {
	// The SQS queue to be used as deadLetterQueue.
	//
	// The events not successfully delivered are automatically retried for a specified period of time,
	// depending on the retry policy of the target.
	// If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue.
	// Default: - no dead-letter queue.
	//
	// Experimental.
	DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"`
	// Input passed to the target.
	// Default: - no input.
	//
	// Experimental.
	Input awscdkscheduleralpha.ScheduleTargetInput `field:"optional" json:"input" yaml:"input"`
	// The maximum age of a request that Scheduler sends to a target for processing.
	//
	// Minimum value of 60.
	// Maximum value of 86400.
	// Default: Duration.hours(24)
	//
	// Experimental.
	MaxEventAge awscdk.Duration `field:"optional" json:"maxEventAge" yaml:"maxEventAge"`
	// The maximum number of times to retry when the target returns an error.
	//
	// Minimum value of 0.
	// Maximum value of 185.
	// Default: 185.
	//
	// Experimental.
	RetryAttempts *float64 `field:"optional" json:"retryAttempts" yaml:"retryAttempts"`
	// An execution role is an IAM role that EventBridge Scheduler assumes in order to interact with other AWS services on your behalf.
	//
	// If none provided templates target will 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.
	// Default: - created by target.
	//
	// Experimental.
	Role awsiam.IRole `field:"optional" json:"role" yaml:"role"`
	// The FIFO message group ID to use as the target.
	//
	// This must be specified when the target is a FIFO queue. If you specify
	// a FIFO queue as a target, the queue must have content-based deduplication enabled.
	//
	// A length of `messageGroupId` must be between 1 and 128.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-scheduler-schedule-sqsparameters.html#cfn-scheduler-schedule-sqsparameters-messagegroupid
	//
	// Default: - no message group ID.
	//
	// Experimental.
	MessageGroupId *string `field:"optional" json:"messageGroupId" yaml:"messageGroupId"`
}

Properties for a SQS Queue Target.

Example:

payload := "test"
messageGroupId := "id"
queue := sqs.NewQueue(this, jsii.String("MyQueue"), &QueueProps{
	Fifo: jsii.Boolean(true),
	ContentBasedDeduplication: jsii.Boolean(true),
})

target := targets.NewSqsSendMessage(queue, &SqsSendMessageProps{
	Input: awscdkscheduleralpha.ScheduleTargetInput_FromText(payload),
	MessageGroupId: jsii.String(MessageGroupId),
})

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

Experimental.

type StepFunctionsStartExecution

type StepFunctionsStartExecution interface {
	ScheduleTargetBase
	awscdkscheduleralpha.IScheduleTarget
	// Experimental.
	TargetArn() *string
	// Experimental.
	AddTargetActionToRole(role awsiam.IRole)
	// Create a return a Schedule Target Configuration for the given schedule.
	//
	// Returns: a Schedule Target Configuration.
	// Experimental.
	Bind(schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
	// Experimental.
	BindBaseTargetConfig(_schedule awscdkscheduleralpha.ISchedule) *awscdkscheduleralpha.ScheduleTargetConfig
}

Use an AWS Step function as a target for AWS EventBridge Scheduler.

Example:

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

payload := map[string]*string{
	"Name": jsii.String("MyParameter"),
	"Value": jsii.String("🌥️"),
}

putParameterStep := tasks.NewCallAwsService(this, jsii.String("PutParameter"), &CallAwsServiceProps{
	Service: jsii.String("ssm"),
	Action: jsii.String("putParameter"),
	IamResources: []*string{
		jsii.String("*"),
	},
	Parameters: map[string]interface{}{
		"Name.$": jsii.String("$.Name"),
		"Value.$": jsii.String("$.Value"),
		"Type": jsii.String("String"),
		"Overwrite": jsii.Boolean(true),
	},
})

stateMachine := sfn.NewStateMachine(this, jsii.String("StateMachine"), &StateMachineProps{
	DefinitionBody: sfn.DefinitionBody_FromChainable(putParameterStep),
})

awscdkscheduleralpha.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdkscheduleralpha.ScheduleExpression_Rate(awscdk.Duration_Hours(jsii.Number(1))),
	Target: targets.NewStepFunctionsStartExecution(stateMachine, &ScheduleTargetBaseProps{
		Input: awscdkscheduleralpha.ScheduleTargetInput_FromObject(payload),
	}),
})

Experimental.

func NewStepFunctionsStartExecution

func NewStepFunctionsStartExecution(stateMachine awsstepfunctions.IStateMachine, props *ScheduleTargetBaseProps) StepFunctionsStartExecution

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