MethodProps

class aws_cdk.aws_apigateway.MethodProps(*, http_method, integration=None, options=None, resource)

Bases: object

Parameters
  • http_method (str) – The HTTP method (“GET”, “POST”, “PUT”, …) that clients use to call this method.

  • integration (Optional[Integration]) – The backend system that the method calls when it receives a request. Default: - a new MockIntegration.

  • options (Optional[MethodOptions]) – Method options. Default: - No options.

  • resource (IResource) – The resource this method is associated with. For root resource methods, specify the RestApi object.

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

# authorizer is of type Authorizer
# integration is of type Integration
# model is of type Model
# request_validator is of type RequestValidator
# resource is of type Resource

method_props = apigateway.MethodProps(
    http_method="httpMethod",
    resource=resource,

    # the properties below are optional
    integration=integration,
    options=apigateway.MethodOptions(
        api_key_required=False,
        authorization_scopes=["authorizationScopes"],
        authorization_type=apigateway.AuthorizationType.NONE,
        authorizer=authorizer,
        method_responses=[apigateway.MethodResponse(
            status_code="statusCode",

            # the properties below are optional
            response_models={
                "response_models_key": model
            },
            response_parameters={
                "response_parameters_key": False
            }
        )],
        operation_name="operationName",
        request_models={
            "request_models_key": model
        },
        request_parameters={
            "request_parameters_key": False
        },
        request_validator=request_validator,
        request_validator_options=apigateway.RequestValidatorOptions(
            request_validator_name="requestValidatorName",
            validate_request_body=False,
            validate_request_parameters=False
        )
    )
)

Attributes

http_method

The HTTP method (“GET”, “POST”, “PUT”, …) that clients use to call this method.

Return type

str

integration

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

Default
  • a new MockIntegration.

Return type

Optional[Integration]

options

Method options.

Default
  • No options.

Return type

Optional[MethodOptions]

resource

The resource this method is associated with.

For root resource methods, specify the RestApi object.

Return type

IResource