software.amazon.awssdk.services.apigateway.model.GetStageResponse 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.Map;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Generated;
import software.amazon.awssdk.utils.CollectionUtils;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Represents a unique identifier for a version of a deployed RestApi that is callable by users.
*
*
*/
@Generated("software.amazon.awssdk:codegen")
public class GetStageResponse extends APIGatewayResponse implements ToCopyableBuilder {
private final String deploymentId;
private final String clientCertificateId;
private final String stageName;
private final String description;
private final Boolean cacheClusterEnabled;
private final String cacheClusterSize;
private final String cacheClusterStatus;
private final Map methodSettings;
private final Map variables;
private final String documentationVersion;
private final Instant createdDate;
private final Instant lastUpdatedDate;
private GetStageResponse(BuilderImpl builder) {
super(builder);
this.deploymentId = builder.deploymentId;
this.clientCertificateId = builder.clientCertificateId;
this.stageName = builder.stageName;
this.description = builder.description;
this.cacheClusterEnabled = builder.cacheClusterEnabled;
this.cacheClusterSize = builder.cacheClusterSize;
this.cacheClusterStatus = builder.cacheClusterStatus;
this.methodSettings = builder.methodSettings;
this.variables = builder.variables;
this.documentationVersion = builder.documentationVersion;
this.createdDate = builder.createdDate;
this.lastUpdatedDate = builder.lastUpdatedDate;
}
/**
*
* The identifier of the Deployment that the stage points to.
*
*
* @return The identifier of the Deployment that the stage points to.
*/
public String deploymentId() {
return deploymentId;
}
/**
*
* The identifier of a client certificate for an API stage.
*
*
* @return The identifier of a client certificate for an API stage.
*/
public String clientCertificateId() {
return clientCertificateId;
}
/**
*
* The name of the stage is the first path segment in the Uniform Resource Identifier (URI) of a call to Amazon API
* Gateway.
*
*
* @return The name of the stage is the first path segment in the Uniform Resource Identifier (URI) of a call to
* Amazon API Gateway.
*/
public String stageName() {
return stageName;
}
/**
*
* The stage's description.
*
*
* @return The stage's description.
*/
public String description() {
return description;
}
/**
*
* Specifies whether a cache cluster is enabled for the stage.
*
*
* @return Specifies whether a cache cluster is enabled for the stage.
*/
public Boolean cacheClusterEnabled() {
return cacheClusterEnabled;
}
/**
*
* The size of the cache cluster for the stage, if enabled.
*
*
* @return The size of the cache cluster for the stage, if enabled.
*/
public String cacheClusterSize() {
return cacheClusterSize;
}
/**
*
* The status of the cache cluster for the stage, if enabled.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #cacheClusterStatus} will return {@link CacheClusterStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #cacheClusterStatusString}.
*
*
* @return The status of the cache cluster for the stage, if enabled.
* @see CacheClusterStatus
*/
public CacheClusterStatus cacheClusterStatus() {
return CacheClusterStatus.fromValue(cacheClusterStatus);
}
/**
*
* The status of the cache cluster for the stage, if enabled.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #cacheClusterStatus} will return {@link CacheClusterStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #cacheClusterStatusString}.
*
*
* @return The status of the cache cluster for the stage, if enabled.
* @see CacheClusterStatus
*/
public String cacheClusterStatusString() {
return cacheClusterStatus;
}
/**
*
* A map that defines the method settings for a Stage resource. Keys (designated as
* /{method_setting_key
below) are method paths defined as {resource_path}/{http_method}
* for an individual method override, or /\*/\*
for overriding all methods in the stage.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return A map that defines the method settings for a Stage resource. Keys (designated as
* /{method_setting_key
below) are method paths defined as
* {resource_path}/{http_method}
for an individual method override, or /\*/\*
* for overriding all methods in the stage.
*/
public Map methodSettings() {
return methodSettings;
}
/**
*
* A map that defines the stage variables for a Stage resource. Variable names can have alphanumeric and
* underscore characters, and the values must match [A-Za-z0-9-._~:/?#&=,]+
.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return A map that defines the stage variables for a Stage resource. Variable names can have alphanumeric
* and underscore characters, and the values must match [A-Za-z0-9-._~:/?#&=,]+
.
*/
public Map variables() {
return variables;
}
/**
*
* The version of the associated API documentation.
*
*
* @return The version of the associated API documentation.
*/
public String documentationVersion() {
return documentationVersion;
}
/**
*
* The timestamp when the stage was created.
*
*
* @return The timestamp when the stage was created.
*/
public Instant createdDate() {
return createdDate;
}
/**
*
* The timestamp when the stage last updated.
*
*
* @return The timestamp when the stage last updated.
*/
public Instant lastUpdatedDate() {
return lastUpdatedDate;
}
@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(deploymentId());
hashCode = 31 * hashCode + Objects.hashCode(clientCertificateId());
hashCode = 31 * hashCode + Objects.hashCode(stageName());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(cacheClusterEnabled());
hashCode = 31 * hashCode + Objects.hashCode(cacheClusterSize());
hashCode = 31 * hashCode + Objects.hashCode(cacheClusterStatusString());
hashCode = 31 * hashCode + Objects.hashCode(methodSettings());
hashCode = 31 * hashCode + Objects.hashCode(variables());
hashCode = 31 * hashCode + Objects.hashCode(documentationVersion());
hashCode = 31 * hashCode + Objects.hashCode(createdDate());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedDate());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof GetStageResponse)) {
return false;
}
GetStageResponse other = (GetStageResponse) obj;
return Objects.equals(deploymentId(), other.deploymentId())
&& Objects.equals(clientCertificateId(), other.clientCertificateId())
&& Objects.equals(stageName(), other.stageName()) && Objects.equals(description(), other.description())
&& Objects.equals(cacheClusterEnabled(), other.cacheClusterEnabled())
&& Objects.equals(cacheClusterSize(), other.cacheClusterSize())
&& Objects.equals(cacheClusterStatusString(), other.cacheClusterStatusString())
&& Objects.equals(methodSettings(), other.methodSettings()) && Objects.equals(variables(), other.variables())
&& Objects.equals(documentationVersion(), other.documentationVersion())
&& Objects.equals(createdDate(), other.createdDate())
&& Objects.equals(lastUpdatedDate(), other.lastUpdatedDate());
}
@Override
public String toString() {
return ToString.builder("GetStageResponse").add("DeploymentId", deploymentId())
.add("ClientCertificateId", clientCertificateId()).add("StageName", stageName())
.add("Description", description()).add("CacheClusterEnabled", cacheClusterEnabled())
.add("CacheClusterSize", cacheClusterSize()).add("CacheClusterStatus", cacheClusterStatusString())
.add("MethodSettings", methodSettings()).add("Variables", variables())
.add("DocumentationVersion", documentationVersion()).add("CreatedDate", createdDate())
.add("LastUpdatedDate", lastUpdatedDate()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "deploymentId":
return Optional.of(clazz.cast(deploymentId()));
case "clientCertificateId":
return Optional.of(clazz.cast(clientCertificateId()));
case "stageName":
return Optional.of(clazz.cast(stageName()));
case "description":
return Optional.of(clazz.cast(description()));
case "cacheClusterEnabled":
return Optional.of(clazz.cast(cacheClusterEnabled()));
case "cacheClusterSize":
return Optional.of(clazz.cast(cacheClusterSize()));
case "cacheClusterStatus":
return Optional.of(clazz.cast(cacheClusterStatusString()));
case "methodSettings":
return Optional.of(clazz.cast(methodSettings()));
case "variables":
return Optional.of(clazz.cast(variables()));
case "documentationVersion":
return Optional.of(clazz.cast(documentationVersion()));
case "createdDate":
return Optional.of(clazz.cast(createdDate()));
case "lastUpdatedDate":
return Optional.of(clazz.cast(lastUpdatedDate()));
default:
return Optional.empty();
}
}
public interface Builder extends APIGatewayResponse.Builder, CopyableBuilder {
/**
*
* The identifier of the Deployment that the stage points to.
*
*
* @param deploymentId
* The identifier of the Deployment that the stage points to.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder deploymentId(String deploymentId);
/**
*
* The identifier of a client certificate for an API stage.
*
*
* @param clientCertificateId
* The identifier of a client certificate for an API stage.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder clientCertificateId(String clientCertificateId);
/**
*
* The name of the stage is the first path segment in the Uniform Resource Identifier (URI) of a call to Amazon
* API Gateway.
*
*
* @param stageName
* The name of the stage is the first path segment in the Uniform Resource Identifier (URI) of a call to
* Amazon API Gateway.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder stageName(String stageName);
/**
*
* The stage's description.
*
*
* @param description
* The stage's description.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder description(String description);
/**
*
* Specifies whether a cache cluster is enabled for the stage.
*
*
* @param cacheClusterEnabled
* Specifies whether a cache cluster is enabled for the stage.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder cacheClusterEnabled(Boolean cacheClusterEnabled);
/**
*
* The size of the cache cluster for the stage, if enabled.
*
*
* @param cacheClusterSize
* The size of the cache cluster for the stage, if enabled.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder cacheClusterSize(String cacheClusterSize);
/**
*
* The status of the cache cluster for the stage, if enabled.
*
*
* @param cacheClusterStatus
* The status of the cache cluster for the stage, if enabled.
* @see CacheClusterStatus
* @return Returns a reference to this object so that method calls can be chained together.
* @see CacheClusterStatus
*/
Builder cacheClusterStatus(String cacheClusterStatus);
/**
*
* The status of the cache cluster for the stage, if enabled.
*
*
* @param cacheClusterStatus
* The status of the cache cluster for the stage, if enabled.
* @see CacheClusterStatus
* @return Returns a reference to this object so that method calls can be chained together.
* @see CacheClusterStatus
*/
Builder cacheClusterStatus(CacheClusterStatus cacheClusterStatus);
/**
*
* A map that defines the method settings for a Stage resource. Keys (designated as
* /{method_setting_key
below) are method paths defined as
* {resource_path}/{http_method}
for an individual method override, or /\*/\*
for
* overriding all methods in the stage.
*
*
* @param methodSettings
* A map that defines the method settings for a Stage resource. Keys (designated as
* /{method_setting_key
below) are method paths defined as
* {resource_path}/{http_method}
for an individual method override, or
* /\*/\*
for overriding all methods in the stage.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder methodSettings(Map methodSettings);
/**
*
* A map that defines the stage variables for a Stage resource. Variable names can have alphanumeric and
* underscore characters, and the values must match [A-Za-z0-9-._~:/?#&=,]+
.
*
*
* @param variables
* A map that defines the stage variables for a Stage resource. Variable names can have
* alphanumeric and underscore characters, and the values must match
* [A-Za-z0-9-._~:/?#&=,]+
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder variables(Map variables);
/**
*
* The version of the associated API documentation.
*
*
* @param documentationVersion
* The version of the associated API documentation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder documentationVersion(String documentationVersion);
/**
*
* The timestamp when the stage was created.
*
*
* @param createdDate
* The timestamp when the stage was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder createdDate(Instant createdDate);
/**
*
* The timestamp when the stage last updated.
*
*
* @param lastUpdatedDate
* The timestamp when the stage last updated.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder lastUpdatedDate(Instant lastUpdatedDate);
}
static final class BuilderImpl extends APIGatewayResponse.BuilderImpl implements Builder {
private String deploymentId;
private String clientCertificateId;
private String stageName;
private String description;
private Boolean cacheClusterEnabled;
private String cacheClusterSize;
private String cacheClusterStatus;
private Map methodSettings;
private Map variables;
private String documentationVersion;
private Instant createdDate;
private Instant lastUpdatedDate;
private BuilderImpl() {
}
private BuilderImpl(GetStageResponse model) {
deploymentId(model.deploymentId);
clientCertificateId(model.clientCertificateId);
stageName(model.stageName);
description(model.description);
cacheClusterEnabled(model.cacheClusterEnabled);
cacheClusterSize(model.cacheClusterSize);
cacheClusterStatus(model.cacheClusterStatus);
methodSettings(model.methodSettings);
variables(model.variables);
documentationVersion(model.documentationVersion);
createdDate(model.createdDate);
lastUpdatedDate(model.lastUpdatedDate);
}
public final String getDeploymentId() {
return deploymentId;
}
@Override
public final Builder deploymentId(String deploymentId) {
this.deploymentId = deploymentId;
return this;
}
public final void setDeploymentId(String deploymentId) {
this.deploymentId = deploymentId;
}
public final String getClientCertificateId() {
return clientCertificateId;
}
@Override
public final Builder clientCertificateId(String clientCertificateId) {
this.clientCertificateId = clientCertificateId;
return this;
}
public final void setClientCertificateId(String clientCertificateId) {
this.clientCertificateId = clientCertificateId;
}
public final String getStageName() {
return stageName;
}
@Override
public final Builder stageName(String stageName) {
this.stageName = stageName;
return this;
}
public final void setStageName(String stageName) {
this.stageName = stageName;
}
public final String getDescription() {
return description;
}
@Override
public final Builder description(String description) {
this.description = description;
return this;
}
public final void setDescription(String description) {
this.description = description;
}
public final Boolean getCacheClusterEnabled() {
return cacheClusterEnabled;
}
@Override
public final Builder cacheClusterEnabled(Boolean cacheClusterEnabled) {
this.cacheClusterEnabled = cacheClusterEnabled;
return this;
}
public final void setCacheClusterEnabled(Boolean cacheClusterEnabled) {
this.cacheClusterEnabled = cacheClusterEnabled;
}
public final String getCacheClusterSize() {
return cacheClusterSize;
}
@Override
public final Builder cacheClusterSize(String cacheClusterSize) {
this.cacheClusterSize = cacheClusterSize;
return this;
}
public final void setCacheClusterSize(String cacheClusterSize) {
this.cacheClusterSize = cacheClusterSize;
}
public final String getCacheClusterStatus() {
return cacheClusterStatus;
}
@Override
public final Builder cacheClusterStatus(String cacheClusterStatus) {
this.cacheClusterStatus = cacheClusterStatus;
return this;
}
@Override
public final Builder cacheClusterStatus(CacheClusterStatus cacheClusterStatus) {
this.cacheClusterStatus(cacheClusterStatus.toString());
return this;
}
public final void setCacheClusterStatus(String cacheClusterStatus) {
this.cacheClusterStatus = cacheClusterStatus;
}
public final Map getMethodSettings() {
return methodSettings != null ? CollectionUtils.mapValues(methodSettings, MethodSetting::toBuilder) : null;
}
@Override
public final Builder methodSettings(Map methodSettings) {
this.methodSettings = MapOfMethodSettingsCopier.copy(methodSettings);
return this;
}
public final void setMethodSettings(Map methodSettings) {
this.methodSettings = MapOfMethodSettingsCopier.copyFromBuilder(methodSettings);
}
public final Map getVariables() {
return variables;
}
@Override
public final Builder variables(Map variables) {
this.variables = MapOfStringToStringCopier.copy(variables);
return this;
}
public final void setVariables(Map variables) {
this.variables = MapOfStringToStringCopier.copy(variables);
}
public final String getDocumentationVersion() {
return documentationVersion;
}
@Override
public final Builder documentationVersion(String documentationVersion) {
this.documentationVersion = documentationVersion;
return this;
}
public final void setDocumentationVersion(String documentationVersion) {
this.documentationVersion = documentationVersion;
}
public final Instant getCreatedDate() {
return createdDate;
}
@Override
public final Builder createdDate(Instant createdDate) {
this.createdDate = createdDate;
return this;
}
public final void setCreatedDate(Instant createdDate) {
this.createdDate = createdDate;
}
public final Instant getLastUpdatedDate() {
return lastUpdatedDate;
}
@Override
public final Builder lastUpdatedDate(Instant lastUpdatedDate) {
this.lastUpdatedDate = lastUpdatedDate;
return this;
}
public final void setLastUpdatedDate(Instant lastUpdatedDate) {
this.lastUpdatedDate = lastUpdatedDate;
}
@Override
public GetStageResponse build() {
return new GetStageResponse(this);
}
}
}