software.amazon.awssdk.services.workmail.model.GetMailDomainResponse 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.workmail.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.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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class GetMailDomainResponse extends WorkMailResponse implements
ToCopyableBuilder {
private static final SdkField> RECORDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Records")
.getter(getter(GetMailDomainResponse::records))
.setter(setter(Builder::records))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Records").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(DnsRecord::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField IS_TEST_DOMAIN_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("IsTestDomain").getter(getter(GetMailDomainResponse::isTestDomain)).setter(setter(Builder::isTestDomain))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IsTestDomain").build()).build();
private static final SdkField IS_DEFAULT_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("IsDefault").getter(getter(GetMailDomainResponse::isDefault)).setter(setter(Builder::isDefault))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IsDefault").build()).build();
private static final SdkField OWNERSHIP_VERIFICATION_STATUS_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("OwnershipVerificationStatus")
.getter(getter(GetMailDomainResponse::ownershipVerificationStatusAsString))
.setter(setter(Builder::ownershipVerificationStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OwnershipVerificationStatus")
.build()).build();
private static final SdkField DKIM_VERIFICATION_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DkimVerificationStatus").getter(getter(GetMailDomainResponse::dkimVerificationStatusAsString))
.setter(setter(Builder::dkimVerificationStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DkimVerificationStatus").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(RECORDS_FIELD,
IS_TEST_DOMAIN_FIELD, IS_DEFAULT_FIELD, OWNERSHIP_VERIFICATION_STATUS_FIELD, DKIM_VERIFICATION_STATUS_FIELD));
private final List records;
private final Boolean isTestDomain;
private final Boolean isDefault;
private final String ownershipVerificationStatus;
private final String dkimVerificationStatus;
private GetMailDomainResponse(BuilderImpl builder) {
super(builder);
this.records = builder.records;
this.isTestDomain = builder.isTestDomain;
this.isDefault = builder.isDefault;
this.ownershipVerificationStatus = builder.ownershipVerificationStatus;
this.dkimVerificationStatus = builder.dkimVerificationStatus;
}
/**
* For responses, this returns true if the service returned a value for the Records 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 hasRecords() {
return records != null && !(records instanceof SdkAutoConstructList);
}
/**
*
* A list of the DNS records that WorkMail recommends adding in your DNS provider for the best user experience. The
* records configure your domain with DMARC, SPF, DKIM, and direct incoming email traffic to SES. See admin guide
* for more details.
*
*
* 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 #hasRecords} method.
*
*
* @return A list of the DNS records that WorkMail recommends adding in your DNS provider for the best user
* experience. The records configure your domain with DMARC, SPF, DKIM, and direct incoming email traffic to
* SES. See admin guide for more details.
*/
public final List records() {
return records;
}
/**
*
* Specifies whether the domain is a test domain provided by WorkMail, or a custom domain.
*
*
* @return Specifies whether the domain is a test domain provided by WorkMail, or a custom domain.
*/
public final Boolean isTestDomain() {
return isTestDomain;
}
/**
*
* Specifies whether the domain is the default domain for your organization.
*
*
* @return Specifies whether the domain is the default domain for your organization.
*/
public final Boolean isDefault() {
return isDefault;
}
/**
*
* Indicates the status of the domain ownership verification.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #ownershipVerificationStatus} will return {@link DnsRecordVerificationStatus#UNKNOWN_TO_SDK_VERSION}. The
* raw value returned by the service is available from {@link #ownershipVerificationStatusAsString}.
*
*
* @return Indicates the status of the domain ownership verification.
* @see DnsRecordVerificationStatus
*/
public final DnsRecordVerificationStatus ownershipVerificationStatus() {
return DnsRecordVerificationStatus.fromValue(ownershipVerificationStatus);
}
/**
*
* Indicates the status of the domain ownership verification.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #ownershipVerificationStatus} will return {@link DnsRecordVerificationStatus#UNKNOWN_TO_SDK_VERSION}. The
* raw value returned by the service is available from {@link #ownershipVerificationStatusAsString}.
*
*
* @return Indicates the status of the domain ownership verification.
* @see DnsRecordVerificationStatus
*/
public final String ownershipVerificationStatusAsString() {
return ownershipVerificationStatus;
}
/**
*
* Indicates the status of a DKIM verification.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #dkimVerificationStatus} will return {@link DnsRecordVerificationStatus#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #dkimVerificationStatusAsString}.
*
*
* @return Indicates the status of a DKIM verification.
* @see DnsRecordVerificationStatus
*/
public final DnsRecordVerificationStatus dkimVerificationStatus() {
return DnsRecordVerificationStatus.fromValue(dkimVerificationStatus);
}
/**
*
* Indicates the status of a DKIM verification.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #dkimVerificationStatus} will return {@link DnsRecordVerificationStatus#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #dkimVerificationStatusAsString}.
*
*
* @return Indicates the status of a DKIM verification.
* @see DnsRecordVerificationStatus
*/
public final String dkimVerificationStatusAsString() {
return dkimVerificationStatus;
}
@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(hasRecords() ? records() : null);
hashCode = 31 * hashCode + Objects.hashCode(isTestDomain());
hashCode = 31 * hashCode + Objects.hashCode(isDefault());
hashCode = 31 * hashCode + Objects.hashCode(ownershipVerificationStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(dkimVerificationStatusAsString());
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 GetMailDomainResponse)) {
return false;
}
GetMailDomainResponse other = (GetMailDomainResponse) obj;
return hasRecords() == other.hasRecords() && Objects.equals(records(), other.records())
&& Objects.equals(isTestDomain(), other.isTestDomain()) && Objects.equals(isDefault(), other.isDefault())
&& Objects.equals(ownershipVerificationStatusAsString(), other.ownershipVerificationStatusAsString())
&& Objects.equals(dkimVerificationStatusAsString(), other.dkimVerificationStatusAsString());
}
/**
* 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("GetMailDomainResponse").add("Records", hasRecords() ? records() : null)
.add("IsTestDomain", isTestDomain()).add("IsDefault", isDefault())
.add("OwnershipVerificationStatus", ownershipVerificationStatusAsString())
.add("DkimVerificationStatus", dkimVerificationStatusAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Records":
return Optional.ofNullable(clazz.cast(records()));
case "IsTestDomain":
return Optional.ofNullable(clazz.cast(isTestDomain()));
case "IsDefault":
return Optional.ofNullable(clazz.cast(isDefault()));
case "OwnershipVerificationStatus":
return Optional.ofNullable(clazz.cast(ownershipVerificationStatusAsString()));
case "DkimVerificationStatus":
return Optional.ofNullable(clazz.cast(dkimVerificationStatusAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function