software.amazon.awssdk.services.apigateway.model.CreateDeploymentRequest 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 Deployment resource.
*
*/
@Generated("software.amazon.awssdk:codegen")
public class CreateDeploymentRequest extends APIGatewayRequest implements
ToCopyableBuilder {
private final String restApiId;
private final String stageName;
private final String stageDescription;
private final String description;
private final Boolean cacheClusterEnabled;
private final String cacheClusterSize;
private final Map variables;
private CreateDeploymentRequest(BuilderImpl builder) {
super(builder);
this.restApiId = builder.restApiId;
this.stageName = builder.stageName;
this.stageDescription = builder.stageDescription;
this.description = builder.description;
this.cacheClusterEnabled = builder.cacheClusterEnabled;
this.cacheClusterSize = builder.cacheClusterSize;
this.variables = builder.variables;
}
/**
*
* The string identifier of the associated RestApi.
*
*
* @return The string identifier of the associated RestApi.
*/
public String restApiId() {
return restApiId;
}
/**
*
* The name of the Stage resource for the Deployment resource to create.
*
*
* @return The name of the Stage resource for the Deployment resource to create.
*/
public String stageName() {
return stageName;
}
/**
*
* The description of the Stage resource for the Deployment resource to create.
*
*
* @return The description of the Stage resource for the Deployment resource to create.
*/
public String stageDescription() {
return stageDescription;
}
/**
*
* The description for the Deployment resource to create.
*
*
* @return The description for the Deployment resource to create.
*/
public String description() {
return description;
}
/**
*
* Enables a cache cluster for the Stage resource specified in the input.
*
*
* @return Enables a cache cluster for the Stage resource specified in the input.
*/
public Boolean cacheClusterEnabled() {
return cacheClusterEnabled;
}
/**
*
* Specifies the cache cluster size for the Stage resource specified in the input, if a cache cluster is
* enabled.
*
*
* @return Specifies the cache cluster size for the Stage resource specified in the input, if a cache cluster
* is enabled.
*/
public String cacheClusterSize() {
return cacheClusterSize;
}
/**
*
* A map that defines the stage variables for the Stage resource that is associated with the new deployment.
* 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 Stage resource that is associated with the new
* deployment. Variable names can have alphanumeric and underscore characters, and the values must match
* [A-Za-z0-9-._~:/?#&=,]+
.
*/
public Map variables() {
return variables;
}
@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(stageDescription());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(cacheClusterEnabled());
hashCode = 31 * hashCode + Objects.hashCode(cacheClusterSize());
hashCode = 31 * hashCode + Objects.hashCode(variables());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateDeploymentRequest)) {
return false;
}
CreateDeploymentRequest other = (CreateDeploymentRequest) obj;
return Objects.equals(restApiId(), other.restApiId()) && Objects.equals(stageName(), other.stageName())
&& Objects.equals(stageDescription(), other.stageDescription())
&& Objects.equals(description(), other.description())
&& Objects.equals(cacheClusterEnabled(), other.cacheClusterEnabled())
&& Objects.equals(cacheClusterSize(), other.cacheClusterSize()) && Objects.equals(variables(), other.variables());
}
@Override
public String toString() {
return ToString.builder("CreateDeploymentRequest").add("RestApiId", restApiId()).add("StageName", stageName())
.add("StageDescription", stageDescription()).add("Description", description())
.add("CacheClusterEnabled", cacheClusterEnabled()).add("CacheClusterSize", cacheClusterSize())
.add("Variables", variables()).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 "stageDescription":
return Optional.of(clazz.cast(stageDescription()));
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()));
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 of the Stage resource for the Deployment resource to create.
*
*
* @param stageName
* The name of the Stage resource for the Deployment resource to create.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder stageName(String stageName);
/**
*
* The description of the Stage resource for the Deployment resource to create.
*
*
* @param stageDescription
* The description of the Stage resource for the Deployment resource to create.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder stageDescription(String stageDescription);
/**
*
* The description for the Deployment resource to create.
*
*
* @param description
* The description for the Deployment resource to create.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder description(String description);
/**
*
* Enables a cache cluster for the Stage resource specified in the input.
*
*
* @param cacheClusterEnabled
* Enables a cache cluster for the Stage resource specified in the input.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder cacheClusterEnabled(Boolean cacheClusterEnabled);
/**
*
* Specifies the cache cluster size for the Stage resource specified in the input, if a cache cluster is
* enabled.
*
*
* @param cacheClusterSize
* Specifies the cache cluster size for the Stage resource specified in the input, if a cache
* cluster is enabled.
* @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 Stage resource that is associated with the new
* deployment. 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 Stage resource that is associated with the new
* deployment. 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);
@Override
Builder requestOverrideConfig(AwsRequestOverrideConfig awsRequestOverrideConfig);
}
static final class BuilderImpl extends APIGatewayRequest.BuilderImpl implements Builder {
private String restApiId;
private String stageName;
private String stageDescription;
private String description;
private Boolean cacheClusterEnabled;
private String cacheClusterSize;
private Map variables;
private BuilderImpl() {
}
private BuilderImpl(CreateDeploymentRequest model) {
restApiId(model.restApiId);
stageName(model.stageName);
stageDescription(model.stageDescription);
description(model.description);
cacheClusterEnabled(model.cacheClusterEnabled);
cacheClusterSize(model.cacheClusterSize);
variables(model.variables);
}
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 getStageDescription() {
return stageDescription;
}
@Override
public final Builder stageDescription(String stageDescription) {
this.stageDescription = stageDescription;
return this;
}
public final void setStageDescription(String stageDescription) {
this.stageDescription = stageDescription;
}
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);
}
@Override
public Builder requestOverrideConfig(AwsRequestOverrideConfig awsRequestOverrideConfig) {
super.requestOverrideConfig(awsRequestOverrideConfig);
return this;
}
@Override
public Builder requestOverrideConfig(Consumer builderConsumer) {
super.requestOverrideConfig(builderConsumer);
return this;
}
@Override
public CreateDeploymentRequest build() {
return new CreateDeploymentRequest(this);
}
}
}