WebSocketApiProps
- class aws_cdk.aws_apigatewayv2.WebSocketApiProps(*, api_key_selection_expression=None, api_name=None, connect_route_options=None, default_route_options=None, description=None, disconnect_route_options=None, route_selection_expression=None)
Bases:
object
(experimental) Props for WebSocket API.
- Parameters:
api_key_selection_expression (
Optional
[WebSocketApiKeySelectionExpression
]) – (experimental) An API key selection expression. Providing this option will require an API Key be provided to access the API. Default: - Key is not required to access these APIsapi_name (
Optional
[str
]) – (experimental) Name for the WebSocket API resource. Default: - id of the WebSocketApi construct.connect_route_options (
Union
[WebSocketRouteOptions
,Dict
[str
,Any
],None
]) – (experimental) Options to configure a ‘$connect’ route. Default: - no ‘$connect’ route configureddefault_route_options (
Union
[WebSocketRouteOptions
,Dict
[str
,Any
],None
]) – (experimental) Options to configure a ‘$default’ route. Default: - no ‘$default’ route configureddescription (
Optional
[str
]) – (experimental) The description of the API. Default: - nonedisconnect_route_options (
Union
[WebSocketRouteOptions
,Dict
[str
,Any
],None
]) – (experimental) Options to configure a ‘$disconnect’ route. Default: - no ‘$disconnect’ route configuredroute_selection_expression (
Optional
[str
]) – (experimental) The route selection expression for the API. Default: ‘$request.body.action’
- Stability:
experimental
- ExampleMetadata:
infused
Example:
from aws_cdk.aws_apigatewayv2_authorizers import WebSocketLambdaAuthorizer from aws_cdk.aws_apigatewayv2_integrations import WebSocketLambdaIntegration # This function handles your auth logic # auth_handler: lambda.Function # This function handles your WebSocket requests # handler: lambda.Function authorizer = WebSocketLambdaAuthorizer("Authorizer", auth_handler) integration = WebSocketLambdaIntegration("Integration", handler) apigwv2.WebSocketApi(self, "WebSocketApi", connect_route_options=apigwv2.WebSocketRouteOptions( integration=integration, authorizer=authorizer ) )
Attributes
- api_key_selection_expression
(experimental) An API key selection expression.
Providing this option will require an API Key be provided to access the API.
- Default:
Key is not required to access these APIs
- Stability:
experimental
- api_name
(experimental) Name for the WebSocket API resource.
- Default:
id of the WebSocketApi construct.
- Stability:
experimental
- connect_route_options
(experimental) Options to configure a ‘$connect’ route.
- Default:
no ‘$connect’ route configured
- Stability:
experimental
- default_route_options
(experimental) Options to configure a ‘$default’ route.
- Default:
no ‘$default’ route configured
- Stability:
experimental
- description
(experimental) The description of the API.
- Default:
none
- Stability:
experimental
- disconnect_route_options
(experimental) Options to configure a ‘$disconnect’ route.
- Default:
no ‘$disconnect’ route configured
- Stability:
experimental
- route_selection_expression
(experimental) The route selection expression for the API.
- Default:
‘$request.body.action’
- Stability:
experimental