
software.amazon.awssdk.services.worklink.model.DescribeDomainResponse Maven / Gradle / Ivy
/*
* Copyright 2014-2019 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.worklink.model;
import java.time.Instant;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class DescribeDomainResponse extends WorkLinkResponse implements
ToCopyableBuilder {
private static final SdkField DOMAIN_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DescribeDomainResponse::domainName)).setter(setter(Builder::domainName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DomainName").build()).build();
private static final SdkField DISPLAY_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DescribeDomainResponse::displayName)).setter(setter(Builder::displayName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DisplayName").build()).build();
private static final SdkField CREATED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(DescribeDomainResponse::createdTime)).setter(setter(Builder::createdTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedTime").build()).build();
private static final SdkField DOMAIN_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DescribeDomainResponse::domainStatusAsString)).setter(setter(Builder::domainStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DomainStatus").build()).build();
private static final SdkField ACM_CERTIFICATE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DescribeDomainResponse::acmCertificateArn)).setter(setter(Builder::acmCertificateArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AcmCertificateArn").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DOMAIN_NAME_FIELD,
DISPLAY_NAME_FIELD, CREATED_TIME_FIELD, DOMAIN_STATUS_FIELD, ACM_CERTIFICATE_ARN_FIELD));
private final String domainName;
private final String displayName;
private final Instant createdTime;
private final String domainStatus;
private final String acmCertificateArn;
private DescribeDomainResponse(BuilderImpl builder) {
super(builder);
this.domainName = builder.domainName;
this.displayName = builder.displayName;
this.createdTime = builder.createdTime;
this.domainStatus = builder.domainStatus;
this.acmCertificateArn = builder.acmCertificateArn;
}
/**
*
* The name of the domain.
*
*
* @return The name of the domain.
*/
public String domainName() {
return domainName;
}
/**
*
* The name to display.
*
*
* @return The name to display.
*/
public String displayName() {
return displayName;
}
/**
*
* The time that the domain was added.
*
*
* @return The time that the domain was added.
*/
public Instant createdTime() {
return createdTime;
}
/**
*
* The current state for the domain.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #domainStatus} will
* return {@link DomainStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #domainStatusAsString}.
*
*
* @return The current state for the domain.
* @see DomainStatus
*/
public DomainStatus domainStatus() {
return DomainStatus.fromValue(domainStatus);
}
/**
*
* The current state for the domain.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #domainStatus} will
* return {@link DomainStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #domainStatusAsString}.
*
*
* @return The current state for the domain.
* @see DomainStatus
*/
public String domainStatusAsString() {
return domainStatus;
}
/**
*
* The ARN of an issued ACM certificate that is valid for the domain being associated.
*
*
* @return The ARN of an issued ACM certificate that is valid for the domain being associated.
*/
public String acmCertificateArn() {
return acmCertificateArn;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(domainName());
hashCode = 31 * hashCode + Objects.hashCode(displayName());
hashCode = 31 * hashCode + Objects.hashCode(createdTime());
hashCode = 31 * hashCode + Objects.hashCode(domainStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(acmCertificateArn());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DescribeDomainResponse)) {
return false;
}
DescribeDomainResponse other = (DescribeDomainResponse) obj;
return Objects.equals(domainName(), other.domainName()) && Objects.equals(displayName(), other.displayName())
&& Objects.equals(createdTime(), other.createdTime())
&& Objects.equals(domainStatusAsString(), other.domainStatusAsString())
&& Objects.equals(acmCertificateArn(), other.acmCertificateArn());
}
/**
* 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("DescribeDomainResponse").add("DomainName", domainName()).add("DisplayName", displayName())
.add("CreatedTime", createdTime()).add("DomainStatus", domainStatusAsString())
.add("AcmCertificateArn", acmCertificateArn()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DomainName":
return Optional.ofNullable(clazz.cast(domainName()));
case "DisplayName":
return Optional.ofNullable(clazz.cast(displayName()));
case "CreatedTime":
return Optional.ofNullable(clazz.cast(createdTime()));
case "DomainStatus":
return Optional.ofNullable(clazz.cast(domainStatusAsString()));
case "AcmCertificateArn":
return Optional.ofNullable(clazz.cast(acmCertificateArn()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function