Documentation ¶
Index ¶
- func LogGroupTargetInput_FromObject(options *LogGroupTargetInputOptions) awsevents.RuleTargetInput
- func NewApiDestination_Override(a ApiDestination, apiDestination awsevents.IApiDestination, ...)
- func NewApiGateway_Override(a ApiGateway, restApi awsapigateway.IRestApi, props *ApiGatewayProps)
- func NewAppSync_Override(a AppSync, appsyncApi awsappsync.IGraphqlApi, props *AppSyncGraphQLApiProps)
- func NewAwsApi_Override(a AwsApi, props *AwsApiProps)
- func NewBatchJob_Override(b BatchJob, jobQueueArn *string, jobQueueScope constructs.IConstruct, ...)
- func NewCloudWatchLogGroup_Override(c CloudWatchLogGroup, logGroup awslogs.ILogGroup, props *LogGroupProps)
- func NewCodeBuildProject_Override(c CodeBuildProject, project awscodebuild.IProject, ...)
- func NewCodePipeline_Override(c CodePipeline, pipeline awscodepipeline.IPipeline, ...)
- func NewEcsTask_Override(e EcsTask, props *EcsTaskProps)
- func NewEventBus_Override(e EventBus, eventBus awsevents.IEventBus, props *EventBusProps)
- func NewKinesisFirehoseStreamV2_Override(k KinesisFirehoseStreamV2, stream IDeliveryStream, ...)
- func NewKinesisFirehoseStream_Override(k KinesisFirehoseStream, stream awskinesisfirehose.CfnDeliveryStream, ...)deprecated
- func NewKinesisStream_Override(k KinesisStream, stream awskinesis.IStream, props *KinesisStreamProps)
- func NewLambdaFunction_Override(l LambdaFunction, handler awslambda.IFunction, props *LambdaFunctionProps)
- func NewLogGroupTargetInput_Override(l LogGroupTargetInput)
- func NewRedshiftQuery_Override(r RedshiftQuery, clusterArn *string, props *RedshiftQueryProps)
- func NewSfnStateMachine_Override(s SfnStateMachine, machine awsstepfunctions.IStateMachine, ...)
- func NewSnsTopic_Override(s SnsTopic, topic awssns.ITopic, props *SnsTopicProps)
- func NewSqsQueue_Override(s SqsQueue, queue awssqs.IQueue, props *SqsQueueProps)
- type ApiDestination
- type ApiDestinationProps
- type ApiGateway
- type ApiGatewayProps
- type AppSync
- type AppSyncGraphQLApiProps
- type AwsApi
- type AwsApiInput
- type AwsApiProps
- type BatchJob
- type BatchJobProps
- type CloudWatchLogGroup
- type CodeBuildProject
- type CodeBuildProjectProps
- type CodePipeline
- type CodePipelineTargetOptions
- type ContainerOverride
- type EcsTask
- type EcsTaskProps
- type EventBus
- type EventBusProps
- type IDeliveryStream
- type KinesisFirehoseStreamdeprecated
- type KinesisFirehoseStreamProps
- type KinesisFirehoseStreamV2
- type KinesisStream
- type KinesisStreamProps
- type LambdaFunction
- type LambdaFunctionProps
- type LogGroupProps
- type LogGroupTargetInput
- type LogGroupTargetInputOptions
- type RedshiftQuery
- type RedshiftQueryProps
- type SfnStateMachine
- type SfnStateMachineProps
- type SnsTopic
- type SnsTopicProps
- type SqsQueue
- type SqsQueueProps
- type Tag
- type TargetBaseProps
- type TaskEnvironmentVariable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogGroupTargetInput_FromObject ¶ added in v2.29.0
func LogGroupTargetInput_FromObject(options *LogGroupTargetInputOptions) awsevents.RuleTargetInput
Pass a JSON object to the the log group event target.
May contain strings returned by `EventField.from()` to substitute in parts of the matched event.
func NewApiDestination_Override ¶ added in v2.13.0
func NewApiDestination_Override(a ApiDestination, apiDestination awsevents.IApiDestination, props *ApiDestinationProps)
func NewApiGateway_Override ¶
func NewApiGateway_Override(a ApiGateway, restApi awsapigateway.IRestApi, props *ApiGatewayProps)
func NewAppSync_Override ¶ added in v2.142.0
func NewAppSync_Override(a AppSync, appsyncApi awsappsync.IGraphqlApi, props *AppSyncGraphQLApiProps)
func NewAwsApi_Override ¶
func NewAwsApi_Override(a AwsApi, props *AwsApiProps)
func NewBatchJob_Override ¶
func NewBatchJob_Override(b BatchJob, jobQueueArn *string, jobQueueScope constructs.IConstruct, jobDefinitionArn *string, jobDefinitionScope constructs.IConstruct, props *BatchJobProps)
func NewCloudWatchLogGroup_Override ¶
func NewCloudWatchLogGroup_Override(c CloudWatchLogGroup, logGroup awslogs.ILogGroup, props *LogGroupProps)
func NewCodeBuildProject_Override ¶
func NewCodeBuildProject_Override(c CodeBuildProject, project awscodebuild.IProject, props *CodeBuildProjectProps)
func NewCodePipeline_Override ¶
func NewCodePipeline_Override(c CodePipeline, pipeline awscodepipeline.IPipeline, options *CodePipelineTargetOptions)
func NewEcsTask_Override ¶
func NewEcsTask_Override(e EcsTask, props *EcsTaskProps)
func NewEventBus_Override ¶
func NewEventBus_Override(e EventBus, eventBus awsevents.IEventBus, props *EventBusProps)
func NewKinesisFirehoseStreamV2_Override ¶ added in v2.143.0
func NewKinesisFirehoseStreamV2_Override(k KinesisFirehoseStreamV2, stream IDeliveryStream, props *KinesisFirehoseStreamProps)
func NewKinesisFirehoseStream_Override
deprecated
func NewKinesisFirehoseStream_Override(k KinesisFirehoseStream, stream awskinesisfirehose.CfnDeliveryStream, props *KinesisFirehoseStreamProps)
Deprecated: Use KinesisFirehoseStreamV2.
func NewKinesisStream_Override ¶
func NewKinesisStream_Override(k KinesisStream, stream awskinesis.IStream, props *KinesisStreamProps)
func NewLambdaFunction_Override ¶
func NewLambdaFunction_Override(l LambdaFunction, handler awslambda.IFunction, props *LambdaFunctionProps)
func NewLogGroupTargetInput_Override ¶ added in v2.29.0
func NewLogGroupTargetInput_Override(l LogGroupTargetInput)
func NewRedshiftQuery_Override ¶ added in v2.156.0
func NewRedshiftQuery_Override(r RedshiftQuery, clusterArn *string, props *RedshiftQueryProps)
func NewSfnStateMachine_Override ¶
func NewSfnStateMachine_Override(s SfnStateMachine, machine awsstepfunctions.IStateMachine, props *SfnStateMachineProps)
func NewSnsTopic_Override ¶
func NewSnsTopic_Override(s SnsTopic, topic awssns.ITopic, props *SnsTopicProps)
func NewSqsQueue_Override ¶
func NewSqsQueue_Override(s SqsQueue, queue awssqs.IQueue, props *SqsQueueProps)
Types ¶
type ApiDestination ¶ added in v2.13.0
type ApiDestination interface { awsevents.IRuleTarget // Returns a RuleTarget that can be used to trigger API destinations from an EventBridge event. Bind(_rule awsevents.IRule, _id *string) *awsevents.RuleTargetConfig }
Use an API Destination rule target.
Example:
connection := events.NewConnection(this, jsii.String("Connection"), &ConnectionProps{ Authorization: events.Authorization_ApiKey(jsii.String("x-api-key"), awscdk.SecretValue_SecretsManager(jsii.String("ApiSecretName"))), Description: jsii.String("Connection with API Key x-api-key"), }) destination := events.NewApiDestination(this, jsii.String("Destination"), &ApiDestinationProps{ Connection: Connection, Endpoint: jsii.String("https://example.com"), Description: jsii.String("Calling example.com with API key x-api-key"), }) rule := events.NewRule(this, jsii.String("Rule"), &RuleProps{ Schedule: events.Schedule_Rate(awscdk.Duration_Minutes(jsii.Number(1))), Targets: []iRuleTarget{ targets.NewApiDestination(destination), }, })
func NewApiDestination ¶ added in v2.13.0
func NewApiDestination(apiDestination awsevents.IApiDestination, props *ApiDestinationProps) ApiDestination
type ApiDestinationProps ¶ added in v2.13.0
type ApiDestinationProps struct { // The SQS queue to be used as deadLetterQueue. Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). // // 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. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The maximum age of a request that Lambda sends to a function for processing. // // Minimum value of 60. // Maximum value of 86400. // Default: Duration.hours(24) // MaxEventAge awscdk.Duration `field:"optional" json:"maxEventAge" yaml:"maxEventAge"` // The maximum number of times to retry when the function returns an error. // // Minimum value of 0. // Maximum value of 185. // Default: 185. // RetryAttempts *float64 `field:"optional" json:"retryAttempts" yaml:"retryAttempts"` // The event to send. // Default: - the entire EventBridge event. // Event awsevents.RuleTargetInput `field:"optional" json:"event" yaml:"event"` // The role to assume before invoking the target. // Default: - a new role will be created. // EventRole awsiam.IRole `field:"optional" json:"eventRole" yaml:"eventRole"` // Additional headers sent to the API Destination. // // These are merged with headers specified on the Connection, with // the headers on the Connection taking precedence. // // You can only specify secret values on the Connection. // Default: - none. // HeaderParameters *map[string]*string `field:"optional" json:"headerParameters" yaml:"headerParameters"` // Path parameters to insert in place of path wildcards (`*`). // // If the API destination has a wilcard in the path, these path parts // will be inserted in that place. // Default: - none. // PathParameterValues *[]*string `field:"optional" json:"pathParameterValues" yaml:"pathParameterValues"` // Additional query string parameters sent to the API Destination. // // These are merged with headers specified on the Connection, with // the headers on the Connection taking precedence. // // You can only specify secret values on the Connection. // Default: - none. // QueryStringParameters *map[string]*string `field:"optional" json:"queryStringParameters" yaml:"queryStringParameters"` }
Customize the EventBridge Api Destinations Target.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import cdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var queue queue var role role var ruleTargetInput ruleTargetInput apiDestinationProps := &ApiDestinationProps{ DeadLetterQueue: queue, Event: ruleTargetInput, EventRole: role, HeaderParameters: map[string]*string{ "headerParametersKey": jsii.String("headerParameters"), }, MaxEventAge: cdk.Duration_Minutes(jsii.Number(30)), PathParameterValues: []*string{ jsii.String("pathParameterValues"), }, QueryStringParameters: map[string]*string{ "queryStringParametersKey": jsii.String("queryStringParameters"), }, RetryAttempts: jsii.Number(123), }
type ApiGateway ¶
type ApiGateway interface { awsevents.IRuleTarget // Returns the target IRestApi. IRestApi() awsapigateway.IRestApi // Deprecated: Use the `iRestApi` getter instead. RestApi() awsapigateway.RestApi // Returns a RuleTarget that can be used to trigger this API Gateway REST APIs as a result from an EventBridge event. // See: https://docs.aws.amazon.com/eventbridge/latest/userguide/resource-based-policies-eventbridge.html#sqs-permissions // Bind(rule awsevents.IRule, _id *string) *awsevents.RuleTargetConfig }
Use an API Gateway REST APIs as a target for Amazon EventBridge rules.
Example:
import api "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" rule := events.NewRule(this, jsii.String("Rule"), &RuleProps{ Schedule: events.Schedule_Rate(awscdk.Duration_Minutes(jsii.Number(1))), }) fn := lambda.NewFunction(this, jsii.String("MyFunc"), &FunctionProps{ Handler: jsii.String("index.handler"), Runtime: lambda.Runtime_NODEJS_LATEST(), Code: lambda.Code_FromInline(jsii.String("exports.handler = e => {}")), }) restApi := api.NewLambdaRestApi(this, jsii.String("MyRestAPI"), &LambdaRestApiProps{ Handler: fn, }) dlq := sqs.NewQueue(this, jsii.String("DeadLetterQueue")) rule.AddTarget( targets.NewApiGateway(restApi, &ApiGatewayProps{ Path: jsii.String("/*/test"), Method: jsii.String("GET"), Stage: jsii.String("prod"), PathParameterValues: []*string{ jsii.String("path-value"), }, HeaderParameters: map[string]*string{ "Header1": jsii.String("header1"), }, QueryStringParameters: map[string]*string{ "QueryParam1": jsii.String("query-param-1"), }, DeadLetterQueue: dlq, }))
func NewApiGateway ¶
func NewApiGateway(restApi awsapigateway.IRestApi, props *ApiGatewayProps) ApiGateway
type ApiGatewayProps ¶
type ApiGatewayProps struct { // The SQS queue to be used as deadLetterQueue. Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). // // 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. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The maximum age of a request that Lambda sends to a function for processing. // // Minimum value of 60. // Maximum value of 86400. // Default: Duration.hours(24) // MaxEventAge awscdk.Duration `field:"optional" json:"maxEventAge" yaml:"maxEventAge"` // The maximum number of times to retry when the function returns an error. // // Minimum value of 0. // Maximum value of 185. // Default: 185. // RetryAttempts *float64 `field:"optional" json:"retryAttempts" yaml:"retryAttempts"` // The role to assume before invoking the target (i.e., the pipeline) when the given rule is triggered. // Default: - a new role will be created. // EventRole awsiam.IRole `field:"optional" json:"eventRole" yaml:"eventRole"` // The headers to be set when requesting API. // Default: no header parameters. // HeaderParameters *map[string]*string `field:"optional" json:"headerParameters" yaml:"headerParameters"` // The method for api resource invoked by the rule. // Default: '*' that treated as ANY. // Method *string `field:"optional" json:"method" yaml:"method"` // The api resource invoked by the rule. // // We can use wildcards('*') to specify the path. In that case, // an equal number of real values must be specified for pathParameterValues. // Default: '/'. // Path *string `field:"optional" json:"path" yaml:"path"` // The path parameter values to be used to populate to wildcards("*") of requesting api path. // Default: no path parameters. // PathParameterValues *[]*string `field:"optional" json:"pathParameterValues" yaml:"pathParameterValues"` // This will be the post request body send to the API. // Default: the entire EventBridge event. // PostBody awsevents.RuleTargetInput `field:"optional" json:"postBody" yaml:"postBody"` // The query parameters to be set when requesting API. // Default: no querystring parameters. // QueryStringParameters *map[string]*string `field:"optional" json:"queryStringParameters" yaml:"queryStringParameters"` // The deploy stage of api gateway invoked by the rule. // Default: the value of deploymentStage.stageName of target api gateway. // Stage *string `field:"optional" json:"stage" yaml:"stage"` }
Customize the API Gateway Event Target.
Example:
import api "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" rule := events.NewRule(this, jsii.String("Rule"), &RuleProps{ Schedule: events.Schedule_Rate(awscdk.Duration_Minutes(jsii.Number(1))), }) fn := lambda.NewFunction(this, jsii.String("MyFunc"), &FunctionProps{ Handler: jsii.String("index.handler"), Runtime: lambda.Runtime_NODEJS_LATEST(), Code: lambda.Code_FromInline(jsii.String("exports.handler = e => {}")), }) restApi := api.NewLambdaRestApi(this, jsii.String("MyRestAPI"), &LambdaRestApiProps{ Handler: fn, }) dlq := sqs.NewQueue(this, jsii.String("DeadLetterQueue")) rule.AddTarget( targets.NewApiGateway(restApi, &ApiGatewayProps{ Path: jsii.String("/*/test"), Method: jsii.String("GET"), Stage: jsii.String("prod"), PathParameterValues: []*string{ jsii.String("path-value"), }, HeaderParameters: map[string]*string{ "Header1": jsii.String("header1"), }, QueryStringParameters: map[string]*string{ "QueryParam1": jsii.String("query-param-1"), }, DeadLetterQueue: dlq, }))
type AppSync ¶ added in v2.142.0
type AppSync interface { awsevents.IRuleTarget // Returns a RuleTarget that can be used to trigger this AppSync GraphQL API as a result from an EventBridge event. Bind(rule awsevents.IRule, _id *string) *awsevents.RuleTargetConfig }
Use an AppSync GraphQL API as a target for Amazon EventBridge rules.
Example:
import "github.com/aws/aws-cdk-go/awscdk" api := appsync.NewGraphqlApi(this, jsii.String("api"), &GraphqlApiProps{ Name: jsii.String("api"), Definition: appsync.Definition_FromFile(jsii.String("schema.graphql")), AuthorizationConfig: &AuthorizationConfig{ DefaultAuthorization: &AuthorizationMode{ AuthorizationType: appsync.AuthorizationType_IAM, }, }, }) rule := events.NewRule(this, jsii.String("Rule"), &RuleProps{ Schedule: events.Schedule_Rate(cdk.Duration_Hours(jsii.Number(1))), }) rule.AddTarget(targets.NewAppSync(api, &AppSyncGraphQLApiProps{ GraphQLOperation: jsii.String("mutation Publish($message: String!){ publish(message: $message) { message } }"), Variables: events.RuleTargetInput_FromObject(map[string]*string{ "message": jsii.String("hello world"), }), }))
func NewAppSync ¶ added in v2.142.0
func NewAppSync(appsyncApi awsappsync.IGraphqlApi, props *AppSyncGraphQLApiProps) AppSync
type AppSyncGraphQLApiProps ¶ added in v2.142.0
type AppSyncGraphQLApiProps struct { // The SQS queue to be used as deadLetterQueue. Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). // // 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. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The maximum age of a request that Lambda sends to a function for processing. // // Minimum value of 60. // Maximum value of 86400. // Default: Duration.hours(24) // MaxEventAge awscdk.Duration `field:"optional" json:"maxEventAge" yaml:"maxEventAge"` // The maximum number of times to retry when the function returns an error. // // Minimum value of 0. // Maximum value of 185. // Default: 185. // RetryAttempts *float64 `field:"optional" json:"retryAttempts" yaml:"retryAttempts"` // The GraphQL operation; // // that is, the query, mutation, or subscription // to be parsed and executed by the GraphQL service. GraphQLOperation *string `field:"required" json:"graphQLOperation" yaml:"graphQLOperation"` // The role to assume before invoking the target (i.e., the pipeline) when the given rule is triggered. // Default: - a new role with permissions to access mutations will be created. // EventRole awsiam.IRole `field:"optional" json:"eventRole" yaml:"eventRole"` // The variables that are include in the GraphQL operation. // Default: - The entire event is used. // Variables awsevents.RuleTargetInput `field:"optional" json:"variables" yaml:"variables"` }
Customize the AppSync GraphQL API target.
Example:
import "github.com/aws/aws-cdk-go/awscdk" api := appsync.NewGraphqlApi(this, jsii.String("api"), &GraphqlApiProps{ Name: jsii.String("api"), Definition: appsync.Definition_FromFile(jsii.String("schema.graphql")), AuthorizationConfig: &AuthorizationConfig{ DefaultAuthorization: &AuthorizationMode{ AuthorizationType: appsync.AuthorizationType_IAM, }, }, }) rule := events.NewRule(this, jsii.String("Rule"), &RuleProps{ Schedule: events.Schedule_Rate(cdk.Duration_Hours(jsii.Number(1))), }) rule.AddTarget(targets.NewAppSync(api, &AppSyncGraphQLApiProps{ GraphQLOperation: jsii.String("mutation Publish($message: String!){ publish(message: $message) { message } }"), Variables: events.RuleTargetInput_FromObject(map[string]*string{ "message": jsii.String("hello world"), }), }))
type AwsApi ¶
type AwsApi interface { awsevents.IRuleTarget // Returns a RuleTarget that can be used to trigger this AwsApi as a result from an EventBridge event. Bind(rule awsevents.IRule, id *string) *awsevents.RuleTargetConfig }
Use an AWS Lambda function that makes API calls as an event rule target.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var parameters interface{} var policyStatement policyStatement awsApi := awscdk.Aws_events_targets.NewAwsApi(&AwsApiProps{ Action: jsii.String("action"), Service: jsii.String("service"), // the properties below are optional ApiVersion: jsii.String("apiVersion"), CatchErrorPattern: jsii.String("catchErrorPattern"), Parameters: parameters, PolicyStatement: policyStatement, })
func NewAwsApi ¶
func NewAwsApi(props *AwsApiProps) AwsApi
type AwsApiInput ¶
type AwsApiInput struct { // The service action to call. // See: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html // Action *string `field:"required" json:"action" yaml:"action"` // The service to call. // See: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html // Service *string `field:"required" json:"service" yaml:"service"` // API version to use for the service. // Deprecated: the handler code was migrated to AWS SDK for JavaScript v3, which does not support this feature anymore. ApiVersion *string `field:"optional" json:"apiVersion" yaml:"apiVersion"` // The regex pattern to use to catch API errors. // // The `code` property of the // `Error` object will be tested against this pattern. If there is a match an // error will not be thrown. // Default: - do not catch errors. // CatchErrorPattern *string `field:"optional" json:"catchErrorPattern" yaml:"catchErrorPattern"` // The parameters for the service action. // See: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html // // Default: - no parameters. // Parameters interface{} `field:"optional" json:"parameters" yaml:"parameters"` }
Rule target input for an AwsApi target.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" var parameters interface{} awsApiInput := &AwsApiInput{ Action: jsii.String("action"), Service: jsii.String("service"), // the properties below are optional ApiVersion: jsii.String("apiVersion"), CatchErrorPattern: jsii.String("catchErrorPattern"), Parameters: parameters, }
type AwsApiProps ¶
type AwsApiProps struct { // The service action to call. // See: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html // Action *string `field:"required" json:"action" yaml:"action"` // The service to call. // See: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html // Service *string `field:"required" json:"service" yaml:"service"` // API version to use for the service. // Deprecated: the handler code was migrated to AWS SDK for JavaScript v3, which does not support this feature anymore. ApiVersion *string `field:"optional" json:"apiVersion" yaml:"apiVersion"` // The regex pattern to use to catch API errors. // // The `code` property of the // `Error` object will be tested against this pattern. If there is a match an // error will not be thrown. // Default: - do not catch errors. // CatchErrorPattern *string `field:"optional" json:"catchErrorPattern" yaml:"catchErrorPattern"` // The parameters for the service action. // See: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html // // Default: - no parameters. // Parameters interface{} `field:"optional" json:"parameters" yaml:"parameters"` // The IAM policy statement to allow the API call. // // Use only if // resource restriction is needed. // Default: - extract the permission from the API call. // PolicyStatement awsiam.PolicyStatement `field:"optional" json:"policyStatement" yaml:"policyStatement"` }
Properties for an AwsApi target.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var parameters interface{} var policyStatement policyStatement awsApiProps := &AwsApiProps{ Action: jsii.String("action"), Service: jsii.String("service"), // the properties below are optional ApiVersion: jsii.String("apiVersion"), CatchErrorPattern: jsii.String("catchErrorPattern"), Parameters: parameters, PolicyStatement: policyStatement, }
type BatchJob ¶
type BatchJob interface { awsevents.IRuleTarget // Returns a RuleTarget that can be used to trigger queue this batch job as a result from an EventBridge event. Bind(rule awsevents.IRule, _id *string) *awsevents.RuleTargetConfig }
Use an AWS Batch Job / Queue as an event rule target.
Most likely the code will look something like this: `new BatchJob(jobQueue.jobQueueArn, jobQueue, jobDefinition.jobDefinitionArn, jobDefinition)`
In the future this API will be improved to be fully typed.
Example:
import ec2 "github.com/aws/aws-cdk-go/awscdk" import ecs "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var vpc vpc computeEnvironment := batch.NewFargateComputeEnvironment(this, jsii.String("ComputeEnv"), &FargateComputeEnvironmentProps{ Vpc: Vpc, }) jobQueue := batch.NewJobQueue(this, jsii.String("JobQueue"), &JobQueueProps{ Priority: jsii.Number(1), ComputeEnvironments: []orderedComputeEnvironment{ &orderedComputeEnvironment{ ComputeEnvironment: *ComputeEnvironment, Order: jsii.Number(1), }, }, }) jobDefinition := batch.NewEcsJobDefinition(this, jsii.String("MyJob"), &EcsJobDefinitionProps{ Container: batch.NewEcsEc2ContainerDefinition(this, jsii.String("Container"), &EcsEc2ContainerDefinitionProps{ Image: ecs.ContainerImage_FromRegistry(jsii.String("test-repo")), Memory: cdk.Size_Mebibytes(jsii.Number(2048)), Cpu: jsii.Number(256), }), }) queue := sqs.NewQueue(this, jsii.String("Queue")) rule := events.NewRule(this, jsii.String("Rule"), &RuleProps{ Schedule: events.Schedule_Rate(awscdk.Duration_Hours(jsii.Number(1))), }) rule.AddTarget(targets.NewBatchJob(jobQueue.JobQueueArn, jobQueue, jobDefinition.JobDefinitionArn, jobDefinition, &BatchJobProps{ DeadLetterQueue: queue, Event: events.RuleTargetInput_FromObject(map[string]*string{ "SomeParam": jsii.String("SomeValue"), }), RetryAttempts: jsii.Number(2), MaxEventAge: awscdk.Duration_*Hours(jsii.Number(2)), }))
func NewBatchJob ¶
func NewBatchJob(jobQueueArn *string, jobQueueScope constructs.IConstruct, jobDefinitionArn *string, jobDefinitionScope constructs.IConstruct, props *BatchJobProps) BatchJob
type BatchJobProps ¶
type BatchJobProps struct { // The SQS queue to be used as deadLetterQueue. Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). // // 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. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The maximum age of a request that Lambda sends to a function for processing. // // Minimum value of 60. // Maximum value of 86400. // Default: Duration.hours(24) // MaxEventAge awscdk.Duration `field:"optional" json:"maxEventAge" yaml:"maxEventAge"` // The maximum number of times to retry when the function returns an error. // // Minimum value of 0. // Maximum value of 185. // Default: 185. // RetryAttempts *float64 `field:"optional" json:"retryAttempts" yaml:"retryAttempts"` // The number of times to attempt to retry, if the job fails. // // Valid values are 1–10. // Default: no retryStrategy is set. // Attempts *float64 `field:"optional" json:"attempts" yaml:"attempts"` // The event to send to the Lambda. // // This will be the payload sent to the Lambda Function. // Default: the entire EventBridge event. // Event awsevents.RuleTargetInput `field:"optional" json:"event" yaml:"event"` // The name of the submitted job. // Default: - Automatically generated. // JobName *string `field:"optional" json:"jobName" yaml:"jobName"` // The size of the array, if this is an array batch job. // // Valid values are integers between 2 and 10,000. // Default: no arrayProperties are set. // Size *float64 `field:"optional" json:"size" yaml:"size"` }
Customize the Batch Job Event Target.
Example:
import ec2 "github.com/aws/aws-cdk-go/awscdk" import ecs "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var vpc vpc computeEnvironment := batch.NewFargateComputeEnvironment(this, jsii.String("ComputeEnv"), &FargateComputeEnvironmentProps{ Vpc: Vpc, }) jobQueue := batch.NewJobQueue(this, jsii.String("JobQueue"), &JobQueueProps{ Priority: jsii.Number(1), ComputeEnvironments: []orderedComputeEnvironment{ &orderedComputeEnvironment{ ComputeEnvironment: *ComputeEnvironment, Order: jsii.Number(1), }, }, }) jobDefinition := batch.NewEcsJobDefinition(this, jsii.String("MyJob"), &EcsJobDefinitionProps{ Container: batch.NewEcsEc2ContainerDefinition(this, jsii.String("Container"), &EcsEc2ContainerDefinitionProps{ Image: ecs.ContainerImage_FromRegistry(jsii.String("test-repo")), Memory: cdk.Size_Mebibytes(jsii.Number(2048)), Cpu: jsii.Number(256), }), }) queue := sqs.NewQueue(this, jsii.String("Queue")) rule := events.NewRule(this, jsii.String("Rule"), &RuleProps{ Schedule: events.Schedule_Rate(awscdk.Duration_Hours(jsii.Number(1))), }) rule.AddTarget(targets.NewBatchJob(jobQueue.JobQueueArn, jobQueue, jobDefinition.JobDefinitionArn, jobDefinition, &BatchJobProps{ DeadLetterQueue: queue, Event: events.RuleTargetInput_FromObject(map[string]*string{ "SomeParam": jsii.String("SomeValue"), }), RetryAttempts: jsii.Number(2), MaxEventAge: awscdk.Duration_*Hours(jsii.Number(2)), }))
type CloudWatchLogGroup ¶
type CloudWatchLogGroup interface { awsevents.IRuleTarget // Returns a RuleTarget that can be used to log an event into a CloudWatch LogGroup. Bind(_rule awsevents.IRule, _id *string) *awsevents.RuleTargetConfig }
Use an AWS CloudWatch LogGroup as an event rule target.
Example:
import logs "github.com/aws/aws-cdk-go/awscdk" var logGroup logGroup var rule rule rule.AddTarget(targets.NewCloudWatchLogGroup(logGroup, &LogGroupProps{ LogEvent: targets.LogGroupTargetInput_FromObject(&LogGroupTargetInputOptions{ Message: jSON.stringify(map[string]*string{ "CustomField": jsii.String("CustomValue"), }), }), }))
func NewCloudWatchLogGroup ¶
func NewCloudWatchLogGroup(logGroup awslogs.ILogGroup, props *LogGroupProps) CloudWatchLogGroup
type CodeBuildProject ¶
type CodeBuildProject interface { awsevents.IRuleTarget // Allows using build projects as event rule targets. Bind(_rule awsevents.IRule, _id *string) *awsevents.RuleTargetConfig }
Start a CodeBuild build when an Amazon EventBridge rule is triggered.
Example:
import sns "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var repo repository var project pipelineProject var myTopic topic // starts a CodeBuild project when a commit is pushed to the "main" branch of the repo repo.onCommit(jsii.String("CommitToMain"), &OnCommitOptions{ Target: targets.NewCodeBuildProject(project), Branches: []*string{ jsii.String("main"), }, }) // publishes a message to an Amazon SNS topic when a comment is made on a pull request rule := repo.onCommentOnPullRequest(jsii.String("CommentOnPullRequest"), &OnEventOptions{ Target: targets.NewSnsTopic(myTopic), })
func NewCodeBuildProject ¶
func NewCodeBuildProject(project awscodebuild.IProject, props *CodeBuildProjectProps) CodeBuildProject
type CodeBuildProjectProps ¶
type CodeBuildProjectProps struct { // The SQS queue to be used as deadLetterQueue. Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). // // 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. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The maximum age of a request that Lambda sends to a function for processing. // // Minimum value of 60. // Maximum value of 86400. // Default: Duration.hours(24) // MaxEventAge awscdk.Duration `field:"optional" json:"maxEventAge" yaml:"maxEventAge"` // The maximum number of times to retry when the function returns an error. // // Minimum value of 0. // Maximum value of 185. // Default: 185. // RetryAttempts *float64 `field:"optional" json:"retryAttempts" yaml:"retryAttempts"` // The event to send to CodeBuild. // // This will be the payload for the StartBuild API. // Default: - the entire EventBridge event. // Event awsevents.RuleTargetInput `field:"optional" json:"event" yaml:"event"` // The role to assume before invoking the target (i.e., the codebuild) when the given rule is triggered. // Default: - a new role will be created. // EventRole awsiam.IRole `field:"optional" json:"eventRole" yaml:"eventRole"` }
Customize the CodeBuild Event Target.
Example:
import "github.com/aws/aws-cdk-go/awscdk" import codecommit "github.com/aws/aws-cdk-go/awscdk" repo := codecommit.NewRepository(this, jsii.String("MyRepo"), &RepositoryProps{ RepositoryName: jsii.String("aws-cdk-codebuild-events"), }) project := codebuild.NewProject(this, jsii.String("MyProject"), &ProjectProps{ Source: codebuild.Source_CodeCommit(&CodeCommitSourceProps{ Repository: repo, }), }) deadLetterQueue := sqs.NewQueue(this, jsii.String("DeadLetterQueue")) // trigger a build when a commit is pushed to the repo onCommitRule := repo.onCommit(jsii.String("OnCommit"), &OnCommitOptions{ Target: targets.NewCodeBuildProject(project, &CodeBuildProjectProps{ DeadLetterQueue: deadLetterQueue, }), Branches: []*string{ jsii.String("master"), }, })
type CodePipeline ¶
type CodePipeline interface { awsevents.IRuleTarget // Returns the rule target specification. // // NOTE: Do not use the various `inputXxx` options. They can be set in a call to `addTarget`. Bind(_rule awsevents.IRule, _id *string) *awsevents.RuleTargetConfig }
Allows the pipeline to be used as an EventBridge rule target.
Example:
// A pipeline being used as a target for a CloudWatch event rule. import targets "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var pipeline pipeline // kick off the pipeline every day rule := events.NewRule(this, jsii.String("Daily"), &RuleProps{ Schedule: events.Schedule_Rate(awscdk.Duration_Days(jsii.Number(1))), }) rule.AddTarget(targets.NewCodePipeline(pipeline))
func NewCodePipeline ¶
func NewCodePipeline(pipeline awscodepipeline.IPipeline, options *CodePipelineTargetOptions) CodePipeline
type CodePipelineTargetOptions ¶
type CodePipelineTargetOptions struct { // The SQS queue to be used as deadLetterQueue. Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). // // 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. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The maximum age of a request that Lambda sends to a function for processing. // // Minimum value of 60. // Maximum value of 86400. // Default: Duration.hours(24) // MaxEventAge awscdk.Duration `field:"optional" json:"maxEventAge" yaml:"maxEventAge"` // The maximum number of times to retry when the function returns an error. // // Minimum value of 0. // Maximum value of 185. // Default: 185. // RetryAttempts *float64 `field:"optional" json:"retryAttempts" yaml:"retryAttempts"` // The role to assume before invoking the target (i.e., the pipeline) when the given rule is triggered. // Default: - a new role will be created. // EventRole awsiam.IRole `field:"optional" json:"eventRole" yaml:"eventRole"` }
Customization options when creating a `CodePipeline` event target.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import cdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var queue queue var role role codePipelineTargetOptions := &CodePipelineTargetOptions{ DeadLetterQueue: queue, EventRole: role, MaxEventAge: cdk.Duration_Minutes(jsii.Number(30)), RetryAttempts: jsii.Number(123), }
type ContainerOverride ¶
type ContainerOverride struct { // Name of the container inside the task definition. ContainerName *string `field:"required" json:"containerName" yaml:"containerName"` // Command to run inside the container. // Default: Default command. // Command *[]*string `field:"optional" json:"command" yaml:"command"` // The number of cpu units reserved for the container. // Default: The default value from the task definition. // Cpu *float64 `field:"optional" json:"cpu" yaml:"cpu"` // Variables to set in the container's environment. Environment *[]*TaskEnvironmentVariable `field:"optional" json:"environment" yaml:"environment"` // Hard memory limit on the container. // Default: The default value from the task definition. // MemoryLimit *float64 `field:"optional" json:"memoryLimit" yaml:"memoryLimit"` // Soft memory limit on the container. // Default: The default value from the task definition. // MemoryReservation *float64 `field:"optional" json:"memoryReservation" yaml:"memoryReservation"` }
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" containerOverride := &ContainerOverride{ ContainerName: jsii.String("containerName"), // the properties below are optional Command: []*string{ jsii.String("command"), }, Cpu: jsii.Number(123), Environment: []taskEnvironmentVariable{ &taskEnvironmentVariable{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, MemoryLimit: jsii.Number(123), MemoryReservation: jsii.Number(123), }
type EcsTask ¶
type EcsTask interface { awsevents.IRuleTarget // The security groups associated with the task. // // Only applicable with awsvpc network mode. // Default: - A new security group is created. // SecurityGroups() *[]awsec2.ISecurityGroup // Allows using tasks as target of EventBridge events. Bind(_rule awsevents.IRule, _id *string) *awsevents.RuleTargetConfig }
Start a task on an ECS cluster.
Example:
import ecs "github.com/aws/aws-cdk-go/awscdk" import ec2 "github.com/aws/aws-cdk-go/awscdk" var cluster iCluster var taskDefinition taskDefinition rule := events.NewRule(this, jsii.String("Rule"), &RuleProps{ Schedule: events.Schedule_Rate(cdk.Duration_Hours(jsii.Number(1))), }) rule.AddTarget( targets.NewEcsTask(&EcsTaskProps{ Cluster: Cluster, TaskDefinition: TaskDefinition, AssignPublicIp: jsii.Boolean(true), SubnetSelection: &SubnetSelection{ SubnetType: ec2.SubnetType_PUBLIC, }, }))
func NewEcsTask ¶
func NewEcsTask(props *EcsTaskProps) EcsTask
type EcsTaskProps ¶
type EcsTaskProps struct { // The SQS queue to be used as deadLetterQueue. Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). // // 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. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The maximum age of a request that Lambda sends to a function for processing. // // Minimum value of 60. // Maximum value of 86400. // Default: Duration.hours(24) // MaxEventAge awscdk.Duration `field:"optional" json:"maxEventAge" yaml:"maxEventAge"` // The maximum number of times to retry when the function returns an error. // // Minimum value of 0. // Maximum value of 185. // Default: 185. // RetryAttempts *float64 `field:"optional" json:"retryAttempts" yaml:"retryAttempts"` // Cluster where service will be deployed. Cluster awsecs.ICluster `field:"required" json:"cluster" yaml:"cluster"` // Task Definition of the task that should be started. TaskDefinition awsecs.ITaskDefinition `field:"required" json:"taskDefinition" yaml:"taskDefinition"` // Specifies whether the task's elastic network interface receives a public IP address. // // You can specify true only when LaunchType is set to FARGATE. // Default: - true if the subnet type is PUBLIC, otherwise false. // AssignPublicIp *bool `field:"optional" json:"assignPublicIp" yaml:"assignPublicIp"` // Container setting overrides. // // Key is the name of the container to override, value is the // values you want to override. ContainerOverrides *[]*ContainerOverride `field:"optional" json:"containerOverrides" yaml:"containerOverrides"` // Whether or not to enable the execute command functionality for the containers in this task. // // If true, this enables execute command functionality on all containers in the task. // Default: - false. // EnableExecuteCommand *bool `field:"optional" json:"enableExecuteCommand" yaml:"enableExecuteCommand"` // Specifies the launch type on which your task is running. // // The launch type that you specify here // must match one of the launch type (compatibilities) of the target task. // Default: - 'EC2' if `isEc2Compatible` for the `taskDefinition` is true, otherwise 'FARGATE'. // LaunchType awsecs.LaunchType `field:"optional" json:"launchType" yaml:"launchType"` // The platform version on which to run your task. // // Unless you have specific compatibility requirements, you don't need to specify this. // See: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html // // Default: - ECS will set the Fargate platform version to 'LATEST'. // PlatformVersion awsecs.FargatePlatformVersion `field:"optional" json:"platformVersion" yaml:"platformVersion"` // Specifies whether to propagate the tags from the task definition to the task. // // If no value is specified, the tags are not propagated. // Default: - Tags will not be propagated. // PropagateTags awsecs.PropagatedTagSource `field:"optional" json:"propagateTags" yaml:"propagateTags"` // Existing IAM role to run the ECS task. // Default: A new IAM role is created. // Role awsiam.IRole `field:"optional" json:"role" yaml:"role"` // Existing security groups to use for the task's ENIs. // // (Only applicable in case the TaskDefinition is configured for AwsVpc networking). // Default: A new security group is created. // SecurityGroups *[]awsec2.ISecurityGroup `field:"optional" json:"securityGroups" yaml:"securityGroups"` // In what subnets to place the task's ENIs. // // (Only applicable in case the TaskDefinition is configured for AwsVpc networking). // Default: Private subnets. // SubnetSelection *awsec2.SubnetSelection `field:"optional" json:"subnetSelection" yaml:"subnetSelection"` // The metadata that you apply to the task to help you categorize and organize them. // // Each tag consists of a key and an optional value, both of which you define. // Default: - No additional tags are applied to the task. // Tags *[]*Tag `field:"optional" json:"tags" yaml:"tags"` // How many tasks should be started when this event is triggered. // Default: 1. // TaskCount *float64 `field:"optional" json:"taskCount" yaml:"taskCount"` }
Properties to define an ECS Event Task.
Example:
import ecs "github.com/aws/aws-cdk-go/awscdk" import ec2 "github.com/aws/aws-cdk-go/awscdk" var cluster iCluster var taskDefinition taskDefinition rule := events.NewRule(this, jsii.String("Rule"), &RuleProps{ Schedule: events.Schedule_Rate(cdk.Duration_Hours(jsii.Number(1))), }) rule.AddTarget( targets.NewEcsTask(&EcsTaskProps{ Cluster: Cluster, TaskDefinition: TaskDefinition, AssignPublicIp: jsii.Boolean(true), SubnetSelection: &SubnetSelection{ SubnetType: ec2.SubnetType_PUBLIC, }, }))
type EventBus ¶
type EventBus interface { awsevents.IRuleTarget // Returns the rule target specification. // // NOTE: Do not use the various `inputXxx` options. They can be set in a call to `addTarget`. Bind(rule awsevents.IRule, _id *string) *awsevents.RuleTargetConfig }
Notify an existing Event Bus of an event.
Example:
rule := events.NewRule(this, jsii.String("Rule"), &RuleProps{ Schedule: events.Schedule_Expression(jsii.String("rate(1 minute)")), }) rule.AddTarget(targets.NewEventBus(events.EventBus_FromEventBusArn(this, jsii.String("External"), jsii.String("arn:aws:events:eu-west-1:999999999999:event-bus/test-bus"))))
func NewEventBus ¶
func NewEventBus(eventBus awsevents.IEventBus, props *EventBusProps) EventBus
type EventBusProps ¶
type EventBusProps struct { // The SQS queue to be used as deadLetterQueue. Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). // // 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. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // Role to be used to publish the event. // Default: a new role is created. // Role awsiam.IRole `field:"optional" json:"role" yaml:"role"` }
Configuration properties of an Event Bus event.
Cannot extend TargetBaseProps. Retry policy is not supported for Event bus targets.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var queue queue var role role eventBusProps := &EventBusProps{ DeadLetterQueue: queue, Role: role, }
type IDeliveryStream ¶ added in v2.143.0
type IDeliveryStream interface { awscdk.IResource // The ARN of the delivery stream. DeliveryStreamArn() *string // The name of the delivery stream. DeliveryStreamName() *string }
Represents a Kinesis Data Firehose delivery stream.
type KinesisFirehoseStream
deprecated
type KinesisFirehoseStream interface { awsevents.IRuleTarget // Returns a RuleTarget that can be used to trigger this Firehose Stream as a result from a Event Bridge event. // Deprecated: Use KinesisFirehoseStreamV2. Bind(_rule awsevents.IRule, _id *string) *awsevents.RuleTargetConfig }
Customize the Firehose Stream Event Target.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var cfnDeliveryStream cfnDeliveryStream var ruleTargetInput ruleTargetInput kinesisFirehoseStream := awscdk.Aws_events_targets.NewKinesisFirehoseStream(cfnDeliveryStream, &KinesisFirehoseStreamProps{ Message: ruleTargetInput, })
Deprecated: Use KinesisFirehoseStreamV2.
func NewKinesisFirehoseStream
deprecated
func NewKinesisFirehoseStream(stream awskinesisfirehose.CfnDeliveryStream, props *KinesisFirehoseStreamProps) KinesisFirehoseStream
Deprecated: Use KinesisFirehoseStreamV2.
type KinesisFirehoseStreamProps ¶
type KinesisFirehoseStreamProps struct { // The message to send to the stream. // // Must be a valid JSON text passed to the target stream. // Default: - the entire Event Bridge event. // Message awsevents.RuleTargetInput `field:"optional" json:"message" yaml:"message"` }
Customize the Firehose Stream Event Target.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var ruleTargetInput ruleTargetInput kinesisFirehoseStreamProps := &KinesisFirehoseStreamProps{ Message: ruleTargetInput, }
type KinesisFirehoseStreamV2 ¶ added in v2.143.0
type KinesisFirehoseStreamV2 interface { awsevents.IRuleTarget // Returns a RuleTarget that can be used to trigger this Firehose Stream as a result from a Event Bridge event. Bind(_rule awsevents.IRule, _id *string) *awsevents.RuleTargetConfig }
Customize the Firehose Stream Event Target V2 to support L2 Kinesis Delivery Stream instead of L1 Cfn Kinesis Delivery Stream.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var deliveryStream iDeliveryStream var ruleTargetInput ruleTargetInput kinesisFirehoseStreamV2 := awscdk.Aws_events_targets.NewKinesisFirehoseStreamV2(deliveryStream, &KinesisFirehoseStreamProps{ Message: ruleTargetInput, })
func NewKinesisFirehoseStreamV2 ¶ added in v2.143.0
func NewKinesisFirehoseStreamV2(stream IDeliveryStream, props *KinesisFirehoseStreamProps) KinesisFirehoseStreamV2
type KinesisStream ¶
type KinesisStream interface { awsevents.IRuleTarget // Returns a RuleTarget that can be used to trigger this Kinesis Stream as a result from a CloudWatch event. Bind(_rule awsevents.IRule, _id *string) *awsevents.RuleTargetConfig }
Use a Kinesis Stream as a target for AWS CloudWatch event rules.
Example:
// put to a Kinesis stream every time code is committed // to a CodeCommit repository repository.onCommit(jsii.String("onCommit"), &OnCommitOptions{ Target: targets.NewKinesisStream(stream), })
func NewKinesisStream ¶
func NewKinesisStream(stream awskinesis.IStream, props *KinesisStreamProps) KinesisStream
type KinesisStreamProps ¶
type KinesisStreamProps struct { // The SQS queue to be used as deadLetterQueue. Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). // // 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. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The maximum age of a request that Lambda sends to a function for processing. // // Minimum value of 60. // Maximum value of 86400. // Default: Duration.hours(24) // MaxEventAge awscdk.Duration `field:"optional" json:"maxEventAge" yaml:"maxEventAge"` // The maximum number of times to retry when the function returns an error. // // Minimum value of 0. // Maximum value of 185. // Default: 185. // RetryAttempts *float64 `field:"optional" json:"retryAttempts" yaml:"retryAttempts"` // The message to send to the stream. // // Must be a valid JSON text passed to the target stream. // Default: - the entire CloudWatch event. // Message awsevents.RuleTargetInput `field:"optional" json:"message" yaml:"message"` // Partition Key Path for records sent to this stream. // Default: - eventId as the partition key. // PartitionKeyPath *string `field:"optional" json:"partitionKeyPath" yaml:"partitionKeyPath"` }
Customize the Kinesis Stream Event Target.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import cdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var queue queue var ruleTargetInput ruleTargetInput kinesisStreamProps := &KinesisStreamProps{ DeadLetterQueue: queue, MaxEventAge: cdk.Duration_Minutes(jsii.Number(30)), Message: ruleTargetInput, PartitionKeyPath: jsii.String("partitionKeyPath"), RetryAttempts: jsii.Number(123), }
type LambdaFunction ¶
type LambdaFunction interface { awsevents.IRuleTarget // Returns a RuleTarget that can be used to trigger this Lambda as a result from an EventBridge event. Bind(rule awsevents.IRule, _id *string) *awsevents.RuleTargetConfig }
Use an AWS Lambda function as an event rule target.
Example:
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()")), }) rule := events.NewRule(this, jsii.String("rule"), &RuleProps{ EventPattern: &EventPattern{ Source: []*string{ jsii.String("aws.ec2"), }, }, }) queue := sqs.NewQueue(this, jsii.String("Queue")) rule.AddTarget(targets.NewLambdaFunction(fn, &LambdaFunctionProps{ DeadLetterQueue: queue, // Optional: add a dead letter queue MaxEventAge: awscdk.Duration_Hours(jsii.Number(2)), // Optional: set the maxEventAge retry policy RetryAttempts: jsii.Number(2), }))
func NewLambdaFunction ¶
func NewLambdaFunction(handler awslambda.IFunction, props *LambdaFunctionProps) LambdaFunction
type LambdaFunctionProps ¶
type LambdaFunctionProps struct { // The SQS queue to be used as deadLetterQueue. Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). // // 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. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The maximum age of a request that Lambda sends to a function for processing. // // Minimum value of 60. // Maximum value of 86400. // Default: Duration.hours(24) // MaxEventAge awscdk.Duration `field:"optional" json:"maxEventAge" yaml:"maxEventAge"` // The maximum number of times to retry when the function returns an error. // // Minimum value of 0. // Maximum value of 185. // Default: 185. // RetryAttempts *float64 `field:"optional" json:"retryAttempts" yaml:"retryAttempts"` // The event to send to the Lambda. // // This will be the payload sent to the Lambda Function. // Default: the entire EventBridge event. // Event awsevents.RuleTargetInput `field:"optional" json:"event" yaml:"event"` }
Customize the Lambda Event Target.
Example:
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()")), }) rule := events.NewRule(this, jsii.String("rule"), &RuleProps{ EventPattern: &EventPattern{ Source: []*string{ jsii.String("aws.ec2"), }, }, }) queue := sqs.NewQueue(this, jsii.String("Queue")) rule.AddTarget(targets.NewLambdaFunction(fn, &LambdaFunctionProps{ DeadLetterQueue: queue, // Optional: add a dead letter queue MaxEventAge: awscdk.Duration_Hours(jsii.Number(2)), // Optional: set the maxEventAge retry policy RetryAttempts: jsii.Number(2), }))
type LogGroupProps ¶
type LogGroupProps struct { // The SQS queue to be used as deadLetterQueue. Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). // // 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. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The maximum age of a request that Lambda sends to a function for processing. // // Minimum value of 60. // Maximum value of 86400. // Default: Duration.hours(24) // MaxEventAge awscdk.Duration `field:"optional" json:"maxEventAge" yaml:"maxEventAge"` // The maximum number of times to retry when the function returns an error. // // Minimum value of 0. // Maximum value of 185. // Default: 185. // RetryAttempts *float64 `field:"optional" json:"retryAttempts" yaml:"retryAttempts"` // The event to send to the CloudWatch LogGroup. // // This will be the event logged into the CloudWatch LogGroup. // Default: - the entire EventBridge event. // // Deprecated: use logEvent instead. Event awsevents.RuleTargetInput `field:"optional" json:"event" yaml:"event"` // Whether the custom resource created wll default to install latest AWS SDK. // Default: - install latest AWS SDK. // InstallLatestAwsSdk *bool `field:"optional" json:"installLatestAwsSdk" yaml:"installLatestAwsSdk"` // The event to send to the CloudWatch LogGroup. // // This will be the event logged into the CloudWatch LogGroup. // Default: - the entire EventBridge event. // LogEvent LogGroupTargetInput `field:"optional" json:"logEvent" yaml:"logEvent"` }
Customize the CloudWatch LogGroup Event Target.
Example:
import logs "github.com/aws/aws-cdk-go/awscdk" var logGroup logGroup var rule rule rule.AddTarget(targets.NewCloudWatchLogGroup(logGroup, &LogGroupProps{ LogEvent: targets.LogGroupTargetInput_FromObject(&LogGroupTargetInputOptions{ Message: jSON.stringify(map[string]*string{ "CustomField": jsii.String("CustomValue"), }), }), }))
type LogGroupTargetInput ¶ added in v2.29.0
type LogGroupTargetInput interface { // Return the input properties for this input object. Bind(rule awsevents.IRule) *awsevents.RuleTargetInputProperties }
The input to send to the CloudWatch LogGroup target.
Example:
import logs "github.com/aws/aws-cdk-go/awscdk" var logGroup logGroup var rule rule rule.AddTarget(targets.NewCloudWatchLogGroup(logGroup, &LogGroupProps{ LogEvent: targets.LogGroupTargetInput_FromObject(&LogGroupTargetInputOptions{ Timestamp: events.EventField_FromPath(jsii.String("$.time")), Message: events.EventField_*FromPath(jsii.String("$.detail-type")), }), }))
type LogGroupTargetInputOptions ¶ added in v2.29.0
type LogGroupTargetInputOptions struct { // The value provided here will be used in the Log "message" field. // // This field must be a string. If an object is passed (e.g. JSON data) // it will not throw an error, but the message that makes it to // CloudWatch logs will be incorrect. This is a likely scenario if // doing something like: EventField.fromPath('$.detail') since in most cases // the `detail` field contains JSON data. // Default: EventField.detailType // Message interface{} `field:"optional" json:"message" yaml:"message"` // The timestamp that will appear in the CloudWatch Logs record. // Default: EventField.time // Timestamp interface{} `field:"optional" json:"timestamp" yaml:"timestamp"` }
Options used when creating a target input template.
Example:
import logs "github.com/aws/aws-cdk-go/awscdk" var logGroup logGroup var rule rule rule.AddTarget(targets.NewCloudWatchLogGroup(logGroup, &LogGroupProps{ LogEvent: targets.LogGroupTargetInput_FromObject(&LogGroupTargetInputOptions{ Timestamp: events.EventField_FromPath(jsii.String("$.time")), Message: events.EventField_*FromPath(jsii.String("$.detail-type")), }), }))
type RedshiftQuery ¶ added in v2.156.0
type RedshiftQuery interface { awsevents.IRuleTarget // Returns the rule target specification. // // NOTE: Do not use the various `inputXxx` options. They can be set in a call to `addTarget`. Bind(rule awsevents.IRule, _id *string) *awsevents.RuleTargetConfig }
Schedule an Amazon Redshift Query to be run, using the Redshift Data API.
If you would like Amazon Redshift to identify the Event Bridge rule, and present it in the Amazon Redshift console, append a `QS2-` prefix to both `statementName` and `ruleName`.
Example:
import redshiftserverless "github.com/aws/aws-cdk-go/awscdk" var workgroup cfnWorkgroup rule := events.NewRule(this, jsii.String("Rule"), &RuleProps{ Schedule: events.Schedule_Rate(cdk.Duration_Hours(jsii.Number(1))), }) dlq := sqs.NewQueue(this, jsii.String("DeadLetterQueue")) rule.AddTarget(targets.NewRedshiftQuery(workgroup.AttrWorkgroupWorkgroupArn, &RedshiftQueryProps{ Database: jsii.String("dev"), DeadLetterQueue: dlq, Sql: []*string{ jsii.String("SELECT * FROM foo"), jsii.String("SELECT * FROM baz"), }, }))
func NewRedshiftQuery ¶ added in v2.156.0
func NewRedshiftQuery(clusterArn *string, props *RedshiftQueryProps) RedshiftQuery
type RedshiftQueryProps ¶ added in v2.156.0
type RedshiftQueryProps struct { // The Amazon Redshift database to run the query against. Database *string `field:"required" json:"database" yaml:"database"` // The SQL queries to be executed. // // Each query is run sequentially within a single transaction; the next query in the array will only execute after the previous one has successfully completed. // // - When multiple sql queries are included, this will use the `batchExecuteStatement` API. Therefore, if any statement fails, the entire transaction is rolled back. // - If a single SQL statement is to be executed, this will use the `executeStatement` API. // Default: - No SQL query is specified. // Sql *[]*string `field:"required" json:"sql" yaml:"sql"` // The Amazon Redshift database user to run the query as. // // This is required when authenticating via temporary credentials. // Default: - No Database user is specified. // DbUser *string `field:"optional" json:"dbUser" yaml:"dbUser"` // The queue to be used as dead letter queue. // Default: - No dead letter queue is specified. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The input to the state machine execution. // Default: - the entire EventBridge event. // Input awsevents.RuleTargetInput `field:"optional" json:"input" yaml:"input"` // The IAM role to be used to execute the SQL statement. // Default: - a new role will be created. // Role awsiam.IRole `field:"optional" json:"role" yaml:"role"` // The secret containing the password for the database user. // // This is required when authenticating via Secrets Manager. // If the full secret ARN is not specified, this will instead use the secret name. // Default: - No secret is specified. // Secret awssecretsmanager.ISecret `field:"optional" json:"secret" yaml:"secret"` // Should an event be sent back to Event Bridge when the SQL statement is executed. // Default: false. // SendEventBridgeEvent *bool `field:"optional" json:"sendEventBridgeEvent" yaml:"sendEventBridgeEvent"` // The name of the SQL statement. // // You can name the SQL statement for identitfication purposes. If you would like Amazon Redshift to identify the Event Bridge rule, and present it in the Amazon Redshift console, append a `QS2-` prefix to the statement name. // Default: - No statement name is specified. // StatementName *string `field:"optional" json:"statementName" yaml:"statementName"` }
Configuration properties of an Amazon Redshift Query event.
Example:
import redshiftserverless "github.com/aws/aws-cdk-go/awscdk" var workgroup cfnWorkgroup rule := events.NewRule(this, jsii.String("Rule"), &RuleProps{ Schedule: events.Schedule_Rate(cdk.Duration_Hours(jsii.Number(1))), }) dlq := sqs.NewQueue(this, jsii.String("DeadLetterQueue")) rule.AddTarget(targets.NewRedshiftQuery(workgroup.AttrWorkgroupWorkgroupArn, &RedshiftQueryProps{ Database: jsii.String("dev"), DeadLetterQueue: dlq, Sql: []*string{ jsii.String("SELECT * FROM foo"), jsii.String("SELECT * FROM baz"), }, }))
type SfnStateMachine ¶
type SfnStateMachine interface { awsevents.IRuleTarget Machine() awsstepfunctions.IStateMachine // Returns a properties that are used in an Rule to trigger this State Machine. // See: https://docs.aws.amazon.com/eventbridge/latest/userguide/resource-based-policies-eventbridge.html#sns-permissions // Bind(_rule awsevents.IRule, _id *string) *awsevents.RuleTargetConfig }
Use a StepFunctions state machine as a target for Amazon EventBridge rules.
Example:
import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" rule := events.NewRule(this, jsii.String("Rule"), &RuleProps{ Schedule: events.Schedule_Rate(awscdk.Duration_Minutes(jsii.Number(1))), }) dlq := sqs.NewQueue(this, jsii.String("DeadLetterQueue")) role := iam.NewRole(this, jsii.String("Role"), &RoleProps{ AssumedBy: iam.NewServicePrincipal(jsii.String("events.amazonaws.com")), }) stateMachine := sfn.NewStateMachine(this, jsii.String("SM"), &StateMachineProps{ Definition: sfn.NewWait(this, jsii.String("Hello"), &WaitProps{ Time: sfn.WaitTime_Duration(awscdk.Duration_Seconds(jsii.Number(10))), }), }) rule.AddTarget(targets.NewSfnStateMachine(stateMachine, &SfnStateMachineProps{ Input: events.RuleTargetInput_FromObject(map[string]*string{ "SomeParam": jsii.String("SomeValue"), }), DeadLetterQueue: dlq, Role: role, }))
func NewSfnStateMachine ¶
func NewSfnStateMachine(machine awsstepfunctions.IStateMachine, props *SfnStateMachineProps) SfnStateMachine
type SfnStateMachineProps ¶
type SfnStateMachineProps struct { // The SQS queue to be used as deadLetterQueue. Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). // // 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. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The maximum age of a request that Lambda sends to a function for processing. // // Minimum value of 60. // Maximum value of 86400. // Default: Duration.hours(24) // MaxEventAge awscdk.Duration `field:"optional" json:"maxEventAge" yaml:"maxEventAge"` // The maximum number of times to retry when the function returns an error. // // Minimum value of 0. // Maximum value of 185. // Default: 185. // RetryAttempts *float64 `field:"optional" json:"retryAttempts" yaml:"retryAttempts"` // The input to the state machine execution. // Default: the entire EventBridge event. // Input awsevents.RuleTargetInput `field:"optional" json:"input" yaml:"input"` // The IAM role to be assumed to execute the State Machine. // Default: - a new role will be created. // Role awsiam.IRole `field:"optional" json:"role" yaml:"role"` }
Customize the Step Functions State Machine target.
Example:
import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" rule := events.NewRule(this, jsii.String("Rule"), &RuleProps{ Schedule: events.Schedule_Rate(awscdk.Duration_Minutes(jsii.Number(1))), }) dlq := sqs.NewQueue(this, jsii.String("DeadLetterQueue")) role := iam.NewRole(this, jsii.String("Role"), &RoleProps{ AssumedBy: iam.NewServicePrincipal(jsii.String("events.amazonaws.com")), }) stateMachine := sfn.NewStateMachine(this, jsii.String("SM"), &StateMachineProps{ Definition: sfn.NewWait(this, jsii.String("Hello"), &WaitProps{ Time: sfn.WaitTime_Duration(awscdk.Duration_Seconds(jsii.Number(10))), }), }) rule.AddTarget(targets.NewSfnStateMachine(stateMachine, &SfnStateMachineProps{ Input: events.RuleTargetInput_FromObject(map[string]*string{ "SomeParam": jsii.String("SomeValue"), }), DeadLetterQueue: dlq, Role: role, }))
type SnsTopic ¶
type SnsTopic interface { awsevents.IRuleTarget Topic() awssns.ITopic // Returns a RuleTarget that can be used to trigger this SNS topic as a result from an EventBridge event. // See: https://docs.aws.amazon.com/eventbridge/latest/userguide/resource-based-policies-eventbridge.html#sns-permissions // Bind(_rule awsevents.IRule, _id *string) *awsevents.RuleTargetConfig }
Use an SNS topic as a target for Amazon EventBridge rules.
If the topic is imported the required permissions to publish to that topic need to be set manually.
Example:
// publish to an SNS topic every time code is committed // to a CodeCommit repository repository.onCommit(jsii.String("onCommit"), &OnCommitOptions{ Target: targets.NewSnsTopic(topic), })
func NewSnsTopic ¶
func NewSnsTopic(topic awssns.ITopic, props *SnsTopicProps) SnsTopic
type SnsTopicProps ¶
type SnsTopicProps struct { // The SQS queue to be used as deadLetterQueue. Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). // // 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. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The maximum age of a request that Lambda sends to a function for processing. // // Minimum value of 60. // Maximum value of 86400. // Default: Duration.hours(24) // MaxEventAge awscdk.Duration `field:"optional" json:"maxEventAge" yaml:"maxEventAge"` // The maximum number of times to retry when the function returns an error. // // Minimum value of 0. // Maximum value of 185. // Default: 185. // RetryAttempts *float64 `field:"optional" json:"retryAttempts" yaml:"retryAttempts"` // The message to send to the topic. // Default: the entire EventBridge event. // Message awsevents.RuleTargetInput `field:"optional" json:"message" yaml:"message"` }
Customize the SNS Topic Event Target.
Example:
var onCommitRule rule var topic topic onCommitRule.AddTarget(targets.NewSnsTopic(topic, &SnsTopicProps{ Message: events.RuleTargetInput_FromText( fmt.Sprintf("A commit was pushed to the repository %v on branch %v", codecommit.ReferenceEvent_RepositoryName(), codecommit.ReferenceEvent_ReferenceName())), }))
type SqsQueue ¶
type SqsQueue interface { awsevents.IRuleTarget Queue() awssqs.IQueue // Returns a RuleTarget that can be used to trigger this SQS queue as a result from an EventBridge event. // See: https://docs.aws.amazon.com/eventbridge/latest/userguide/resource-based-policies-eventbridge.html#sqs-permissions // Bind(rule awsevents.IRule, _id *string) *awsevents.RuleTargetConfig }
Use an SQS Queue as a target for Amazon EventBridge rules.
Example:
// publish to an SQS queue every time code is committed // to a CodeCommit repository repository.onCommit(jsii.String("onCommit"), &OnCommitOptions{ Target: targets.NewSqsQueue(queue), })
func NewSqsQueue ¶
func NewSqsQueue(queue awssqs.IQueue, props *SqsQueueProps) SqsQueue
type SqsQueueProps ¶
type SqsQueueProps struct { // The SQS queue to be used as deadLetterQueue. Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). // // 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. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The maximum age of a request that Lambda sends to a function for processing. // // Minimum value of 60. // Maximum value of 86400. // Default: Duration.hours(24) // MaxEventAge awscdk.Duration `field:"optional" json:"maxEventAge" yaml:"maxEventAge"` // The maximum number of times to retry when the function returns an error. // // Minimum value of 0. // Maximum value of 185. // Default: 185. // RetryAttempts *float64 `field:"optional" json:"retryAttempts" yaml:"retryAttempts"` // The message to send to the queue. // // Must be a valid JSON text passed to the target queue. // Default: the entire EventBridge event. // Message awsevents.RuleTargetInput `field:"optional" json:"message" yaml:"message"` // Message Group ID for messages sent to this queue. // // Required for FIFO queues, leave empty for regular queues. // Default: - no message group ID (regular queue). // MessageGroupId *string `field:"optional" json:"messageGroupId" yaml:"messageGroupId"` }
Customize the SQS Queue Event Target.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import cdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var queue queue var ruleTargetInput ruleTargetInput sqsQueueProps := &SqsQueueProps{ DeadLetterQueue: queue, MaxEventAge: cdk.Duration_Minutes(jsii.Number(30)), Message: ruleTargetInput, MessageGroupId: jsii.String("messageGroupId"), RetryAttempts: jsii.Number(123), }
type Tag ¶ added in v2.76.0
type Tag struct { // Key is the name of the tag. Key *string `field:"required" json:"key" yaml:"key"` // Value is the metadata contents of the tag. Value *string `field:"required" json:"value" yaml:"value"` }
Metadata that you apply to a resource to help categorize and organize the resource.
Each tag consists of a key and an optional value, both of which you define.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" tag := &Tag{ Key: jsii.String("key"), Value: jsii.String("value"), }
type TargetBaseProps ¶
type TargetBaseProps struct { // The SQS queue to be used as deadLetterQueue. Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). // // 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. // DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"` // The maximum age of a request that Lambda sends to a function for processing. // // Minimum value of 60. // Maximum value of 86400. // Default: Duration.hours(24) // MaxEventAge awscdk.Duration `field:"optional" json:"maxEventAge" yaml:"maxEventAge"` // The maximum number of times to retry when the function returns an error. // // Minimum value of 0. // Maximum value of 185. // Default: 185. // RetryAttempts *float64 `field:"optional" json:"retryAttempts" yaml:"retryAttempts"` }
The generic properties for an RuleTarget.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import cdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var queue queue targetBaseProps := &TargetBaseProps{ DeadLetterQueue: queue, MaxEventAge: cdk.Duration_Minutes(jsii.Number(30)), RetryAttempts: jsii.Number(123), }
type TaskEnvironmentVariable ¶
type TaskEnvironmentVariable struct { // Name for the environment variable. // // Exactly one of `name` and `namePath` must be specified. Name *string `field:"required" json:"name" yaml:"name"` // Value of the environment variable. // // Exactly one of `value` and `valuePath` must be specified. Value *string `field:"required" json:"value" yaml:"value"` }
An environment variable to be set in the container run as a task.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" taskEnvironmentVariable := &TaskEnvironmentVariable{ Name: jsii.String("name"), Value: jsii.String("value"), }
Source Files ¶
- ApiDestination.go
- ApiDestinationProps.go
- ApiDestination__checks.go
- ApiGateway.go
- ApiGatewayProps.go
- ApiGateway__checks.go
- AppSync.go
- AppSyncGraphQLApiProps.go
- AppSync__checks.go
- AwsApi.go
- AwsApiInput.go
- AwsApiProps.go
- AwsApi__checks.go
- BatchJob.go
- BatchJobProps.go
- BatchJob__checks.go
- CloudWatchLogGroup.go
- CloudWatchLogGroup__checks.go
- CodeBuildProject.go
- CodeBuildProjectProps.go
- CodeBuildProject__checks.go
- CodePipeline.go
- CodePipelineTargetOptions.go
- CodePipeline__checks.go
- ContainerOverride.go
- EcsTask.go
- EcsTaskProps.go
- EcsTask__checks.go
- EventBus.go
- EventBusProps.go
- EventBus__checks.go
- IDeliveryStream.go
- KinesisFirehoseStream.go
- KinesisFirehoseStreamProps.go
- KinesisFirehoseStreamV2.go
- KinesisFirehoseStreamV2__checks.go
- KinesisFirehoseStream__checks.go
- KinesisStream.go
- KinesisStreamProps.go
- KinesisStream__checks.go
- LambdaFunction.go
- LambdaFunctionProps.go
- LambdaFunction__checks.go
- LogGroupProps.go
- LogGroupTargetInput.go
- LogGroupTargetInputOptions.go
- LogGroupTargetInput__checks.go
- RedshiftQuery.go
- RedshiftQueryProps.go
- RedshiftQuery__checks.go
- SfnStateMachine.go
- SfnStateMachineProps.go
- SfnStateMachine__checks.go
- SnsTopic.go
- SnsTopicProps.go
- SnsTopic__checks.go
- SqsQueue.go
- SqsQueueProps.go
- SqsQueue__checks.go
- Tag.go
- TargetBaseProps.go
- TaskEnvironmentVariable.go
- main.go