All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awscdk.services.events.targets.LambdaFunction Maven / Gradle / Ivy

There is a newer version: 1.204.0
Show newest version
package software.amazon.awscdk.services.events.targets;

/**
 * Use an AWS Lambda function as an event rule target.
 */
@javax.annotation.Generated(value = "jsii-pacmak/1.30.0 (build adae23f)", date = "2021-07-09T19:18:30.461Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.events.targets.$Module.class, fqn = "@aws-cdk/aws-events-targets.LambdaFunction")
public class LambdaFunction extends software.amazon.jsii.JsiiObject implements software.amazon.awscdk.services.events.IRuleTarget {

    protected LambdaFunction(final software.amazon.jsii.JsiiObjectRef objRef) {
        super(objRef);
    }

    protected LambdaFunction(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
        super(initializationMode);
    }

    /**
     * @param handler This parameter is required.
     * @param props
     */
    @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
    public LambdaFunction(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.lambda.IFunction handler, final @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.events.targets.LambdaFunctionProps props) {
        super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
        software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(handler, "handler is required"), props });
    }

    /**
     * @param handler This parameter is required.
     */
    @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
    public LambdaFunction(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.lambda.IFunction handler) {
        super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
        software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(handler, "handler is required") });
    }

    /**
     * Returns a RuleTarget that can be used to trigger this Lambda as a result from an EventBridge event.
     * 

* @param rule This parameter is required. * @param _id */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @Override public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.events.RuleTargetConfig bind(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.events.IRule rule, final @org.jetbrains.annotations.Nullable java.lang.String _id) { return software.amazon.jsii.Kernel.call(this, "bind", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.events.RuleTargetConfig.class), new Object[] { java.util.Objects.requireNonNull(rule, "rule is required"), _id }); } /** * Returns a RuleTarget that can be used to trigger this Lambda as a result from an EventBridge event. *

* @param rule This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @Override public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.events.RuleTargetConfig bind(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.events.IRule rule) { return software.amazon.jsii.Kernel.call(this, "bind", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.events.RuleTargetConfig.class), new Object[] { java.util.Objects.requireNonNull(rule, "rule is required") }); } /** * A fluent builder for {@link software.amazon.awscdk.services.events.targets.LambdaFunction}. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public static final class Builder implements software.amazon.jsii.Builder { /** * @return a new instance of {@link Builder}. * @param handler This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public static Builder create(final software.amazon.awscdk.services.lambda.IFunction handler) { return new Builder(handler); } private final software.amazon.awscdk.services.lambda.IFunction handler; private software.amazon.awscdk.services.events.targets.LambdaFunctionProps.Builder props; private Builder(final software.amazon.awscdk.services.lambda.IFunction handler) { this.handler = handler; } /** * 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 *

* @return {@code this} * @param deadLetterQueue 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). This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder deadLetterQueue(final software.amazon.awscdk.services.sqs.IQueue deadLetterQueue) { this.props().deadLetterQueue(deadLetterQueue); return this; } /** * 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) *

* @return {@code this} * @param maxEventAge The maximum age of a request that Lambda sends to a function for processing. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder maxEventAge(final software.amazon.awscdk.core.Duration maxEventAge) { this.props().maxEventAge(maxEventAge); return this; } /** * The maximum number of times to retry when the function returns an error. *

* Minimum value of 0. * Maximum value of 185. *

* Default: 185 *

* @return {@code this} * @param retryAttempts The maximum number of times to retry when the function returns an error. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder retryAttempts(final java.lang.Number retryAttempts) { this.props().retryAttempts(retryAttempts); return this; } /** * The event to send to the Lambda. *

* This will be the payload sent to the Lambda Function. *

* Default: the entire EventBridge event *

* @return {@code this} * @param event The event to send to the Lambda. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder event(final software.amazon.awscdk.services.events.RuleTargetInput event) { this.props().event(event); return this; } /** * @returns a newly built instance of {@link software.amazon.awscdk.services.events.targets.LambdaFunction}. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @Override public software.amazon.awscdk.services.events.targets.LambdaFunction build() { return new software.amazon.awscdk.services.events.targets.LambdaFunction( this.handler, this.props != null ? this.props.build() : null ); } private software.amazon.awscdk.services.events.targets.LambdaFunctionProps.Builder props() { if (this.props == null) { this.props = new software.amazon.awscdk.services.events.targets.LambdaFunctionProps.Builder(); } return this.props; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy