See: Description
| Interface | Description |
|---|---|
| ApiGatewayProps |
(experimental) Customize the API Gateway Event Target.
|
| AwsApiInput |
(experimental) Rule target input for an AwsApi target.
|
| AwsApiProps |
(experimental) Properties for an AwsApi target.
|
| BatchJobProps |
(experimental) Customize the Batch Job Event Target.
|
| CodeBuildProjectProps |
(experimental) Customize the CodeBuild Event Target.
|
| CodePipelineTargetOptions |
(experimental) Customization options when creating a
CodePipeline event target. |
| ContainerOverride | |
| EcsTaskProps |
(experimental) Properties to define an ECS Event Task.
|
| EventBusProps |
(experimental) Configuration properties of an Event Bus event.
|
| KinesisFirehoseStreamProps |
(experimental) Customize the Firehose Stream Event Target.
|
| KinesisStreamProps |
(experimental) Customize the Kinesis Stream Event Target.
|
| LambdaFunctionProps |
(experimental) Customize the Lambda Event Target.
|
| LogGroupProps |
(experimental) Customize the CloudWatch LogGroup Event Target.
|
| SfnStateMachineProps |
(experimental) Customize the Step Functions State Machine target.
|
| SnsTopicProps |
(experimental) Customize the SNS Topic Event Target.
|
| SqsQueueProps |
(experimental) Customize the SQS Queue Event Target.
|
| TargetBaseProps |
(experimental) The generic properties for an RuleTarget.
|
| TaskEnvironmentVariable |
(experimental) An environment variable to be set in the container run as a task.
|
| Class | Description |
|---|---|
| ApiGateway |
(experimental) Use an API Gateway REST APIs as a target for Amazon EventBridge rules.
|
| ApiGateway.Builder |
(experimental) A fluent builder for
ApiGateway. |
| ApiGatewayProps.Builder |
A builder for
ApiGatewayProps |
| ApiGatewayProps.Jsii$Proxy |
An implementation for
ApiGatewayProps |
| AwsApi |
(experimental) Use an AWS Lambda function that makes API calls as an event rule target.
|
| AwsApi.Builder |
(experimental) A fluent builder for
AwsApi. |
| AwsApiInput.Builder |
A builder for
AwsApiInput |
| AwsApiInput.Jsii$Proxy |
An implementation for
AwsApiInput |
| AwsApiProps.Builder |
A builder for
AwsApiProps |
| AwsApiProps.Jsii$Proxy |
An implementation for
AwsApiProps |
| BatchJob |
(experimental) Use an AWS Batch Job / Queue as an event rule target.
|
| BatchJob.Builder |
(experimental) A fluent builder for
BatchJob. |
| BatchJobProps.Builder |
A builder for
BatchJobProps |
| BatchJobProps.Jsii$Proxy |
An implementation for
BatchJobProps |
| CloudWatchLogGroup |
(experimental) Use an AWS CloudWatch LogGroup as an event rule target.
|
| CloudWatchLogGroup.Builder |
(experimental) A fluent builder for
CloudWatchLogGroup. |
| CodeBuildProject |
(experimental) Start a CodeBuild build when an Amazon EventBridge rule is triggered.
|
| CodeBuildProject.Builder |
(experimental) A fluent builder for
CodeBuildProject. |
| CodeBuildProjectProps.Builder |
A builder for
CodeBuildProjectProps |
| CodeBuildProjectProps.Jsii$Proxy |
An implementation for
CodeBuildProjectProps |
| CodePipeline |
(experimental) Allows the pipeline to be used as an EventBridge rule target.
|
| CodePipeline.Builder |
(experimental) A fluent builder for
CodePipeline. |
| CodePipelineTargetOptions.Builder |
A builder for
CodePipelineTargetOptions |
| CodePipelineTargetOptions.Jsii$Proxy |
An implementation for
CodePipelineTargetOptions |
| ContainerOverride.Builder |
A builder for
ContainerOverride |
| ContainerOverride.Jsii$Proxy |
An implementation for
ContainerOverride |
| EcsTask |
(experimental) Start a task on an ECS cluster.
|
| EcsTask.Builder |
(experimental) A fluent builder for
EcsTask. |
| EcsTaskProps.Builder |
A builder for
EcsTaskProps |
| EcsTaskProps.Jsii$Proxy |
An implementation for
EcsTaskProps |
| EventBus |
(experimental) Notify an existing Event Bus of an event.
|
| EventBus.Builder |
(experimental) A fluent builder for
EventBus. |
| EventBusProps.Builder |
A builder for
EventBusProps |
| EventBusProps.Jsii$Proxy |
An implementation for
EventBusProps |
| KinesisFirehoseStream |
(experimental) Customize the Firehose Stream Event Target.
|
| KinesisFirehoseStream.Builder |
(experimental) A fluent builder for
KinesisFirehoseStream. |
| KinesisFirehoseStreamProps.Builder |
A builder for
KinesisFirehoseStreamProps |
| KinesisFirehoseStreamProps.Jsii$Proxy |
An implementation for
KinesisFirehoseStreamProps |
| KinesisStream |
(experimental) Use a Kinesis Stream as a target for AWS CloudWatch event rules.
|
| KinesisStream.Builder |
(experimental) A fluent builder for
KinesisStream. |
| KinesisStreamProps.Builder |
A builder for
KinesisStreamProps |
| KinesisStreamProps.Jsii$Proxy |
An implementation for
KinesisStreamProps |
| LambdaFunction |
(experimental) Use an AWS Lambda function as an event rule target.
|
| LambdaFunction.Builder |
(experimental) A fluent builder for
LambdaFunction. |
| LambdaFunctionProps.Builder |
A builder for
LambdaFunctionProps |
| LambdaFunctionProps.Jsii$Proxy |
An implementation for
LambdaFunctionProps |
| LogGroupProps.Builder |
A builder for
LogGroupProps |
| LogGroupProps.Jsii$Proxy |
An implementation for
LogGroupProps |
| SfnStateMachine |
(experimental) Use a StepFunctions state machine as a target for Amazon EventBridge rules.
|
| SfnStateMachine.Builder |
(experimental) A fluent builder for
SfnStateMachine. |
| SfnStateMachineProps.Builder |
A builder for
SfnStateMachineProps |
| SfnStateMachineProps.Jsii$Proxy |
An implementation for
SfnStateMachineProps |
| SnsTopic |
(experimental) Use an SNS topic as a target for Amazon EventBridge rules.
|
| SnsTopic.Builder |
(experimental) A fluent builder for
SnsTopic. |
| SnsTopicProps.Builder |
A builder for
SnsTopicProps |
| SnsTopicProps.Jsii$Proxy |
An implementation for
SnsTopicProps |
| SqsQueue |
(experimental) Use an SQS Queue as a target for Amazon EventBridge rules.
|
| SqsQueue.Builder |
(experimental) A fluent builder for
SqsQueue. |
| SqsQueueProps.Builder |
A builder for
SqsQueueProps |
| SqsQueueProps.Jsii$Proxy |
An implementation for
SqsQueueProps |
| TargetBaseProps.Builder |
A builder for
TargetBaseProps |
| TargetBaseProps.Jsii$Proxy |
An implementation for
TargetBaseProps |
| TaskEnvironmentVariable.Builder |
A builder for
TaskEnvironmentVariable |
| TaskEnvironmentVariable.Jsii$Proxy |
An implementation for
TaskEnvironmentVariable |
---
This library contains integration classes to send Amazon EventBridge to any
number of supported AWS Services. Instances of these classes should be passed
to the rule.addTarget() method.
Currently supported are:
See the README of the @aws-cdk/aws-events library for more information on
EventBridge.
The Codebuild, CodePipeline, Lambda, StepFunctions and LogGroup targets support attaching a dead letter queue and setting retry policies. See the lambda example. Use escape hatches for the other target types.
Use the LambdaFunction target to invoke a lambda function.
The code snippet below creates an event rule with a Lambda function as a target
triggered for every events from aws.ec2 source. You can optionally attach a
dead letter queue.
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
import software.amazon.awscdk.aws_lambda;
import software.amazon.awscdk.aws_events;
import software.amazon.awscdk.aws_sqs;
import software.amazon.awscdk.aws_events_targets;
import software.amazon.awscdk.*;
Function fn = new Function(this, "MyFunc", new FunctionProps()
.runtime(lambda.Runtime.getNODEJS_12_X())
.handler("index.handler")
.code(lambda.Code.fromInline(String.format("exports.handler = %s", handler.toString()))));
Rule rule = new Rule(this, "rule", new RuleProps()
.eventPattern(new EventPattern()
.source(asList("aws.ec2"))));
Queue queue = new Queue(this, "Queue");
rule.addTarget(new LambdaFunction(fn, new LambdaFunctionProps()
.deadLetterQueue(queue)// Optional: add a dead letter queue
.maxEventAge(cdk.Duration.hours(2))// Otional: set the maxEventAge retry policy
.retryAttempts(2)));
Use the LogGroup target to log your events in a CloudWatch LogGroup.
For example, the following code snippet creates an event rule with a CloudWatch LogGroup as a target.
Every events sent from the aws.ec2 source will be sent to the CloudWatch LogGroup.
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
import software.amazon.awscdk.aws_logs;
import software.amazon.awscdk.aws_events;
import software.amazon.awscdk.aws_events_targets;
LogGroup logGroup = new LogGroup(this, "MyLogGroup", new LogGroupProps()
.logGroupName("MyLogGroup"));
Rule rule = new Rule(this, "rule", new RuleProps()
.eventPattern(new EventPattern()
.source(asList("aws.ec2"))));
rule.addTarget(new CloudWatchLogGroup(logGroup));
Use the CodeBuildProject target to trigger a CodeBuild project.
The code snippet below creates a CodeCommit repository that triggers a CodeBuild project on commit to the master branch. You can optionally attach a dead letter queue.
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
import aws.sdk.aws.codebuild.*;
import aws.sdk.aws.codecommit.*;
import aws.sdk.aws.sqs.*;
import software.amazon.awscdk.aws_events_targets;
Object repo = Repository.Builder.create(this, "MyRepo")
.repositoryName("aws-cdk-codebuild-events")
.build();
Object project = Project.Builder.create(this, "MyProject")
.source(codebuild.Source.codeCommit(Map.of("repository", repo)))
.build();
Object deadLetterQueue = new Queue(this, "DeadLetterQueue");
// trigger a build when a commit is pushed to the repo
Object onCommitRule = repo.onCommit("OnCommit", Map.of(
"target", new CodeBuildProject(project, new CodeBuildProjectProps()
.deadLetterQueue(deadLetterQueue)),
"branches", asList("master")));
Use the CodePipeline target to trigger a CodePipeline pipeline.
The code snippet below creates a CodePipeline pipeline that is triggered every hour
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
import aws.sdk.aws.codepipeline.*;
import aws.sdk.aws.sqs.*;
Object pipeline = new Pipeline(this, "Pipeline");
Object rule = Rule.Builder.create(stack, "Rule")
.schedule(events.Schedule.expression("rate(1 hour)"))
.build();
rule.addTarget(new CodePipeline(pipeline));
Use the SfnStateMachine target to trigger a State Machine.
The code snippet below creates a Simple StateMachine that is triggered every minute with a dummy object as input. You can optionally attach a dead letter queue to the target.
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
import aws.sdk.aws.iam.*;
import aws.sdk.aws.sqs.*;
import software.amazon.awscdk.aws_stepfunctions;
import software.amazon.awscdk.aws_events_targets;
Object rule = Rule.Builder.create(stack, "Rule")
.schedule(events.Schedule.rate(cdk.Duration.minutes(1)))
.build();
Object dlq = new Queue(stack, "DeadLetterQueue");
Object role = Role.Builder.create(stack, "Role")
.assumedBy(new ServicePrincipal("events.amazonaws.com"))
.build();
StateMachine stateMachine = new StateMachine(stack, "SM", new StateMachineProps()
.definition(new Wait(stack, "Hello", new WaitProps().time(sfn.WaitTime.duration(cdk.Duration.seconds(10)))))
.role(role));
rule.addTarget(new SfnStateMachine(stateMachine, new SfnStateMachineProps()
.input(events.RuleTargetInput.fromObject(Map.of("SomeParam", "SomeValue")))
.deadLetterQueue(dlq)));
Use the ApiGateway target to trigger a REST API.
The code snippet below creates a Api Gateway REST API that is invoked every hour.
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
import aws.sdk.aws.iam.*;
import aws.sdk.aws.sqs.*;
import software.amazon.awscdk.aws_apigateway;
import software.amazon.awscdk.aws_events_targets;
Object rule = Rule.Builder.create(stack, "Rule")
.schedule(events.Schedule.rate(cdk.Duration.minutes(1)))
.build();
Function fn = new Function(this, "MyFunc", new FunctionProps()
.handler("index.handler")
.runtime(lambda.Runtime.getNODEJS_12_X())
.code(lambda.Code.fromInline("exports.handler = e => {}")));
LambdaRestApi restApi = new LambdaRestApi(this, "MyRestAPI", new LambdaRestApiProps().handler(fn));
Object dlq = new Queue(stack, "DeadLetterQueue");
rule.addTarget(
new ApiGateway(restApi, new ApiGatewayProps()
.path("/* /test")
.mehod("GET")
.stage("prod")
.pathParameterValues(asList("path-value"))
.headerParameters(Map.of(
"Header1", "header1"))
.queryStringParameters(Map.of(
"QueryParam1", "query-param-1"))
.deadLetterQueue(queue)));
Copyright © 2021. All rights reserved.