software.amazon.awssdk.services.ses.model.SetIdentityMailFromDomainRequest Maven / Gradle / Ivy
Show all versions of ses Show documentation
/*
* 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.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.Consumer;
import java.util.function.Function;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Represents a request to enable or disable the Amazon SES custom MAIL FROM domain setup for a verified identity. For
* information about using a custom MAIL FROM domain, see the Amazon SES Developer Guide.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class SetIdentityMailFromDomainRequest extends SesRequest implements
ToCopyableBuilder {
private static final SdkField IDENTITY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Identity").getter(getter(SetIdentityMailFromDomainRequest::identity)).setter(setter(Builder::identity))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Identity").build()).build();
private static final SdkField MAIL_FROM_DOMAIN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MailFromDomain").getter(getter(SetIdentityMailFromDomainRequest::mailFromDomain))
.setter(setter(Builder::mailFromDomain))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MailFromDomain").build()).build();
private static final SdkField BEHAVIOR_ON_MX_FAILURE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BehaviorOnMXFailure").getter(getter(SetIdentityMailFromDomainRequest::behaviorOnMXFailureAsString))
.setter(setter(Builder::behaviorOnMXFailure))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BehaviorOnMXFailure").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(IDENTITY_FIELD,
MAIL_FROM_DOMAIN_FIELD, BEHAVIOR_ON_MX_FAILURE_FIELD));
private final String identity;
private final String mailFromDomain;
private final String behaviorOnMXFailure;
private SetIdentityMailFromDomainRequest(BuilderImpl builder) {
super(builder);
this.identity = builder.identity;
this.mailFromDomain = builder.mailFromDomain;
this.behaviorOnMXFailure = builder.behaviorOnMXFailure;
}
/**
*
* The verified identity.
*
*
* @return The verified identity.
*/
public final String identity() {
return identity;
}
/**
*
* The custom MAIL FROM domain for the verified identity to use. The MAIL FROM domain must 1) be a subdomain of the
* verified identity, 2) not be used in a "From" address if the MAIL FROM domain is the destination of email
* feedback forwarding (for more information, see the Amazon SES Developer Guide), and 3) not be
* used to receive emails. A value of null
disables the custom MAIL FROM setting for the identity.
*
*
* @return The custom MAIL FROM domain for the verified identity to use. The MAIL FROM domain must 1) be a subdomain
* of the verified identity, 2) not be used in a "From" address if the MAIL FROM domain is the destination
* of email feedback forwarding (for more information, see the Amazon SES Developer Guide), and 3)
* not be used to receive emails. A value of null
disables the custom MAIL FROM setting for the
* identity.
*/
public final String mailFromDomain() {
return mailFromDomain;
}
/**
*
* The action for Amazon SES to take if it cannot successfully read the required MX record when you send an email.
* If you choose UseDefaultValue
, Amazon SES uses amazonses.com (or a subdomain of that) as the MAIL
* FROM domain. If you choose RejectMessage
, Amazon SES returns a
* MailFromDomainNotVerified
error and not send the email.
*
*
* The action specified in BehaviorOnMXFailure
is taken when the custom MAIL FROM domain setup is in
* the Pending
, Failed
, and TemporaryFailure
states.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #behaviorOnMXFailure} will return {@link BehaviorOnMXFailure#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #behaviorOnMXFailureAsString}.
*
*
* @return The action for Amazon SES to take if it cannot successfully read the required MX record when you send an
* email. If you choose UseDefaultValue
, Amazon SES uses amazonses.com (or a subdomain of that)
* as the MAIL FROM domain. If you choose RejectMessage
, Amazon SES returns a
* MailFromDomainNotVerified
error and not send the email.
*
* The action specified in BehaviorOnMXFailure
is taken when the custom MAIL FROM domain setup
* is in the Pending
, Failed
, and TemporaryFailure
states.
* @see BehaviorOnMXFailure
*/
public final BehaviorOnMXFailure behaviorOnMXFailure() {
return BehaviorOnMXFailure.fromValue(behaviorOnMXFailure);
}
/**
*
* The action for Amazon SES to take if it cannot successfully read the required MX record when you send an email.
* If you choose UseDefaultValue
, Amazon SES uses amazonses.com (or a subdomain of that) as the MAIL
* FROM domain. If you choose RejectMessage
, Amazon SES returns a
* MailFromDomainNotVerified
error and not send the email.
*
*
* The action specified in BehaviorOnMXFailure
is taken when the custom MAIL FROM domain setup is in
* the Pending
, Failed
, and TemporaryFailure
states.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #behaviorOnMXFailure} will return {@link BehaviorOnMXFailure#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #behaviorOnMXFailureAsString}.
*
*
* @return The action for Amazon SES to take if it cannot successfully read the required MX record when you send an
* email. If you choose UseDefaultValue
, Amazon SES uses amazonses.com (or a subdomain of that)
* as the MAIL FROM domain. If you choose RejectMessage
, Amazon SES returns a
* MailFromDomainNotVerified
error and not send the email.
*
* The action specified in BehaviorOnMXFailure
is taken when the custom MAIL FROM domain setup
* is in the Pending
, Failed
, and TemporaryFailure
states.
* @see BehaviorOnMXFailure
*/
public final String behaviorOnMXFailureAsString() {
return behaviorOnMXFailure;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(identity());
hashCode = 31 * hashCode + Objects.hashCode(mailFromDomain());
hashCode = 31 * hashCode + Objects.hashCode(behaviorOnMXFailureAsString());
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 SetIdentityMailFromDomainRequest)) {
return false;
}
SetIdentityMailFromDomainRequest other = (SetIdentityMailFromDomainRequest) obj;
return Objects.equals(identity(), other.identity()) && Objects.equals(mailFromDomain(), other.mailFromDomain())
&& Objects.equals(behaviorOnMXFailureAsString(), other.behaviorOnMXFailureAsString());
}
/**
* 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("SetIdentityMailFromDomainRequest").add("Identity", identity())
.add("MailFromDomain", mailFromDomain()).add("BehaviorOnMXFailure", behaviorOnMXFailureAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Identity":
return Optional.ofNullable(clazz.cast(identity()));
case "MailFromDomain":
return Optional.ofNullable(clazz.cast(mailFromDomain()));
case "BehaviorOnMXFailure":
return Optional.ofNullable(clazz.cast(behaviorOnMXFailureAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* The action specified in BehaviorOnMXFailure
is taken when the custom MAIL FROM domain
* setup is in the Pending
, Failed
, and TemporaryFailure
states.
* @see BehaviorOnMXFailure
* @return Returns a reference to this object so that method calls can be chained together.
* @see BehaviorOnMXFailure
*/
Builder behaviorOnMXFailure(String behaviorOnMXFailure);
/**
*
* The action for Amazon SES to take if it cannot successfully read the required MX record when you send an
* email. If you choose UseDefaultValue
, Amazon SES uses amazonses.com (or a subdomain of that) as
* the MAIL FROM domain. If you choose RejectMessage
, Amazon SES returns a
* MailFromDomainNotVerified
error and not send the email.
*
*
* The action specified in BehaviorOnMXFailure
is taken when the custom MAIL FROM domain setup is
* in the Pending
, Failed
, and TemporaryFailure
states.
*
*
* @param behaviorOnMXFailure
* The action for Amazon SES to take if it cannot successfully read the required MX record when you send
* an email. If you choose UseDefaultValue
, Amazon SES uses amazonses.com (or a subdomain of
* that) as the MAIL FROM domain. If you choose RejectMessage
, Amazon SES returns a
* MailFromDomainNotVerified
error and not send the email.
*
* The action specified in BehaviorOnMXFailure
is taken when the custom MAIL FROM domain
* setup is in the Pending
, Failed
, and TemporaryFailure
states.
* @see BehaviorOnMXFailure
* @return Returns a reference to this object so that method calls can be chained together.
* @see BehaviorOnMXFailure
*/
Builder behaviorOnMXFailure(BehaviorOnMXFailure behaviorOnMXFailure);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends SesRequest.BuilderImpl implements Builder {
private String identity;
private String mailFromDomain;
private String behaviorOnMXFailure;
private BuilderImpl() {
}
private BuilderImpl(SetIdentityMailFromDomainRequest model) {
super(model);
identity(model.identity);
mailFromDomain(model.mailFromDomain);
behaviorOnMXFailure(model.behaviorOnMXFailure);
}
public final String getIdentity() {
return identity;
}
public final void setIdentity(String identity) {
this.identity = identity;
}
@Override
public final Builder identity(String identity) {
this.identity = identity;
return this;
}
public final String getMailFromDomain() {
return mailFromDomain;
}
public final void setMailFromDomain(String mailFromDomain) {
this.mailFromDomain = mailFromDomain;
}
@Override
public final Builder mailFromDomain(String mailFromDomain) {
this.mailFromDomain = mailFromDomain;
return this;
}
public final String getBehaviorOnMXFailure() {
return behaviorOnMXFailure;
}
public final void setBehaviorOnMXFailure(String behaviorOnMXFailure) {
this.behaviorOnMXFailure = behaviorOnMXFailure;
}
@Override
public final Builder behaviorOnMXFailure(String behaviorOnMXFailure) {
this.behaviorOnMXFailure = behaviorOnMXFailure;
return this;
}
@Override
public final Builder behaviorOnMXFailure(BehaviorOnMXFailure behaviorOnMXFailure) {
this.behaviorOnMXFailure(behaviorOnMXFailure == null ? null : behaviorOnMXFailure.toString());
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 SetIdentityMailFromDomainRequest build() {
return new SetIdentityMailFromDomainRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}