software.amazon.awssdk.services.acm.model.DomainValidation Maven / Gradle / Ivy
Show all versions of acm 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.acm.model;
import java.beans.Transient;
import java.io.Serializable;
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 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;
/**
*
* Contains information about the validation of each domain name in the certificate.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DomainValidation implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField DOMAIN_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DomainName").getter(getter(DomainValidation::domainName)).setter(setter(Builder::domainName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DomainName").build()).build();
private static final SdkField> VALIDATION_EMAILS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("ValidationEmails")
.getter(getter(DomainValidation::validationEmails))
.setter(setter(Builder::validationEmails))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ValidationEmails").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 VALIDATION_DOMAIN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ValidationDomain").getter(getter(DomainValidation::validationDomain))
.setter(setter(Builder::validationDomain))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ValidationDomain").build()).build();
private static final SdkField VALIDATION_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ValidationStatus").getter(getter(DomainValidation::validationStatusAsString))
.setter(setter(Builder::validationStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ValidationStatus").build()).build();
private static final SdkField RESOURCE_RECORD_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ResourceRecord")
.getter(getter(DomainValidation::resourceRecord)).setter(setter(Builder::resourceRecord))
.constructor(ResourceRecord::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceRecord").build()).build();
private static final SdkField VALIDATION_METHOD_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ValidationMethod").getter(getter(DomainValidation::validationMethodAsString))
.setter(setter(Builder::validationMethod))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ValidationMethod").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DOMAIN_NAME_FIELD,
VALIDATION_EMAILS_FIELD, VALIDATION_DOMAIN_FIELD, VALIDATION_STATUS_FIELD, RESOURCE_RECORD_FIELD,
VALIDATION_METHOD_FIELD));
private static final long serialVersionUID = 1L;
private final String domainName;
private final List validationEmails;
private final String validationDomain;
private final String validationStatus;
private final ResourceRecord resourceRecord;
private final String validationMethod;
private DomainValidation(BuilderImpl builder) {
this.domainName = builder.domainName;
this.validationEmails = builder.validationEmails;
this.validationDomain = builder.validationDomain;
this.validationStatus = builder.validationStatus;
this.resourceRecord = builder.resourceRecord;
this.validationMethod = builder.validationMethod;
}
/**
*
* A fully qualified domain name (FQDN) in the certificate. For example, www.example.com
or
* example.com
.
*
*
* @return A fully qualified domain name (FQDN) in the certificate. For example, www.example.com
or
* example.com
.
*/
public final String domainName() {
return domainName;
}
/**
* For responses, this returns true if the service returned a value for the ValidationEmails 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 hasValidationEmails() {
return validationEmails != null && !(validationEmails instanceof SdkAutoConstructList);
}
/**
*
* A list of email addresses that ACM used to send domain validation emails.
*
*
* 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 #hasValidationEmails} method.
*
*
* @return A list of email addresses that ACM used to send domain validation emails.
*/
public final List validationEmails() {
return validationEmails;
}
/**
*
* The domain name that ACM used to send domain validation emails.
*
*
* @return The domain name that ACM used to send domain validation emails.
*/
public final String validationDomain() {
return validationDomain;
}
/**
*
* The validation status of the domain name. This can be one of the following values:
*
*
* -
*
* PENDING_VALIDATION
*
*
* -
*
*
SUCCESS
*
*
* -
*
*
FAILED
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #validationStatus}
* will return {@link DomainStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #validationStatusAsString}.
*
*
* @return The validation status of the domain name. This can be one of the following values:
*
* -
*
* PENDING_VALIDATION
*
*
* -
*
*
SUCCESS
*
*
* -
*
*
FAILED
*
*
* @see DomainStatus
*/
public final DomainStatus validationStatus() {
return DomainStatus.fromValue(validationStatus);
}
/**
*
* The validation status of the domain name. This can be one of the following values:
*
*
* -
*
* PENDING_VALIDATION
*
*
* -
*
*
SUCCESS
*
*
* -
*
*
FAILED
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #validationStatus}
* will return {@link DomainStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #validationStatusAsString}.
*
*
* @return The validation status of the domain name. This can be one of the following values:
*
* -
*
* PENDING_VALIDATION
*
*
* -
*
*
SUCCESS
*
*
* -
*
*
FAILED
*
*
* @see DomainStatus
*/
public final String validationStatusAsString() {
return validationStatus;
}
/**
*
* Contains the CNAME record that you add to your DNS database for domain validation. For more information, see Use DNS to Validate Domain
* Ownership.
*
*
* Note: The CNAME information that you need does not include the name of your domain. If you include
your
* domain name in the DNS database CNAME record, validation fails.
For example, if the name is
* "_a79865eb4cd1a6ab990a45779b4e0b96.yourdomain.com", only "_a79865eb4cd1a6ab990a45779b4e0b96" must be used.
*
*
* @return Contains the CNAME record that you add to your DNS database for domain validation. For more information,
* see Use DNS to
* Validate Domain Ownership.
*
* Note: The CNAME information that you need does not include the name of your domain. If you
* include
your domain name in the DNS database CNAME record, validation fails.
For example,
* if the name is "_a79865eb4cd1a6ab990a45779b4e0b96.yourdomain.com", only
* "_a79865eb4cd1a6ab990a45779b4e0b96" must be used.
*/
public final ResourceRecord resourceRecord() {
return resourceRecord;
}
/**
*
* Specifies the domain validation method.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #validationMethod}
* will return {@link ValidationMethod#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #validationMethodAsString}.
*
*
* @return Specifies the domain validation method.
* @see ValidationMethod
*/
public final ValidationMethod validationMethod() {
return ValidationMethod.fromValue(validationMethod);
}
/**
*
* Specifies the domain validation method.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #validationMethod}
* will return {@link ValidationMethod#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #validationMethodAsString}.
*
*
* @return Specifies the domain validation method.
* @see ValidationMethod
*/
public final String validationMethodAsString() {
return validationMethod;
}
@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(domainName());
hashCode = 31 * hashCode + Objects.hashCode(hasValidationEmails() ? validationEmails() : null);
hashCode = 31 * hashCode + Objects.hashCode(validationDomain());
hashCode = 31 * hashCode + Objects.hashCode(validationStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(resourceRecord());
hashCode = 31 * hashCode + Objects.hashCode(validationMethodAsString());
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 DomainValidation)) {
return false;
}
DomainValidation other = (DomainValidation) obj;
return Objects.equals(domainName(), other.domainName()) && hasValidationEmails() == other.hasValidationEmails()
&& Objects.equals(validationEmails(), other.validationEmails())
&& Objects.equals(validationDomain(), other.validationDomain())
&& Objects.equals(validationStatusAsString(), other.validationStatusAsString())
&& Objects.equals(resourceRecord(), other.resourceRecord())
&& Objects.equals(validationMethodAsString(), other.validationMethodAsString());
}
/**
* 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("DomainValidation").add("DomainName", domainName())
.add("ValidationEmails", hasValidationEmails() ? validationEmails() : null)
.add("ValidationDomain", validationDomain()).add("ValidationStatus", validationStatusAsString())
.add("ResourceRecord", resourceRecord()).add("ValidationMethod", validationMethodAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DomainName":
return Optional.ofNullable(clazz.cast(domainName()));
case "ValidationEmails":
return Optional.ofNullable(clazz.cast(validationEmails()));
case "ValidationDomain":
return Optional.ofNullable(clazz.cast(validationDomain()));
case "ValidationStatus":
return Optional.ofNullable(clazz.cast(validationStatusAsString()));
case "ResourceRecord":
return Optional.ofNullable(clazz.cast(resourceRecord()));
case "ValidationMethod":
return Optional.ofNullable(clazz.cast(validationMethodAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function