software.amazon.awssdk.services.ses.model.IdentityMailFromDomainAttributes 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.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;
/**
*
* Represents the custom MAIL FROM domain attributes of a verified identity (email address or domain).
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class IdentityMailFromDomainAttributes implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField MAIL_FROM_DOMAIN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(IdentityMailFromDomainAttributes::mailFromDomain)).setter(setter(Builder::mailFromDomain))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MailFromDomain").build()).build();
private static final SdkField MAIL_FROM_DOMAIN_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(IdentityMailFromDomainAttributes::mailFromDomainStatusAsString))
.setter(setter(Builder::mailFromDomainStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MailFromDomainStatus").build())
.build();
private static final SdkField BEHAVIOR_ON_MX_FAILURE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(IdentityMailFromDomainAttributes::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(MAIL_FROM_DOMAIN_FIELD,
MAIL_FROM_DOMAIN_STATUS_FIELD, BEHAVIOR_ON_MX_FAILURE_FIELD));
private static final long serialVersionUID = 1L;
private final String mailFromDomain;
private final String mailFromDomainStatus;
private final String behaviorOnMXFailure;
private IdentityMailFromDomainAttributes(BuilderImpl builder) {
this.mailFromDomain = builder.mailFromDomain;
this.mailFromDomainStatus = builder.mailFromDomainStatus;
this.behaviorOnMXFailure = builder.behaviorOnMXFailure;
}
/**
*
* The custom MAIL FROM domain that the identity is configured to use.
*
*
* @return The custom MAIL FROM domain that the identity is configured to use.
*/
public String mailFromDomain() {
return mailFromDomain;
}
/**
*
* The state that indicates whether Amazon SES has successfully read the MX record required for custom MAIL FROM
* domain setup. If the state is Success
, Amazon SES uses the specified custom MAIL FROM domain when
* the verified identity sends an email. All other states indicate that Amazon SES takes the action described by
* BehaviorOnMXFailure
.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #mailFromDomainStatus} will return {@link CustomMailFromStatus#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #mailFromDomainStatusAsString}.
*
*
* @return The state that indicates whether Amazon SES has successfully read the MX record required for custom MAIL
* FROM domain setup. If the state is Success
, Amazon SES uses the specified custom MAIL FROM
* domain when the verified identity sends an email. All other states indicate that Amazon SES takes the
* action described by BehaviorOnMXFailure
.
* @see CustomMailFromStatus
*/
public CustomMailFromStatus mailFromDomainStatus() {
return CustomMailFromStatus.fromValue(mailFromDomainStatus);
}
/**
*
* The state that indicates whether Amazon SES has successfully read the MX record required for custom MAIL FROM
* domain setup. If the state is Success
, Amazon SES uses the specified custom MAIL FROM domain when
* the verified identity sends an email. All other states indicate that Amazon SES takes the action described by
* BehaviorOnMXFailure
.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #mailFromDomainStatus} will return {@link CustomMailFromStatus#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #mailFromDomainStatusAsString}.
*
*
* @return The state that indicates whether Amazon SES has successfully read the MX record required for custom MAIL
* FROM domain setup. If the state is Success
, Amazon SES uses the specified custom MAIL FROM
* domain when the verified identity sends an email. All other states indicate that Amazon SES takes the
* action described by BehaviorOnMXFailure
.
* @see CustomMailFromStatus
*/
public String mailFromDomainStatusAsString() {
return mailFromDomainStatus;
}
/**
*
* The action that Amazon SES takes if it cannot successfully read the required MX record when you send an email. A
* value of UseDefaultValue
indicates that if Amazon SES cannot read the required MX record, it uses
* amazonses.com (or a subdomain of that) as the MAIL FROM domain. A value of RejectMessage
indicates
* that if Amazon SES cannot read the required MX record, Amazon SES returns a
* MailFromDomainNotVerified
error and does not send the email.
*
*
* The custom MAIL FROM setup states that result in this behavior are Pending
, Failed
, and
* TemporaryFailure
.
*
*
* 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 that Amazon SES takes if it cannot successfully read the required MX record when you send an
* email. A value of UseDefaultValue
indicates that if Amazon SES cannot read the required MX
* record, it uses amazonses.com (or a subdomain of that) as the MAIL FROM domain. A value of
* RejectMessage
indicates that if Amazon SES cannot read the required MX record, Amazon SES
* returns a MailFromDomainNotVerified
error and does not send the email.
*
* The custom MAIL FROM setup states that result in this behavior are Pending
,
* Failed
, and TemporaryFailure
.
* @see BehaviorOnMXFailure
*/
public BehaviorOnMXFailure behaviorOnMXFailure() {
return BehaviorOnMXFailure.fromValue(behaviorOnMXFailure);
}
/**
*
* The action that Amazon SES takes if it cannot successfully read the required MX record when you send an email. A
* value of UseDefaultValue
indicates that if Amazon SES cannot read the required MX record, it uses
* amazonses.com (or a subdomain of that) as the MAIL FROM domain. A value of RejectMessage
indicates
* that if Amazon SES cannot read the required MX record, Amazon SES returns a
* MailFromDomainNotVerified
error and does not send the email.
*
*
* The custom MAIL FROM setup states that result in this behavior are Pending
, Failed
, and
* TemporaryFailure
.
*
*
* 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 that Amazon SES takes if it cannot successfully read the required MX record when you send an
* email. A value of UseDefaultValue
indicates that if Amazon SES cannot read the required MX
* record, it uses amazonses.com (or a subdomain of that) as the MAIL FROM domain. A value of
* RejectMessage
indicates that if Amazon SES cannot read the required MX record, Amazon SES
* returns a MailFromDomainNotVerified
error and does not send the email.
*
* The custom MAIL FROM setup states that result in this behavior are Pending
,
* Failed
, and TemporaryFailure
.
* @see BehaviorOnMXFailure
*/
public 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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(mailFromDomain());
hashCode = 31 * hashCode + Objects.hashCode(mailFromDomainStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(behaviorOnMXFailureAsString());
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 IdentityMailFromDomainAttributes)) {
return false;
}
IdentityMailFromDomainAttributes other = (IdentityMailFromDomainAttributes) obj;
return Objects.equals(mailFromDomain(), other.mailFromDomain())
&& Objects.equals(mailFromDomainStatusAsString(), other.mailFromDomainStatusAsString())
&& 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 String toString() {
return ToString.builder("IdentityMailFromDomainAttributes").add("MailFromDomain", mailFromDomain())
.add("MailFromDomainStatus", mailFromDomainStatusAsString())
.add("BehaviorOnMXFailure", behaviorOnMXFailureAsString()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "MailFromDomain":
return Optional.ofNullable(clazz.cast(mailFromDomain()));
case "MailFromDomainStatus":
return Optional.ofNullable(clazz.cast(mailFromDomainStatusAsString()));
case "BehaviorOnMXFailure":
return Optional.ofNullable(clazz.cast(behaviorOnMXFailureAsString()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* The custom MAIL FROM setup states that result in this behavior are Pending
,
* Failed
, and TemporaryFailure
.
* @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 that Amazon SES takes if it cannot successfully read the required MX record when you send an
* email. A value of UseDefaultValue
indicates that if Amazon SES cannot read the required MX
* record, it uses amazonses.com (or a subdomain of that) as the MAIL FROM domain. A value of
* RejectMessage
indicates that if Amazon SES cannot read the required MX record, Amazon SES
* returns a MailFromDomainNotVerified
error and does not send the email.
*
*
* The custom MAIL FROM setup states that result in this behavior are Pending
, Failed
,
* and TemporaryFailure
.
*
*
* @param behaviorOnMXFailure
* The action that Amazon SES takes if it cannot successfully read the required MX record when you send
* an email. A value of UseDefaultValue
indicates that if Amazon SES cannot read the
* required MX record, it uses amazonses.com (or a subdomain of that) as the MAIL FROM domain. A value of
* RejectMessage
indicates that if Amazon SES cannot read the required MX record, Amazon SES
* returns a MailFromDomainNotVerified
error and does not send the email.
*
* The custom MAIL FROM setup states that result in this behavior are Pending
,
* Failed
, and TemporaryFailure
.
* @see BehaviorOnMXFailure
* @return Returns a reference to this object so that method calls can be chained together.
* @see BehaviorOnMXFailure
*/
Builder behaviorOnMXFailure(BehaviorOnMXFailure behaviorOnMXFailure);
}
static final class BuilderImpl implements Builder {
private String mailFromDomain;
private String mailFromDomainStatus;
private String behaviorOnMXFailure;
private BuilderImpl() {
}
private BuilderImpl(IdentityMailFromDomainAttributes model) {
mailFromDomain(model.mailFromDomain);
mailFromDomainStatus(model.mailFromDomainStatus);
behaviorOnMXFailure(model.behaviorOnMXFailure);
}
public final String getMailFromDomain() {
return mailFromDomain;
}
@Override
public final Builder mailFromDomain(String mailFromDomain) {
this.mailFromDomain = mailFromDomain;
return this;
}
public final void setMailFromDomain(String mailFromDomain) {
this.mailFromDomain = mailFromDomain;
}
public final String getMailFromDomainStatus() {
return mailFromDomainStatus;
}
@Override
public final Builder mailFromDomainStatus(String mailFromDomainStatus) {
this.mailFromDomainStatus = mailFromDomainStatus;
return this;
}
@Override
public final Builder mailFromDomainStatus(CustomMailFromStatus mailFromDomainStatus) {
this.mailFromDomainStatus(mailFromDomainStatus == null ? null : mailFromDomainStatus.toString());
return this;
}
public final void setMailFromDomainStatus(String mailFromDomainStatus) {
this.mailFromDomainStatus = mailFromDomainStatus;
}
public final String getBehaviorOnMXFailure() {
return 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;
}
public final void setBehaviorOnMXFailure(String behaviorOnMXFailure) {
this.behaviorOnMXFailure = behaviorOnMXFailure;
}
@Override
public IdentityMailFromDomainAttributes build() {
return new IdentityMailFromDomainAttributes(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}