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

software.amazon.awssdk.services.sesv2.model.SendEmailRequest Maven / Gradle / Ivy

/*
 * 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.sesv2.model;

import java.util.Arrays;
import java.util.Collection;
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.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Represents a request to send a single formatted email using Amazon SES. For more information, see the Amazon SES Developer * Guide. *

*/ @Generated("software.amazon.awssdk:codegen") public final class SendEmailRequest extends SesV2Request implements ToCopyableBuilder { private static final SdkField FROM_EMAIL_ADDRESS_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("FromEmailAddress").getter(getter(SendEmailRequest::fromEmailAddress)) .setter(setter(Builder::fromEmailAddress)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FromEmailAddress").build()).build(); private static final SdkField FROM_EMAIL_ADDRESS_IDENTITY_ARN_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("FromEmailAddressIdentityArn") .getter(getter(SendEmailRequest::fromEmailAddressIdentityArn)) .setter(setter(Builder::fromEmailAddressIdentityArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FromEmailAddressIdentityArn") .build()).build(); private static final SdkField DESTINATION_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("Destination").getter(getter(SendEmailRequest::destination)).setter(setter(Builder::destination)) .constructor(Destination::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Destination").build()).build(); private static final SdkField> REPLY_TO_ADDRESSES_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("ReplyToAddresses") .getter(getter(SendEmailRequest::replyToAddresses)) .setter(setter(Builder::replyToAddresses)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReplyToAddresses").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField FEEDBACK_FORWARDING_EMAIL_ADDRESS_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("FeedbackForwardingEmailAddress") .getter(getter(SendEmailRequest::feedbackForwardingEmailAddress)) .setter(setter(Builder::feedbackForwardingEmailAddress)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FeedbackForwardingEmailAddress") .build()).build(); private static final SdkField FEEDBACK_FORWARDING_EMAIL_ADDRESS_IDENTITY_ARN_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("FeedbackForwardingEmailAddressIdentityArn") .getter(getter(SendEmailRequest::feedbackForwardingEmailAddressIdentityArn)) .setter(setter(Builder::feedbackForwardingEmailAddressIdentityArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("FeedbackForwardingEmailAddressIdentityArn").build()).build(); private static final SdkField CONTENT_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("Content").getter(getter(SendEmailRequest::content)).setter(setter(Builder::content)) .constructor(EmailContent::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Content").build()).build(); private static final SdkField> EMAIL_TAGS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("EmailTags") .getter(getter(SendEmailRequest::emailTags)) .setter(setter(Builder::emailTags)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EmailTags").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(MessageTag::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField CONFIGURATION_SET_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ConfigurationSetName").getter(getter(SendEmailRequest::configurationSetName)) .setter(setter(Builder::configurationSetName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConfigurationSetName").build()) .build(); private static final SdkField LIST_MANAGEMENT_OPTIONS_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("ListManagementOptions") .getter(getter(SendEmailRequest::listManagementOptions)).setter(setter(Builder::listManagementOptions)) .constructor(ListManagementOptions::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ListManagementOptions").build()) .build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FROM_EMAIL_ADDRESS_FIELD, FROM_EMAIL_ADDRESS_IDENTITY_ARN_FIELD, DESTINATION_FIELD, REPLY_TO_ADDRESSES_FIELD, FEEDBACK_FORWARDING_EMAIL_ADDRESS_FIELD, FEEDBACK_FORWARDING_EMAIL_ADDRESS_IDENTITY_ARN_FIELD, CONTENT_FIELD, EMAIL_TAGS_FIELD, CONFIGURATION_SET_NAME_FIELD, LIST_MANAGEMENT_OPTIONS_FIELD)); private final String fromEmailAddress; private final String fromEmailAddressIdentityArn; private final Destination destination; private final List replyToAddresses; private final String feedbackForwardingEmailAddress; private final String feedbackForwardingEmailAddressIdentityArn; private final EmailContent content; private final List emailTags; private final String configurationSetName; private final ListManagementOptions listManagementOptions; private SendEmailRequest(BuilderImpl builder) { super(builder); this.fromEmailAddress = builder.fromEmailAddress; this.fromEmailAddressIdentityArn = builder.fromEmailAddressIdentityArn; this.destination = builder.destination; this.replyToAddresses = builder.replyToAddresses; this.feedbackForwardingEmailAddress = builder.feedbackForwardingEmailAddress; this.feedbackForwardingEmailAddressIdentityArn = builder.feedbackForwardingEmailAddressIdentityArn; this.content = builder.content; this.emailTags = builder.emailTags; this.configurationSetName = builder.configurationSetName; this.listManagementOptions = builder.listManagementOptions; } /** *

* The email address to use as the "From" address for the email. The address that you specify has to be verified. *

* * @return The email address to use as the "From" address for the email. The address that you specify has to be * verified. */ public final String fromEmailAddress() { return fromEmailAddress; } /** *

* This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the * sending authorization policy that permits you to use the email address specified in the * FromEmailAddress parameter. *

*

* For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com) * attaches a policy to it that authorizes you to use [email protected], then you would specify the * FromEmailAddressIdentityArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com, and the * FromEmailAddress to be [email protected]. *

*

* For more information about sending authorization, see the Amazon SES Developer * Guide. *

*

* For Raw emails, the FromEmailAddressIdentityArn value overrides the X-SES-SOURCE-ARN and * X-SES-FROM-ARN headers specified in raw email message content. *

* * @return This parameter is used only for sending authorization. It is the ARN of the identity that is associated * with the sending authorization policy that permits you to use the email address specified in the * FromEmailAddress parameter.

*

* For example, if the owner of example.com (which has ARN * arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you to * use [email protected], then you would specify the FromEmailAddressIdentityArn to be * arn:aws:ses:us-east-1:123456789012:identity/example.com, and the FromEmailAddress to be * [email protected]. *

*

* For more information about sending authorization, see the Amazon SES * Developer Guide. *

*

* For Raw emails, the FromEmailAddressIdentityArn value overrides the X-SES-SOURCE-ARN and * X-SES-FROM-ARN headers specified in raw email message content. */ public final String fromEmailAddressIdentityArn() { return fromEmailAddressIdentityArn; } /** *

* An object that contains the recipients of the email message. *

* * @return An object that contains the recipients of the email message. */ public final Destination destination() { return destination; } /** * For responses, this returns true if the service returned a value for the ReplyToAddresses property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasReplyToAddresses() { return replyToAddresses != null && !(replyToAddresses instanceof SdkAutoConstructList); } /** *

* The "Reply-to" email addresses for the message. When the recipient replies to the message, each Reply-to address * receives the reply. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasReplyToAddresses} method. *

* * @return The "Reply-to" email addresses for the message. When the recipient replies to the message, each Reply-to * address receives the reply. */ public final List replyToAddresses() { return replyToAddresses; } /** *

* The address that you want bounce and complaint notifications to be sent to. *

* * @return The address that you want bounce and complaint notifications to be sent to. */ public final String feedbackForwardingEmailAddress() { return feedbackForwardingEmailAddress; } /** *

* This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the * sending authorization policy that permits you to use the email address specified in the * FeedbackForwardingEmailAddress parameter. *

*

* For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com) * attaches a policy to it that authorizes you to use [email protected], then you would specify the * FeedbackForwardingEmailAddressIdentityArn to be * arn:aws:ses:us-east-1:123456789012:identity/example.com, and the FeedbackForwardingEmailAddress to * be [email protected]. *

*

* For more information about sending authorization, see the Amazon SES Developer * Guide. *

* * @return This parameter is used only for sending authorization. It is the ARN of the identity that is associated * with the sending authorization policy that permits you to use the email address specified in the * FeedbackForwardingEmailAddress parameter.

*

* For example, if the owner of example.com (which has ARN * arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you to * use [email protected], then you would specify the * FeedbackForwardingEmailAddressIdentityArn to be * arn:aws:ses:us-east-1:123456789012:identity/example.com, and the * FeedbackForwardingEmailAddress to be [email protected]. *

*

* For more information about sending authorization, see the Amazon SES * Developer Guide. */ public final String feedbackForwardingEmailAddressIdentityArn() { return feedbackForwardingEmailAddressIdentityArn; } /** *

* An object that contains the body of the message. You can send either a Simple message Raw message or a template * Message. *

* * @return An object that contains the body of the message. You can send either a Simple message Raw message or a * template Message. */ public final EmailContent content() { return content; } /** * For responses, this returns true if the service returned a value for the EmailTags property. This DOES NOT check * that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is * useful because the SDK will never return a null collection or map, but you may need to differentiate between the * service returning nothing (or null) and the service returning an empty collection or map. For requests, this * returns true if a value for the property was specified in the request builder, and false if a value was not * specified. */ public final boolean hasEmailTags() { return emailTags != null && !(emailTags instanceof SdkAutoConstructList); } /** *

* A list of tags, in the form of name/value pairs, to apply to an email that you send using the * SendEmail operation. Tags correspond to characteristics of the email that you define, so that you * can publish email sending events. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasEmailTags} method. *

* * @return A list of tags, in the form of name/value pairs, to apply to an email that you send using the * SendEmail operation. Tags correspond to characteristics of the email that you define, so * that you can publish email sending events. */ public final List emailTags() { return emailTags; } /** *

* The name of the configuration set to use when sending the email. *

* * @return The name of the configuration set to use when sending the email. */ public final String configurationSetName() { return configurationSetName; } /** *

* An object used to specify a list or topic to which an email belongs, which will be used when a contact chooses to * unsubscribe. *

* * @return An object used to specify a list or topic to which an email belongs, which will be used when a contact * chooses to unsubscribe. */ public final ListManagementOptions listManagementOptions() { return listManagementOptions; } @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 + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(fromEmailAddress()); hashCode = 31 * hashCode + Objects.hashCode(fromEmailAddressIdentityArn()); hashCode = 31 * hashCode + Objects.hashCode(destination()); hashCode = 31 * hashCode + Objects.hashCode(hasReplyToAddresses() ? replyToAddresses() : null); hashCode = 31 * hashCode + Objects.hashCode(feedbackForwardingEmailAddress()); hashCode = 31 * hashCode + Objects.hashCode(feedbackForwardingEmailAddressIdentityArn()); hashCode = 31 * hashCode + Objects.hashCode(content()); hashCode = 31 * hashCode + Objects.hashCode(hasEmailTags() ? emailTags() : null); hashCode = 31 * hashCode + Objects.hashCode(configurationSetName()); hashCode = 31 * hashCode + Objects.hashCode(listManagementOptions()); return hashCode; } @Override public final boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof SendEmailRequest)) { return false; } SendEmailRequest other = (SendEmailRequest) obj; return Objects.equals(fromEmailAddress(), other.fromEmailAddress()) && Objects.equals(fromEmailAddressIdentityArn(), other.fromEmailAddressIdentityArn()) && Objects.equals(destination(), other.destination()) && hasReplyToAddresses() == other.hasReplyToAddresses() && Objects.equals(replyToAddresses(), other.replyToAddresses()) && Objects.equals(feedbackForwardingEmailAddress(), other.feedbackForwardingEmailAddress()) && Objects.equals(feedbackForwardingEmailAddressIdentityArn(), other.feedbackForwardingEmailAddressIdentityArn()) && Objects.equals(content(), other.content()) && hasEmailTags() == other.hasEmailTags() && Objects.equals(emailTags(), other.emailTags()) && Objects.equals(configurationSetName(), other.configurationSetName()) && Objects.equals(listManagementOptions(), other.listManagementOptions()); } /** * 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("SendEmailRequest").add("FromEmailAddress", fromEmailAddress()) .add("FromEmailAddressIdentityArn", fromEmailAddressIdentityArn()).add("Destination", destination()) .add("ReplyToAddresses", hasReplyToAddresses() ? replyToAddresses() : null) .add("FeedbackForwardingEmailAddress", feedbackForwardingEmailAddress()) .add("FeedbackForwardingEmailAddressIdentityArn", feedbackForwardingEmailAddressIdentityArn()) .add("Content", content()).add("EmailTags", hasEmailTags() ? emailTags() : null) .add("ConfigurationSetName", configurationSetName()).add("ListManagementOptions", listManagementOptions()) .build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "FromEmailAddress": return Optional.ofNullable(clazz.cast(fromEmailAddress())); case "FromEmailAddressIdentityArn": return Optional.ofNullable(clazz.cast(fromEmailAddressIdentityArn())); case "Destination": return Optional.ofNullable(clazz.cast(destination())); case "ReplyToAddresses": return Optional.ofNullable(clazz.cast(replyToAddresses())); case "FeedbackForwardingEmailAddress": return Optional.ofNullable(clazz.cast(feedbackForwardingEmailAddress())); case "FeedbackForwardingEmailAddressIdentityArn": return Optional.ofNullable(clazz.cast(feedbackForwardingEmailAddressIdentityArn())); case "Content": return Optional.ofNullable(clazz.cast(content())); case "EmailTags": return Optional.ofNullable(clazz.cast(emailTags())); case "ConfigurationSetName": return Optional.ofNullable(clazz.cast(configurationSetName())); case "ListManagementOptions": return Optional.ofNullable(clazz.cast(listManagementOptions())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((SendEmailRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SesV2Request.Builder, SdkPojo, CopyableBuilder { /** *

* The email address to use as the "From" address for the email. The address that you specify has to be * verified. *

* * @param fromEmailAddress * The email address to use as the "From" address for the email. The address that you specify has to be * verified. * @return Returns a reference to this object so that method calls can be chained together. */ Builder fromEmailAddress(String fromEmailAddress); /** *

* This parameter is used only for sending authorization. It is the ARN of the identity that is associated with * the sending authorization policy that permits you to use the email address specified in the * FromEmailAddress parameter. *

*

* For example, if the owner of example.com (which has ARN * arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you to use * [email protected], then you would specify the FromEmailAddressIdentityArn to be * arn:aws:ses:us-east-1:123456789012:identity/example.com, and the FromEmailAddress to be * [email protected]. *

*

* For more information about sending authorization, see the Amazon SES Developer * Guide. *

*

* For Raw emails, the FromEmailAddressIdentityArn value overrides the X-SES-SOURCE-ARN and * X-SES-FROM-ARN headers specified in raw email message content. *

* * @param fromEmailAddressIdentityArn * This parameter is used only for sending authorization. It is the ARN of the identity that is * associated with the sending authorization policy that permits you to use the email address specified * in the FromEmailAddress parameter.

*

* For example, if the owner of example.com (which has ARN * arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you * to use [email protected], then you would specify the FromEmailAddressIdentityArn to be * arn:aws:ses:us-east-1:123456789012:identity/example.com, and the FromEmailAddress to be * [email protected]. *

*

* For more information about sending authorization, see the Amazon SES * Developer Guide. *

*

* For Raw emails, the FromEmailAddressIdentityArn value overrides the X-SES-SOURCE-ARN and * X-SES-FROM-ARN headers specified in raw email message content. * @return Returns a reference to this object so that method calls can be chained together. */ Builder fromEmailAddressIdentityArn(String fromEmailAddressIdentityArn); /** *

* An object that contains the recipients of the email message. *

* * @param destination * An object that contains the recipients of the email message. * @return Returns a reference to this object so that method calls can be chained together. */ Builder destination(Destination destination); /** *

* An object that contains the recipients of the email message. *

* This is a convenience method that creates an instance of the {@link Destination.Builder} avoiding the need to * create one manually via {@link Destination#builder()}. * *

* When the {@link Consumer} completes, {@link Destination.Builder#build()} is called immediately and its result * is passed to {@link #destination(Destination)}. * * @param destination * a consumer that will call methods on {@link Destination.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #destination(Destination) */ default Builder destination(Consumer destination) { return destination(Destination.builder().applyMutation(destination).build()); } /** *

* The "Reply-to" email addresses for the message. When the recipient replies to the message, each Reply-to * address receives the reply. *

* * @param replyToAddresses * The "Reply-to" email addresses for the message. When the recipient replies to the message, each * Reply-to address receives the reply. * @return Returns a reference to this object so that method calls can be chained together. */ Builder replyToAddresses(Collection replyToAddresses); /** *

* The "Reply-to" email addresses for the message. When the recipient replies to the message, each Reply-to * address receives the reply. *

* * @param replyToAddresses * The "Reply-to" email addresses for the message. When the recipient replies to the message, each * Reply-to address receives the reply. * @return Returns a reference to this object so that method calls can be chained together. */ Builder replyToAddresses(String... replyToAddresses); /** *

* The address that you want bounce and complaint notifications to be sent to. *

* * @param feedbackForwardingEmailAddress * The address that you want bounce and complaint notifications to be sent to. * @return Returns a reference to this object so that method calls can be chained together. */ Builder feedbackForwardingEmailAddress(String feedbackForwardingEmailAddress); /** *

* This parameter is used only for sending authorization. It is the ARN of the identity that is associated with * the sending authorization policy that permits you to use the email address specified in the * FeedbackForwardingEmailAddress parameter. *

*

* For example, if the owner of example.com (which has ARN * arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you to use * [email protected], then you would specify the FeedbackForwardingEmailAddressIdentityArn to be * arn:aws:ses:us-east-1:123456789012:identity/example.com, and the FeedbackForwardingEmailAddress * to be [email protected]. *

*

* For more information about sending authorization, see the Amazon SES Developer * Guide. *

* * @param feedbackForwardingEmailAddressIdentityArn * This parameter is used only for sending authorization. It is the ARN of the identity that is * associated with the sending authorization policy that permits you to use the email address specified * in the FeedbackForwardingEmailAddress parameter.

*

* For example, if the owner of example.com (which has ARN * arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you * to use [email protected], then you would specify the * FeedbackForwardingEmailAddressIdentityArn to be * arn:aws:ses:us-east-1:123456789012:identity/example.com, and the * FeedbackForwardingEmailAddress to be [email protected]. *

*

* For more information about sending authorization, see the Amazon SES * Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder feedbackForwardingEmailAddressIdentityArn(String feedbackForwardingEmailAddressIdentityArn); /** *

* An object that contains the body of the message. You can send either a Simple message Raw message or a * template Message. *

* * @param content * An object that contains the body of the message. You can send either a Simple message Raw message or a * template Message. * @return Returns a reference to this object so that method calls can be chained together. */ Builder content(EmailContent content); /** *

* An object that contains the body of the message. You can send either a Simple message Raw message or a * template Message. *

* This is a convenience method that creates an instance of the {@link EmailContent.Builder} avoiding the need * to create one manually via {@link EmailContent#builder()}. * *

* When the {@link Consumer} completes, {@link EmailContent.Builder#build()} is called immediately and its * result is passed to {@link #content(EmailContent)}. * * @param content * a consumer that will call methods on {@link EmailContent.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #content(EmailContent) */ default Builder content(Consumer content) { return content(EmailContent.builder().applyMutation(content).build()); } /** *

* A list of tags, in the form of name/value pairs, to apply to an email that you send using the * SendEmail operation. Tags correspond to characteristics of the email that you define, so that * you can publish email sending events. *

* * @param emailTags * A list of tags, in the form of name/value pairs, to apply to an email that you send using the * SendEmail operation. Tags correspond to characteristics of the email that you define, so * that you can publish email sending events. * @return Returns a reference to this object so that method calls can be chained together. */ Builder emailTags(Collection emailTags); /** *

* A list of tags, in the form of name/value pairs, to apply to an email that you send using the * SendEmail operation. Tags correspond to characteristics of the email that you define, so that * you can publish email sending events. *

* * @param emailTags * A list of tags, in the form of name/value pairs, to apply to an email that you send using the * SendEmail operation. Tags correspond to characteristics of the email that you define, so * that you can publish email sending events. * @return Returns a reference to this object so that method calls can be chained together. */ Builder emailTags(MessageTag... emailTags); /** *

* A list of tags, in the form of name/value pairs, to apply to an email that you send using the * SendEmail operation. Tags correspond to characteristics of the email that you define, so that * you can publish email sending events. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.sesv2.model.MessageTag.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.sesv2.model.MessageTag#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.sesv2.model.MessageTag.Builder#build()} is called immediately and its * result is passed to {@link #emailTags(List)}. * * @param emailTags * a consumer that will call methods on * {@link software.amazon.awssdk.services.sesv2.model.MessageTag.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #emailTags(java.util.Collection) */ Builder emailTags(Consumer... emailTags); /** *

* The name of the configuration set to use when sending the email. *

* * @param configurationSetName * The name of the configuration set to use when sending the email. * @return Returns a reference to this object so that method calls can be chained together. */ Builder configurationSetName(String configurationSetName); /** *

* An object used to specify a list or topic to which an email belongs, which will be used when a contact * chooses to unsubscribe. *

* * @param listManagementOptions * An object used to specify a list or topic to which an email belongs, which will be used when a contact * chooses to unsubscribe. * @return Returns a reference to this object so that method calls can be chained together. */ Builder listManagementOptions(ListManagementOptions listManagementOptions); /** *

* An object used to specify a list or topic to which an email belongs, which will be used when a contact * chooses to unsubscribe. *

* This is a convenience method that creates an instance of the {@link ListManagementOptions.Builder} avoiding * the need to create one manually via {@link ListManagementOptions#builder()}. * *

* When the {@link Consumer} completes, {@link ListManagementOptions.Builder#build()} is called immediately and * its result is passed to {@link #listManagementOptions(ListManagementOptions)}. * * @param listManagementOptions * a consumer that will call methods on {@link ListManagementOptions.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #listManagementOptions(ListManagementOptions) */ default Builder listManagementOptions(Consumer listManagementOptions) { return listManagementOptions(ListManagementOptions.builder().applyMutation(listManagementOptions).build()); } @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends SesV2Request.BuilderImpl implements Builder { private String fromEmailAddress; private String fromEmailAddressIdentityArn; private Destination destination; private List replyToAddresses = DefaultSdkAutoConstructList.getInstance(); private String feedbackForwardingEmailAddress; private String feedbackForwardingEmailAddressIdentityArn; private EmailContent content; private List emailTags = DefaultSdkAutoConstructList.getInstance(); private String configurationSetName; private ListManagementOptions listManagementOptions; private BuilderImpl() { } private BuilderImpl(SendEmailRequest model) { super(model); fromEmailAddress(model.fromEmailAddress); fromEmailAddressIdentityArn(model.fromEmailAddressIdentityArn); destination(model.destination); replyToAddresses(model.replyToAddresses); feedbackForwardingEmailAddress(model.feedbackForwardingEmailAddress); feedbackForwardingEmailAddressIdentityArn(model.feedbackForwardingEmailAddressIdentityArn); content(model.content); emailTags(model.emailTags); configurationSetName(model.configurationSetName); listManagementOptions(model.listManagementOptions); } public final String getFromEmailAddress() { return fromEmailAddress; } public final void setFromEmailAddress(String fromEmailAddress) { this.fromEmailAddress = fromEmailAddress; } @Override public final Builder fromEmailAddress(String fromEmailAddress) { this.fromEmailAddress = fromEmailAddress; return this; } public final String getFromEmailAddressIdentityArn() { return fromEmailAddressIdentityArn; } public final void setFromEmailAddressIdentityArn(String fromEmailAddressIdentityArn) { this.fromEmailAddressIdentityArn = fromEmailAddressIdentityArn; } @Override public final Builder fromEmailAddressIdentityArn(String fromEmailAddressIdentityArn) { this.fromEmailAddressIdentityArn = fromEmailAddressIdentityArn; return this; } public final Destination.Builder getDestination() { return destination != null ? destination.toBuilder() : null; } public final void setDestination(Destination.BuilderImpl destination) { this.destination = destination != null ? destination.build() : null; } @Override public final Builder destination(Destination destination) { this.destination = destination; return this; } public final Collection getReplyToAddresses() { if (replyToAddresses instanceof SdkAutoConstructList) { return null; } return replyToAddresses; } public final void setReplyToAddresses(Collection replyToAddresses) { this.replyToAddresses = EmailAddressListCopier.copy(replyToAddresses); } @Override public final Builder replyToAddresses(Collection replyToAddresses) { this.replyToAddresses = EmailAddressListCopier.copy(replyToAddresses); return this; } @Override @SafeVarargs public final Builder replyToAddresses(String... replyToAddresses) { replyToAddresses(Arrays.asList(replyToAddresses)); return this; } public final String getFeedbackForwardingEmailAddress() { return feedbackForwardingEmailAddress; } public final void setFeedbackForwardingEmailAddress(String feedbackForwardingEmailAddress) { this.feedbackForwardingEmailAddress = feedbackForwardingEmailAddress; } @Override public final Builder feedbackForwardingEmailAddress(String feedbackForwardingEmailAddress) { this.feedbackForwardingEmailAddress = feedbackForwardingEmailAddress; return this; } public final String getFeedbackForwardingEmailAddressIdentityArn() { return feedbackForwardingEmailAddressIdentityArn; } public final void setFeedbackForwardingEmailAddressIdentityArn(String feedbackForwardingEmailAddressIdentityArn) { this.feedbackForwardingEmailAddressIdentityArn = feedbackForwardingEmailAddressIdentityArn; } @Override public final Builder feedbackForwardingEmailAddressIdentityArn(String feedbackForwardingEmailAddressIdentityArn) { this.feedbackForwardingEmailAddressIdentityArn = feedbackForwardingEmailAddressIdentityArn; return this; } public final EmailContent.Builder getContent() { return content != null ? content.toBuilder() : null; } public final void setContent(EmailContent.BuilderImpl content) { this.content = content != null ? content.build() : null; } @Override public final Builder content(EmailContent content) { this.content = content; return this; } public final List getEmailTags() { List result = MessageTagListCopier.copyToBuilder(this.emailTags); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setEmailTags(Collection emailTags) { this.emailTags = MessageTagListCopier.copyFromBuilder(emailTags); } @Override public final Builder emailTags(Collection emailTags) { this.emailTags = MessageTagListCopier.copy(emailTags); return this; } @Override @SafeVarargs public final Builder emailTags(MessageTag... emailTags) { emailTags(Arrays.asList(emailTags)); return this; } @Override @SafeVarargs public final Builder emailTags(Consumer... emailTags) { emailTags(Stream.of(emailTags).map(c -> MessageTag.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final String getConfigurationSetName() { return configurationSetName; } public final void setConfigurationSetName(String configurationSetName) { this.configurationSetName = configurationSetName; } @Override public final Builder configurationSetName(String configurationSetName) { this.configurationSetName = configurationSetName; return this; } public final ListManagementOptions.Builder getListManagementOptions() { return listManagementOptions != null ? listManagementOptions.toBuilder() : null; } public final void setListManagementOptions(ListManagementOptions.BuilderImpl listManagementOptions) { this.listManagementOptions = listManagementOptions != null ? listManagementOptions.build() : null; } @Override public final Builder listManagementOptions(ListManagementOptions listManagementOptions) { this.listManagementOptions = listManagementOptions; return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public SendEmailRequest build() { return new SendEmailRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy