Skip to content

AWS::ApiGateway::Method

The AWS::ApiGateway::Method resource creates API Gateway methods that define the parameters and body that clients must send in their requests.

Generated by cfn-typegen --out cfn_types AWS::ApiGateway::Method 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, UpdateReplacePolicy, build
from cfn_typed.intrinsics import Expr


_c0=["CONVERT_TO_BINARY","CONVERT_TO_TEXT"]
CONSTRAINTS:dict[str,Any]={
'AWS::ApiGateway::Method':{'Integration':{'P':{'ConnectionType':{'e':["INTERNET","VPC_LINK"]},'IntegrationResponses':{'T':{'P':{'ContentHandling':{'e':_c0}}}},'ResponseTransferMode':{'e':["BUFFERED","STREAM"]},'PassthroughBehavior':{'e':["WHEN_NO_MATCH","WHEN_NO_TEMPLATES","NEVER"]},'Type':{'e':["AWS","AWS_PROXY","HTTP","HTTP_PROXY","MOCK"]},'ContentHandling':{'e':_c0},'TimeoutInMillis':{'m':50}}}},
}


ATTRIBUTES:dict[str,Any]={"AWS::ApiGateway::Method":["HttpMethod","ResourceId","RestApiId"]}


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

These are defined above the properties in the generated module.

class MethodIntegrationResponse(TypedDict, closed=True):
    '``IntegrationResponse`` is a property of the [Amazon API Gateway Method Integration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-prope...'
    ResponseTemplates: NotRequired[Expr[Mapping[str, Expr[str]]]]
    SelectionPattern: NotRequired[Expr[str]]
    ContentHandling: NotRequired[Expr[str]]
    ResponseParameters: NotRequired[Expr[Mapping[str, Expr[str]]]]
    StatusCode: Expr[str]


class MethodIntegration(TypedDict, closed=True):
    '``Integration`` is a property of the [AWS::ApiGateway::Method](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method....'
    CacheNamespace: NotRequired[Expr[str]]
    ConnectionType: NotRequired[Expr[str]]
    IntegrationResponses: NotRequired[Expr[Sequence[Expr[MethodIntegrationResponse]]]]
    IntegrationHttpMethod: NotRequired[Expr[str]]
    ResponseTransferMode: NotRequired[Expr[str]]
    Uri: NotRequired[Expr[str]]
    PassthroughBehavior: NotRequired[Expr[str]]
    RequestParameters: NotRequired[Expr[Mapping[str, Expr[str]]]]
    ConnectionId: NotRequired[Expr[str]]
    Type: Expr[str]
    CacheKeyParameters: NotRequired[Expr[list[Expr[str]]]]
    IntegrationTarget: NotRequired[Expr[str]]
    ContentHandling: NotRequired[Expr[str]]
    RequestTemplates: NotRequired[Expr[Mapping[str, Expr[str]]]]
    TimeoutInMillis: NotRequired[Expr[int]]
    Credentials: NotRequired[Expr[str]]


class MethodMethodResponse(TypedDict, closed=True):
    ResponseParameters: NotRequired[Expr[Mapping[str, Expr[bool] | Expr[str]]]]
    StatusCode: Expr[str]
    ResponseModels: NotRequired[Expr[Mapping[str, Expr[str]]]]


class MethodProps(TypedDict, closed=True):
    'The ``AWS::ApiGateway::Method`` resource creates API Gateway methods that define the parameters and body that clients must send in their requests.'
    Integration: NotRequired[Expr[MethodIntegration]]
    OperationName: NotRequired[Expr[str]]
    RequestModels: NotRequired[Expr[Mapping[str, Expr[str]]]]
    RestApiId: Expr[str]
    AuthorizationScopes: NotRequired[Expr[list[Expr[str]]]]
    RequestValidatorId: NotRequired[Expr[str]]
    RequestParameters: NotRequired[Expr[Mapping[str, Expr[bool] | Expr[str]]]]
    MethodResponses: NotRequired[Expr[Sequence[Expr[MethodMethodResponse]]]]
    AuthorizerId: NotRequired[Expr[str]]
    ResourceId: Expr[str]
    ApiKeyRequired: NotRequired[Expr[bool]]
    AuthorizationType: NotRequired[Expr[str]]
    "The method's authorization type."
    HttpMethod: Expr[str]


class Method(ResourceAttrs):
    'The ``AWS::ApiGateway::Method`` resource creates API Gateway methods that define the parameters and body that clients must send in their requests.'
    Type: Literal['AWS::ApiGateway::Method']
    Properties: MethodProps


def method(
    *,
    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[MethodProps],
) -> Method:
    return build('AWS::ApiGateway::Method', props, depends_on, deletion_policy, update_replace_policy, condition, metadata)