software.amazon.awssdk.services.apigateway.model.CreateDomainNameResponse Maven / Gradle / Ivy
Show all versions of api-gateway Show documentation
/*
* Copyright 2013-2018 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.apigateway.model;
import java.time.Instant;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import javax.annotation.Generated;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Represents a custom domain name as a user-friendly host name of an API (RestApi).
*
*
*
* When you deploy an API, Amazon API Gateway creates a default host name for the API. This default API host name is of
* the {restapi-id}.execute-api.{region}.amazonaws.com
format. With the default host name, you can access
* the API's root resource with the URL of https://{restapi-id}.execute-api.{region}.amazonaws.com/{stage}/
* . When you set up a custom domain name of apis.example.com
for this API, you can then access the same
* resource using the URL of the https://apis.examples.com/myApi
, where myApi
is the base path
* mapping (BasePathMapping) of your API under the custom domain name.
*
*
*/
@Generated("software.amazon.awssdk:codegen")
public class CreateDomainNameResponse extends APIGatewayResponse implements
ToCopyableBuilder {
private final String domainName;
private final String certificateName;
private final String certificateArn;
private final Instant certificateUploadDate;
private final String regionalDomainName;
private final String regionalHostedZoneId;
private final String regionalCertificateName;
private final String regionalCertificateArn;
private final String distributionDomainName;
private final String distributionHostedZoneId;
private final EndpointConfiguration endpointConfiguration;
private CreateDomainNameResponse(BuilderImpl builder) {
super(builder);
this.domainName = builder.domainName;
this.certificateName = builder.certificateName;
this.certificateArn = builder.certificateArn;
this.certificateUploadDate = builder.certificateUploadDate;
this.regionalDomainName = builder.regionalDomainName;
this.regionalHostedZoneId = builder.regionalHostedZoneId;
this.regionalCertificateName = builder.regionalCertificateName;
this.regionalCertificateArn = builder.regionalCertificateArn;
this.distributionDomainName = builder.distributionDomainName;
this.distributionHostedZoneId = builder.distributionHostedZoneId;
this.endpointConfiguration = builder.endpointConfiguration;
}
/**
*
* The name of the DomainName resource.
*
*
* @return The name of the DomainName resource.
*/
public String domainName() {
return domainName;
}
/**
*
* The name of the certificate that will be used by edge-optimized endpoint for this domain name.
*
*
* @return The name of the certificate that will be used by edge-optimized endpoint for this domain name.
*/
public String certificateName() {
return certificateName;
}
/**
*
* The reference to an AWS-managed certificate that will be used by edge-optimized endpoint for this domain name.
* AWS Certificate Manager is the only supported source.
*
*
* @return The reference to an AWS-managed certificate that will be used by edge-optimized endpoint for this domain
* name. AWS Certificate Manager is the only supported source.
*/
public String certificateArn() {
return certificateArn;
}
/**
*
* The timestamp when the certificate that was used by edge-optimized endpoint for this domain name was uploaded.
*
*
* @return The timestamp when the certificate that was used by edge-optimized endpoint for this domain name was
* uploaded.
*/
public Instant certificateUploadDate() {
return certificateUploadDate;
}
/**
*
* The domain name associated with the regional endpoint for this custom domain name. You set up this association by
* adding a DNS record that points the custom domain name to this regional domain name. The regional domain name is
* returned by Amazon API Gateway when you create a regional endpoint.
*
*
* @return The domain name associated with the regional endpoint for this custom domain name. You set up this
* association by adding a DNS record that points the custom domain name to this regional domain name. The
* regional domain name is returned by Amazon API Gateway when you create a regional endpoint.
*/
public String regionalDomainName() {
return regionalDomainName;
}
/**
*
* The region-specific Amazon Route 53 Hosted Zone ID of the regional endpoint. For more information, see Set up a Regional Custom Domain Name and AWS Regions and Endpoints for
* API Gateway.
*
*
* @return The region-specific Amazon Route 53 Hosted Zone ID of the regional endpoint. For more information, see Set up a Regional Custom Domain Name and AWS Regions and
* Endpoints for API Gateway.
*/
public String regionalHostedZoneId() {
return regionalHostedZoneId;
}
/**
*
* The name of the certificate that will be used for validating the regional domain name.
*
*
* @return The name of the certificate that will be used for validating the regional domain name.
*/
public String regionalCertificateName() {
return regionalCertificateName;
}
/**
*
* The reference to an AWS-managed certificate that will be used for validating the regional domain name. AWS
* Certificate Manager is the only supported source.
*
*
* @return The reference to an AWS-managed certificate that will be used for validating the regional domain name.
* AWS Certificate Manager is the only supported source.
*/
public String regionalCertificateArn() {
return regionalCertificateArn;
}
/**
*
* The domain name of the Amazon CloudFront distribution associated with this custom domain name for an
* edge-optimized endpoint. You set up this association when adding a DNS record pointing the custom domain name to
* this distribution name. For more information about CloudFront distributions, see the Amazon CloudFront documentation.
*
*
* @return The domain name of the Amazon CloudFront distribution associated with this custom domain name for an
* edge-optimized endpoint. You set up this association when adding a DNS record pointing the custom domain
* name to this distribution name. For more information about CloudFront distributions, see the Amazon CloudFront
* documentation.
*/
public String distributionDomainName() {
return distributionDomainName;
}
/**
*
* The region-agnostic Amazon Route 53 Hosted Zone ID of the edge-optimized endpoint. The valid value is
* Z2FDTNDATAQYW2
for all the regions. For more information, see Set up a Regional Custom Domain Name and AWS Regions and Endpoints for
* API Gateway.
*
*
* @return The region-agnostic Amazon Route 53 Hosted Zone ID of the edge-optimized endpoint. The valid value is
* Z2FDTNDATAQYW2
for all the regions. For more information, see Set up a Regional Custom Domain Name and AWS Regions and
* Endpoints for API Gateway.
*/
public String distributionHostedZoneId() {
return distributionHostedZoneId;
}
/**
*
* The endpoint configuration of this DomainName showing the endpoint types of the domain name.
*
*
* @return The endpoint configuration of this DomainName showing the endpoint types of the domain name.
*/
public EndpointConfiguration endpointConfiguration() {
return endpointConfiguration;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(domainName());
hashCode = 31 * hashCode + Objects.hashCode(certificateName());
hashCode = 31 * hashCode + Objects.hashCode(certificateArn());
hashCode = 31 * hashCode + Objects.hashCode(certificateUploadDate());
hashCode = 31 * hashCode + Objects.hashCode(regionalDomainName());
hashCode = 31 * hashCode + Objects.hashCode(regionalHostedZoneId());
hashCode = 31 * hashCode + Objects.hashCode(regionalCertificateName());
hashCode = 31 * hashCode + Objects.hashCode(regionalCertificateArn());
hashCode = 31 * hashCode + Objects.hashCode(distributionDomainName());
hashCode = 31 * hashCode + Objects.hashCode(distributionHostedZoneId());
hashCode = 31 * hashCode + Objects.hashCode(endpointConfiguration());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateDomainNameResponse)) {
return false;
}
CreateDomainNameResponse other = (CreateDomainNameResponse) obj;
return Objects.equals(domainName(), other.domainName()) && Objects.equals(certificateName(), other.certificateName())
&& Objects.equals(certificateArn(), other.certificateArn())
&& Objects.equals(certificateUploadDate(), other.certificateUploadDate())
&& Objects.equals(regionalDomainName(), other.regionalDomainName())
&& Objects.equals(regionalHostedZoneId(), other.regionalHostedZoneId())
&& Objects.equals(regionalCertificateName(), other.regionalCertificateName())
&& Objects.equals(regionalCertificateArn(), other.regionalCertificateArn())
&& Objects.equals(distributionDomainName(), other.distributionDomainName())
&& Objects.equals(distributionHostedZoneId(), other.distributionHostedZoneId())
&& Objects.equals(endpointConfiguration(), other.endpointConfiguration());
}
@Override
public String toString() {
return ToString.builder("CreateDomainNameResponse").add("DomainName", domainName())
.add("CertificateName", certificateName()).add("CertificateArn", certificateArn())
.add("CertificateUploadDate", certificateUploadDate()).add("RegionalDomainName", regionalDomainName())
.add("RegionalHostedZoneId", regionalHostedZoneId()).add("RegionalCertificateName", regionalCertificateName())
.add("RegionalCertificateArn", regionalCertificateArn()).add("DistributionDomainName", distributionDomainName())
.add("DistributionHostedZoneId", distributionHostedZoneId())
.add("EndpointConfiguration", endpointConfiguration()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "domainName":
return Optional.of(clazz.cast(domainName()));
case "certificateName":
return Optional.of(clazz.cast(certificateName()));
case "certificateArn":
return Optional.of(clazz.cast(certificateArn()));
case "certificateUploadDate":
return Optional.of(clazz.cast(certificateUploadDate()));
case "regionalDomainName":
return Optional.of(clazz.cast(regionalDomainName()));
case "regionalHostedZoneId":
return Optional.of(clazz.cast(regionalHostedZoneId()));
case "regionalCertificateName":
return Optional.of(clazz.cast(regionalCertificateName()));
case "regionalCertificateArn":
return Optional.of(clazz.cast(regionalCertificateArn()));
case "distributionDomainName":
return Optional.of(clazz.cast(distributionDomainName()));
case "distributionHostedZoneId":
return Optional.of(clazz.cast(distributionHostedZoneId()));
case "endpointConfiguration":
return Optional.of(clazz.cast(endpointConfiguration()));
default:
return Optional.empty();
}
}
public interface Builder extends APIGatewayResponse.Builder, CopyableBuilder {
/**
*
* The name of the DomainName resource.
*
*
* @param domainName
* The name of the DomainName resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder domainName(String domainName);
/**
*
* The name of the certificate that will be used by edge-optimized endpoint for this domain name.
*
*
* @param certificateName
* The name of the certificate that will be used by edge-optimized endpoint for this domain name.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder certificateName(String certificateName);
/**
*
* The reference to an AWS-managed certificate that will be used by edge-optimized endpoint for this domain
* name. AWS Certificate Manager is the only supported source.
*
*
* @param certificateArn
* The reference to an AWS-managed certificate that will be used by edge-optimized endpoint for this
* domain name. AWS Certificate Manager is the only supported source.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder certificateArn(String certificateArn);
/**
*
* The timestamp when the certificate that was used by edge-optimized endpoint for this domain name was
* uploaded.
*
*
* @param certificateUploadDate
* The timestamp when the certificate that was used by edge-optimized endpoint for this domain name was
* uploaded.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder certificateUploadDate(Instant certificateUploadDate);
/**
*
* The domain name associated with the regional endpoint for this custom domain name. You set up this
* association by adding a DNS record that points the custom domain name to this regional domain name. The
* regional domain name is returned by Amazon API Gateway when you create a regional endpoint.
*
*
* @param regionalDomainName
* The domain name associated with the regional endpoint for this custom domain name. You set up this
* association by adding a DNS record that points the custom domain name to this regional domain name.
* The regional domain name is returned by Amazon API Gateway when you create a regional endpoint.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder regionalDomainName(String regionalDomainName);
/**
*
* The region-specific Amazon Route 53 Hosted Zone ID of the regional endpoint. For more information, see Set up a Regional Custom Domain Name and AWS Regions and Endpoints
* for API Gateway.
*
*
* @param regionalHostedZoneId
* The region-specific Amazon Route 53 Hosted Zone ID of the regional endpoint. For more information, see
* Set up a Regional Custom Domain Name and AWS Regions and
* Endpoints for API Gateway.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder regionalHostedZoneId(String regionalHostedZoneId);
/**
*
* The name of the certificate that will be used for validating the regional domain name.
*
*
* @param regionalCertificateName
* The name of the certificate that will be used for validating the regional domain name.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder regionalCertificateName(String regionalCertificateName);
/**
*
* The reference to an AWS-managed certificate that will be used for validating the regional domain name. AWS
* Certificate Manager is the only supported source.
*
*
* @param regionalCertificateArn
* The reference to an AWS-managed certificate that will be used for validating the regional domain name.
* AWS Certificate Manager is the only supported source.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder regionalCertificateArn(String regionalCertificateArn);
/**
*
* The domain name of the Amazon CloudFront distribution associated with this custom domain name for an
* edge-optimized endpoint. You set up this association when adding a DNS record pointing the custom domain name
* to this distribution name. For more information about CloudFront distributions, see the Amazon CloudFront documentation.
*
*
* @param distributionDomainName
* The domain name of the Amazon CloudFront distribution associated with this custom domain name for an
* edge-optimized endpoint. You set up this association when adding a DNS record pointing the custom
* domain name to this distribution name. For more information about CloudFront distributions, see the Amazon CloudFront
* documentation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder distributionDomainName(String distributionDomainName);
/**
*
* The region-agnostic Amazon Route 53 Hosted Zone ID of the edge-optimized endpoint. The valid value is
* Z2FDTNDATAQYW2
for all the regions. For more information, see Set up a Regional Custom Domain Name and AWS Regions and Endpoints
* for API Gateway.
*
*
* @param distributionHostedZoneId
* The region-agnostic Amazon Route 53 Hosted Zone ID of the edge-optimized endpoint. The valid value is
* Z2FDTNDATAQYW2
for all the regions. For more information, see Set up a Regional Custom Domain Name and AWS Regions and
* Endpoints for API Gateway.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder distributionHostedZoneId(String distributionHostedZoneId);
/**
*
* The endpoint configuration of this DomainName showing the endpoint types of the domain name.
*
*
* @param endpointConfiguration
* The endpoint configuration of this DomainName showing the endpoint types of the domain name.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder endpointConfiguration(EndpointConfiguration endpointConfiguration);
/**
*
* The endpoint configuration of this DomainName showing the endpoint types of the domain name.
*
* This is a convenience that creates an instance of the {@link EndpointConfiguration.Builder} avoiding the need
* to create one manually via {@link EndpointConfiguration#builder()}.
*
* When the {@link Consumer} completes, {@link EndpointConfiguration.Builder#build()} is called immediately and
* its result is passed to {@link #endpointConfiguration(EndpointConfiguration)}.
*
* @param endpointConfiguration
* a consumer that will call methods on {@link EndpointConfiguration.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #endpointConfiguration(EndpointConfiguration)
*/
default Builder endpointConfiguration(Consumer endpointConfiguration) {
return endpointConfiguration(EndpointConfiguration.builder().apply(endpointConfiguration).build());
}
}
static final class BuilderImpl extends APIGatewayResponse.BuilderImpl implements Builder {
private String domainName;
private String certificateName;
private String certificateArn;
private Instant certificateUploadDate;
private String regionalDomainName;
private String regionalHostedZoneId;
private String regionalCertificateName;
private String regionalCertificateArn;
private String distributionDomainName;
private String distributionHostedZoneId;
private EndpointConfiguration endpointConfiguration;
private BuilderImpl() {
}
private BuilderImpl(CreateDomainNameResponse model) {
domainName(model.domainName);
certificateName(model.certificateName);
certificateArn(model.certificateArn);
certificateUploadDate(model.certificateUploadDate);
regionalDomainName(model.regionalDomainName);
regionalHostedZoneId(model.regionalHostedZoneId);
regionalCertificateName(model.regionalCertificateName);
regionalCertificateArn(model.regionalCertificateArn);
distributionDomainName(model.distributionDomainName);
distributionHostedZoneId(model.distributionHostedZoneId);
endpointConfiguration(model.endpointConfiguration);
}
public final String getDomainName() {
return domainName;
}
@Override
public final Builder domainName(String domainName) {
this.domainName = domainName;
return this;
}
public final void setDomainName(String domainName) {
this.domainName = domainName;
}
public final String getCertificateName() {
return certificateName;
}
@Override
public final Builder certificateName(String certificateName) {
this.certificateName = certificateName;
return this;
}
public final void setCertificateName(String certificateName) {
this.certificateName = certificateName;
}
public final String getCertificateArn() {
return certificateArn;
}
@Override
public final Builder certificateArn(String certificateArn) {
this.certificateArn = certificateArn;
return this;
}
public final void setCertificateArn(String certificateArn) {
this.certificateArn = certificateArn;
}
public final Instant getCertificateUploadDate() {
return certificateUploadDate;
}
@Override
public final Builder certificateUploadDate(Instant certificateUploadDate) {
this.certificateUploadDate = certificateUploadDate;
return this;
}
public final void setCertificateUploadDate(Instant certificateUploadDate) {
this.certificateUploadDate = certificateUploadDate;
}
public final String getRegionalDomainName() {
return regionalDomainName;
}
@Override
public final Builder regionalDomainName(String regionalDomainName) {
this.regionalDomainName = regionalDomainName;
return this;
}
public final void setRegionalDomainName(String regionalDomainName) {
this.regionalDomainName = regionalDomainName;
}
public final String getRegionalHostedZoneId() {
return regionalHostedZoneId;
}
@Override
public final Builder regionalHostedZoneId(String regionalHostedZoneId) {
this.regionalHostedZoneId = regionalHostedZoneId;
return this;
}
public final void setRegionalHostedZoneId(String regionalHostedZoneId) {
this.regionalHostedZoneId = regionalHostedZoneId;
}
public final String getRegionalCertificateName() {
return regionalCertificateName;
}
@Override
public final Builder regionalCertificateName(String regionalCertificateName) {
this.regionalCertificateName = regionalCertificateName;
return this;
}
public final void setRegionalCertificateName(String regionalCertificateName) {
this.regionalCertificateName = regionalCertificateName;
}
public final String getRegionalCertificateArn() {
return regionalCertificateArn;
}
@Override
public final Builder regionalCertificateArn(String regionalCertificateArn) {
this.regionalCertificateArn = regionalCertificateArn;
return this;
}
public final void setRegionalCertificateArn(String regionalCertificateArn) {
this.regionalCertificateArn = regionalCertificateArn;
}
public final String getDistributionDomainName() {
return distributionDomainName;
}
@Override
public final Builder distributionDomainName(String distributionDomainName) {
this.distributionDomainName = distributionDomainName;
return this;
}
public final void setDistributionDomainName(String distributionDomainName) {
this.distributionDomainName = distributionDomainName;
}
public final String getDistributionHostedZoneId() {
return distributionHostedZoneId;
}
@Override
public final Builder distributionHostedZoneId(String distributionHostedZoneId) {
this.distributionHostedZoneId = distributionHostedZoneId;
return this;
}
public final void setDistributionHostedZoneId(String distributionHostedZoneId) {
this.distributionHostedZoneId = distributionHostedZoneId;
}
public final EndpointConfiguration.Builder getEndpointConfiguration() {
return endpointConfiguration != null ? endpointConfiguration.toBuilder() : null;
}
@Override
public final Builder endpointConfiguration(EndpointConfiguration endpointConfiguration) {
this.endpointConfiguration = endpointConfiguration;
return this;
}
public final void setEndpointConfiguration(EndpointConfiguration.BuilderImpl endpointConfiguration) {
this.endpointConfiguration = endpointConfiguration != null ? endpointConfiguration.build() : null;
}
@Override
public CreateDomainNameResponse build() {
return new CreateDomainNameResponse(this);
}
}
}