/* * Copyright 2018-2023 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 com.amazonaws.services.apigateway.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; /** *
* The POST Request to add a new RestApi resource to your collection. *
*/ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class CreateRestApiRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** ** The name of the RestApi. *
*/ private String name; /** ** The description of the RestApi. *
*/ private String description; /** ** A version identifier for the API. *
*/ private String version; /** ** The ID of the RestApi that you want to clone from. *
*/ private String cloneFrom; /** ** The list of binary media types supported by the RestApi. By default, the RestApi supports only UTF-8-encoded text * payloads. *
*/ private java.util.List* A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, * inclusive) or disable compression (with a null value) on an API. When compression is enabled, compression or * decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero * allows compression for any payload size. *
*/ private Integer minimumCompressionSize; /** *
* The source of the API key for metering requests according to a usage plan. Valid values are: >
* HEADER
to read the API key from the X-API-Key
header of a request.
* AUTHORIZER
to read the API key from the UsageIdentifierKey
from a custom authorizer.
*
* The endpoint configuration of this RestApi showing the endpoint types of the API. *
*/ private EndpointConfiguration endpointConfiguration; /** ** A stringified JSON policy document that applies to this RestApi regardless of the caller and Method * configuration. *
*/ private String policy; /** *
* The key-value map of strings. The valid character set is [a-zA-Z+-=._:/]. The tag key can be up to 128 characters
* and must not start with aws:
. The tag value can be up to 256 characters.
*
* Specifies whether clients can invoke your API by using the default execute-api
endpoint. By default,
* clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com
* endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint
*
* The name of the RestApi. *
* * @param name * The name of the RestApi. */ public void setName(String name) { this.name = name; } /** ** The name of the RestApi. *
* * @return The name of the RestApi. */ public String getName() { return this.name; } /** ** The name of the RestApi. *
* * @param name * The name of the RestApi. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateRestApiRequest withName(String name) { setName(name); return this; } /** ** The description of the RestApi. *
* * @param description * The description of the RestApi. */ public void setDescription(String description) { this.description = description; } /** ** The description of the RestApi. *
* * @return The description of the RestApi. */ public String getDescription() { return this.description; } /** ** The description of the RestApi. *
* * @param description * The description of the RestApi. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateRestApiRequest withDescription(String description) { setDescription(description); return this; } /** ** A version identifier for the API. *
* * @param version * A version identifier for the API. */ public void setVersion(String version) { this.version = version; } /** ** A version identifier for the API. *
* * @return A version identifier for the API. */ public String getVersion() { return this.version; } /** ** A version identifier for the API. *
* * @param version * A version identifier for the API. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateRestApiRequest withVersion(String version) { setVersion(version); return this; } /** ** The ID of the RestApi that you want to clone from. *
* * @param cloneFrom * The ID of the RestApi that you want to clone from. */ public void setCloneFrom(String cloneFrom) { this.cloneFrom = cloneFrom; } /** ** The ID of the RestApi that you want to clone from. *
* * @return The ID of the RestApi that you want to clone from. */ public String getCloneFrom() { return this.cloneFrom; } /** ** The ID of the RestApi that you want to clone from. *
* * @param cloneFrom * The ID of the RestApi that you want to clone from. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateRestApiRequest withCloneFrom(String cloneFrom) { setCloneFrom(cloneFrom); return this; } /** ** The list of binary media types supported by the RestApi. By default, the RestApi supports only UTF-8-encoded text * payloads. *
* * @return The list of binary media types supported by the RestApi. By default, the RestApi supports only * UTF-8-encoded text payloads. */ public java.util.List* The list of binary media types supported by the RestApi. By default, the RestApi supports only UTF-8-encoded text * payloads. *
* * @param binaryMediaTypes * The list of binary media types supported by the RestApi. By default, the RestApi supports only * UTF-8-encoded text payloads. */ public void setBinaryMediaTypes(java.util.Collection* The list of binary media types supported by the RestApi. By default, the RestApi supports only UTF-8-encoded text * payloads. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setBinaryMediaTypes(java.util.Collection)} or {@link #withBinaryMediaTypes(java.util.Collection)} if you * want to override the existing values. *
* * @param binaryMediaTypes * The list of binary media types supported by the RestApi. By default, the RestApi supports only * UTF-8-encoded text payloads. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateRestApiRequest withBinaryMediaTypes(String... binaryMediaTypes) { if (this.binaryMediaTypes == null) { setBinaryMediaTypes(new java.util.ArrayList* The list of binary media types supported by the RestApi. By default, the RestApi supports only UTF-8-encoded text * payloads. *
* * @param binaryMediaTypes * The list of binary media types supported by the RestApi. By default, the RestApi supports only * UTF-8-encoded text payloads. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateRestApiRequest withBinaryMediaTypes(java.util.Collection* A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, * inclusive) or disable compression (with a null value) on an API. When compression is enabled, compression or * decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero * allows compression for any payload size. *
* * @param minimumCompressionSize * A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) * bytes, inclusive) or disable compression (with a null value) on an API. When compression is enabled, * compression or decompression is not applied on the payload if the payload size is smaller than this value. * Setting it to zero allows compression for any payload size. */ public void setMinimumCompressionSize(Integer minimumCompressionSize) { this.minimumCompressionSize = minimumCompressionSize; } /** ** A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, * inclusive) or disable compression (with a null value) on an API. When compression is enabled, compression or * decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero * allows compression for any payload size. *
* * @return A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) * bytes, inclusive) or disable compression (with a null value) on an API. When compression is enabled, * compression or decompression is not applied on the payload if the payload size is smaller than this * value. Setting it to zero allows compression for any payload size. */ public Integer getMinimumCompressionSize() { return this.minimumCompressionSize; } /** ** A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, * inclusive) or disable compression (with a null value) on an API. When compression is enabled, compression or * decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero * allows compression for any payload size. *
* * @param minimumCompressionSize * A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) * bytes, inclusive) or disable compression (with a null value) on an API. When compression is enabled, * compression or decompression is not applied on the payload if the payload size is smaller than this value. * Setting it to zero allows compression for any payload size. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateRestApiRequest withMinimumCompressionSize(Integer minimumCompressionSize) { setMinimumCompressionSize(minimumCompressionSize); return this; } /** *
* The source of the API key for metering requests according to a usage plan. Valid values are: >
* HEADER
to read the API key from the X-API-Key
header of a request.
* AUTHORIZER
to read the API key from the UsageIdentifierKey
from a custom authorizer.
*
HEADER
to read the API key from the X-API-Key
header of a request.
* AUTHORIZER
to read the API key from the UsageIdentifierKey
from a custom
* authorizer.
* @see ApiKeySourceType
*/
public void setApiKeySource(String apiKeySource) {
this.apiKeySource = apiKeySource;
}
/**
*
* The source of the API key for metering requests according to a usage plan. Valid values are: >
* HEADER
to read the API key from the X-API-Key
header of a request.
* AUTHORIZER
to read the API key from the UsageIdentifierKey
from a custom authorizer.
*
HEADER
to read the API key from the X-API-Key
header of a request.
* AUTHORIZER
to read the API key from the UsageIdentifierKey
from a custom
* authorizer.
* @see ApiKeySourceType
*/
public String getApiKeySource() {
return this.apiKeySource;
}
/**
*
* The source of the API key for metering requests according to a usage plan. Valid values are: >
* HEADER
to read the API key from the X-API-Key
header of a request.
* AUTHORIZER
to read the API key from the UsageIdentifierKey
from a custom authorizer.
*
HEADER
to read the API key from the X-API-Key
header of a request.
* AUTHORIZER
to read the API key from the UsageIdentifierKey
from a custom
* authorizer.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ApiKeySourceType
*/
public CreateRestApiRequest withApiKeySource(String apiKeySource) {
setApiKeySource(apiKeySource);
return this;
}
/**
*
* The source of the API key for metering requests according to a usage plan. Valid values are: >
* HEADER
to read the API key from the X-API-Key
header of a request.
* AUTHORIZER
to read the API key from the UsageIdentifierKey
from a custom authorizer.
*
HEADER
to read the API key from the X-API-Key
header of a request.
* AUTHORIZER
to read the API key from the UsageIdentifierKey
from a custom
* authorizer.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ApiKeySourceType
*/
public CreateRestApiRequest withApiKeySource(ApiKeySourceType apiKeySource) {
this.apiKeySource = apiKeySource.toString();
return this;
}
/**
* * The endpoint configuration of this RestApi showing the endpoint types of the API. *
* * @param endpointConfiguration * The endpoint configuration of this RestApi showing the endpoint types of the API. */ public void setEndpointConfiguration(EndpointConfiguration endpointConfiguration) { this.endpointConfiguration = endpointConfiguration; } /** ** The endpoint configuration of this RestApi showing the endpoint types of the API. *
* * @return The endpoint configuration of this RestApi showing the endpoint types of the API. */ public EndpointConfiguration getEndpointConfiguration() { return this.endpointConfiguration; } /** ** The endpoint configuration of this RestApi showing the endpoint types of the API. *
* * @param endpointConfiguration * The endpoint configuration of this RestApi showing the endpoint types of the API. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateRestApiRequest withEndpointConfiguration(EndpointConfiguration endpointConfiguration) { setEndpointConfiguration(endpointConfiguration); return this; } /** ** A stringified JSON policy document that applies to this RestApi regardless of the caller and Method * configuration. *
* * @param policy * A stringified JSON policy document that applies to this RestApi regardless of the caller and Method * configuration. */ public void setPolicy(String policy) { this.policy = policy; } /** ** A stringified JSON policy document that applies to this RestApi regardless of the caller and Method * configuration. *
* * @return A stringified JSON policy document that applies to this RestApi regardless of the caller and Method * configuration. */ public String getPolicy() { return this.policy; } /** ** A stringified JSON policy document that applies to this RestApi regardless of the caller and Method * configuration. *
* * @param policy * A stringified JSON policy document that applies to this RestApi regardless of the caller and Method * configuration. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateRestApiRequest withPolicy(String policy) { setPolicy(policy); return this; } /** *
* The key-value map of strings. The valid character set is [a-zA-Z+-=._:/]. The tag key can be up to 128 characters
* and must not start with aws:
. The tag value can be up to 256 characters.
*
aws:
. The tag value can be up to 256 characters.
*/
public java.util.Map
* The key-value map of strings. The valid character set is [a-zA-Z+-=._:/]. The tag key can be up to 128 characters
* and must not start with aws:
. The tag value can be up to 256 characters.
*
aws:
. The tag value can be up to 256 characters.
*/
public void setTags(java.util.Map
* The key-value map of strings. The valid character set is [a-zA-Z+-=._:/]. The tag key can be up to 128 characters
* and must not start with aws:
. The tag value can be up to 256 characters.
*
aws:
. The tag value can be up to 256 characters.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateRestApiRequest withTags(java.util.Map
* Specifies whether clients can invoke your API by using the default execute-api
endpoint. By default,
* clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com
* endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint
*
execute-api
endpoint. By
* default, clients can invoke your API with the default
* https://{api_id}.execute-api.{region}.amazonaws.com
endpoint. To require that clients use a
* custom domain name to invoke your API, disable the default endpoint
*/
public void setDisableExecuteApiEndpoint(Boolean disableExecuteApiEndpoint) {
this.disableExecuteApiEndpoint = disableExecuteApiEndpoint;
}
/**
*
* Specifies whether clients can invoke your API by using the default execute-api
endpoint. By default,
* clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com
* endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint
*
execute-api
endpoint. By
* default, clients can invoke your API with the default
* https://{api_id}.execute-api.{region}.amazonaws.com
endpoint. To require that clients use a
* custom domain name to invoke your API, disable the default endpoint
*/
public Boolean getDisableExecuteApiEndpoint() {
return this.disableExecuteApiEndpoint;
}
/**
*
* Specifies whether clients can invoke your API by using the default execute-api
endpoint. By default,
* clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com
* endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint
*
execute-api
endpoint. By
* default, clients can invoke your API with the default
* https://{api_id}.execute-api.{region}.amazonaws.com
endpoint. To require that clients use a
* custom domain name to invoke your API, disable the default endpoint
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateRestApiRequest withDisableExecuteApiEndpoint(Boolean disableExecuteApiEndpoint) {
setDisableExecuteApiEndpoint(disableExecuteApiEndpoint);
return this;
}
/**
*
* Specifies whether clients can invoke your API by using the default execute-api
endpoint. By default,
* clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com
* endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint
*
execute-api
endpoint. By
* default, clients can invoke your API with the default
* https://{api_id}.execute-api.{region}.amazonaws.com
endpoint. To require that clients use a
* custom domain name to invoke your API, disable the default endpoint
*/
public Boolean isDisableExecuteApiEndpoint() {
return this.disableExecuteApiEndpoint;
}
/**
* 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.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getName() != null)
sb.append("Name: ").append(getName()).append(",");
if (getDescription() != null)
sb.append("Description: ").append(getDescription()).append(",");
if (getVersion() != null)
sb.append("Version: ").append(getVersion()).append(",");
if (getCloneFrom() != null)
sb.append("CloneFrom: ").append(getCloneFrom()).append(",");
if (getBinaryMediaTypes() != null)
sb.append("BinaryMediaTypes: ").append(getBinaryMediaTypes()).append(",");
if (getMinimumCompressionSize() != null)
sb.append("MinimumCompressionSize: ").append(getMinimumCompressionSize()).append(",");
if (getApiKeySource() != null)
sb.append("ApiKeySource: ").append(getApiKeySource()).append(",");
if (getEndpointConfiguration() != null)
sb.append("EndpointConfiguration: ").append(getEndpointConfiguration()).append(",");
if (getPolicy() != null)
sb.append("Policy: ").append(getPolicy()).append(",");
if (getTags() != null)
sb.append("Tags: ").append(getTags()).append(",");
if (getDisableExecuteApiEndpoint() != null)
sb.append("DisableExecuteApiEndpoint: ").append(getDisableExecuteApiEndpoint());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof CreateRestApiRequest == false)
return false;
CreateRestApiRequest other = (CreateRestApiRequest) obj;
if (other.getName() == null ^ this.getName() == null)
return false;
if (other.getName() != null && other.getName().equals(this.getName()) == false)
return false;
if (other.getDescription() == null ^ this.getDescription() == null)
return false;
if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == false)
return false;
if (other.getVersion() == null ^ this.getVersion() == null)
return false;
if (other.getVersion() != null && other.getVersion().equals(this.getVersion()) == false)
return false;
if (other.getCloneFrom() == null ^ this.getCloneFrom() == null)
return false;
if (other.getCloneFrom() != null && other.getCloneFrom().equals(this.getCloneFrom()) == false)
return false;
if (other.getBinaryMediaTypes() == null ^ this.getBinaryMediaTypes() == null)
return false;
if (other.getBinaryMediaTypes() != null && other.getBinaryMediaTypes().equals(this.getBinaryMediaTypes()) == false)
return false;
if (other.getMinimumCompressionSize() == null ^ this.getMinimumCompressionSize() == null)
return false;
if (other.getMinimumCompressionSize() != null && other.getMinimumCompressionSize().equals(this.getMinimumCompressionSize()) == false)
return false;
if (other.getApiKeySource() == null ^ this.getApiKeySource() == null)
return false;
if (other.getApiKeySource() != null && other.getApiKeySource().equals(this.getApiKeySource()) == false)
return false;
if (other.getEndpointConfiguration() == null ^ this.getEndpointConfiguration() == null)
return false;
if (other.getEndpointConfiguration() != null && other.getEndpointConfiguration().equals(this.getEndpointConfiguration()) == false)
return false;
if (other.getPolicy() == null ^ this.getPolicy() == null)
return false;
if (other.getPolicy() != null && other.getPolicy().equals(this.getPolicy()) == false)
return false;
if (other.getTags() == null ^ this.getTags() == null)
return false;
if (other.getTags() != null && other.getTags().equals(this.getTags()) == false)
return false;
if (other.getDisableExecuteApiEndpoint() == null ^ this.getDisableExecuteApiEndpoint() == null)
return false;
if (other.getDisableExecuteApiEndpoint() != null && other.getDisableExecuteApiEndpoint().equals(this.getDisableExecuteApiEndpoint()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode());
hashCode = prime * hashCode + ((getVersion() == null) ? 0 : getVersion().hashCode());
hashCode = prime * hashCode + ((getCloneFrom() == null) ? 0 : getCloneFrom().hashCode());
hashCode = prime * hashCode + ((getBinaryMediaTypes() == null) ? 0 : getBinaryMediaTypes().hashCode());
hashCode = prime * hashCode + ((getMinimumCompressionSize() == null) ? 0 : getMinimumCompressionSize().hashCode());
hashCode = prime * hashCode + ((getApiKeySource() == null) ? 0 : getApiKeySource().hashCode());
hashCode = prime * hashCode + ((getEndpointConfiguration() == null) ? 0 : getEndpointConfiguration().hashCode());
hashCode = prime * hashCode + ((getPolicy() == null) ? 0 : getPolicy().hashCode());
hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode());
hashCode = prime * hashCode + ((getDisableExecuteApiEndpoint() == null) ? 0 : getDisableExecuteApiEndpoint().hashCode());
return hashCode;
}
@Override
public CreateRestApiRequest clone() {
return (CreateRestApiRequest) super.clone();
}
}