@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:39.329Z") @Stability(value=Stable) public class LambdaFunction extends software.amazon.jsii.JsiiObject implements IRuleTarget
Example:
import software.amazon.awscdk.services.lambda.*;
Function fn = Function.Builder.create(this, "MyFunc")
.runtime(Runtime.NODEJS_14_X)
.handler("index.handler")
.code(Code.fromInline("exports.handler = handler.toString()"))
.build();
Rule rule = Rule.Builder.create(this, "rule")
.eventPattern(EventPattern.builder()
.source(List.of("aws.ec2"))
.build())
.build();
Queue queue = new Queue(this, "Queue");
rule.addTarget(LambdaFunction.Builder.create(fn)
.deadLetterQueue(queue) // Optional: add a dead letter queue
.maxEventAge(Duration.hours(2)) // Optional: set the maxEventAge retry policy
.retryAttempts(2)
.build());
| Modifier and Type | Class and Description |
|---|---|
static class |
LambdaFunction.Builder
A fluent builder for
LambdaFunction. |
software.amazon.jsii.JsiiObject.InitializationModeIRuleTarget.Jsii$Default, IRuleTarget.Jsii$Proxy| Modifier | Constructor and Description |
|---|---|
|
LambdaFunction(IFunction handler) |
|
LambdaFunction(IFunction handler,
LambdaFunctionProps props) |
protected |
LambdaFunction(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
LambdaFunction(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
RuleTargetConfig |
bind(IRule rule)
Returns a RuleTarget that can be used to trigger this Lambda as a result from an EventBridge event.
|
RuleTargetConfig |
bind(IRule rule,
String _id)
Returns a RuleTarget that can be used to trigger this Lambda as a result from an EventBridge event.
|
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected LambdaFunction(software.amazon.jsii.JsiiObjectRef objRef)
protected LambdaFunction(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public LambdaFunction(@NotNull
IFunction handler,
@Nullable
LambdaFunctionProps props)
handler - This parameter is required.props - @Stability(value=Stable)
public LambdaFunction(@NotNull
IFunction handler)
handler - This parameter is required.@Stability(value=Stable) @NotNull public RuleTargetConfig bind(@NotNull IRule rule, @Nullable String _id)
bind in interface IRuleTargetrule - This parameter is required._id - @Stability(value=Stable) @NotNull public RuleTargetConfig bind(@NotNull IRule rule)
bind in interface IRuleTargetrule - This parameter is required.Copyright © 2022. All rights reserved.