
software.amazon.awssdk.services.sesv2.model.DkimAttributes 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.io.Serializable;
import java.time.Instant;
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.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.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;
/**
*
* An object that contains information about the DKIM authentication status for an email identity.
*
*
* Amazon SES determines the authentication status by searching for specific records in the DNS configuration for the
* domain. If you used Easy DKIM to
* set up DKIM authentication, Amazon SES tries to find three unique CNAME records in the DNS configuration for your
* domain. If you provided a public key to perform DKIM authentication, Amazon SES tries to find a TXT record that uses
* the selector that you specified. The value of the TXT record must be a public key that's paired with the private key
* that you specified in the process of creating the identity
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DkimAttributes implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField SIGNING_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("SigningEnabled").getter(getter(DkimAttributes::signingEnabled)).setter(setter(Builder::signingEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SigningEnabled").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(DkimAttributes::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField> TOKENS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tokens")
.getter(getter(DkimAttributes::tokens))
.setter(setter(Builder::tokens))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tokens").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 SIGNING_ATTRIBUTES_ORIGIN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SigningAttributesOrigin").getter(getter(DkimAttributes::signingAttributesOriginAsString))
.setter(setter(Builder::signingAttributesOrigin))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SigningAttributesOrigin").build())
.build();
private static final SdkField NEXT_SIGNING_KEY_LENGTH_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NextSigningKeyLength").getter(getter(DkimAttributes::nextSigningKeyLengthAsString))
.setter(setter(Builder::nextSigningKeyLength))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NextSigningKeyLength").build())
.build();
private static final SdkField CURRENT_SIGNING_KEY_LENGTH_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CurrentSigningKeyLength").getter(getter(DkimAttributes::currentSigningKeyLengthAsString))
.setter(setter(Builder::currentSigningKeyLength))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CurrentSigningKeyLength").build())
.build();
private static final SdkField LAST_KEY_GENERATION_TIMESTAMP_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("LastKeyGenerationTimestamp")
.getter(getter(DkimAttributes::lastKeyGenerationTimestamp))
.setter(setter(Builder::lastKeyGenerationTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastKeyGenerationTimestamp").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SIGNING_ENABLED_FIELD,
STATUS_FIELD, TOKENS_FIELD, SIGNING_ATTRIBUTES_ORIGIN_FIELD, NEXT_SIGNING_KEY_LENGTH_FIELD,
CURRENT_SIGNING_KEY_LENGTH_FIELD, LAST_KEY_GENERATION_TIMESTAMP_FIELD));
private static final long serialVersionUID = 1L;
private final Boolean signingEnabled;
private final String status;
private final List tokens;
private final String signingAttributesOrigin;
private final String nextSigningKeyLength;
private final String currentSigningKeyLength;
private final Instant lastKeyGenerationTimestamp;
private DkimAttributes(BuilderImpl builder) {
this.signingEnabled = builder.signingEnabled;
this.status = builder.status;
this.tokens = builder.tokens;
this.signingAttributesOrigin = builder.signingAttributesOrigin;
this.nextSigningKeyLength = builder.nextSigningKeyLength;
this.currentSigningKeyLength = builder.currentSigningKeyLength;
this.lastKeyGenerationTimestamp = builder.lastKeyGenerationTimestamp;
}
/**
*
* If the value is true
, then the messages that you send from the identity are signed using DKIM. If
* the value is false
, then the messages that you send from the identity aren't DKIM-signed.
*
*
* @return If the value is true
, then the messages that you send from the identity are signed using
* DKIM. If the value is false
, then the messages that you send from the identity aren't
* DKIM-signed.
*/
public final Boolean signingEnabled() {
return signingEnabled;
}
/**
*
* Describes whether or not Amazon SES has successfully located the DKIM records in the DNS records for the domain.
* The status can be one of the following:
*
*
* -
*
* PENDING
– The verification process was initiated, but Amazon SES hasn't yet detected the DKIM
* records in the DNS configuration for the domain.
*
*
* -
*
* SUCCESS
– The verification process completed successfully.
*
*
* -
*
* FAILED
– The verification process failed. This typically occurs when Amazon SES fails to find the
* DKIM records in the DNS configuration of the domain.
*
*
* -
*
* TEMPORARY_FAILURE
– A temporary issue is preventing Amazon SES from determining the DKIM
* authentication status of the domain.
*
*
* -
*
* NOT_STARTED
– The DKIM verification process hasn't been initiated for the domain.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link DkimStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return Describes whether or not Amazon SES has successfully located the DKIM records in the DNS records for the
* domain. The status can be one of the following:
*
* -
*
* PENDING
– The verification process was initiated, but Amazon SES hasn't yet detected the
* DKIM records in the DNS configuration for the domain.
*
*
* -
*
* SUCCESS
– The verification process completed successfully.
*
*
* -
*
* FAILED
– The verification process failed. This typically occurs when Amazon SES fails to
* find the DKIM records in the DNS configuration of the domain.
*
*
* -
*
* TEMPORARY_FAILURE
– A temporary issue is preventing Amazon SES from determining the DKIM
* authentication status of the domain.
*
*
* -
*
* NOT_STARTED
– The DKIM verification process hasn't been initiated for the domain.
*
*
* @see DkimStatus
*/
public final DkimStatus status() {
return DkimStatus.fromValue(status);
}
/**
*
* Describes whether or not Amazon SES has successfully located the DKIM records in the DNS records for the domain.
* The status can be one of the following:
*
*
* -
*
* PENDING
– The verification process was initiated, but Amazon SES hasn't yet detected the DKIM
* records in the DNS configuration for the domain.
*
*
* -
*
* SUCCESS
– The verification process completed successfully.
*
*
* -
*
* FAILED
– The verification process failed. This typically occurs when Amazon SES fails to find the
* DKIM records in the DNS configuration of the domain.
*
*
* -
*
* TEMPORARY_FAILURE
– A temporary issue is preventing Amazon SES from determining the DKIM
* authentication status of the domain.
*
*
* -
*
* NOT_STARTED
– The DKIM verification process hasn't been initiated for the domain.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link DkimStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return Describes whether or not Amazon SES has successfully located the DKIM records in the DNS records for the
* domain. The status can be one of the following:
*
* -
*
* PENDING
– The verification process was initiated, but Amazon SES hasn't yet detected the
* DKIM records in the DNS configuration for the domain.
*
*
* -
*
* SUCCESS
– The verification process completed successfully.
*
*
* -
*
* FAILED
– The verification process failed. This typically occurs when Amazon SES fails to
* find the DKIM records in the DNS configuration of the domain.
*
*
* -
*
* TEMPORARY_FAILURE
– A temporary issue is preventing Amazon SES from determining the DKIM
* authentication status of the domain.
*
*
* -
*
* NOT_STARTED
– The DKIM verification process hasn't been initiated for the domain.
*
*
* @see DkimStatus
*/
public final String statusAsString() {
return status;
}
/**
* For responses, this returns true if the service returned a value for the Tokens 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 hasTokens() {
return tokens != null && !(tokens instanceof SdkAutoConstructList);
}
/**
*
* If you used Easy DKIM to
* configure DKIM authentication for the domain, then this object contains a set of unique strings that you use to
* create a set of CNAME records that you add to the DNS configuration for your domain. When Amazon SES detects
* these records in the DNS configuration for your domain, the DKIM authentication process is complete.
*
*
* If you configured DKIM authentication for the domain by providing your own public-private key pair, then this
* object contains the selector for the public key.
*
*
* Regardless of the DKIM authentication method you use, Amazon SES searches for the appropriate records in the DNS
* configuration of the domain for up to 72 hours.
*
*
* 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 #hasTokens} method.
*
*
* @return If you used Easy DKIM
* to configure DKIM authentication for the domain, then this object contains a set of unique strings that
* you use to create a set of CNAME records that you add to the DNS configuration for your domain. When
* Amazon SES detects these records in the DNS configuration for your domain, the DKIM authentication
* process is complete.
*
* If you configured DKIM authentication for the domain by providing your own public-private key pair, then
* this object contains the selector for the public key.
*
*
* Regardless of the DKIM authentication method you use, Amazon SES searches for the appropriate records in
* the DNS configuration of the domain for up to 72 hours.
*/
public final List tokens() {
return tokens;
}
/**
*
* A string that indicates how DKIM was configured for the identity. These are the possible values:
*
*
* -
*
* AWS_SES
– Indicates that DKIM was configured for the identity by using Easy DKIM.
*
*
* -
*
* EXTERNAL
– Indicates that DKIM was configured for the identity by using Bring Your Own DKIM
* (BYODKIM).
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #signingAttributesOrigin} will return {@link DkimSigningAttributesOrigin#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #signingAttributesOriginAsString}.
*
*
* @return A string that indicates how DKIM was configured for the identity. These are the possible values:
*
* -
*
* AWS_SES
– Indicates that DKIM was configured for the identity by using Easy DKIM.
*
*
* -
*
* EXTERNAL
– Indicates that DKIM was configured for the identity by using Bring Your Own DKIM
* (BYODKIM).
*
*
* @see DkimSigningAttributesOrigin
*/
public final DkimSigningAttributesOrigin signingAttributesOrigin() {
return DkimSigningAttributesOrigin.fromValue(signingAttributesOrigin);
}
/**
*
* A string that indicates how DKIM was configured for the identity. These are the possible values:
*
*
* -
*
* AWS_SES
– Indicates that DKIM was configured for the identity by using Easy DKIM.
*
*
* -
*
* EXTERNAL
– Indicates that DKIM was configured for the identity by using Bring Your Own DKIM
* (BYODKIM).
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #signingAttributesOrigin} will return {@link DkimSigningAttributesOrigin#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #signingAttributesOriginAsString}.
*
*
* @return A string that indicates how DKIM was configured for the identity. These are the possible values:
*
* -
*
* AWS_SES
– Indicates that DKIM was configured for the identity by using Easy DKIM.
*
*
* -
*
* EXTERNAL
– Indicates that DKIM was configured for the identity by using Bring Your Own DKIM
* (BYODKIM).
*
*
* @see DkimSigningAttributesOrigin
*/
public final String signingAttributesOriginAsString() {
return signingAttributesOrigin;
}
/**
*
* [Easy DKIM] The key length of the future DKIM key pair to be generated. This can be changed at most once per day.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #nextSigningKeyLength} will return {@link DkimSigningKeyLength#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #nextSigningKeyLengthAsString}.
*
*
* @return [Easy DKIM] The key length of the future DKIM key pair to be generated. This can be changed at most once
* per day.
* @see DkimSigningKeyLength
*/
public final DkimSigningKeyLength nextSigningKeyLength() {
return DkimSigningKeyLength.fromValue(nextSigningKeyLength);
}
/**
*
* [Easy DKIM] The key length of the future DKIM key pair to be generated. This can be changed at most once per day.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #nextSigningKeyLength} will return {@link DkimSigningKeyLength#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #nextSigningKeyLengthAsString}.
*
*
* @return [Easy DKIM] The key length of the future DKIM key pair to be generated. This can be changed at most once
* per day.
* @see DkimSigningKeyLength
*/
public final String nextSigningKeyLengthAsString() {
return nextSigningKeyLength;
}
/**
*
* [Easy DKIM] The key length of the DKIM key pair in use.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #currentSigningKeyLength} will return {@link DkimSigningKeyLength#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #currentSigningKeyLengthAsString}.
*
*
* @return [Easy DKIM] The key length of the DKIM key pair in use.
* @see DkimSigningKeyLength
*/
public final DkimSigningKeyLength currentSigningKeyLength() {
return DkimSigningKeyLength.fromValue(currentSigningKeyLength);
}
/**
*
* [Easy DKIM] The key length of the DKIM key pair in use.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #currentSigningKeyLength} will return {@link DkimSigningKeyLength#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #currentSigningKeyLengthAsString}.
*
*
* @return [Easy DKIM] The key length of the DKIM key pair in use.
* @see DkimSigningKeyLength
*/
public final String currentSigningKeyLengthAsString() {
return currentSigningKeyLength;
}
/**
*
* [Easy DKIM] The last time a key pair was generated for this identity.
*
*
* @return [Easy DKIM] The last time a key pair was generated for this identity.
*/
public final Instant lastKeyGenerationTimestamp() {
return lastKeyGenerationTimestamp;
}
@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 + Objects.hashCode(signingEnabled());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasTokens() ? tokens() : null);
hashCode = 31 * hashCode + Objects.hashCode(signingAttributesOriginAsString());
hashCode = 31 * hashCode + Objects.hashCode(nextSigningKeyLengthAsString());
hashCode = 31 * hashCode + Objects.hashCode(currentSigningKeyLengthAsString());
hashCode = 31 * hashCode + Objects.hashCode(lastKeyGenerationTimestamp());
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 DkimAttributes)) {
return false;
}
DkimAttributes other = (DkimAttributes) obj;
return Objects.equals(signingEnabled(), other.signingEnabled())
&& Objects.equals(statusAsString(), other.statusAsString()) && hasTokens() == other.hasTokens()
&& Objects.equals(tokens(), other.tokens())
&& Objects.equals(signingAttributesOriginAsString(), other.signingAttributesOriginAsString())
&& Objects.equals(nextSigningKeyLengthAsString(), other.nextSigningKeyLengthAsString())
&& Objects.equals(currentSigningKeyLengthAsString(), other.currentSigningKeyLengthAsString())
&& Objects.equals(lastKeyGenerationTimestamp(), other.lastKeyGenerationTimestamp());
}
/**
* 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("DkimAttributes").add("SigningEnabled", signingEnabled()).add("Status", statusAsString())
.add("Tokens", hasTokens() ? tokens() : null).add("SigningAttributesOrigin", signingAttributesOriginAsString())
.add("NextSigningKeyLength", nextSigningKeyLengthAsString())
.add("CurrentSigningKeyLength", currentSigningKeyLengthAsString())
.add("LastKeyGenerationTimestamp", lastKeyGenerationTimestamp()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "SigningEnabled":
return Optional.ofNullable(clazz.cast(signingEnabled()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "Tokens":
return Optional.ofNullable(clazz.cast(tokens()));
case "SigningAttributesOrigin":
return Optional.ofNullable(clazz.cast(signingAttributesOriginAsString()));
case "NextSigningKeyLength":
return Optional.ofNullable(clazz.cast(nextSigningKeyLengthAsString()));
case "CurrentSigningKeyLength":
return Optional.ofNullable(clazz.cast(currentSigningKeyLengthAsString()));
case "LastKeyGenerationTimestamp":
return Optional.ofNullable(clazz.cast(lastKeyGenerationTimestamp()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function