CfnRestApiProps
- class aws_cdk.aws_apigateway.CfnRestApiProps(*, api_key_source_type=None, binary_media_types=None, body=None, body_s3_location=None, clone_from=None, description=None, disable_execute_api_endpoint=None, endpoint_configuration=None, fail_on_warnings=None, minimum_compression_size=None, mode=None, name=None, parameters=None, policy=None, tags=None)
Bases:
object
Properties for defining a
CfnRestApi
.- Parameters:
api_key_source_type (
Optional
[str
]) – The source of the API key for metering requests according to a usage plan. Valid values are:HEADER
to read the API key from theX-API-Key
header of a request.AUTHORIZER
to read the API key from theUsageIdentifierKey
from a custom authorizer.binary_media_types (
Optional
[Sequence
[str
]]) – The list of binary media types supported by the RestApi. By default, the RestApi supports only UTF-8-encoded text payloads.body (
Any
) – An OpenAPI specification that defines a set of RESTful APIs in JSON format. For YAML templates, you can also provide the specification in YAML format.body_s3_location (
Union
[IResolvable
,S3LocationProperty
,Dict
[str
,Any
],None
]) – The Amazon Simple Storage Service (Amazon S3) location that points to an OpenAPI file, which defines a set of RESTful APIs in JSON or YAML format.clone_from (
Optional
[str
]) – The ID of the RestApi that you want to clone from.description (
Optional
[str
]) – The description of the RestApi.disable_execute_api_endpoint (
Union
[bool
,IResolvable
,None
]) – Specifies whether clients can invoke your API by using the defaultexecute-api
endpoint. By default, clients can invoke your API with the defaulthttps://{api_id}.execute-api.{region}.amazonaws.com
endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpointendpoint_configuration (
Union
[IResolvable
,EndpointConfigurationProperty
,Dict
[str
,Any
],None
]) – A list of the endpoint types of the API. Use this property when creating an API. When importing an existing API, specify the endpoint configuration types using theParameters
property.fail_on_warnings (
Union
[bool
,IResolvable
,None
]) – A query parameter to indicate whether to rollback the API update (true
) or not (false
) when a warning is encountered. The default value isfalse
.minimum_compression_size (
Union
[int
,float
,None
]) – 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.mode (
Optional
[str
]) – This property applies only when you use OpenAPI to define your REST API. TheMode
determines how API Gateway handles resource updates. Valid values areoverwrite
ormerge
. Foroverwrite
, the new API definition replaces the existing one. The existing API identifier remains unchanged. Formerge
, the new API definition is merged with the existing API. If you don’t specify this property, a default value is chosen. For REST APIs created before March 29, 2021, the default isoverwrite
. For REST APIs created after March 29, 2021, the new API definition takes precedence, but any container types such as endpoint configurations and binary media types are merged with the existing API. Use the default mode to define top-levelRestApi
properties in addition to using OpenAPI. Generally, it’s preferred to use API Gateway’s OpenAPI extensions to model these properties.name (
Optional
[str
]) – The name of the RestApi. A name is required if the REST API is not based on an OpenAPI specification.parameters (
Union
[Mapping
[str
,str
],IResolvable
,None
]) – Custom header parameters as part of the request. For example, to exclude DocumentationParts from an imported API, setignore=documentation
as aparameters
value, as in the AWS CLI command ofaws apigateway import-rest-api --parameters ignore=documentation --body 'file:///path/to/imported-api-body.json'
.policy (
Any
) – A policy document that contains the permissions for theRestApi
resource. To set the ARN for the policy, use the!Join
intrinsic function with""
as delimiter and values of"execute-api:/"
and"*"
.tags (
Optional
[Sequence
[Union
[CfnTag
,Dict
[str
,Any
]]]]) – 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 withaws:
. The tag value can be up to 256 characters.
- See:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_apigateway as apigateway # body: Any # policy: Any cfn_rest_api_props = apigateway.CfnRestApiProps( api_key_source_type="apiKeySourceType", binary_media_types=["binaryMediaTypes"], body=body, body_s3_location=apigateway.CfnRestApi.S3LocationProperty( bucket="bucket", e_tag="eTag", key="key", version="version" ), clone_from="cloneFrom", description="description", disable_execute_api_endpoint=False, endpoint_configuration=apigateway.CfnRestApi.EndpointConfigurationProperty( types=["types"], vpc_endpoint_ids=["vpcEndpointIds"] ), fail_on_warnings=False, minimum_compression_size=123, mode="mode", name="name", parameters={ "parameters_key": "parameters" }, policy=policy, tags=[CfnTag( key="key", value="value" )] )
Attributes
- api_key_source_type
The source of the API key for metering requests according to a usage plan.
Valid values are:
HEADER
to read the API key from theX-API-Key
header of a request.AUTHORIZER
to read the API key from theUsageIdentifierKey
from a custom authorizer.
- binary_media_types
The list of binary media types supported by the RestApi.
By default, the RestApi supports only UTF-8-encoded text payloads.
- body
An OpenAPI specification that defines a set of RESTful APIs in JSON format.
For YAML templates, you can also provide the specification in YAML format.
- body_s3_location
The Amazon Simple Storage Service (Amazon S3) location that points to an OpenAPI file, which defines a set of RESTful APIs in JSON or YAML format.
- clone_from
The ID of the RestApi that you want to clone from.
- description
The description of the RestApi.
- disable_execute_api_endpoint
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
- endpoint_configuration
A list of the endpoint types of the API.
Use this property when creating an API. When importing an existing API, specify the endpoint configuration types using the
Parameters
property.
- fail_on_warnings
A query parameter to indicate whether to rollback the API update (
true
) or not (false
) when a warning is encountered.The default value is
false
.
- minimum_compression_size
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.
- mode
This property applies only when you use OpenAPI to define your REST API.
The
Mode
determines how API Gateway handles resource updates.Valid values are
overwrite
ormerge
.For
overwrite
, the new API definition replaces the existing one. The existing API identifier remains unchanged.For
merge
, the new API definition is merged with the existing API.If you don’t specify this property, a default value is chosen. For REST APIs created before March 29, 2021, the default is
overwrite
. For REST APIs created after March 29, 2021, the new API definition takes precedence, but any container types such as endpoint configurations and binary media types are merged with the existing API.Use the default mode to define top-level
RestApi
properties in addition to using OpenAPI. Generally, it’s preferred to use API Gateway’s OpenAPI extensions to model these properties.
- name
The name of the RestApi.
A name is required if the REST API is not based on an OpenAPI specification.
- parameters
Custom header parameters as part of the request.
For example, to exclude DocumentationParts from an imported API, set
ignore=documentation
as aparameters
value, as in the AWS CLI command ofaws apigateway import-rest-api --parameters ignore=documentation --body 'file:///path/to/imported-api-body.json'
.
- policy
A policy document that contains the permissions for the
RestApi
resource.To set the ARN for the policy, use the
!Join
intrinsic function with""
as delimiter and values of"execute-api:/"
and"*"
.
- tags
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.