Documentation
¶
Index ¶
- func NewEventBridgeDestination_Override(e EventBridgeDestination, eventBus awsevents.IEventBus)
- func NewLambdaDestination_Override(l LambdaDestination, fn awslambda.IFunction, options *LambdaDestinationOptions)
- func NewSnsDestination_Override(s SnsDestination, topic awssns.ITopic)
- func NewSqsDestination_Override(s SqsDestination, queue awssqs.IQueue)
- type EventBridgeDestination
- type LambdaDestination
- type LambdaDestinationOptions
- type SnsDestination
- type SqsDestination
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewEventBridgeDestination_Override ¶
func NewEventBridgeDestination_Override(e EventBridgeDestination, eventBus awsevents.IEventBus)
Default: - use the default event bus.
func NewLambdaDestination_Override ¶
func NewLambdaDestination_Override(l LambdaDestination, fn awslambda.IFunction, options *LambdaDestinationOptions)
func NewSnsDestination_Override ¶
func NewSnsDestination_Override(s SnsDestination, topic awssns.ITopic)
func NewSqsDestination_Override ¶
func NewSqsDestination_Override(s SqsDestination, queue awssqs.IQueue)
Types ¶
type EventBridgeDestination ¶
type EventBridgeDestination interface {
awslambda.IDestination
// Returns a destination configuration.
Bind(_scope constructs.Construct, fn awslambda.IFunction, _options *awslambda.DestinationOptions) *awslambda.DestinationConfig
}
Use an Event Bridge event bus as a Lambda destination.
If no event bus is specified, the default event bus is used.
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 eventBus eventBus eventBridgeDestination := awscdk.Aws_lambda_destinations.NewEventBridgeDestination(eventBus)
func NewEventBridgeDestination ¶
func NewEventBridgeDestination(eventBus awsevents.IEventBus) EventBridgeDestination
Default: - use the default event bus.
type LambdaDestination ¶
type LambdaDestination interface {
awslambda.IDestination
// Returns a destination configuration.
Bind(scope constructs.Construct, fn awslambda.IFunction, options *awslambda.DestinationOptions) *awslambda.DestinationConfig
}
Use a Lambda function as a Lambda destination.
Example:
// Auto-extract response payload with a lambda destination
var destinationFn function
sourceFn := lambda.NewFunction(this, jsii.String("Source"), &FunctionProps{
Runtime: lambda.Runtime_NODEJS_LATEST(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("lambda-handler"))),
// auto-extract on success
OnSuccess: destinations.NewLambdaDestination(destinationFn, &LambdaDestinationOptions{
ResponseOnly: jsii.Boolean(true),
}),
})
func NewLambdaDestination ¶
func NewLambdaDestination(fn awslambda.IFunction, options *LambdaDestinationOptions) LambdaDestination
type LambdaDestinationOptions ¶
type LambdaDestinationOptions struct {
// Whether the destination function receives only the `responsePayload` of the source function.
//
// When set to `true` and used as `onSuccess` destination, the destination
// function will be invoked with the payload returned by the source function.
//
// When set to `true` and used as `onFailure` destination, the destination
// function will be invoked with the error object returned by source function.
//
// See the README of this module to see a full explanation of this option.
// Default: false The destination function receives the full invocation record.
//
ResponseOnly *bool `field:"optional" json:"responseOnly" yaml:"responseOnly"`
}
Options for a Lambda destination.
Example:
// Auto-extract response payload with a lambda destination
var destinationFn function
sourceFn := lambda.NewFunction(this, jsii.String("Source"), &FunctionProps{
Runtime: lambda.Runtime_NODEJS_LATEST(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("lambda-handler"))),
// auto-extract on success
OnSuccess: destinations.NewLambdaDestination(destinationFn, &LambdaDestinationOptions{
ResponseOnly: jsii.Boolean(true),
}),
})
type SnsDestination ¶
type SnsDestination interface {
awslambda.IDestination
// Returns a destination configuration.
Bind(_scope constructs.Construct, fn awslambda.IFunction, _options *awslambda.DestinationOptions) *awslambda.DestinationConfig
}
Use a SNS topic as a Lambda destination.
Example:
// An sns topic for successful invocations of a lambda function
import sns "github.com/aws/aws-cdk-go/awscdk"
myTopic := sns.NewTopic(this, jsii.String("Topic"))
myFn := lambda.NewFunction(this, jsii.String("Fn"), &FunctionProps{
Runtime: lambda.Runtime_NODEJS_LATEST(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("lambda-handler"))),
// sns topic for successful invocations
OnSuccess: destinations.NewSnsDestination(myTopic),
})
func NewSnsDestination ¶
func NewSnsDestination(topic awssns.ITopic) SnsDestination
type SqsDestination ¶
type SqsDestination interface {
awslambda.IDestination
// Returns a destination configuration.
Bind(_scope constructs.Construct, fn awslambda.IFunction, _options *awslambda.DestinationOptions) *awslambda.DestinationConfig
}
Use a SQS queue as a Lambda destination.
Example:
// An sqs queue for unsuccessful invocations of a lambda function
import sqs "github.com/aws/aws-cdk-go/awscdk"
deadLetterQueue := sqs.NewQueue(this, jsii.String("DeadLetterQueue"))
myFn := lambda.NewFunction(this, jsii.String("Fn"), &FunctionProps{
Runtime: lambda.Runtime_NODEJS_LATEST(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromInline(jsii.String("// your code")),
// sqs queue for unsuccessful invocations
OnFailure: destinations.NewSqsDestination(deadLetterQueue),
})
func NewSqsDestination ¶
func NewSqsDestination(queue awssqs.IQueue) SqsDestination
Source Files
¶
Click to show internal directories.
Click to hide internal directories.