software.amazon.awssdk.services.apprunner.model.CustomDomain Maven / Gradle / Ivy
Show all versions of apprunner 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.apprunner.model;
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 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;
/**
*
* Describes a custom domain that's associated with an AWS App Runner service.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class CustomDomain implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField DOMAIN_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DomainName").getter(getter(CustomDomain::domainName)).setter(setter(Builder::domainName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DomainName").build()).build();
private static final SdkField ENABLE_WWW_SUBDOMAIN_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("EnableWWWSubdomain").getter(getter(CustomDomain::enableWWWSubdomain))
.setter(setter(Builder::enableWWWSubdomain))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EnableWWWSubdomain").build())
.build();
private static final SdkField> CERTIFICATE_VALIDATION_RECORDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("CertificateValidationRecords")
.getter(getter(CustomDomain::certificateValidationRecords))
.setter(setter(Builder::certificateValidationRecords))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CertificateValidationRecords")
.build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(CertificateValidationRecord::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(CustomDomain::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DOMAIN_NAME_FIELD,
ENABLE_WWW_SUBDOMAIN_FIELD, CERTIFICATE_VALIDATION_RECORDS_FIELD, STATUS_FIELD));
private static final long serialVersionUID = 1L;
private final String domainName;
private final Boolean enableWWWSubdomain;
private final List certificateValidationRecords;
private final String status;
private CustomDomain(BuilderImpl builder) {
this.domainName = builder.domainName;
this.enableWWWSubdomain = builder.enableWWWSubdomain;
this.certificateValidationRecords = builder.certificateValidationRecords;
this.status = builder.status;
}
/**
*
* An associated custom domain endpoint. It can be a root domain (for example, example.com
), a
* subdomain (for example, login.example.com
or admin.login.example.com
), or a wildcard
* (for example, *.example.com
).
*
*
* @return An associated custom domain endpoint. It can be a root domain (for example, example.com
), a
* subdomain (for example, login.example.com
or admin.login.example.com
), or a
* wildcard (for example, *.example.com
).
*/
public final String domainName() {
return domainName;
}
/**
*
* When true
, the subdomain www.DomainName
is associated with the App Runner
* service in addition to the base domain.
*
*
* @return When true
, the subdomain www.DomainName
is associated with the App
* Runner service in addition to the base domain.
*/
public final Boolean enableWWWSubdomain() {
return enableWWWSubdomain;
}
/**
* Returns true if the CertificateValidationRecords property was specified by the sender (it may be empty), or false
* if the sender did not specify the value (it will be empty). For responses returned by the SDK, the sender is the
* AWS service.
*/
public final boolean hasCertificateValidationRecords() {
return certificateValidationRecords != null && !(certificateValidationRecords instanceof SdkAutoConstructList);
}
/**
*
* A list of certificate CNAME records that's used for this domain name.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasCertificateValidationRecords()} to see if a value was sent in this field.
*
*
* @return A list of certificate CNAME records that's used for this domain name.
*/
public final List certificateValidationRecords() {
return certificateValidationRecords;
}
/**
*
* The current state of the domain name association.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link CustomDomainAssociationStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #statusAsString}.
*
*
* @return The current state of the domain name association.
* @see CustomDomainAssociationStatus
*/
public final CustomDomainAssociationStatus status() {
return CustomDomainAssociationStatus.fromValue(status);
}
/**
*
* The current state of the domain name association.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link CustomDomainAssociationStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #statusAsString}.
*
*
* @return The current state of the domain name association.
* @see CustomDomainAssociationStatus
*/
public final String statusAsString() {
return status;
}
@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(domainName());
hashCode = 31 * hashCode + Objects.hashCode(enableWWWSubdomain());
hashCode = 31 * hashCode + Objects.hashCode(hasCertificateValidationRecords() ? certificateValidationRecords() : null);
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
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 CustomDomain)) {
return false;
}
CustomDomain other = (CustomDomain) obj;
return Objects.equals(domainName(), other.domainName())
&& Objects.equals(enableWWWSubdomain(), other.enableWWWSubdomain())
&& hasCertificateValidationRecords() == other.hasCertificateValidationRecords()
&& Objects.equals(certificateValidationRecords(), other.certificateValidationRecords())
&& Objects.equals(statusAsString(), other.statusAsString());
}
/**
* 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("CustomDomain").add("DomainName", domainName()).add("EnableWWWSubdomain", enableWWWSubdomain())
.add("CertificateValidationRecords", hasCertificateValidationRecords() ? certificateValidationRecords() : null)
.add("Status", statusAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DomainName":
return Optional.ofNullable(clazz.cast(domainName()));
case "EnableWWWSubdomain":
return Optional.ofNullable(clazz.cast(enableWWWSubdomain()));
case "CertificateValidationRecords":
return Optional.ofNullable(clazz.cast(certificateValidationRecords()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function