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

software.amazon.awssdk.services.ses.model.BounceAction 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.beans.Transient;
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 rejects the received email by returning a bounce response to the sender * and, optionally, publishes a notification to Amazon Simple Notification Service (Amazon SNS). *

*

* For information about sending a bounce message in response to a received email, see the Amazon SES Developer * Guide. *

*/ @Generated("software.amazon.awssdk:codegen") public final class BounceAction implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField TOPIC_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("TopicArn").getter(getter(BounceAction::topicArn)).setter(setter(Builder::topicArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TopicArn").build()).build(); private static final SdkField SMTP_REPLY_CODE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("SmtpReplyCode").getter(getter(BounceAction::smtpReplyCode)).setter(setter(Builder::smtpReplyCode)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SmtpReplyCode").build()).build(); private static final SdkField STATUS_CODE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("StatusCode").getter(getter(BounceAction::statusCode)).setter(setter(Builder::statusCode)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StatusCode").build()).build(); private static final SdkField MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Message") .getter(getter(BounceAction::message)).setter(setter(Builder::message)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Message").build()).build(); private static final SdkField SENDER_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Sender") .getter(getter(BounceAction::sender)).setter(setter(Builder::sender)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Sender").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TOPIC_ARN_FIELD, SMTP_REPLY_CODE_FIELD, STATUS_CODE_FIELD, MESSAGE_FIELD, SENDER_FIELD)); private static final long serialVersionUID = 1L; private final String topicArn; private final String smtpReplyCode; private final String statusCode; private final String message; private final String sender; private BounceAction(BuilderImpl builder) { this.topicArn = builder.topicArn; this.smtpReplyCode = builder.smtpReplyCode; this.statusCode = builder.statusCode; this.message = builder.message; this.sender = builder.sender; } /** *

* The Amazon Resource Name (ARN) of the Amazon SNS topic to notify when the bounce 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 bounce 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 final String topicArn() { return topicArn; } /** *

* The SMTP reply code, as defined by RFC 5321. *

* * @return The SMTP reply code, as defined by RFC 5321. */ public final String smtpReplyCode() { return smtpReplyCode; } /** *

* The SMTP enhanced status code, as defined by RFC 3463. *

* * @return The SMTP enhanced status code, as defined by RFC 3463. */ public final String statusCode() { return statusCode; } /** *

* Human-readable text to include in the bounce message. *

* * @return Human-readable text to include in the bounce message. */ public final String message() { return message; } /** *

* The email address of the sender of the bounced email. This is the address from which the bounce message will be * sent. *

* * @return The email address of the sender of the bounced email. This is the address from which the bounce message * will be sent. */ public final String sender() { return sender; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(topicArn()); hashCode = 31 * hashCode + Objects.hashCode(smtpReplyCode()); hashCode = 31 * hashCode + Objects.hashCode(statusCode()); hashCode = 31 * hashCode + Objects.hashCode(message()); hashCode = 31 * hashCode + Objects.hashCode(sender()); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof BounceAction)) { return false; } BounceAction other = (BounceAction) obj; return Objects.equals(topicArn(), other.topicArn()) && Objects.equals(smtpReplyCode(), other.smtpReplyCode()) && Objects.equals(statusCode(), other.statusCode()) && Objects.equals(message(), other.message()) && Objects.equals(sender(), other.sender()); } /** * 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 final String toString() { return ToString.builder("BounceAction").add("TopicArn", topicArn()).add("SmtpReplyCode", smtpReplyCode()) .add("StatusCode", statusCode()).add("Message", message()).add("Sender", sender()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "TopicArn": return Optional.ofNullable(clazz.cast(topicArn())); case "SmtpReplyCode": return Optional.ofNullable(clazz.cast(smtpReplyCode())); case "StatusCode": return Optional.ofNullable(clazz.cast(statusCode())); case "Message": return Optional.ofNullable(clazz.cast(message())); case "Sender": return Optional.ofNullable(clazz.cast(sender())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((BounceAction) 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 bounce 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 bounce 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 SMTP reply code, as defined by RFC 5321. *

* * @param smtpReplyCode * The SMTP reply code, as defined by RFC 5321. * @return Returns a reference to this object so that method calls can be chained together. */ Builder smtpReplyCode(String smtpReplyCode); /** *

* The SMTP enhanced status code, as defined by RFC 3463. *

* * @param statusCode * The SMTP enhanced status code, as defined by RFC * 3463. * @return Returns a reference to this object so that method calls can be chained together. */ Builder statusCode(String statusCode); /** *

* Human-readable text to include in the bounce message. *

* * @param message * Human-readable text to include in the bounce message. * @return Returns a reference to this object so that method calls can be chained together. */ Builder message(String message); /** *

* The email address of the sender of the bounced email. This is the address from which the bounce message will * be sent. *

* * @param sender * The email address of the sender of the bounced email. This is the address from which the bounce * message will be sent. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sender(String sender); } static final class BuilderImpl implements Builder { private String topicArn; private String smtpReplyCode; private String statusCode; private String message; private String sender; private BuilderImpl() { } private BuilderImpl(BounceAction model) { topicArn(model.topicArn); smtpReplyCode(model.smtpReplyCode); statusCode(model.statusCode); message(model.message); sender(model.sender); } public final String getTopicArn() { return topicArn; } public final void setTopicArn(String topicArn) { this.topicArn = topicArn; } @Override @Transient public final Builder topicArn(String topicArn) { this.topicArn = topicArn; return this; } public final String getSmtpReplyCode() { return smtpReplyCode; } public final void setSmtpReplyCode(String smtpReplyCode) { this.smtpReplyCode = smtpReplyCode; } @Override @Transient public final Builder smtpReplyCode(String smtpReplyCode) { this.smtpReplyCode = smtpReplyCode; return this; } public final String getStatusCode() { return statusCode; } public final void setStatusCode(String statusCode) { this.statusCode = statusCode; } @Override @Transient public final Builder statusCode(String statusCode) { this.statusCode = statusCode; return this; } public final String getMessage() { return message; } public final void setMessage(String message) { this.message = message; } @Override @Transient public final Builder message(String message) { this.message = message; return this; } public final String getSender() { return sender; } public final void setSender(String sender) { this.sender = sender; } @Override @Transient public final Builder sender(String sender) { this.sender = sender; return this; } @Override public BounceAction build() { return new BounceAction(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy