aws-solutions-constructs.aws-apigatewayv2websocket-sqs 2.85.1__tar.gz → 2.85.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.3/PKG-INFO +28 -0
  2. aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.3/README.md +1 -0
  3. {aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.1 → aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.3}/setup.py +3 -3
  4. {aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.1 → aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.3}/src/aws_solutions_constructs/aws_apigatewayv2websocket_sqs/__init__.py +1 -149
  5. {aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.1 → aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.3}/src/aws_solutions_constructs/aws_apigatewayv2websocket_sqs/_jsii/__init__.py +2 -2
  6. aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.3/src/aws_solutions_constructs/aws_apigatewayv2websocket_sqs/_jsii/aws-apigatewayv2websocket-sqs@2.85.3.jsii.tgz +0 -0
  7. aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.3/src/aws_solutions_constructs.aws_apigatewayv2websocket_sqs.egg-info/PKG-INFO +28 -0
  8. {aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.1 → aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.3}/src/aws_solutions_constructs.aws_apigatewayv2websocket_sqs.egg-info/SOURCES.txt +1 -1
  9. {aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.1 → aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.3}/src/aws_solutions_constructs.aws_apigatewayv2websocket_sqs.egg-info/requires.txt +1 -1
  10. aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.1/PKG-INFO +0 -176
  11. aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.1/README.md +0 -149
  12. aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.1/src/aws_solutions_constructs/aws_apigatewayv2websocket_sqs/_jsii/aws-apigatewayv2websocket-sqs@2.85.1.jsii.tgz +0 -0
  13. aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.1/src/aws_solutions_constructs.aws_apigatewayv2websocket_sqs.egg-info/PKG-INFO +0 -176
  14. {aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.1 → aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.3}/LICENSE +0 -0
  15. {aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.1 → aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.3}/MANIFEST.in +0 -0
  16. {aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.1 → aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.3}/pyproject.toml +0 -0
  17. {aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.1 → aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.3}/setup.cfg +0 -0
  18. {aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.1 → aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.3}/src/aws_solutions_constructs/aws_apigatewayv2websocket_sqs/py.typed +0 -0
  19. {aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.1 → aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.3}/src/aws_solutions_constructs.aws_apigatewayv2websocket_sqs.egg-info/dependency_links.txt +0 -0
  20. {aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.1 → aws_solutions_constructs_aws_apigatewayv2websocket_sqs-2.85.3}/src/aws_solutions_constructs.aws_apigatewayv2websocket_sqs.egg-info/top_level.txt +0 -0
