CfnMethod

class aws_cdk.aws_apigateway.CfnMethod(scope, id, *, http_method, resource_id, rest_api_id, api_key_required=None, authorization_scopes=None, authorization_type=None, authorizer_id=None, integration=None, method_responses=None, operation_name=None, request_models=None, request_parameters=None, request_validator_id=None)

Bases: aws_cdk.core.CfnResource

A CloudFormation 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.

CloudformationResource

AWS::ApiGateway::Method

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_apigateway as apigateway

cfn_method = apigateway.CfnMethod(self, "MyCfnMethod",
    http_method="httpMethod",
    resource_id="resourceId",
    rest_api_id="restApiId",

    # the properties below are optional
    api_key_required=False,
    authorization_scopes=["authorizationScopes"],
    authorization_type="authorizationType",
    authorizer_id="authorizerId",
    integration=apigateway.CfnMethod.IntegrationProperty(
        cache_key_parameters=["cacheKeyParameters"],
        cache_namespace="cacheNamespace",
        connection_id="connectionId",
        connection_type="connectionType",
        content_handling="contentHandling",
        credentials="credentials",
        integration_http_method="integrationHttpMethod",
        integration_responses=[apigateway.CfnMethod.IntegrationResponseProperty(
            status_code="statusCode",

            # the properties below are optional
            content_handling="contentHandling",
            response_parameters={
                "response_parameters_key": "responseParameters"
            },
            response_templates={
                "response_templates_key": "responseTemplates"
            },
            selection_pattern="selectionPattern"
        )],
        passthrough_behavior="passthroughBehavior",
        request_parameters={
            "request_parameters_key": "requestParameters"
        },
        request_templates={
            "request_templates_key": "requestTemplates"
        },
        timeout_in_millis=123,
        type="type",
        uri="uri"
    ),
    method_responses=[apigateway.CfnMethod.MethodResponseProperty(
        status_code="statusCode",

        # the properties below are optional
        response_models={
            "response_models_key": "responseModels"
        },
        response_parameters={
            "response_parameters_key": False
        }
    )],
    operation_name="operationName",
    request_models={
        "request_models_key": "requestModels"
    },
    request_parameters={
        "request_parameters_key": False
    },
    request_validator_id="requestValidatorId"
)

Create a new AWS::ApiGateway::Method.

Parameters
  • scope (Construct) –

    • scope in which this resource is defined.

  • id (str) –

    • scoped id of the resource.

  • http_method (str) – The HTTP method that clients use to call this method.

  • resource_id (str) – The ID of an API Gateway resource . For root resource methods, specify the RestApi root resource ID, such as { "Fn::GetAtt": ["MyRestApi", "RootResourceId"] } .

  • rest_api_id (str) – The ID of the RestApi resource in which API Gateway creates the method.

  • api_key_required (Union[bool, IResolvable, None]) – Indicates whether the method requires clients to submit a valid API key.

  • authorization_scopes (Optional[Sequence[str]]) – A list of authorization scopes configured on the method. The scopes are used with a COGNITO_USER_POOLS authorizer to authorize the method invocation. The authorization works by matching the method scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any method scopes match a claimed scope in the access token. Otherwise, the invocation is not authorized. When the method scope is configured, the client must provide an access token instead of an identity token for authorization purposes.

  • authorization_type (Optional[str]) – The method’s authorization type. This parameter is required. For valid values, see Method in the API Gateway API Reference . .. epigraph:: If you specify the AuthorizerId property, specify CUSTOM or COGNITO_USER_POOLS for this property.

  • authorizer_id (Optional[str]) – The identifier of the authorizer to use on this method. If you specify this property, specify CUSTOM or COGNITO_USER_POOLS for the AuthorizationType property.

  • integration (Union[IResolvable, IntegrationProperty, Dict[str, Any], None]) – The backend system that the method calls when it receives a request.

  • method_responses (Union[IResolvable, Sequence[Union[IResolvable, MethodResponseProperty, Dict[str, Any]]], None]) – The responses that can be sent to the client who calls the method.

  • operation_name (Optional[str]) – A friendly operation name for the method. For example, you can assign the OperationName of ListPets for the GET /pets method.

  • request_models (Union[IResolvable, Mapping[str, str], None]) – The resources that are used for the request’s content type. Specify request models as key-value pairs (string-to-string mapping), with a content type as the key and a Model resource name as the value. To use the same model regardless of the content type, specify $default as the key.

  • request_parameters (Union[IResolvable, Mapping[str, Union[bool, IResolvable]], None]) – The request parameters that API Gateway accepts. Specify request parameters as key-value pairs (string-to-Boolean mapping), with a source as the key and a Boolean as the value. The Boolean specifies whether a parameter is required. A source must match the format method.request. *location* . *name* , where the location is querystring, path, or header, and name is a valid, unique parameter name.

  • request_validator_id (Optional[str]) – The ID of the associated request validator.

