Class LambdaFunction
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.events.targets.LambdaFunction
- All Implemented Interfaces:
IRuleTarget
,software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:47.737Z")
@Stability(Stable)
public class LambdaFunction
extends software.amazon.jsii.JsiiObject
implements IRuleTarget
Use an AWS Lambda function as an event rule target.
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());
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.events.IRuleTarget
IRuleTarget.Jsii$Default, IRuleTarget.Jsii$Proxy
-
Constructor Summary
ModifierConstructorDescriptionLambdaFunction
(IFunction handler) LambdaFunction
(IFunction handler, LambdaFunctionProps props) protected
LambdaFunction
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
LambdaFunction
(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionReturns a RuleTarget that can be used to trigger this Lambda as a result from an EventBridge event.Returns a RuleTarget that can be used to trigger this Lambda as a result from an EventBridge event.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
LambdaFunction
protected LambdaFunction(software.amazon.jsii.JsiiObjectRef objRef) -
LambdaFunction
protected LambdaFunction(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
LambdaFunction
@Stability(Stable) public LambdaFunction(@NotNull IFunction handler, @Nullable LambdaFunctionProps props) - Parameters:
handler
- This parameter is required.props
-
-
LambdaFunction
- Parameters:
handler
- This parameter is required.
-
-
Method Details
-
bind
Returns a RuleTarget that can be used to trigger this Lambda as a result from an EventBridge event.- Specified by:
bind
in interfaceIRuleTarget
- Parameters:
rule
- This parameter is required._id
-
-
bind
Returns a RuleTarget that can be used to trigger this Lambda as a result from an EventBridge event.- Specified by:
bind
in interfaceIRuleTarget
- Parameters:
rule
- This parameter is required.
-