MethodResponse

class aws_cdk.aws_apigateway.MethodResponse(*, status_code, response_models=None, response_parameters=None)

Bases: object

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

  • response_models (Optional[Mapping[str, IModel]]) – 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. Default: None

  • response_parameters (Optional[Mapping[str, bool]]) – 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 the name is a valid, unique header name. The Boolean specifies whether a parameter is required. Default: None

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

# model is of type Model

method_response = apigateway.MethodResponse(
    status_code="statusCode",

    # the properties below are optional
    response_models={
        "response_models_key": model
    },
    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.

Default

None

Return type

Optional[Mapping[str, IModel]]

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 the name is a valid, unique header name. The Boolean specifies whether a parameter is required.

Default

None

Return type

Optional[Mapping[str, bool]]

status_code

The method response’s status code, which you map to an IntegrationResponse.

Required.

Return type

str