Methods

add_deletion_override(path)

Syntactic sugar for addOverride(path, undefined).

Parameters

path (str) – The path of the value to delete.

Return type

None

add_depends_on(target)

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.

Parameters

target (CfnResource) –

Return type

None

add_metadata(key, value)

Add a value to the CloudFormation Resource Metadata.

Parameters
  • key (str) –

  • value (Any) –

See

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.

Return type

None

add_override(path, value)

Adds an override to the synthesized CloudFormation resource.

To add a property override, either use addPropertyOverride or prefix path with “Properties.” (i.e. Properties.TopicName).

If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.

To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.

For example:

cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"])
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")

would add the overrides Example:

"Properties": {
   "GlobalSecondaryIndexes": [
     {
       "Projection": {
         "NonKeyAttributes": [ "myattribute" ]
         ...
       }
       ...
     },
     {
       "ProjectionType": "INCLUDE"
       ...
     },
   ]
   ...
}

The value argument to addOverride will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.

Parameters
  • path (str) –

    • The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.

  • value (Any) –

    • The value. Could be primitive or complex.

Return type

None

add_property_deletion_override(property_path)

Adds an override that deletes the value of a property from the resource definition.

Parameters

property_path (str) – The path to the property.

Return type

None

add_property_override(property_path, value)

Adds an override to a resource property.

Syntactic sugar for addOverride("Properties.<...>", value).

Parameters
  • property_path (str) – The path of the property.

  • value (Any) – The value.

Return type

None

apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)

