GatewayResponseProps

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

Bases: GatewayResponseOptions

Properties for a new gateway response.

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

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

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

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

# response_type: apigateway.ResponseType
# rest_api: apigateway.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

rest_api

Rest api resource to target.

status_code

Http status code for response.

Default:
  • standard http status code for the response type.

templates

Custom templates to get mapped as response.

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

type

Response type to associate with gateway response.

See:

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