@@ -0,0 +1,28 @@
1
+ Metadata-Version: 2.1
2
+ Name: aws-solutions-constructs.aws-apigatewayv2websocket-sqs
3
+ Version: 2.85.3
4
+ Summary: CDK constructs for defining an interaction between an AWS Lambda function and an Amazon S3 bucket.
5
+ Home-page: https://github.com/awslabs/aws-solutions-constructs.git
6
+ Author: Amazon Web Services
7
+ License: Apache-2.0
8
+ Project-URL: Source, https://github.com/awslabs/aws-solutions-constructs.git
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: JavaScript
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Typing :: Typed
17
+ Classifier: License :: OSI Approved
18
+ Requires-Python: ~=3.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: aws-cdk-lib<3.0.0,>=2.193.0
22
+ Requires-Dist: aws-solutions-constructs.core==2.85.3
23
+ Requires-Dist: constructs<11.0.0,>=10.0.0
24
+ Requires-Dist: jsii<2.0.0,>=1.111.0
25
+ Requires-Dist: publication>=0.0.3
26
+ Requires-Dist: typeguard<4.3.0,>=2.13.3
27
+
28
+ Documentation for this pattern can be found [here](https://github.com/awslabs/aws-solutions-constructs/blob/main/source/patterns/%40aws-solutions-constructs/aws-apigatewayv2websocket-sqs/README.adoc)
@@ -0,0 +1 @@
1
+ Documentation for this pattern can be found [here](https://github.com/awslabs/aws-solutions-constructs/blob/main/source/patterns/%40aws-solutions-constructs/aws-apigatewayv2websocket-sqs/README.adoc)
@@ -5,7 +5,7 @@ kwargs = json.loads(
5
5
  """
6
6
  {
7
7
  "name": "aws-solutions-constructs.aws-apigatewayv2websocket-sqs",
8
- "version": "2.85.1",
8
+ "version": "2.85.3",
9
9
  "description": "CDK constructs for defining an interaction between an AWS Lambda function and an Amazon S3 bucket.",
10
10
  "license": "Apache-2.0",
11
11
  "url": "https://github.com/awslabs/aws-solutions-constructs.git",
@@ -26,7 +26,7 @@ kwargs = json.loads(
26
26
  ],
27
27
  "package_data": {
28
28
  "aws_solutions_constructs.aws_apigatewayv2websocket_sqs._jsii": [
29
- "aws-apigatewayv2websocket-sqs@2.85.1.jsii.tgz"
29
+ "aws-apigatewayv2websocket-sqs@2.85.3.jsii.tgz"
30
30
  ],
31
31
  "aws_solutions_constructs.aws_apigatewayv2websocket_sqs": [
32
32
  "py.typed"
@@ -35,7 +35,7 @@ kwargs = json.loads(
35
35
  "python_requires": "~=3.9",
36
36
  "install_requires": [
37
37
  "aws-cdk-lib>=2.193.0, <3.0.0",
38
- "aws-solutions-constructs.core==2.85.1",
38
+ "aws-solutions-constructs.core==2.85.3",
39
39
  "constructs>=10.0.0, <11.0.0",
40
40
  "jsii>=1.111.0, <2.0.0",
41
41
  "publication>=0.0.3",
@@ -1,153 +1,5 @@
1
1
  r'''
2
- # aws-apigatewayv2websocket-sqs module
3
-
4
- <!--BEGIN STABILITY BANNER-->---
5
-
6
-
7
- ![Stability: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)
8
-
9
- ---
10
- <!--END STABILITY BANNER-->
11
-
12
- | **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
13
- |:-------------|:-------------|
14
-
15
- <div style="height:8px"></div>
16
-
17
- | **Language** | **Package** |
18
- |:-------------|-----------------|
19
- |![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_apigatewayv2websocket_sqs`|
20
- |![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-apigatewayv2websocket-sqs`|
21
- |![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.apigatewayv2websocketsqs`|
22
-
23
- ## Overview
24
-
25
- This AWS Solutions Construct implements an Amazon API Gateway WebSocket connected to an Amazon SQS queue pattern.
26
-
27
- Here is a minimal deployable pattern definition:
28
-
29
- Typescript
30
-
31
- ```python
32
- import { Construct } from "constructs";
33
- import { Stack, StackProps } from "aws-cdk-lib";
34
- import {
35
- ApiGatewayV2WebSocketToSqs,
36
- ApiGatewayV2WebSocketToSqsProps,
37
- } from "@aws-solutions-constructs/aws-apigatewayv2websocket-sqs";
38
- import { WebSocketLambdaAuthorizer } from 'aws-cdk-lib/aws-apigatewayv2-authorizers';
39
-
40
- const authorizer = new WebSocketLambdaAuthorizer('Authorizer', authHandler);
41
-
42
- new ApiGateApiGatewayV2WebSocketToSqswayToSqs(this, "ApiGatewayV2WebSocketToSqsPattern", {
43
- webSocketApiProps: {
44
- connectRouteOptions: {
45
- integration: new WebSocketLambdaIntegration("ConnectIntegration", connectLambda),
46
- authorizer: authorizer,
47
- },
48
- disconnectRouteOptions: {
49
- integration: new WebSocketLambdaIntegration("DisconnectIntegration", disconnectLambda),
50
- },
51
- },
52
- createDefaultRoute: true
53
- });
54
- ```
55
-
56
- Python
57
-
58
- ```python
59
- from aws_solutions_constructs.aws_apigateway_sqs import ApiGatewayV2WebSocketToSqs
60
- from aws_cdk.aws_apigatewayv2_authorizers import WebSocketLambdaAuthorizer
61
- from aws_cdk import Stack
62
- from constructs import Construct
63
-
64
- authorizer = WebSocketLambdaAuthorizer("Authorizer", auth_handler)
65
-
66
- ApiGatewayV2WebSocketToSqs(self, 'ApiGatewayV2WebSocketToSqsPattern',
67
- connect_route_options=apigwv2.WebSocketRouteOptions(
68
- integration=WebSocketLambdaIntegration("ConnectIntegration", connect_lambda),
69
- authorizer=authorizer
70
- ),
71
- disconnect_route_options=apigwv2.WebSocketRouteOptions(
72
- integration=WebSocketLambdaIntegration("DisConnectIntegration", disconnect_lambda),
73
- ),
74
- create_default_route=True
75
- )
76
- ```
77
-
78
- Java
79
-
80
- ```java
81
- import software.constructs.Construct;
82
-
83
- import software.amazon.awscdk.Stack;
84
- import software.amazon.awscdk.StackProps;
85
- import software.amazon.awscdk.aws_apigatewayv2_authorizers.*;
86
- import software.amazon.awscdk.aws_apigatewayv2_integrations.*;
87
- import software.amazon.awsconstructs.services.apigatewaysqs.*;
88
-
89
- new ApiGatewayV2WebSocketToSqs(this, "ApiGatewayV2WebSocketToSqsPattern", new ApiGatewayV2WebSocketToSqsProps.Builder()
90
- .webSocketApiProps(new WebSocketApiProps.Builder()
91
- .connectRouteOptions(new WebSocketRouteOptions.builder()
92
- .integration(new WebSocketLambdaIntegration("ConnectIntegration", connect_lambda)))
93
- .disconnectRouteOptions(new WebSocketRouteOptions.builder()
94
- .integration(new WebSocketLambdaIntegration("DisConnectIntegration", disconnect_lambda)))
95
- .createDefaultRoute(true)
96
- .build());
97
- ```
98
-
99
- ## Pattern Construct Props
100
-
101
- | **Name** | **Type** | **Description** |
102
- |:-------------|:----------------|-----------------|
103
- |existingWebSocketApi?|[`apigwv2.WebSocketApi`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketApi.html)|Optional API Gateway WebSocket instance. Providing both existingWebSocketApi and webSocketApiProps will cause an error.|
104
- |webSocketApiProps?|[`apigwv2.WebSocketApiProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketApiProps.html)|Optional user-provided props to override the default props for the API Gateway. Providing both existingWebSocketApi and webSocketApiProps will cause an error.|
105
- |queueProps?|[`sqs.QueueProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.QueueProps.html)|Optional user-provided props to override the default props for the queue. Providing both existingQueueObj and queueProps will cause an error.|
106
- |existingQueueObj?|[`sqs.Queue`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.Queue.html)|Optional existing instance of SQS Queue. Providing both existingQueueObj and queueProps will cause an error.|
107
- |deployDeadLetterQueue?|`boolean`|Whether to deploy a secondary queue to be used as a dead letter queue. Defaults to `true`.|
108
- |deadLetterQueueProps?|[`sqs.QueueProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.QueueProps.html)|Optional properties to use for creating dead letter queue. Note that if you are creating a FIFO Queue, the dead letter queue should also be FIFO.|
109
- |maxReceiveCount|`number`|The number of times a message can be unsuccessfully dequeued before being moved to the dead-letter queue.|
110
- |createDefaultRoute?|`boolean`|Whether to create a default route. At least one of createDefaultRoute or customRouteName must be provided. If set to true, then it will use the value supplied with `defaultRouteRequestTemplate`.|
111
- |defaultRouteRequestTemplate?|`{ [contentType: string]: string }`|Optional user provided API Gateway Request Template for the default route and/ or customRoute (if customRouteName is provided). This property will only be used if createDefaultRoute is `true`. If createDefaultRoute is `true` and this property is not provided, the construct will create the default route with the following VTL mapping `"Action=SendMessage&MessageGroupId=$input.path('$.MessageGroupId')&MessageDeduplicationId=$context.requestId&MessageAttribute.1.Name=connectionId&MessageAttribute.1.Value.StringValue=$context.connectionId&MessageAttribute.1.Value.DataType=String&MessageAttribute.2.Name=requestId&MessageAttribute.2.Value.StringValue=$context.requestId&MessageAttribute.2.Value.DataType=String&MessageBody=$util.urlEncode($input.json($util.escapeJavaScript('$').replaceAll(\"\\\\'\",\"'\")))"`.|
112
- |defaultIamAuthorization?|`boolean`|Add IAM authorization to the $connect path by default. Only set this to false if: 1) If plan to provide an authorizer with the `$connect` route; or 2) The API should be open (no authorization) (AWS recommends against deploying unprotected APIs). If an authorizer is specified in connectRouteOptions, this parameter is ignored and no default IAM authorizer will be created. |
113
- |customRouteName?|`string`|The name of the route that will be sent through WebSocketApiProps.routeSelectionExpression when invoking the WebSocket endpoint. At least one of createDefaultRoute or customRouteName must be provided. |
114
-
115
- ## Pattern Properties
116
-
117
- | **Name** | **Type** | **Description** |
118
- |:-------------|:----------------|-----------------|
119
- |webSocketApi|[`apigwv2.WebSocketApi`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketApi.html)|Returns an instance of the API Gateway WebSocket API created by the pattern.|
120
- |apiGatewayRole|[`iam.Role`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html)|Returns an instance of the iam.Role created by the construct for API Gateway.|
121
- |webSocketStage|[`apigwv2.WebSocketStage`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketStage.html)|Returns an instance of the WebSocketStage created by the construct.|
122
- |apiGatewayLogGroup|[`logs.LogGroup`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs.LogGroup.html)|Returns an instance of the LogGroup created by the construct for API Gateway access logging to CloudWatch.|
123
- |sqsQueue|[`sqs.Queue`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.Queue.html)|Returns an instance of the SQS queue created by the pattern.|
124
- |deadLetterQueue?|[`sqs.DeadLetterQueue`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.DeadLetterQueue.html)|Returns an instance of the DeadLetterQueue created by the pattern.|
125
-
126
- ## Default settings
127
-
128
- Out of the box implementation of the Construct without any override will set the following defaults:
129
-
130
- ### Amazon API Gateway
131
-
132
- * Deploy a WebSocket endpoint
133
- * Enable CloudWatch logging for API Gateway
134
- * Configure least privilege access IAM role for API Gateway
135
- * Enable X-Ray Tracing
136
-
137
- ### Amazon SQS Queue
138
-
139
- * Deploy SQS dead-letter queue for the source SQS Queue
140
- * Enable server-side encryption for source SQS Queue using AWS Managed KMS Key
141
- * Enforce encryption of data in transit
142
-
143
- ## Architecture
144
-
145
- ![Architecture Diagram](architecture.png)
146
-
147
- ---
148
-
149
-
150
- © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ Documentation for this pattern can be found [here](https://github.com/awslabs/aws-solutions-constructs/blob/main/source/patterns/%40aws-solutions-constructs/aws-apigatewayv2websocket-sqs/README.adoc)
151
3
  '''
152
4
  from pkgutil import extend_path
153
5
  __path__ = extend_path(__path__, __name__)
@@ -34,9 +34,9 @@ import constructs._jsii
34
34
 
35
35
  __jsii_assembly__ = jsii.JSIIAssembly.load(
36
36
  "@aws-solutions-constructs/aws-apigatewayv2websocket-sqs",
37
- "2.85.1",
37
+ "2.85.3",
38
38
  __name__[0:-6],
39
- "aws-apigatewayv2websocket-sqs@2.85.1.jsii.tgz",
39
+ "aws-apigatewayv2websocket-sqs@2.85.3.jsii.tgz",
40
40
  )
41
41
 
42
42
  __all__ = [
@@ -0,0 +1,28 @@
1
+ Metadata-Version: 2.1
2
+ Name: aws-solutions-constructs.aws-apigatewayv2websocket-sqs
3
+ Version: 2.85.3
4
+ Summary: CDK constructs for defining an interaction between an AWS Lambda function and an Amazon S3 bucket.
5
+ Home-page: https://github.com/awslabs/aws-solutions-constructs.git
6
+ Author: Amazon Web Services
7
+ License: Apache-2.0
8
+ Project-URL: Source, https://github.com/awslabs/aws-solutions-constructs.git
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: JavaScript
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Typing :: Typed
17
+ Classifier: License :: OSI Approved
18
+ Requires-Python: ~=3.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: aws-cdk-lib<3.0.0,>=2.193.0
22
+ Requires-Dist: aws-solutions-constructs.core==2.85.3
23
+ Requires-Dist: constructs<11.0.0,>=10.0.0
24
+ Requires-Dist: jsii<2.0.0,>=1.111.0
25
+ Requires-Dist: publication>=0.0.3
26
+ Requires-Dist: typeguard<4.3.0,>=2.13.3
27
+
28
+ Documentation for this pattern can be found [here](https://github.com/awslabs/aws-solutions-constructs/blob/main/source/patterns/%40aws-solutions-constructs/aws-apigatewayv2websocket-sqs/README.adoc)
@@ -11,4 +11,4 @@ src/aws_solutions_constructs.aws_apigatewayv2websocket_sqs.egg-info/top_level.tx
11
11
  src/aws_solutions_constructs/aws_apigatewayv2websocket_sqs/__init__.py
12
12
  src/aws_solutions_constructs/aws_apigatewayv2websocket_sqs/py.typed
13
13
  src/aws_solutions_constructs/aws_apigatewayv2websocket_sqs/_jsii/__init__.py
14
- src/aws_solutions_constructs/aws_apigatewayv2websocket_sqs/_jsii/aws-apigatewayv2websocket-sqs@2.85.1.jsii.tgz
14
+ src/aws_solutions_constructs/aws_apigatewayv2websocket_sqs/_jsii/aws-apigatewayv2websocket-sqs@2.85.3.jsii.tgz
@@ -1,5 +1,5 @@
1
1
  aws-cdk-lib<3.0.0,>=2.193.0
2
- aws-solutions-constructs.core==2.85.1
2
+ aws-solutions-constructs.core==2.85.3
3
3
  constructs<11.0.0,>=10.0.0
4
4
  jsii<2.0.0,>=1.111.0
5
5
  publication>=0.0.3
@@ -1,176 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: aws-solutions-constructs.aws-apigatewayv2websocket-sqs
3
- Version: 2.85.1
4
- Summary: CDK constructs for defining an interaction between an AWS Lambda function and an Amazon S3 bucket.
5
- Home-page: https://github.com/awslabs/aws-solutions-constructs.git
6
- Author: Amazon Web Services
7
- License: Apache-2.0
8
- Project-URL: Source, https://github.com/awslabs/aws-solutions-constructs.git
9
- Classifier: Intended Audience :: Developers
10
- Classifier: Operating System :: OS Independent
11
- Classifier: Programming Language :: JavaScript
12
- Classifier: Programming Language :: Python :: 3 :: Only
13
- Classifier: Programming Language :: Python :: 3.9
14
- Classifier: Programming Language :: Python :: 3.10
15
- Classifier: Programming Language :: Python :: 3.11
16
- Classifier: Typing :: Typed
17
- Classifier: License :: OSI Approved
18
- Requires-Python: ~=3.9
19
- Description-Content-Type: text/markdown
20
- License-File: LICENSE
21
- Requires-Dist: aws-cdk-lib<3.0.0,>=2.193.0
22
- Requires-Dist: aws-solutions-constructs.core==2.85.1
23
- Requires-Dist: constructs<11.0.0,>=10.0.0
24
- Requires-Dist: jsii<2.0.0,>=1.111.0
25
- Requires-Dist: publication>=0.0.3
26
- Requires-Dist: typeguard<4.3.0,>=2.13.3
27
-
28
- # aws-apigatewayv2websocket-sqs module
29
-
30
- <!--BEGIN STABILITY BANNER-->---
31
-
32
-
33
- ![Stability: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)
34
-
35
- ---
36
- <!--END STABILITY BANNER-->
37
-
38
- | **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
39
- |:-------------|:-------------|
40
-
41
- <div style="height:8px"></div>
42
-
43
- | **Language** | **Package** |
44
- |:-------------|-----------------|
45
- |![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_apigatewayv2websocket_sqs`|
46
- |![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-apigatewayv2websocket-sqs`|
47
- |![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.apigatewayv2websocketsqs`|
48
-
49
- ## Overview
50
-
51
- This AWS Solutions Construct implements an Amazon API Gateway WebSocket connected to an Amazon SQS queue pattern.
52
-
53
- Here is a minimal deployable pattern definition:
54
-
55
- Typescript
56
-
57
- ```python
58
- import { Construct } from "constructs";
59
- import { Stack, StackProps } from "aws-cdk-lib";
60
- import {
61
- ApiGatewayV2WebSocketToSqs,
62
- ApiGatewayV2WebSocketToSqsProps,
63
- } from "@aws-solutions-constructs/aws-apigatewayv2websocket-sqs";
64
- import { WebSocketLambdaAuthorizer } from 'aws-cdk-lib/aws-apigatewayv2-authorizers';
65
-
66
- const authorizer = new WebSocketLambdaAuthorizer('Authorizer', authHandler);
67
-
68
- new ApiGateApiGatewayV2WebSocketToSqswayToSqs(this, "ApiGatewayV2WebSocketToSqsPattern", {
69
- webSocketApiProps: {
70
- connectRouteOptions: {
71
- integration: new WebSocketLambdaIntegration("ConnectIntegration", connectLambda),
72
- authorizer: authorizer,
73
- },
74
- disconnectRouteOptions: {
75
- integration: new WebSocketLambdaIntegration("DisconnectIntegration", disconnectLambda),
76
- },
77
- },
78
- createDefaultRoute: true
79
- });
80
- ```
81
-
82
- Python
83
-
84
- ```python
85
- from aws_solutions_constructs.aws_apigateway_sqs import ApiGatewayV2WebSocketToSqs
86
- from aws_cdk.aws_apigatewayv2_authorizers import WebSocketLambdaAuthorizer
87
- from aws_cdk import Stack
88
- from constructs import Construct
89
-
90
- authorizer = WebSocketLambdaAuthorizer("Authorizer", auth_handler)
91
-
92
- ApiGatewayV2WebSocketToSqs(self, 'ApiGatewayV2WebSocketToSqsPattern',
93
- connect_route_options=apigwv2.WebSocketRouteOptions(
94
- integration=WebSocketLambdaIntegration("ConnectIntegration", connect_lambda),
95
- authorizer=authorizer
96
- ),
97
- disconnect_route_options=apigwv2.WebSocketRouteOptions(
98
- integration=WebSocketLambdaIntegration("DisConnectIntegration", disconnect_lambda),
99
- ),
100
- create_default_route=True
101
- )
102
- ```
103
-
104
- Java
105
-
106
- ```java
107
- import software.constructs.Construct;
108
-
109
- import software.amazon.awscdk.Stack;
110
- import software.amazon.awscdk.StackProps;
111
- import software.amazon.awscdk.aws_apigatewayv2_authorizers.*;
112
- import software.amazon.awscdk.aws_apigatewayv2_integrations.*;
113
- import software.amazon.awsconstructs.services.apigatewaysqs.*;
114
-
115
- new ApiGatewayV2WebSocketToSqs(this, "ApiGatewayV2WebSocketToSqsPattern", new ApiGatewayV2WebSocketToSqsProps.Builder()
116
- .webSocketApiProps(new WebSocketApiProps.Builder()
117
- .connectRouteOptions(new WebSocketRouteOptions.builder()
118
- .integration(new WebSocketLambdaIntegration("ConnectIntegration", connect_lambda)))
119
- .disconnectRouteOptions(new WebSocketRouteOptions.builder()
120
- .integration(new WebSocketLambdaIntegration("DisConnectIntegration", disconnect_lambda)))
121
- .createDefaultRoute(true)
122
- .build());
123
- ```
124
-
125
- ## Pattern Construct Props
126
-
127
- | **Name** | **Type** | **Description** |
128
- |:-------------|:----------------|-----------------|
129
- |existingWebSocketApi?|[`apigwv2.WebSocketApi`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketApi.html)|Optional API Gateway WebSocket instance. Providing both existingWebSocketApi and webSocketApiProps will cause an error.|
130
- |webSocketApiProps?|[`apigwv2.WebSocketApiProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketApiProps.html)|Optional user-provided props to override the default props for the API Gateway. Providing both existingWebSocketApi and webSocketApiProps will cause an error.|
131
- |queueProps?|[`sqs.QueueProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.QueueProps.html)|Optional user-provided props to override the default props for the queue. Providing both existingQueueObj and queueProps will cause an error.|
132
- |existingQueueObj?|[`sqs.Queue`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.Queue.html)|Optional existing instance of SQS Queue. Providing both existingQueueObj and queueProps will cause an error.|
133
- |deployDeadLetterQueue?|`boolean`|Whether to deploy a secondary queue to be used as a dead letter queue. Defaults to `true`.|
134
- |deadLetterQueueProps?|[`sqs.QueueProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.QueueProps.html)|Optional properties to use for creating dead letter queue. Note that if you are creating a FIFO Queue, the dead letter queue should also be FIFO.|
135
- |maxReceiveCount|`number`|The number of times a message can be unsuccessfully dequeued before being moved to the dead-letter queue.|
136
- |createDefaultRoute?|`boolean`|Whether to create a default route. At least one of createDefaultRoute or customRouteName must be provided. If set to true, then it will use the value supplied with `defaultRouteRequestTemplate`.|
137
- |defaultRouteRequestTemplate?|`{ [contentType: string]: string }`|Optional user provided API Gateway Request Template for the default route and/ or customRoute (if customRouteName is provided). This property will only be used if createDefaultRoute is `true`. If createDefaultRoute is `true` and this property is not provided, the construct will create the default route with the following VTL mapping `"Action=SendMessage&MessageGroupId=$input.path('$.MessageGroupId')&MessageDeduplicationId=$context.requestId&MessageAttribute.1.Name=connectionId&MessageAttribute.1.Value.StringValue=$context.connectionId&MessageAttribute.1.Value.DataType=String&MessageAttribute.2.Name=requestId&MessageAttribute.2.Value.StringValue=$context.requestId&MessageAttribute.2.Value.DataType=String&MessageBody=$util.urlEncode($input.json($util.escapeJavaScript('$').replaceAll(\"\\\\'\",\"'\")))"`.|
138
- |defaultIamAuthorization?|`boolean`|Add IAM authorization to the $connect path by default. Only set this to false if: 1) If plan to provide an authorizer with the `$connect` route; or 2) The API should be open (no authorization) (AWS recommends against deploying unprotected APIs). If an authorizer is specified in connectRouteOptions, this parameter is ignored and no default IAM authorizer will be created. |
139
- |customRouteName?|`string`|The name of the route that will be sent through WebSocketApiProps.routeSelectionExpression when invoking the WebSocket endpoint. At least one of createDefaultRoute or customRouteName must be provided. |
140
-
141
- ## Pattern Properties
142
-
143
- | **Name** | **Type** | **Description** |
144
- |:-------------|:----------------|-----------------|
145
- |webSocketApi|[`apigwv2.WebSocketApi`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketApi.html)|Returns an instance of the API Gateway WebSocket API created by the pattern.|
146
- |apiGatewayRole|[`iam.Role`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html)|Returns an instance of the iam.Role created by the construct for API Gateway.|
147
- |webSocketStage|[`apigwv2.WebSocketStage`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketStage.html)|Returns an instance of the WebSocketStage created by the construct.|
148
- |apiGatewayLogGroup|[`logs.LogGroup`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs.LogGroup.html)|Returns an instance of the LogGroup created by the construct for API Gateway access logging to CloudWatch.|
149
- |sqsQueue|[`sqs.Queue`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.Queue.html)|Returns an instance of the SQS queue created by the pattern.|
150
- |deadLetterQueue?|[`sqs.DeadLetterQueue`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.DeadLetterQueue.html)|Returns an instance of the DeadLetterQueue created by the pattern.|
151
-
152
- ## Default settings
153
-
154
- Out of the box implementation of the Construct without any override will set the following defaults:
155
-
156
- ### Amazon API Gateway
157
-
158
- * Deploy a WebSocket endpoint
159
- * Enable CloudWatch logging for API Gateway
160
- * Configure least privilege access IAM role for API Gateway
161
- * Enable X-Ray Tracing
162
-
163
- ### Amazon SQS Queue
164
-
165
- * Deploy SQS dead-letter queue for the source SQS Queue
166
- * Enable server-side encryption for source SQS Queue using AWS Managed KMS Key
167
- * Enforce encryption of data in transit
168
-
169
- ## Architecture
170
-
171
- ![Architecture Diagram](architecture.png)
172
-
173
- ---
174
-
175
-
176
- © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -1,149 +0,0 @@
1
- # aws-apigatewayv2websocket-sqs module
2
-
3
- <!--BEGIN STABILITY BANNER-->---
4
-
5
-
6
- ![Stability: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)
7
-
8
- ---
9
- <!--END STABILITY BANNER-->
10
-
11
- | **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
12
- |:-------------|:-------------|
13
-
14
- <div style="height:8px"></div>
15
-
16
- | **Language** | **Package** |
17
- |:-------------|-----------------|
18
- |![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_apigatewayv2websocket_sqs`|
19
- |![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-apigatewayv2websocket-sqs`|
20
- |![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.apigatewayv2websocketsqs`|
21
-
22
- ## Overview
23
-
24
- This AWS Solutions Construct implements an Amazon API Gateway WebSocket connected to an Amazon SQS queue pattern.
25
-
26
- Here is a minimal deployable pattern definition:
27
-
28
- Typescript
29
-
30
- ```python
31
- import { Construct } from "constructs";
32
- import { Stack, StackProps } from "aws-cdk-lib";
33
- import {
34
- ApiGatewayV2WebSocketToSqs,
35
- ApiGatewayV2WebSocketToSqsProps,
36
- } from "@aws-solutions-constructs/aws-apigatewayv2websocket-sqs";
37
- import { WebSocketLambdaAuthorizer } from 'aws-cdk-lib/aws-apigatewayv2-authorizers';
38
-
39
- const authorizer = new WebSocketLambdaAuthorizer('Authorizer', authHandler);
40
-
41
- new ApiGateApiGatewayV2WebSocketToSqswayToSqs(this, "ApiGatewayV2WebSocketToSqsPattern", {
42
- webSocketApiProps: {
43
- connectRouteOptions: {
44
- integration: new WebSocketLambdaIntegration("ConnectIntegration", connectLambda),
45
- authorizer: authorizer,
46
- },
47
- disconnectRouteOptions: {
48
- integration: new WebSocketLambdaIntegration("DisconnectIntegration", disconnectLambda),
49
- },
50
- },
51
- createDefaultRoute: true
52
- });
53
- ```
54
-
55
- Python
56
-
57
- ```python
58
- from aws_solutions_constructs.aws_apigateway_sqs import ApiGatewayV2WebSocketToSqs
59
- from aws_cdk.aws_apigatewayv2_authorizers import WebSocketLambdaAuthorizer
60
- from aws_cdk import Stack
61
- from constructs import Construct
62
-
63
- authorizer = WebSocketLambdaAuthorizer("Authorizer", auth_handler)
64
-
65
- ApiGatewayV2WebSocketToSqs(self, 'ApiGatewayV2WebSocketToSqsPattern',
66
- connect_route_options=apigwv2.WebSocketRouteOptions(
67
- integration=WebSocketLambdaIntegration("ConnectIntegration", connect_lambda),
68
- authorizer=authorizer
69
- ),
70
- disconnect_route_options=apigwv2.WebSocketRouteOptions(
71
- integration=WebSocketLambdaIntegration("DisConnectIntegration", disconnect_lambda),
72
- ),
73
- create_default_route=True
74
- )
75
- ```
76
-
77
- Java
78
-
79
- ```java
80
- import software.constructs.Construct;
81
-
82
- import software.amazon.awscdk.Stack;
83
- import software.amazon.awscdk.StackProps;
84
- import software.amazon.awscdk.aws_apigatewayv2_authorizers.*;
85
- import software.amazon.awscdk.aws_apigatewayv2_integrations.*;
86
- import software.amazon.awsconstructs.services.apigatewaysqs.*;
87
-
88
- new ApiGatewayV2WebSocketToSqs(this, "ApiGatewayV2WebSocketToSqsPattern", new ApiGatewayV2WebSocketToSqsProps.Builder()
89
- .webSocketApiProps(new WebSocketApiProps.Builder()
90
- .connectRouteOptions(new WebSocketRouteOptions.builder()
91
- .integration(new WebSocketLambdaIntegration("ConnectIntegration", connect_lambda)))
92
- .disconnectRouteOptions(new WebSocketRouteOptions.builder()
93
- .integration(new WebSocketLambdaIntegration("DisConnectIntegration", disconnect_lambda)))
94
- .createDefaultRoute(true)
95
- .build());
96
- ```
97
-
98
- ## Pattern Construct Props
99
-
100
- | **Name** | **Type** | **Description** |
101
- |:-------------|:----------------|-----------------|
102
- |existingWebSocketApi?|[`apigwv2.WebSocketApi`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketApi.html)|Optional API Gateway WebSocket instance. Providing both existingWebSocketApi and webSocketApiProps will cause an error.|
103
- |webSocketApiProps?|[`apigwv2.WebSocketApiProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketApiProps.html)|Optional user-provided props to override the default props for the API Gateway. Providing both existingWebSocketApi and webSocketApiProps will cause an error.|
104
- |queueProps?|[`sqs.QueueProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.QueueProps.html)|Optional user-provided props to override the default props for the queue. Providing both existingQueueObj and queueProps will cause an error.|
105
- |existingQueueObj?|[`sqs.Queue`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.Queue.html)|Optional existing instance of SQS Queue. Providing both existingQueueObj and queueProps will cause an error.|
106
- |deployDeadLetterQueue?|`boolean`|Whether to deploy a secondary queue to be used as a dead letter queue. Defaults to `true`.|
107
- |deadLetterQueueProps?|[`sqs.QueueProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.QueueProps.html)|Optional properties to use for creating dead letter queue. Note that if you are creating a FIFO Queue, the dead letter queue should also be FIFO.|
108
- |maxReceiveCount|`number`|The number of times a message can be unsuccessfully dequeued before being moved to the dead-letter queue.|
109
- |createDefaultRoute?|`boolean`|Whether to create a default route. At least one of createDefaultRoute or customRouteName must be provided. If set to true, then it will use the value supplied with `defaultRouteRequestTemplate`.|
110
- |defaultRouteRequestTemplate?|`{ [contentType: string]: string }`|Optional user provided API Gateway Request Template for the default route and/ or customRoute (if customRouteName is provided). This property will only be used if createDefaultRoute is `true`. If createDefaultRoute is `true` and this property is not provided, the construct will create the default route with the following VTL mapping `"Action=SendMessage&MessageGroupId=$input.path('$.MessageGroupId')&MessageDeduplicationId=$context.requestId&MessageAttribute.1.Name=connectionId&MessageAttribute.1.Value.StringValue=$context.connectionId&MessageAttribute.1.Value.DataType=String&MessageAttribute.2.Name=requestId&MessageAttribute.2.Value.StringValue=$context.requestId&MessageAttribute.2.Value.DataType=String&MessageBody=$util.urlEncode($input.json($util.escapeJavaScript('$').replaceAll(\"\\\\'\",\"'\")))"`.|
111
- |defaultIamAuthorization?|`boolean`|Add IAM authorization to the $connect path by default. Only set this to false if: 1) If plan to provide an authorizer with the `$connect` route; or 2) The API should be open (no authorization) (AWS recommends against deploying unprotected APIs). If an authorizer is specified in connectRouteOptions, this parameter is ignored and no default IAM authorizer will be created. |
112
- |customRouteName?|`string`|The name of the route that will be sent through WebSocketApiProps.routeSelectionExpression when invoking the WebSocket endpoint. At least one of createDefaultRoute or customRouteName must be provided. |
113
-
114
- ## Pattern Properties
115
-
116
- | **Name** | **Type** | **Description** |
117
- |:-------------|:----------------|-----------------|
118
- |webSocketApi|[`apigwv2.WebSocketApi`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketApi.html)|Returns an instance of the API Gateway WebSocket API created by the pattern.|
119
- |apiGatewayRole|[`iam.Role`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html)|Returns an instance of the iam.Role created by the construct for API Gateway.|
120
- |webSocketStage|[`apigwv2.WebSocketStage`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketStage.html)|Returns an instance of the WebSocketStage created by the construct.|
121
- |apiGatewayLogGroup|[`logs.LogGroup`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs.LogGroup.html)|Returns an instance of the LogGroup created by the construct for API Gateway access logging to CloudWatch.|
122
- |sqsQueue|[`sqs.Queue`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.Queue.html)|Returns an instance of the SQS queue created by the pattern.|
123
- |deadLetterQueue?|[`sqs.DeadLetterQueue`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.DeadLetterQueue.html)|Returns an instance of the DeadLetterQueue created by the pattern.|
124
-
125
- ## Default settings
126
-
127
- Out of the box implementation of the Construct without any override will set the following defaults:
128
-
129
- ### Amazon API Gateway
130
-
131
- * Deploy a WebSocket endpoint
132
- * Enable CloudWatch logging for API Gateway
133
- * Configure least privilege access IAM role for API Gateway
134
- * Enable X-Ray Tracing
135
-
136
- ### Amazon SQS Queue
137
-
138
- * Deploy SQS dead-letter queue for the source SQS Queue
139
- * Enable server-side encryption for source SQS Queue using AWS Managed KMS Key
140
- * Enforce encryption of data in transit
141
-
142
- ## Architecture
143
-
144
- ![Architecture Diagram](architecture.png)
145
-
146
- ---
147
-
148
-
149
- © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -1,176 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: aws-solutions-constructs.aws-apigatewayv2websocket-sqs
3
- Version: 2.85.1
4
- Summary: CDK constructs for defining an interaction between an AWS Lambda function and an Amazon S3 bucket.
5
- Home-page: https://github.com/awslabs/aws-solutions-constructs.git
6
- Author: Amazon Web Services
7
- License: Apache-2.0
8
- Project-URL: Source, https://github.com/awslabs/aws-solutions-constructs.git
9
- Classifier: Intended Audience :: Developers
10
- Classifier: Operating System :: OS Independent
11
- Classifier: Programming Language :: JavaScript
12
- Classifier: Programming Language :: Python :: 3 :: Only
13
- Classifier: Programming Language :: Python :: 3.9
14
- Classifier: Programming Language :: Python :: 3.10
15
- Classifier: Programming Language :: Python :: 3.11
16
- Classifier: Typing :: Typed
17
- Classifier: License :: OSI Approved
18
- Requires-Python: ~=3.9
19
- Description-Content-Type: text/markdown
20
- License-File: LICENSE
21
- Requires-Dist: aws-cdk-lib<3.0.0,>=2.193.0
22
- Requires-Dist: aws-solutions-constructs.core==2.85.1
23
- Requires-Dist: constructs<11.0.0,>=10.0.0
24
- Requires-Dist: jsii<2.0.0,>=1.111.0
25
- Requires-Dist: publication>=0.0.3
26
- Requires-Dist: typeguard<4.3.0,>=2.13.3
27
-
28
- # aws-apigatewayv2websocket-sqs module
29
-
30
- <!--BEGIN STABILITY BANNER-->---
31
-
32
-
33
- ![Stability: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)
34
-
35
- ---
36
- <!--END STABILITY BANNER-->
37
-
38
- | **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
39
- |:-------------|:-------------|
40
-
41
- <div style="height:8px"></div>
42
-
43
- | **Language** | **Package** |
44
- |:-------------|-----------------|
45
- |![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_apigatewayv2websocket_sqs`|
46
- |![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-apigatewayv2websocket-sqs`|
47
- |![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.apigatewayv2websocketsqs`|
48
-
49
- ## Overview
50
-
51
- This AWS Solutions Construct implements an Amazon API Gateway WebSocket connected to an Amazon SQS queue pattern.
52
-
53
- Here is a minimal deployable pattern definition:
54
-
55
- Typescript
56
-
57
- ```python
58
- import { Construct } from "constructs";
59
- import { Stack, StackProps } from "aws-cdk-lib";
60
- import {
61
- ApiGatewayV2WebSocketToSqs,
62
- ApiGatewayV2WebSocketToSqsProps,
63
- } from "@aws-solutions-constructs/aws-apigatewayv2websocket-sqs";
64
- import { WebSocketLambdaAuthorizer } from 'aws-cdk-lib/aws-apigatewayv2-authorizers';
65
-
66
- const authorizer = new WebSocketLambdaAuthorizer('Authorizer', authHandler);
67
-
68
- new ApiGateApiGatewayV2WebSocketToSqswayToSqs(this, "ApiGatewayV2WebSocketToSqsPattern", {
69
- webSocketApiProps: {
70
- connectRouteOptions: {
71
- integration: new WebSocketLambdaIntegration("ConnectIntegration", connectLambda),
72
- authorizer: authorizer,
73
- },
74
- disconnectRouteOptions: {
75
- integration: new WebSocketLambdaIntegration("DisconnectIntegration", disconnectLambda),
76
- },
77
- },
78
- createDefaultRoute: true
79
- });
80
- ```
81
-
82
- Python
83
-
84
- ```python
85
- from aws_solutions_constructs.aws_apigateway_sqs import ApiGatewayV2WebSocketToSqs
86
- from aws_cdk.aws_apigatewayv2_authorizers import WebSocketLambdaAuthorizer
87
- from aws_cdk import Stack
88
- from constructs import Construct
89
-
90
- authorizer = WebSocketLambdaAuthorizer("Authorizer", auth_handler)
91
-
92
- ApiGatewayV2WebSocketToSqs(self, 'ApiGatewayV2WebSocketToSqsPattern',
93
- connect_route_options=apigwv2.WebSocketRouteOptions(
94
- integration=WebSocketLambdaIntegration("ConnectIntegration", connect_lambda),
95
- authorizer=authorizer
96
- ),
97
- disconnect_route_options=apigwv2.WebSocketRouteOptions(
98
- integration=WebSocketLambdaIntegration("DisConnectIntegration", disconnect_lambda),
99
- ),
100
- create_default_route=True
101
- )
102
- ```
103
-
104
- Java
105
-
106
- ```java
107
- import software.constructs.Construct;
108
-
109
- import software.amazon.awscdk.Stack;
110
- import software.amazon.awscdk.StackProps;
111
- import software.amazon.awscdk.aws_apigatewayv2_authorizers.*;
112
- import software.amazon.awscdk.aws_apigatewayv2_integrations.*;
113
- import software.amazon.awsconstructs.services.apigatewaysqs.*;
114
-
115
- new ApiGatewayV2WebSocketToSqs(this, "ApiGatewayV2WebSocketToSqsPattern", new ApiGatewayV2WebSocketToSqsProps.Builder()
116
- .webSocketApiProps(new WebSocketApiProps.Builder()
117
- .connectRouteOptions(new WebSocketRouteOptions.builder()
118
- .integration(new WebSocketLambdaIntegration("ConnectIntegration", connect_lambda)))
119
- .disconnectRouteOptions(new WebSocketRouteOptions.builder()
120
- .integration(new WebSocketLambdaIntegration("DisConnectIntegration", disconnect_lambda)))
121
- .createDefaultRoute(true)
122
- .build());
123
- ```
124
-
125
- ## Pattern Construct Props
126
-
127
- | **Name** | **Type** | **Description** |
128
- |:-------------|:----------------|-----------------|
129
- |existingWebSocketApi?|[`apigwv2.WebSocketApi`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketApi.html)|Optional API Gateway WebSocket instance. Providing both existingWebSocketApi and webSocketApiProps will cause an error.|
130
- |webSocketApiProps?|[`apigwv2.WebSocketApiProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketApiProps.html)|Optional user-provided props to override the default props for the API Gateway. Providing both existingWebSocketApi and webSocketApiProps will cause an error.|
131
- |queueProps?|[`sqs.QueueProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.QueueProps.html)|Optional user-provided props to override the default props for the queue. Providing both existingQueueObj and queueProps will cause an error.|
132
- |existingQueueObj?|[`sqs.Queue`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.Queue.html)|Optional existing instance of SQS Queue. Providing both existingQueueObj and queueProps will cause an error.|
133
- |deployDeadLetterQueue?|`boolean`|Whether to deploy a secondary queue to be used as a dead letter queue. Defaults to `true`.|
134
- |deadLetterQueueProps?|[`sqs.QueueProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.QueueProps.html)|Optional properties to use for creating dead letter queue. Note that if you are creating a FIFO Queue, the dead letter queue should also be FIFO.|
135
- |maxReceiveCount|`number`|The number of times a message can be unsuccessfully dequeued before being moved to the dead-letter queue.|
136
- |createDefaultRoute?|`boolean`|Whether to create a default route. At least one of createDefaultRoute or customRouteName must be provided. If set to true, then it will use the value supplied with `defaultRouteRequestTemplate`.|
137
- |defaultRouteRequestTemplate?|`{ [contentType: string]: string }`|Optional user provided API Gateway Request Template for the default route and/ or customRoute (if customRouteName is provided). This property will only be used if createDefaultRoute is `true`. If createDefaultRoute is `true` and this property is not provided, the construct will create the default route with the following VTL mapping `"Action=SendMessage&MessageGroupId=$input.path('$.MessageGroupId')&MessageDeduplicationId=$context.requestId&MessageAttribute.1.Name=connectionId&MessageAttribute.1.Value.StringValue=$context.connectionId&MessageAttribute.1.Value.DataType=String&MessageAttribute.2.Name=requestId&MessageAttribute.2.Value.StringValue=$context.requestId&MessageAttribute.2.Value.DataType=String&MessageBody=$util.urlEncode($input.json($util.escapeJavaScript('$').replaceAll(\"\\\\'\",\"'\")))"`.|
138
- |defaultIamAuthorization?|`boolean`|Add IAM authorization to the $connect path by default. Only set this to false if: 1) If plan to provide an authorizer with the `$connect` route; or 2) The API should be open (no authorization) (AWS recommends against deploying unprotected APIs). If an authorizer is specified in connectRouteOptions, this parameter is ignored and no default IAM authorizer will be created. |
139
- |customRouteName?|`string`|The name of the route that will be sent through WebSocketApiProps.routeSelectionExpression when invoking the WebSocket endpoint. At least one of createDefaultRoute or customRouteName must be provided. |
140
-
141
- ## Pattern Properties
142
-
143
- | **Name** | **Type** | **Description** |
144
- |:-------------|:----------------|-----------------|
145
- |webSocketApi|[`apigwv2.WebSocketApi`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketApi.html)|Returns an instance of the API Gateway WebSocket API created by the pattern.|
146
- |apiGatewayRole|[`iam.Role`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html)|Returns an instance of the iam.Role created by the construct for API Gateway.|
147
- |webSocketStage|[`apigwv2.WebSocketStage`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketStage.html)|Returns an instance of the WebSocketStage created by the construct.|
148
- |apiGatewayLogGroup|[`logs.LogGroup`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs.LogGroup.html)|Returns an instance of the LogGroup created by the construct for API Gateway access logging to CloudWatch.|
149
- |sqsQueue|[`sqs.Queue`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.Queue.html)|Returns an instance of the SQS queue created by the pattern.|
150
- |deadLetterQueue?|[`sqs.DeadLetterQueue`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.DeadLetterQueue.html)|Returns an instance of the DeadLetterQueue created by the pattern.|
151
-
152
- ## Default settings
153
-
154
- Out of the box implementation of the Construct without any override will set the following defaults:
155
-
156
- ### Amazon API Gateway
157
-
158
- * Deploy a WebSocket endpoint
159
- * Enable CloudWatch logging for API Gateway
160
- * Configure least privilege access IAM role for API Gateway
161
- * Enable X-Ray Tracing
162
-
163
- ### Amazon SQS Queue
164
-
165
- * Deploy SQS dead-letter queue for the source SQS Queue
166
- * Enable server-side encryption for source SQS Queue using AWS Managed KMS Key
167
- * Enforce encryption of data in transit
168
-
169
- ## Architecture
170
-
171
- ![Architecture Diagram](architecture.png)
172
-
173
- ---
174
-
175
-
176
- © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.