CfnMethodProps

class aws_cdk.aws_apigateway.CfnMethodProps(*, 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: object

Properties for defining a CfnMethod.

Parameters:
  • http_method (str) – The method’s HTTP verb.

  • resource_id (str) – The Resource identifier for the MethodResponse resource.

  • rest_api_id (str) – The string identifier of the associated RestApi.

  • api_key_required (Union[bool, IResolvable, None]) – A boolean flag specifying whether a valid ApiKey is required to invoke this method.

  • 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 matches 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 an authorizer to use on this method. The method’s authorization type must be CUSTOM or COGNITO_USER_POOLS .

  • integration (Union[IResolvable, IntegrationProperty, Dict[str, Any], None]) – Represents an HTTP , HTTP_PROXY , AWS , AWS_PROXY , or Mock integration.

  • method_responses (Union[IResolvable, Sequence[Union[IResolvable, MethodResponseProperty, Dict[str, Any]]], None]) – Gets a method response associated with a given HTTP status code.

  • operation_name (Optional[str]) – A human-friendly operation identifier for the method. For example, you can assign the operationName of ListPets for the GET /pets method in the PetStore example.

  • request_models (Union[IResolvable, Mapping[str, str], None]) – A key-value map specifying data schemas, represented by Model resources, (as the mapped value) of the request payloads of given content types (as the mapping key).

  • request_parameters (Union[IResolvable, Mapping[str, Union[bool, IResolvable]], None]) – A key-value map defining required or optional method request parameters that can be accepted by API Gateway. A key is a method request parameter name matching the pattern of method.request.{location}.{name} , where location is querystring , path , or header and name is a valid and unique parameter name. The value associated with the key is a Boolean flag indicating whether the parameter is required ( true ) or optional ( false ). The method request parameter names defined here are available in Integration to be mapped to integration request parameters or templates.

  • request_validator_id (Optional[str]) – The identifier of a RequestValidator for request validation.

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_props = apigateway.CfnMethodProps(
    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"
)

Attributes

api_key_required

A boolean flag specifying whether a valid ApiKey is required to invoke this method.

Link:

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

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 matches 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

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

authorizer_id

The identifier of an authorizer to use on this method.

The method’s authorization type must be CUSTOM or COGNITO_USER_POOLS .

Link:

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

http_method

The method’s HTTP verb.

Link:

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

integration

Represents an HTTP , HTTP_PROXY , AWS , AWS_PROXY , or Mock integration.

Link:

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

method_responses

Gets a method response associated with a given HTTP status code.

Link:

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

operation_name

A human-friendly operation identifier for the method.

For example, you can assign the operationName of ListPets for the GET /pets method in the PetStore example.

Link:

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

request_models

A key-value map specifying data schemas, represented by Model resources, (as the mapped value) of the request payloads of given content types (as the mapping key).

Link:

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

request_parameters

A key-value map defining required or optional method request parameters that can be accepted by API Gateway.

A key is a method request parameter name matching the pattern of method.request.{location}.{name} , where location is querystring , path , or header and name is a valid and unique parameter name. The value associated with the key is a Boolean flag indicating whether the parameter is required ( true ) or optional ( false ). The method request parameter names defined here are available in Integration to be mapped to integration request parameters or templates.

Link:

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

request_validator_id

The identifier of a RequestValidator for request validation.

Link:

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

resource_id

The Resource identifier for the MethodResponse resource.

Link:

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

rest_api_id

The string identifier of the associated RestApi.

Link:

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