@aws-cdk_aws-apigatewayv2-alpha.WebSocketRoute

class WebSocketRoute (construct) ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.Apigatewayv2.Alpha.WebSocketRoute
Gogithub.com/aws/aws-cdk-go/awscdkapigatewayv2alpha/v2#WebSocketRoute
Javasoftware.amazon.awscdk.services.apigatewayv2.alpha.WebSocketRoute
Pythonaws_cdk.aws_apigatewayv2_alpha.WebSocketRoute
TypeScript (source)@aws-cdk/aws-apigatewayv2-alpha ยป WebSocketRoute

Implements IConstruct, IDependable, IResource, IWebSocketRoute, IRoute

Route class that creates the Route for API Gateway WebSocket API.

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as apigatewayv2_alpha from '@aws-cdk/aws-apigatewayv2-alpha';

declare const webSocketApi: apigatewayv2_alpha.WebSocketApi;
declare const webSocketRouteAuthorizer: apigatewayv2_alpha.IWebSocketRouteAuthorizer;
declare const webSocketRouteIntegration: apigatewayv2_alpha.WebSocketRouteIntegration;
const webSocketRoute = new apigatewayv2_alpha.WebSocketRoute(this, 'MyWebSocketRoute', {
  integration: webSocketRouteIntegration,
  routeKey: 'routeKey',
  webSocketApi: webSocketApi,

  // the properties below are optional
  apiKeyRequired: false,
  authorizer: webSocketRouteAuthorizer,
  returnResponse: false,
});

Initializer

new WebSocketRoute(scope: Construct, id: string, props: WebSocketRouteProps)

Parameters

  • scope Construct
  • id string
  • props WebSocketRouteProps

Construct Props

NameTypeDescription
integration๐Ÿ”นWebSocketRouteIntegrationThe integration to be configured on this route.
routeKey๐Ÿ”นstringThe key to this route.
webSocketApi๐Ÿ”นIWebSocketApiThe API the route is associated with.
apiKeyRequired?๐Ÿ”นbooleanWhether the route requires an API Key to be provided.
authorizer?๐Ÿ”นIWebSocketRouteAuthorizerThe authorize to this route.
returnResponse?๐Ÿ”นbooleanShould the route send a response to the client.

integration๐Ÿ”น

Type: WebSocketRouteIntegration

The integration to be configured on this route.


routeKey๐Ÿ”น

Type: string

The key to this route.


webSocketApi๐Ÿ”น

Type: IWebSocketApi

The API the route is associated with.


apiKeyRequired?๐Ÿ”น

Type: boolean (optional, default: false)

Whether the route requires an API Key to be provided.


authorizer?๐Ÿ”น

Type: IWebSocketRouteAuthorizer (optional, default: No Authorizer)

The authorize to this route.

You can only set authorizer to a $connect route.


returnResponse?๐Ÿ”น

Type: boolean (optional, default: false)

Should the route send a response to the client.

Properties

NameTypeDescription
env๐Ÿ”นResourceEnvironmentThe environment this resource belongs to.
node๐Ÿ”นNodeThe tree node.
routeId๐Ÿ”นstringId of the Route.
routeKey๐Ÿ”นstringThe key to this route.
stack๐Ÿ”นStackThe stack in which this resource is defined.
webSocketApi๐Ÿ”นIWebSocketApiThe WebSocket API associated with this route.
integrationResponseId?๐Ÿ”นstringIntegration response ID.

env๐Ÿ”น

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


node๐Ÿ”น

Type: Node

The tree node.


routeId๐Ÿ”น

Type: string

Id of the Route.


routeKey๐Ÿ”น

Type: string

The key to this route.


stack๐Ÿ”น

Type: Stack

The stack in which this resource is defined.


webSocketApi๐Ÿ”น

Type: IWebSocketApi

The WebSocket API associated with this route.


integrationResponseId?๐Ÿ”น

Type: string (optional)

Integration response ID.

Methods

NameDescription
applyRemovalPolicy(policy)๐Ÿ”นApply the given removal policy to this resource.
toString()๐Ÿ”นReturns a string representation of this construct.

applyRemovalPolicy(policy)๐Ÿ”น

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).


toString()๐Ÿ”น

public toString(): string

Returns

  • string

Returns a string representation of this construct.