-
Notifications
You must be signed in to change notification settings - Fork 17
/
LambdaDestination.go
82 lines (68 loc) · 2.27 KB
/
LambdaDestination.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package awslambdadestinations
import (
_init_ "github.com/aws/aws-cdk-go/awscdk/v2/jsii"
_jsii_ "github.com/aws/jsii-runtime-go/runtime"
"github.com/aws/aws-cdk-go/awscdk/v2/awslambda"
"github.com/aws/aws-cdk-go/awscdk/v2/awslambdadestinations/internal"
"github.com/aws/constructs-go/constructs/v10"
)
// 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_14_X(),
// 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 LambdaDestination interface {
awslambda.IDestination
// Returns a destination configuration.
Bind(scope constructs.Construct, fn awslambda.IFunction, options *awslambda.DestinationOptions) *awslambda.DestinationConfig
}
// The jsii proxy struct for LambdaDestination
type jsiiProxy_LambdaDestination struct {
internal.Type__awslambdaIDestination
}
func NewLambdaDestination(fn awslambda.IFunction, options *LambdaDestinationOptions) LambdaDestination {
_init_.Initialize()
if err := validateNewLambdaDestinationParameters(fn, options); err != nil {
panic(err)
}
j := jsiiProxy_LambdaDestination{}
_jsii_.Create(
"aws-cdk-lib.aws_lambda_destinations.LambdaDestination",
[]interface{}{fn, options},
&j,
)
return &j
}
func NewLambdaDestination_Override(l LambdaDestination, fn awslambda.IFunction, options *LambdaDestinationOptions) {
_init_.Initialize()
_jsii_.Create(
"aws-cdk-lib.aws_lambda_destinations.LambdaDestination",
[]interface{}{fn, options},
l,
)
}
func (l *jsiiProxy_LambdaDestination) Bind(scope constructs.Construct, fn awslambda.IFunction, options *awslambda.DestinationOptions) *awslambda.DestinationConfig {
if err := l.validateBindParameters(scope, fn, options); err != nil {
panic(err)
}
var returns *awslambda.DestinationConfig
_jsii_.Invoke(
l,
"bind",
[]interface{}{scope, fn, options},
&returns,
)
return returns
}