Skip to content

AWS::ApiGateway::RestApi

The AWS::ApiGateway::RestApi resource creates a REST API.

Generated by cfn-typegen --out cfn_types AWS::ApiGateway::RestApi into cfn_types/apigateway.py:

# Generated by cfn-typegen from the CloudFormation registry schemas. Do not edit.
# fmt: off
# ruff: noqa
"""AWS::ApiGateway resources."""

from collections.abc import Mapping, Sequence
from typing import Any, Literal, NotRequired, Unpack
from typing_extensions import TypedDict
from cfn_typed.base import DeletionPolicy, DependsOn, ResourceAttrs, Tag, UpdateReplacePolicy, build
from cfn_typed.intrinsics import Expr


CONSTRAINTS:dict[str,Any]={
}


ATTRIBUTES:dict[str,Any]={"AWS::ApiGateway::RestApi":["RestApiId","RootResourceId"]}


RULES:dict[str,Any]={}
Nested types (5)

These are defined above the properties in the generated module.

class RestApiS3Location(TypedDict, closed=True):
    '``S3Location`` is a property of the [AWS::ApiGateway::RestApi](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi...'
    Bucket: NotRequired[Expr[str]]
    'The name of the S3 bucket where the OpenAPI file is stored.'
    ETag: NotRequired[Expr[str]]
    'The Amazon S3 ETag (a file checksum) of the OpenAPI file.'
    Version: NotRequired[Expr[str]]
    'For versioning-enabled buckets, a specific version of the OpenAPI file.'
    Key: NotRequired[Expr[str]]
    'The file name of the OpenAPI file (Amazon S3 object name).'


class RestApiEndpointConfiguration(TypedDict, closed=True):
    'The ``EndpointConfiguration`` property type specifies the endpoint types and IP address types of a REST API.'
    IpAddressType: NotRequired[Expr[str]]
    Types: NotRequired[Expr[list[Expr[str]]]]
    VpcEndpointIds: NotRequired[Expr[list[Expr[str]]]]


class RestApiProps(TypedDict, closed=True):
    'The ``AWS::ApiGateway::RestApi`` resource creates a REST API.'
    Policy: NotRequired[Expr[Mapping[str, Any]] | Expr[str]]
    'A policy document that contains the permissions for the ``RestApi`` resource.'
    BodyS3Location: NotRequired[Expr[RestApiS3Location]]
    '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.'
    Description: NotRequired[Expr[str]]
    MinimumCompressionSize: NotRequired[Expr[int]]
    Parameters: NotRequired[Expr[Mapping[str, Expr[str]]] | Expr[str]]
    CloneFrom: NotRequired[Expr[str]]
    Mode: NotRequired[Expr[str]]
    'This property applies only when you use OpenAPI to define your REST API.'
    DisableExecuteApiEndpoint: NotRequired[Expr[bool]]
    FailOnWarnings: NotRequired[Expr[bool]]
    BinaryMediaTypes: NotRequired[Expr[list[Expr[str]]]]
    Name: NotRequired[Expr[str]]
    'The name of the RestApi.'
    Version: NotRequired[Expr[str]]
    SecurityPolicy: NotRequired[Expr[str]]
    ApiKeySourceType: NotRequired[Expr[str]]
    EndpointConfiguration: NotRequired[Expr[RestApiEndpointConfiguration]]
    'A list of the endpoint types and IP address types of the API.'
    Body: NotRequired[Expr[Mapping[str, Any]] | Expr[str]]
    'An OpenAPI specification that defines a set of RESTful APIs in JSON format.'
    Tags: NotRequired[Expr[Sequence[Expr[Tag]]]]
    EndpointAccessMode: NotRequired[Expr[str]]


class RestApi(ResourceAttrs):
    'The ``AWS::ApiGateway::RestApi`` resource creates a REST API.'
    Type: Literal['AWS::ApiGateway::RestApi']
    Properties: NotRequired[RestApiProps]


def rest_api(
    *,
    depends_on: DependsOn | None = None,
    deletion_policy: DeletionPolicy | None = None,
    update_replace_policy: UpdateReplacePolicy | None = None,
    condition: str | None = None,
    metadata: dict[str, Any] | None = None,
    **props: Unpack[RestApiProps],
) -> RestApi:
    return build('AWS::ApiGateway::RestApi', props, depends_on, deletion_policy, update_replace_policy, condition, metadata)

Attributes

Read-only values for get_att(logical_id, attribute). They are not accepted as inputs.

  • RestApiId
  • RootResourceId