WebSocketIntegrationProps

class aws_cdk.aws_apigatewayv2.WebSocketIntegrationProps(*, integration_type, integration_uri, web_socket_api, content_handling=None, credentials_role=None, integration_method=None, passthrough_behavior=None, request_parameters=None, request_templates=None, template_selection_expression=None, timeout=None)

Bases: object

The integration properties.

Parameters:
  • integration_type (WebSocketIntegrationType) – Integration type.

  • integration_uri (str) – Integration URI.

  • web_socket_api (IWebSocketApi) – The WebSocket API to which this integration should be bound.

  • content_handling (Optional[ContentHandling]) – Specifies how to handle response payload content type conversions. Default: - The response payload will be passed through from the integration response to the route response or method response without modification.

  • credentials_role (Optional[IRole]) – Specifies the IAM role required for the integration. Default: - No IAM role required.

  • integration_method (Optional[str]) – Specifies the integration’s HTTP method type. Default: - No HTTP method required.

  • passthrough_behavior (Optional[PassthroughBehavior]) – Specifies the pass-through behavior for incoming requests based on the Content-Type header in the request, and the available mapping templates specified as the requestTemplates property on the Integration resource. There are three valid values: WHEN_NO_MATCH, WHEN_NO_TEMPLATES, and NEVER. Default: - No passthrough behavior required.

  • request_parameters (Optional[Mapping[str, str]]) – The request parameters that API Gateway sends with the backend request. Specify request parameters as key-value pairs (string-to-string mappings), with a destination as the key and a source as the value. Default: - No request parameters required.

  • request_templates (Optional[Mapping[str, str]]) – A map of Apache Velocity templates that are applied on the request payload. Example:: { “application/json”: “{ "statusCode": 200 }” } Default: - No request templates required.

  • template_selection_expression (Optional[str]) – The template selection expression for the integration. Default: - No template selection expression required.

  • timeout (Optional[Duration]) – The maximum amount of time an integration will run before it returns without a response. Must be between 50 milliseconds and 29 seconds. Default: Duration.seconds(29)

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 as cdk
from aws_cdk import aws_apigatewayv2 as apigatewayv2
from aws_cdk import aws_iam as iam

# role: iam.Role
# web_socket_api: apigatewayv2.WebSocketApi

web_socket_integration_props = apigatewayv2.WebSocketIntegrationProps(
    integration_type=apigatewayv2.WebSocketIntegrationType.AWS_PROXY,
    integration_uri="integrationUri",
    web_socket_api=web_socket_api,

    # the properties below are optional
    content_handling=apigatewayv2.ContentHandling.CONVERT_TO_BINARY,
    credentials_role=role,
    integration_method="integrationMethod",
    passthrough_behavior=apigatewayv2.PassthroughBehavior.WHEN_NO_MATCH,
    request_parameters={
        "request_parameters_key": "requestParameters"
    },
    request_templates={
        "request_templates_key": "requestTemplates"
    },
    template_selection_expression="templateSelectionExpression",
    timeout=cdk.Duration.minutes(30)
)

Attributes

content_handling

Specifies how to handle response payload content type conversions.

Default:

  • The response payload will be passed through from the integration response to

the route response or method response without modification.

credentials_role

Specifies the IAM role required for the integration.

Default:
  • No IAM role required.

integration_method

Specifies the integration’s HTTP method type.

Default:
  • No HTTP method required.

integration_type

Integration type.

integration_uri

Integration URI.

passthrough_behavior

Specifies the pass-through behavior for incoming requests based on the Content-Type header in the request, and the available mapping templates specified as the requestTemplates property on the Integration resource.

There are three valid values: WHEN_NO_MATCH, WHEN_NO_TEMPLATES, and NEVER.

Default:
  • No passthrough behavior required.

request_parameters

The request parameters that API Gateway sends with the backend request.

Specify request parameters as key-value pairs (string-to-string mappings), with a destination as the key and a source as the value.

Default:
  • No request parameters required.

request_templates

A map of Apache Velocity templates that are applied on the request payload.

Example:

{ "application/json": "{ \"statusCode\": 200 }" }
Default:
  • No request templates required.

template_selection_expression

The template selection expression for the integration.

Default:
  • No template selection expression required.

timeout

The maximum amount of time an integration will run before it returns without a response.

Must be between 50 milliseconds and 29 seconds.

Default:

Duration.seconds(29)

web_socket_api

The WebSocket API to which this integration should be bound.