MethodProps

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

Bases: object

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

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

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

  • options (Union[MethodOptions, Dict[str, Any], None]) – Method options. Default: - No options.

ExampleMetadata:

fixture=_generated

Example:

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

# authorizer: apigateway.Authorizer
# integration: apigateway.Integration
# model: apigateway.Model
# request_validator: apigateway.RequestValidator
# resource: apigateway.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.

integration

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

Default:
  • a new MockIntegration.

options

Method options.

Default:
  • No options.

resource

The resource this method is associated with.

For root resource methods, specify the RestApi object.