Sets the deletion policy of the resource based on the removal policy specified.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters
  • policy (Optional[RemovalPolicy]) –

  • apply_to_update_replace_policy (Optional[bool]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: true

  • default (Optional[RemovalPolicy]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.

Return type

None

get_att(attribute_name)

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility in case there is no generated attribute.

Parameters

attribute_name (str) – The name of the attribute.

Return type

Reference

get_metadata(key)

Retrieve a value value from the CloudFormation Resource Metadata.

Parameters

key (str) –

See

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.

Return type

Any

inspect(inspector)

Examines the CloudFormation resource and discloses attributes.

Parameters

inspector (TreeInspector) –

  • tree inspector to collect and process attributes.

Return type

None

override_logical_id(new_logical_id)

Overrides the auto-generated logical ID with a specific ID.

Parameters

new_logical_id (str) – The new logical ID to use for this stack element.

Return type

None

to_string()

Returns a string representation of this construct.

Return type

str

Returns

a string representation of this resource

Attributes

CFN_RESOURCE_TYPE_NAME = 'AWS::ApiGateway::Method'
api_key_required

Indicates whether the method requires clients to submit a valid API key.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-apikeyrequired

Return type

Union[bool, IResolvable, None]

authorization_scopes

A list of authorization scopes configured on the method.

The scopes are used with a COGNITO_USER_POOLS authorizer to authorize the method invocation. The authorization works by matching the method scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any method scopes match a claimed scope in the access token. Otherwise, the invocation is not authorized. When the method scope is configured, the client must provide an access token instead of an identity token for authorization purposes.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-authorizationscopes

Return type

Optional[List[str]]

authorization_type

The method’s authorization type.

This parameter is required. For valid values, see Method in the API Gateway API Reference . .. epigraph:

If you specify the ``AuthorizerId`` property, specify ``CUSTOM`` or ``COGNITO_USER_POOLS`` for this property.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-authorizationtype

Return type

Optional[str]

authorizer_id

//docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-authorizer.html>`_ to use on this method. If you specify this property, specify CUSTOM or COGNITO_USER_POOLS for the AuthorizationType property.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-authorizerid

Type

The identifier of the `authorizer <https

Return type

Optional[str]

cfn_options

Options for this resource, such as condition, update policy etc.

Return type

ICfnResourceOptions

cfn_resource_type

AWS resource type.

Return type

str

creation_stack

return:

the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.

Return type

List[str]

http_method

The HTTP method that clients use to call this method.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-httpmethod

Return type

str

integration

The backend system that the method calls when it receives a request.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-integration

Return type

Union[IResolvable, IntegrationProperty, None]

logical_id

The logical ID for this CloudFormation stack element.

The logical ID of the element is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Return type

str

Returns

the logical ID as a stringified token. This value will only get resolved during synthesis.

method_responses

The responses that can be sent to the client who calls the method.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-methodresponses

Return type

Union[IResolvable, List[Union[IResolvable, MethodResponseProperty]], None]

node

The construct tree node associated with this construct.

Return type

ConstructNode

operation_name

A friendly operation name for the method.

For example, you can assign the OperationName of ListPets for the GET /pets method.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-operationname

Return type

Optional[str]

ref

Return a string that will be resolved to a CloudFormation { Ref } for this element.

If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).

Return type

str

request_models

The resources that are used for the request’s content type.

Specify request models as key-value pairs (string-to-string mapping), with a content type as the key and a Model resource name as the value. To use the same model regardless of the content type, specify $default as the key.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-requestmodels

Return type

Union[IResolvable, Mapping[str, str], None]

request_parameters

The request parameters that API Gateway accepts.

Specify request parameters as key-value pairs (string-to-Boolean mapping), with a source as the key and a Boolean as the value. The Boolean specifies whether a parameter is required. A source must match the format method.request. *location* . *name* , where the location is querystring, path, or header, and name is a valid, unique parameter name.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-requestparameters

Return type

Union[IResolvable, Mapping[str, Union[bool, IResolvable]], None]

request_validator_id

The ID of the associated request validator.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-requestvalidatorid

Return type

Optional[str]

resource_id

//docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-resource.html>`_ . For root resource methods, specify the RestApi root resource ID, such as { "Fn::GetAtt": ["MyRestApi", "RootResourceId"] } .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-resourceid

Type

The ID of an API Gateway `resource <https

Return type

str

rest_api_id

//docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html>`_ resource in which API Gateway creates the method.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-restapiid

Type

The ID of the `RestApi <https

Return type

str

stack

The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).

Return type

Stack

Static Methods

classmethod is_cfn_element(x)

Returns true if a construct is a stack element (i.e. part of the synthesized cloudformation template).

Uses duck-typing instead of instanceof to allow stack elements from different versions of this library to be included in the same stack.

Parameters

x (Any) –

Return type

bool

Returns

The construct as a stack element or undefined if it is not a stack element.

classmethod is_cfn_resource(construct)

Check whether the given construct is a CfnResource.

Parameters

construct (IConstruct) –

Return type

bool

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool

IntegrationProperty

class CfnMethod.IntegrationProperty(*, cache_key_parameters=None, cache_namespace=None, connection_id=None, connection_type=None, content_handling=None, credentials=None, integration_http_method=None, integration_responses=None, passthrough_behavior=None, request_parameters=None, request_templates=None, timeout_in_millis=None, type=None, uri=None)

Bases: object

Integration is a property of the AWS::ApiGateway::Method resource that specifies information about the target backend that a method calls.

Parameters
  • cache_key_parameters (Optional[Sequence[str]]) – A list of request parameters whose values API Gateway caches. For cases where the integration type allows for RequestParameters to be set, these parameters must also be specified in RequestParameters to be supported in CacheKeyParameters .

  • cache_namespace (Optional[str]) – An API-specific tag group of related cached parameters.

  • connection_id (Optional[str]) – The ID of the VpcLink used for the integration when connectionType=VPC_LINK , otherwise undefined.

  • connection_type (Optional[str]) – The type of the network connection to the integration endpoint. The valid value is INTERNET for connections through the public routable internet or VPC_LINK for private connections between API Gateway and a network load balancer in a VPC. The default value is INTERNET .

  • content_handling (Optional[str]) – Specifies how to handle request payload content type conversions. Valid values are:. - CONVERT_TO_BINARY : Converts a request payload from a base64-encoded string to a binary blob. - CONVERT_TO_TEXT : Converts a request payload from a binary blob to a base64-encoded string. If this property isn’t defined, the request payload is passed through from the method request to the integration request without modification, provided that the PassthroughBehaviors property is configured to support payload pass-through.

  • credentials (Optional[str]) – The credentials that are required for the integration. To specify an AWS Identity and Access Management (IAM) role that API Gateway assumes, specify the role’s Amazon Resource Name (ARN). To require that the caller’s identity be passed through from the request, specify arn:aws:iam:::user/. To use resource-based permissions on the AWS Lambda (Lambda) function, don’t specify this property. Use the AWS::Lambda::Permission resource to permit API Gateway to call the function. For more information, see Allow Amazon API Gateway to Invoke a Lambda Function in the AWS Lambda Developer Guide .

  • integration_http_method (Optional[str]) – The integration’s HTTP method type. For the Type property, if you specify MOCK , this property is optional. For all other types, you must specify this property.

  • integration_responses (Union[IResolvable, Sequence[Union[IResolvable, IntegrationResponseProperty, Dict[str, Any]]], None]) – The response that API Gateway provides after a method’s backend completes processing a request. API Gateway intercepts the response from the backend so that you can control how API Gateway surfaces backend responses. For example, you can map the backend status codes to codes that you define.

  • passthrough_behavior (Optional[str]) – Indicates when API Gateway passes requests to the targeted backend. This behavior depends on the request’s Content-Type header and whether you defined a mapping template for it. For more information and valid values, see the passthroughBehavior field in the API Gateway API Reference .

  • request_parameters (Union[IResolvable, Mapping[str, str], None]) – The request parameters that API Gateway sends with the backend request. Specify request parameters as key-value pairs (string-to-string mappings), with a destination as the key and a source as the value. Specify the destination by using the following pattern integration.request. *location* . *name* , where location is query string, path, or header, and name is a valid, unique parameter name. The source must be an existing method request parameter or a static value. You must enclose static values in single quotation marks and pre-encode these values based on their destination in the request.

  • request_templates (Union[IResolvable, Mapping[str, str], None]) – A map of Apache Velocity templates that are applied on the request payload. The template that API Gateway uses is based on the value of the Content-Type header that’s sent by the client. The content type value is the key, and the template is the value (specified as a string), such as the following snippet: "application/json": "{\n \"statusCode\": 200\n}" For more information about templates, see API Gateway Mapping Template and Access Logging Variable Reference in the API Gateway Developer Guide .

  • timeout_in_millis (Union[int, float, None]) – Custom timeout between 50 and 29,000 milliseconds. The default value is 29,000 milliseconds or 29 seconds.

  • type (Optional[str]) – The type of backend that your method is running, such as HTTP or MOCK . For all of the valid values, see the type property for the Integration resource in the Amazon API Gateway REST API Reference .

  • uri (Optional[str]) – The Uniform Resource Identifier (URI) for the integration. If you specify HTTP for the Type property, specify the API endpoint URL. If you specify MOCK for the Type property, don’t specify this property. If you specify AWS for the Type property, specify an AWS service that follows this form: arn:aws:apigateway: region : subdomain . service|service : path|action / service_api . For example, a Lambda function URI follows this form: arn:aws:apigateway: region :lambda:path/ path . The path is usually in the form /2015-03-31/functions/ LambdaFunctionARN /invocations. For more information, see the uri property of the Integration resource in the Amazon API Gateway REST API Reference. If you specified HTTP or AWS for the Type property, you must specify this property.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_apigateway as apigateway

integration_property = apigateway.CfnMethod.IntegrationProperty(
    cache_key_parameters=["cacheKeyParameters"],
    cache_namespace="cacheNamespace",
    connection_id="connectionId",
    connection_type="connectionType",
    content_handling="contentHandling",
    credentials="credentials",
    integration_http_method="integrationHttpMethod",
    integration_responses=[apigateway.CfnMethod.IntegrationResponseProperty(
        status_code="statusCode",

        # the properties below are optional
        content_handling="contentHandling",
        response_parameters={
            "response_parameters_key": "responseParameters"
        },
        response_templates={
            "response_templates_key": "responseTemplates"
        },
        selection_pattern="selectionPattern"
    )],
    passthrough_behavior="passthroughBehavior",
    request_parameters={
        "request_parameters_key": "requestParameters"
    },
    request_templates={
        "request_templates_key": "requestTemplates"
    },
    timeout_in_millis=123,
    type="type",
    uri="uri"
)

Attributes

cache_key_parameters

A list of request parameters whose values API Gateway caches.

For cases where the integration type allows for RequestParameters to be set, these parameters must also be specified in RequestParameters to be supported in CacheKeyParameters .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-cachekeyparameters

Return type

Optional[List[str]]

cache_namespace

An API-specific tag group of related cached parameters.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-cachenamespace

Return type

Optional[str]

connection_id

The ID of the VpcLink used for the integration when connectionType=VPC_LINK , otherwise undefined.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-connectionid

Return type

Optional[str]

connection_type

The type of the network connection to the integration endpoint.

The valid value is INTERNET for connections through the public routable internet or VPC_LINK for private connections between API Gateway and a network load balancer in a VPC. The default value is INTERNET .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-connectiontype

Return type

Optional[str]

content_handling

.

  • CONVERT_TO_BINARY : Converts a request payload from a base64-encoded string to a binary blob.

  • CONVERT_TO_TEXT : Converts a request payload from a binary blob to a base64-encoded string.

If this property isn’t defined, the request payload is passed through from the method request to the integration request without modification, provided that the PassthroughBehaviors property is configured to support payload pass-through.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-contenthandling

Type

Specifies how to handle request payload content type conversions. Valid values are

Return type

Optional[str]

credentials

The credentials that are required for the integration.

To specify an AWS Identity and Access Management (IAM) role that API Gateway assumes, specify the role’s Amazon Resource Name (ARN). To require that the caller’s identity be passed through from the request, specify arn:aws:iam:::user/.

To use resource-based permissions on the AWS Lambda (Lambda) function, don’t specify this property. Use the AWS::Lambda::Permission resource to permit API Gateway to call the function. For more information, see Allow Amazon API Gateway to Invoke a Lambda Function in the AWS Lambda Developer Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-credentials

Return type

Optional[str]

integration_http_method

The integration’s HTTP method type.

For the Type property, if you specify MOCK , this property is optional. For all other types, you must specify this property.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-integrationhttpmethod

Return type

Optional[str]

integration_responses

The response that API Gateway provides after a method’s backend completes processing a request.

API Gateway intercepts the response from the backend so that you can control how API Gateway surfaces backend responses. For example, you can map the backend status codes to codes that you define.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-integrationresponses

Return type

Union[IResolvable, List[Union[IResolvable, IntegrationResponseProperty]], None]

passthrough_behavior

Indicates when API Gateway passes requests to the targeted backend.

This behavior depends on the request’s Content-Type header and whether you defined a mapping template for it.

For more information and valid values, see the passthroughBehavior field in the API Gateway API Reference .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-passthroughbehavior

Return type

Optional[str]

request_parameters

The request parameters that API Gateway sends with the backend request.

Specify request parameters as key-value pairs (string-to-string mappings), with a destination as the key and a source as the value.

Specify the destination by using the following pattern integration.request. *location* . *name* , where location is query string, path, or header, and name is a valid, unique parameter name.

The source must be an existing method request parameter or a static value. You must enclose static values in single quotation marks and pre-encode these values based on their destination in the request.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-requestparameters

Return type

Union[IResolvable, Mapping[str, str], None]

request_templates

A map of Apache Velocity templates that are applied on the request payload.

The template that API Gateway uses is based on the value of the Content-Type header that’s sent by the client. The content type value is the key, and the template is the value (specified as a string), such as the following snippet:

"application/json": "{\n \"statusCode\": 200\n}"

For more information about templates, see API Gateway Mapping Template and Access Logging Variable Reference in the API Gateway Developer Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-requesttemplates

Return type

Union[IResolvable, Mapping[str, str], None]

timeout_in_millis

Custom timeout between 50 and 29,000 milliseconds.

The default value is 29,000 milliseconds or 29 seconds.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-timeoutinmillis

Return type

Union[int, float, None]

type

The type of backend that your method is running, such as HTTP or MOCK .

For all of the valid values, see the type property for the Integration resource in the Amazon API Gateway REST API Reference .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-type

Return type

Optional[str]

uri

The Uniform Resource Identifier (URI) for the integration.

If you specify HTTP for the Type property, specify the API endpoint URL.

If you specify MOCK for the Type property, don’t specify this property.

If you specify AWS for the Type property, specify an AWS service that follows this form: arn:aws:apigateway: region : subdomain . service|service : path|action / service_api . For example, a Lambda function URI follows this form: arn:aws:apigateway: region :lambda:path/ path . The path is usually in the form /2015-03-31/functions/ LambdaFunctionARN /invocations. For more information, see the uri property of the Integration resource in the Amazon API Gateway REST API Reference.

If you specified HTTP or AWS for the Type property, you must specify this property.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-uri

Return type

Optional[str]

IntegrationResponseProperty

class CfnMethod.IntegrationResponseProperty(*, status_code, content_handling=None, response_parameters=None, response_templates=None, selection_pattern=None)

Bases: object

IntegrationResponse is a property of the Amazon API Gateway Method Integration property type that specifies the response that API Gateway sends after a method’s backend finishes processing a request.

Parameters
  • status_code (str) – The status code that API Gateway uses to map the integration response to a MethodResponse status code.

  • content_handling (Optional[str]) – Specifies how to handle request payload content type conversions. Valid values are:. - CONVERT_TO_BINARY : Converts a request payload from a base64-encoded string to a binary blob. - CONVERT_TO_TEXT : Converts a request payload from a binary blob to a base64-encoded string. If this property isn’t defined, the request payload is passed through from the method request to the integration request without modification.

  • response_parameters (Union[IResolvable, Mapping[str, str], None]) –

    The response parameters from the backend response that API Gateway sends to the method response. Specify response parameters as key-value pairs ( string-to-string mappings ). Use the destination as the key and the source as the value: - The destination must be an existing response parameter in the MethodResponse property. - The source must be an existing method request parameter or a static value. You must enclose static values in single quotation marks and pre-encode these values based on the destination specified in the request. For more information about templates, see API Gateway Mapping Template and Access Logging Variable Reference in the API Gateway Developer Guide .

  • response_templates (Union[IResolvable, Mapping[str, str], None]) –

    The templates that are used to transform the integration response body. Specify templates as key-value pairs (string-to-string mappings), with a content type as the key and a template as the value. For more information, see API Gateway Mapping Template and Access Logging Variable Reference in the API Gateway Developer Guide .

  • selection_pattern (Optional[str]) – A regular expression that specifies which error strings or status codes from the backend map to the integration response.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration-integrationresponse.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_apigateway as apigateway

integration_response_property = apigateway.CfnMethod.IntegrationResponseProperty(
    status_code="statusCode",

    # the properties below are optional
    content_handling="contentHandling",
    response_parameters={
        "response_parameters_key": "responseParameters"
    },
    response_templates={
        "response_templates_key": "responseTemplates"
    },
    selection_pattern="selectionPattern"
)

Attributes

content_handling

.

  • CONVERT_TO_BINARY : Converts a request payload from a base64-encoded string to a binary blob.

  • CONVERT_TO_TEXT : Converts a request payload from a binary blob to a base64-encoded string.

If this property isn’t defined, the request payload is passed through from the method request to the integration request without modification.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration-integrationresponse.html#cfn-apigateway-method-integrationresponse-contenthandling

Type

Specifies how to handle request payload content type conversions. Valid values are

Return type

Optional[str]

response_parameters

The response parameters from the backend response that API Gateway sends to the method response.

Specify response parameters as key-value pairs ( string-to-string mappings ).

Use the destination as the key and the source as the value:

  • The destination must be an existing response parameter in the MethodResponse property.

  • The source must be an existing method request parameter or a static value. You must enclose static values in single quotation marks and pre-encode these values based on the destination specified in the request.

For more information about templates, see API Gateway Mapping Template and Access Logging Variable Reference in the API Gateway Developer Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration-integrationresponse.html#cfn-apigateway-method-integration-integrationresponse-responseparameters

Return type

Union[IResolvable, Mapping[str, str], None]

response_templates

The templates that are used to transform the integration response body.

Specify templates as key-value pairs (string-to-string mappings), with a content type as the key and a template as the value. For more information, see API Gateway Mapping Template and Access Logging Variable Reference in the API Gateway Developer Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration-integrationresponse.html#cfn-apigateway-method-integration-integrationresponse-responsetemplates

Return type

Union[IResolvable, Mapping[str, str], None]

selection_pattern

//docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-regexes.html>`_ that specifies which error strings or status codes from the backend map to the integration response.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration-integrationresponse.html#cfn-apigateway-method-integration-integrationresponse-selectionpattern

Type

A `regular expression <https

Return type

Optional[str]

status_code

//docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-methodresponse.html>`_ status code.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration-integrationresponse.html#cfn-apigateway-method-integration-integrationresponse-statuscode

Type

The status code that API Gateway uses to map the integration response to a `MethodResponse <https

Return type

str

MethodResponseProperty

class CfnMethod.MethodResponseProperty(*, status_code, response_models=None, response_parameters=None)

Bases: object

MethodResponse is a property of the AWS::ApiGateway::Method resource that defines the responses that can be sent to the client that calls a method.

Parameters
  • status_code (str) – The method response’s status code, which you map to an IntegrationResponse .

  • response_models (Union[IResolvable, Mapping[str, str], None]) – The resources used for the response’s content type. Specify response models as key-value pairs (string-to-string maps), with a content type as the key and a Model resource name as the value.

  • response_parameters (Union[IResolvable, Mapping[str, Union[bool, IResolvable]], None]) – Response parameters that API Gateway sends to the client that called a method. Specify response parameters as key-value pairs (string-to-Boolean maps), with a destination as the key and a Boolean as the value. Specify the destination using the following pattern: method.response.header. *name* , where name is a valid, unique header name. The Boolean specifies whether a parameter is required.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-methodresponse.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_apigateway as apigateway

method_response_property = apigateway.CfnMethod.MethodResponseProperty(
    status_code="statusCode",

    # the properties below are optional
    response_models={
        "response_models_key": "responseModels"
    },
    response_parameters={
        "response_parameters_key": False
    }
)

Attributes

response_models

The resources used for the response’s content type.

Specify response models as key-value pairs (string-to-string maps), with a content type as the key and a Model resource name as the value.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-methodresponse.html#cfn-apigateway-method-methodresponse-responsemodels

Return type

Union[IResolvable, Mapping[str, str], None]

response_parameters

Response parameters that API Gateway sends to the client that called a method.

Specify response parameters as key-value pairs (string-to-Boolean maps), with a destination as the key and a Boolean as the value. Specify the destination using the following pattern: method.response.header. *name* , where name is a valid, unique header name. The Boolean specifies whether a parameter is required.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-methodresponse.html#cfn-apigateway-method-methodresponse-responseparameters

Return type

Union[IResolvable, Mapping[str, Union[bool, IResolvable]], None]

status_code

//docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration-integrationresponse.html>`_ .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-methodresponse.html#cfn-apigateway-method-methodresponse-statuscode

Type

The method response’s status code, which you map to an `IntegrationResponse <https

Return type

str