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

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

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]

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]

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]

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]

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