software.amazon.awssdk.services.apigateway.model.CreateStageRequest 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.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import javax.annotation.Generated;
import software.amazon.awssdk.core.AwsRequestOverrideConfig;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Requests Amazon API Gateway to create a Stage resource.
*
*/
@Generated("software.amazon.awssdk:codegen")
public class CreateStageRequest extends APIGatewayRequest implements
ToCopyableBuilder {
private final String restApiId;
private final String stageName;
private final String deploymentId;
private final String description;
private final Boolean cacheClusterEnabled;
private final String cacheClusterSize;
private final Map variables;
private final String documentationVersion;
private CreateStageRequest(BuilderImpl builder) {
super(builder);
this.restApiId = builder.restApiId;
this.stageName = builder.stageName;
this.deploymentId = builder.deploymentId;
this.description = builder.description;
this.cacheClusterEnabled = builder.cacheClusterEnabled;
this.cacheClusterSize = builder.cacheClusterSize;
this.variables = builder.variables;
this.documentationVersion = builder.documentationVersion;
}
/**
*
* The string identifier of the associated RestApi.
*
*
* @return The string identifier of the associated RestApi.
*/
public String restApiId() {
return restApiId;
}
/**
*
* The name for the Stage resource.
*
*
* @return The name for the Stage resource.
*/
public String stageName() {
return stageName;
}
/**
*
* The identifier of the Deployment resource for the Stage resource.
*
*
* @return The identifier of the Deployment resource for the Stage resource.
*/
public String deploymentId() {
return deploymentId;
}
/**
*
* The description of the Stage resource.
*
*
* @return The description of the Stage resource.
*/
public String description() {
return description;
}
/**
*
* Whether cache clustering is enabled for the stage.
*
*
* @return Whether cache clustering is enabled for the stage.
*/
public Boolean cacheClusterEnabled() {
return cacheClusterEnabled;
}
/**
*
* The stage's cache cluster size.
*
*
* @return The stage's cache cluster size.
*/
public String cacheClusterSize() {
return cacheClusterSize;
}
/**
*
* A map that defines the stage variables for the new 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 the new 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;
}
@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(restApiId());
hashCode = 31 * hashCode + Objects.hashCode(stageName());
hashCode = 31 * hashCode + Objects.hashCode(deploymentId());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(cacheClusterEnabled());
hashCode = 31 * hashCode + Objects.hashCode(cacheClusterSize());
hashCode = 31 * hashCode + Objects.hashCode(variables());
hashCode = 31 * hashCode + Objects.hashCode(documentationVersion());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateStageRequest)) {
return false;
}
CreateStageRequest other = (CreateStageRequest) obj;
return Objects.equals(restApiId(), other.restApiId()) && Objects.equals(stageName(), other.stageName())
&& Objects.equals(deploymentId(), other.deploymentId()) && Objects.equals(description(), other.description())
&& Objects.equals(cacheClusterEnabled(), other.cacheClusterEnabled())
&& Objects.equals(cacheClusterSize(), other.cacheClusterSize()) && Objects.equals(variables(), other.variables())
&& Objects.equals(documentationVersion(), other.documentationVersion());
}
@Override
public String toString() {
return ToString.builder("CreateStageRequest").add("RestApiId", restApiId()).add("StageName", stageName())
.add("DeploymentId", deploymentId()).add("Description", description())
.add("CacheClusterEnabled", cacheClusterEnabled()).add("CacheClusterSize", cacheClusterSize())
.add("Variables", variables()).add("DocumentationVersion", documentationVersion()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "restApiId":
return Optional.of(clazz.cast(restApiId()));
case "stageName":
return Optional.of(clazz.cast(stageName()));
case "deploymentId":
return Optional.of(clazz.cast(deploymentId()));
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 "variables":
return Optional.of(clazz.cast(variables()));
case "documentationVersion":
return Optional.of(clazz.cast(documentationVersion()));
default:
return Optional.empty();
}
}
public interface Builder extends APIGatewayRequest.Builder, CopyableBuilder {
/**
*
* The string identifier of the associated RestApi.
*
*
* @param restApiId
* The string identifier of the associated RestApi.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder restApiId(String restApiId);
/**
*
* The name for the Stage resource.
*
*
* @param stageName
* The name for the Stage resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder stageName(String stageName);
/**
*
* The identifier of the Deployment resource for the Stage resource.
*
*
* @param deploymentId
* The identifier of the Deployment resource for the Stage resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder deploymentId(String deploymentId);
/**
*
* The description of the Stage resource.
*
*
* @param description
* The description of the Stage resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder description(String description);
/**
*
* Whether cache clustering is enabled for the stage.
*
*
* @param cacheClusterEnabled
* Whether cache clustering 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 stage's cache cluster size.
*
*
* @param cacheClusterSize
* The stage's cache cluster size.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder cacheClusterSize(String cacheClusterSize);
/**
*
* A map that defines the stage variables for the new 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 the new 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);
@Override
Builder requestOverrideConfig(AwsRequestOverrideConfig awsRequestOverrideConfig);
}
static final class BuilderImpl extends APIGatewayRequest.BuilderImpl implements Builder {
private String restApiId;
private String stageName;
private String deploymentId;
private String description;
private Boolean cacheClusterEnabled;
private String cacheClusterSize;
private Map variables;
private String documentationVersion;
private BuilderImpl() {
}
private BuilderImpl(CreateStageRequest model) {
restApiId(model.restApiId);
stageName(model.stageName);
deploymentId(model.deploymentId);
description(model.description);
cacheClusterEnabled(model.cacheClusterEnabled);
cacheClusterSize(model.cacheClusterSize);
variables(model.variables);
documentationVersion(model.documentationVersion);
}
public final String getRestApiId() {
return restApiId;
}
@Override
public final Builder restApiId(String restApiId) {
this.restApiId = restApiId;
return this;
}
public final void setRestApiId(String restApiId) {
this.restApiId = restApiId;
}
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 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 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 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;
}
@Override
public Builder requestOverrideConfig(AwsRequestOverrideConfig awsRequestOverrideConfig) {
super.requestOverrideConfig(awsRequestOverrideConfig);
return this;
}
@Override
public Builder requestOverrideConfig(Consumer builderConsumer) {
super.requestOverrideConfig(builderConsumer);
return this;
}
@Override
public CreateStageRequest build() {
return new CreateStageRequest(this);
}
}
}