interface WebSocketAwsIntegrationProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AwsApigatewayv2Integrations.WebSocketAwsIntegrationProps |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsapigatewayv2integrations#WebSocketAwsIntegrationProps |
![]() | software.amazon.awscdk.aws_apigatewayv2_integrations.WebSocketAwsIntegrationProps |
![]() | aws_cdk.aws_apigatewayv2_integrations.WebSocketAwsIntegrationProps |
![]() | aws-cdk-lib » aws_apigatewayv2_integrations » WebSocketAwsIntegrationProps |
Props for AWS type integration for a WebSocket Api.
Example
import { WebSocketAwsIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
import * as iam from 'aws-cdk-lib/aws-iam';
const webSocketApi = new apigwv2.WebSocketApi(this, 'mywsapi');
new apigwv2.WebSocketStage(this, 'mystage', {
webSocketApi,
stageName: 'dev',
autoDeploy: true,
});
declare const apiRole: iam.Role;
declare const table: dynamodb.Table;
webSocketApi.addRoute('$connect', {
integration: new WebSocketAwsIntegration('DynamodbPutItem', {
integrationUri: `arn:aws:apigateway:${this.region}:dynamodb:action/PutItem`,
integrationMethod: apigwv2.HttpMethod.POST,
credentialsRole: apiRole,
requestTemplates: {
'application/json': JSON.stringify({
TableName: table.tableName,
Item: {
id: {
S: '$context.requestId',
},
},
}),
},
}),
});
Properties
Name | Type | Description |
---|---|---|
integration | string | Specifies the integration's HTTP method type. |
integration | string | Integration URI. |
content | Content | Specifies how to handle response payload content type conversions. |
credentials | IRole | Specifies the credentials role required for the integration. |
passthrough | Passthrough | 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. |
request | { [string]: string } | The request parameters that API Gateway sends with the backend request. |
request | { [string]: string } | A map of Apache Velocity templates that are applied on the request payload. |
template | string | The template selection expression for the integration. |
timeout? | Duration | The maximum amount of time an integration will run before it returns without a response. |
integrationMethod
Type:
string
Specifies the integration's HTTP method type.
integrationUri
Type:
string
Integration URI.
contentHandling?
Type:
Content
(optional, default: The response payload will be passed through from the integration response to
the route response or method response without modification.)
Specifies how to handle response payload content type conversions.
credentialsRole?
Type:
IRole
(optional, default: No credential role provided.)
Specifies the credentials role required for the integration.
passthroughBehavior?
Type:
Passthrough
(optional, default: No passthrough behavior required.)
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.
requestParameters?
Type:
{ [string]: string }
(optional, default: No request parameter provided to the integration.)
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.
requestTemplates?
Type:
{ [string]: string }
(optional, default: No request template provided to the integration.)
A map of Apache Velocity templates that are applied on the request payload.
{ "application/json": "{ \"statusCode\": 200 }" }
templateSelectionExpression?
Type:
string
(optional, default: No template selection expression provided.)
The template selection expression for the integration.
timeout?
Type:
Duration
(optional, default: Duration.seconds(29))
The maximum amount of time an integration will run before it returns without a response.
Must be between 50 milliseconds and 29 seconds.