GatewayResponseProps

class aws_cdk.aws_apigateway.GatewayResponseProps(*, response_headers=None, status_code=None, templates=None, type, rest_api)

Bases: aws_cdk.aws_apigateway.GatewayResponseOptions

Properties for a new gateway response.

Parameters
  • response_headers (Optional[Mapping[str, str]]) – Custom headers parameters for response. Default: - no headers

  • status_code (Optional[str]) – Http status code for response. Default: - standard http status code for the response type.

  • templates (Optional[Mapping[str, str]]) – Custom templates to get mapped as response. Default: - Response from api will be returned without applying any transformation.

  • type (ResponseType) – Response type to associate with gateway response.

  • rest_api (IRestApi) – Rest api resource to target.

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

# response_type is of type ResponseType
# rest_api is of type RestApi

gateway_response_props = apigateway.GatewayResponseProps(
    rest_api=rest_api,
    type=response_type,

    # the properties below are optional
    response_headers={
        "response_headers_key": "responseHeaders"
    },
    status_code="statusCode",
    templates={
        "templates_key": "templates"
    }
)

Attributes

response_headers

Custom headers parameters for response.

Default
  • no headers

Return type

Optional[Mapping[str, str]]

rest_api

Rest api resource to target.

Return type

IRestApi

status_code

Http status code for response.

Default
  • standard http status code for the response type.

Return type

Optional[str]

templates

Custom templates to get mapped as response.

Default
  • Response from api will be returned without applying any transformation.

Return type

Optional[Mapping[str, str]]

type

Response type to associate with gateway response.

See

https://docs.aws.amazon.com/apigateway/latest/developerguide/supported-gateway-response-types.html

Return type

ResponseType