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

software.amazon.awssdk.services.ses.model.LambdaAction Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon SES module holds the client classes that are used for communicating with Amazon Simple Email Service

There is a newer version: 2.29.39
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.ses.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* When included in a receipt rule, this action calls an AWS Lambda function and, optionally, publishes a notification * to Amazon Simple Notification Service (Amazon SNS). *

*

* To enable Amazon SES to call your AWS Lambda function or to publish to an Amazon SNS topic of another account, Amazon * SES must have permission to access those resources. For information about giving permissions, see the Amazon SES Developer * Guide. *

*

* For information about using AWS Lambda actions in receipt rules, see the Amazon SES Developer * Guide. *

*/ @Generated("software.amazon.awssdk:codegen") public final class LambdaAction implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField TOPIC_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(LambdaAction::topicArn)).setter(setter(Builder::topicArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TopicArn").build()).build(); private static final SdkField FUNCTION_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(LambdaAction::functionArn)).setter(setter(Builder::functionArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FunctionArn").build()).build(); private static final SdkField INVOCATION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(LambdaAction::invocationTypeAsString)).setter(setter(Builder::invocationType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InvocationType").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TOPIC_ARN_FIELD, FUNCTION_ARN_FIELD, INVOCATION_TYPE_FIELD)); private static final long serialVersionUID = 1L; private final String topicArn; private final String functionArn; private final String invocationType; private LambdaAction(BuilderImpl builder) { this.topicArn = builder.topicArn; this.functionArn = builder.functionArn; this.invocationType = builder.invocationType; } /** *

* The Amazon Resource Name (ARN) of the Amazon SNS topic to notify when the Lambda action is taken. An example of * an Amazon SNS topic ARN is arn:aws:sns:us-west-2:123456789012:MyTopic. For more information about * Amazon SNS topics, see the Amazon SNS * Developer Guide. *

* * @return The Amazon Resource Name (ARN) of the Amazon SNS topic to notify when the Lambda action is taken. An * example of an Amazon SNS topic ARN is arn:aws:sns:us-west-2:123456789012:MyTopic. For more * information about Amazon SNS topics, see the Amazon SNS Developer Guide. */ public String topicArn() { return topicArn; } /** *

* The Amazon Resource Name (ARN) of the AWS Lambda function. An example of an AWS Lambda function ARN is * arn:aws:lambda:us-west-2:account-id:function:MyFunction. For more information about AWS Lambda, see * the AWS Lambda Developer Guide. *

* * @return The Amazon Resource Name (ARN) of the AWS Lambda function. An example of an AWS Lambda function ARN is * arn:aws:lambda:us-west-2:account-id:function:MyFunction. For more information about AWS * Lambda, see the AWS Lambda Developer * Guide. */ public String functionArn() { return functionArn; } /** *

* The invocation type of the AWS Lambda function. An invocation type of RequestResponse means that the * execution of the function will immediately result in a response, and a value of Event means that the * function will be invoked asynchronously. The default value is Event. For information about AWS * Lambda invocation types, see the AWS * Lambda Developer Guide. *

* *

* There is a 30-second timeout on RequestResponse invocations. You should use Event * invocation in most cases. Use RequestResponse only when you want to make a mail flow decision, such * as whether to stop the receipt rule or the receipt rule set. *

*
*

* If the service returns an enum value that is not available in the current SDK version, {@link #invocationType} * will return {@link InvocationType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #invocationTypeAsString}. *

* * @return The invocation type of the AWS Lambda function. An invocation type of RequestResponse means * that the execution of the function will immediately result in a response, and a value of * Event means that the function will be invoked asynchronously. The default value is * Event. For information about AWS Lambda invocation types, see the AWS Lambda Developer Guide.

* *

* There is a 30-second timeout on RequestResponse invocations. You should use * Event invocation in most cases. Use RequestResponse only when you want to make * a mail flow decision, such as whether to stop the receipt rule or the receipt rule set. *

* @see InvocationType */ public InvocationType invocationType() { return InvocationType.fromValue(invocationType); } /** *

* The invocation type of the AWS Lambda function. An invocation type of RequestResponse means that the * execution of the function will immediately result in a response, and a value of Event means that the * function will be invoked asynchronously. The default value is Event. For information about AWS * Lambda invocation types, see the AWS * Lambda Developer Guide. *

* *

* There is a 30-second timeout on RequestResponse invocations. You should use Event * invocation in most cases. Use RequestResponse only when you want to make a mail flow decision, such * as whether to stop the receipt rule or the receipt rule set. *

*
*

* If the service returns an enum value that is not available in the current SDK version, {@link #invocationType} * will return {@link InvocationType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #invocationTypeAsString}. *

* * @return The invocation type of the AWS Lambda function. An invocation type of RequestResponse means * that the execution of the function will immediately result in a response, and a value of * Event means that the function will be invoked asynchronously. The default value is * Event. For information about AWS Lambda invocation types, see the AWS Lambda Developer Guide.

* *

* There is a 30-second timeout on RequestResponse invocations. You should use * Event invocation in most cases. Use RequestResponse only when you want to make * a mail flow decision, such as whether to stop the receipt rule or the receipt rule set. *

* @see InvocationType */ public String invocationTypeAsString() { return invocationType; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(topicArn()); hashCode = 31 * hashCode + Objects.hashCode(functionArn()); hashCode = 31 * hashCode + Objects.hashCode(invocationTypeAsString()); return hashCode; } @Override public boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof LambdaAction)) { return false; } LambdaAction other = (LambdaAction) obj; return Objects.equals(topicArn(), other.topicArn()) && Objects.equals(functionArn(), other.functionArn()) && Objects.equals(invocationTypeAsString(), other.invocationTypeAsString()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public String toString() { return ToString.builder("LambdaAction").add("TopicArn", topicArn()).add("FunctionArn", functionArn()) .add("InvocationType", invocationTypeAsString()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "TopicArn": return Optional.ofNullable(clazz.cast(topicArn())); case "FunctionArn": return Optional.ofNullable(clazz.cast(functionArn())); case "InvocationType": return Optional.ofNullable(clazz.cast(invocationTypeAsString())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((LambdaAction) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The Amazon Resource Name (ARN) of the Amazon SNS topic to notify when the Lambda action is taken. An example * of an Amazon SNS topic ARN is arn:aws:sns:us-west-2:123456789012:MyTopic. For more information * about Amazon SNS topics, see the Amazon * SNS Developer Guide. *

* * @param topicArn * The Amazon Resource Name (ARN) of the Amazon SNS topic to notify when the Lambda action is taken. An * example of an Amazon SNS topic ARN is arn:aws:sns:us-west-2:123456789012:MyTopic. For * more information about Amazon SNS topics, see the Amazon SNS Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder topicArn(String topicArn); /** *

* The Amazon Resource Name (ARN) of the AWS Lambda function. An example of an AWS Lambda function ARN is * arn:aws:lambda:us-west-2:account-id:function:MyFunction. For more information about AWS Lambda, * see the AWS Lambda Developer Guide. *

* * @param functionArn * The Amazon Resource Name (ARN) of the AWS Lambda function. An example of an AWS Lambda function ARN is * arn:aws:lambda:us-west-2:account-id:function:MyFunction. For more information about AWS * Lambda, see the AWS Lambda * Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder functionArn(String functionArn); /** *

* The invocation type of the AWS Lambda function. An invocation type of RequestResponse means that * the execution of the function will immediately result in a response, and a value of Event means * that the function will be invoked asynchronously. The default value is Event. For information * about AWS Lambda invocation types, see the AWS Lambda Developer Guide. *

* *

* There is a 30-second timeout on RequestResponse invocations. You should use Event * invocation in most cases. Use RequestResponse only when you want to make a mail flow decision, * such as whether to stop the receipt rule or the receipt rule set. *

*
* * @param invocationType * The invocation type of the AWS Lambda function. An invocation type of RequestResponse * means that the execution of the function will immediately result in a response, and a value of * Event means that the function will be invoked asynchronously. The default value is * Event. For information about AWS Lambda invocation types, see the AWS Lambda Developer * Guide.

*

* There is a 30-second timeout on RequestResponse invocations. You should use * Event invocation in most cases. Use RequestResponse only when you want to * make a mail flow decision, such as whether to stop the receipt rule or the receipt rule set. *

* @see InvocationType * @return Returns a reference to this object so that method calls can be chained together. * @see InvocationType */ Builder invocationType(String invocationType); /** *

* The invocation type of the AWS Lambda function. An invocation type of RequestResponse means that * the execution of the function will immediately result in a response, and a value of Event means * that the function will be invoked asynchronously. The default value is Event. For information * about AWS Lambda invocation types, see the AWS Lambda Developer Guide. *

* *

* There is a 30-second timeout on RequestResponse invocations. You should use Event * invocation in most cases. Use RequestResponse only when you want to make a mail flow decision, * such as whether to stop the receipt rule or the receipt rule set. *

*
* * @param invocationType * The invocation type of the AWS Lambda function. An invocation type of RequestResponse * means that the execution of the function will immediately result in a response, and a value of * Event means that the function will be invoked asynchronously. The default value is * Event. For information about AWS Lambda invocation types, see the AWS Lambda Developer * Guide.

*

* There is a 30-second timeout on RequestResponse invocations. You should use * Event invocation in most cases. Use RequestResponse only when you want to * make a mail flow decision, such as whether to stop the receipt rule or the receipt rule set. *

* @see InvocationType * @return Returns a reference to this object so that method calls can be chained together. * @see InvocationType */ Builder invocationType(InvocationType invocationType); } static final class BuilderImpl implements Builder { private String topicArn; private String functionArn; private String invocationType; private BuilderImpl() { } private BuilderImpl(LambdaAction model) { topicArn(model.topicArn); functionArn(model.functionArn); invocationType(model.invocationType); } public final String getTopicArn() { return topicArn; } @Override public final Builder topicArn(String topicArn) { this.topicArn = topicArn; return this; } public final void setTopicArn(String topicArn) { this.topicArn = topicArn; } public final String getFunctionArn() { return functionArn; } @Override public final Builder functionArn(String functionArn) { this.functionArn = functionArn; return this; } public final void setFunctionArn(String functionArn) { this.functionArn = functionArn; } public final String getInvocationType() { return invocationType; } @Override public final Builder invocationType(String invocationType) { this.invocationType = invocationType; return this; } @Override public final Builder invocationType(InvocationType invocationType) { this.invocationType(invocationType == null ? null : invocationType.toString()); return this; } public final void setInvocationType(String invocationType) { this.invocationType = invocationType; } @Override public LambdaAction build() { return new LambdaAction(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy