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

software.amazon.awscdk.services.sns.subscriptions.LambdaSubscription Maven / Gradle / Ivy

package software.amazon.awscdk.services.sns.subscriptions;

/**
 * Use a Lambda function as a subscription target.
 */
@javax.annotation.Generated(value = "jsii-pacmak/0.20.5 (build a820217)", date = "2019-11-13T14:31:31.674Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.sns.subscriptions.$Module.class, fqn = "@aws-cdk/aws-sns-subscriptions.LambdaSubscription")
public class LambdaSubscription extends software.amazon.jsii.JsiiObject implements software.amazon.awscdk.services.sns.ITopicSubscription {

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

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

    /**
     * @param fn This parameter is required.
     * @param props
     */
    @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
    public LambdaSubscription(final software.amazon.awscdk.services.lambda.IFunction fn, final software.amazon.awscdk.services.sns.subscriptions.LambdaSubscriptionProps props) {
        super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
        software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(fn, "fn is required"), props });
    }

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

    /**
     * @param topic This parameter is required.
     */
    @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
    @Override
    public software.amazon.awscdk.services.sns.TopicSubscriptionConfig bind(final software.amazon.awscdk.services.sns.ITopic topic) {
        return this.jsiiCall("bind", software.amazon.awscdk.services.sns.TopicSubscriptionConfig.class, new Object[] { java.util.Objects.requireNonNull(topic, "topic is required") });
    }

    /**
     * A fluent builder for {@link software.amazon.awscdk.services.sns.subscriptions.LambdaSubscription}.
     */
    @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
    public static final class Builder {
        /**
         * @return a new instance of {@link Builder}.
         * @param fn 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 fn) {
            return new Builder(fn);
        }

        private final software.amazon.awscdk.services.lambda.IFunction fn;
        private software.amazon.awscdk.services.sns.subscriptions.LambdaSubscriptionProps.Builder props;

        private Builder(final software.amazon.awscdk.services.lambda.IFunction fn) {
            this.fn = fn;
        }

        /**
         * @return {@code this}
         * @param filterPolicy The filter policy. This parameter is required.
         */
        @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
        public Builder filterPolicy(final java.util.Map filterPolicy) {
            this.props().filterPolicy(filterPolicy);
            return this;
        }

        /**
         * @returns a newly built instance of {@link software.amazon.awscdk.services.sns.subscriptions.LambdaSubscription}.
         */
        @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
        public software.amazon.awscdk.services.sns.subscriptions.LambdaSubscription build() {
            return new software.amazon.awscdk.services.sns.subscriptions.LambdaSubscription(
                this.fn,
                this.props != null ? this.props.build() : null
            );
        }

        private software.amazon.awscdk.services.sns.subscriptions.LambdaSubscriptionProps.Builder props() {
            if (this.props == null) {
                this.props = new software.amazon.awscdk.services.sns.subscriptions.LambdaSubscriptionProps.Builder();
            }
            return this.props;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy