Skip to content

Commit bc6e06c

Browse files
authored
Merge branch 'master' into issue-8315
2 parents 2563648 + faa0c06 commit bc6e06c

File tree

101 files changed

+4682
-631
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+4682
-631
lines changed

.gitallowed

+1
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ account: '772975370895'
2222
account: '856666278305'
2323
account: '840364872350'
2424
account: '422531588944'
25+
account: '924023996002'

.github/workflows/pr-linter.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22
# https://github.com/actions/toolkit/blob/master/packages/github/src/context.ts
33

44
name: PR Linter
5-
on: pull_request
5+
on:
6+
pull_request:
7+
types:
8+
- labeled
9+
- unlabeled
10+
- edited
11+
- opened
12+
- synchronize
13+
- reopened
614

715
jobs:
816
validate-pr:

.github/workflows/yarn-upgrade.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
uses: actions/checkout@v2
1717

1818
- name: Set up Node
19-
uses: actions/[email protected].4
19+
uses: actions/[email protected].5
2020
with:
2121
node-version: 10
2222

CHANGELOG.md

+82
Large diffs are not rendered by default.

packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/appmesh.ts

+1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ export class AppMeshExtension extends ServiceExtension {
165165

166166
'me-south-1': this.accountIdForRegion('me-south-1'),
167167
'ap-east-1': this.accountIdForRegion('ap-east-1'),
168+
'af-south-1': this.accountIdForRegion('af-south-1'),
168169
},
169170
});
170171

packages/@aws-cdk-containers/ecs-service-extensions/test/integ.all-service-addons.expected.json

+9
Original file line numberDiff line numberDiff line change
@@ -3354,6 +3354,9 @@
33543354
},
33553355
"ap-east-1": {
33563356
"ecrRepo": "856666278305"
3357+
},
3358+
"af-south-1": {
3359+
"ecrRepo": "924023996002"
33573360
}
33583361
},
33593362
"greetingenvoyimageaccountmapping": {
@@ -3413,6 +3416,9 @@
34133416
},
34143417
"ap-east-1": {
34153418
"ecrRepo": "856666278305"
3419+
},
3420+
"af-south-1": {
3421+
"ecrRepo": "924023996002"
34163422
}
34173423
},
34183424
"greeterenvoyimageaccountmapping": {
@@ -3472,6 +3478,9 @@
34723478
},
34733479
"ap-east-1": {
34743480
"ecrRepo": "856666278305"
3481+
},
3482+
"af-south-1": {
3483+
"ecrRepo": "924023996002"
34753484
}
34763485
}
34773486
},

packages/@aws-cdk-containers/ecs-service-extensions/test/integ.multiple-environments.expected.json

+6
Original file line numberDiff line numberDiff line change
@@ -2173,6 +2173,9 @@
21732173
},
21742174
"ap-east-1": {
21752175
"ecrRepo": "856666278305"
2176+
},
2177+
"af-south-1": {
2178+
"ecrRepo": "924023996002"
21762179
}
21772180
},
21782181
"namedevelopmentenvoyimageaccountmapping": {
@@ -2232,6 +2235,9 @@
22322235
},
22332236
"ap-east-1": {
22342237
"ecrRepo": "856666278305"
2238+
},
2239+
"af-south-1": {
2240+
"ecrRepo": "924023996002"
22352241
}
22362242
}
22372243
}

packages/@aws-cdk/assets/lib/fs/options.ts

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export interface CopyOptions {
1010
* A strategy for how to handle symlinks.
1111
*
1212
* @default Never
13-
* @deprecated use `followSymlinks` instead
1413
*/
1514
readonly follow?: FollowMode;
1615

packages/@aws-cdk/aws-apigatewayv2-integrations/README.md

+31
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
- [Lambda Integration](#lambda)
2222
- [HTTP Proxy Integration](#http-proxy)
2323
- [Private Integration](#private-integration)
24+
- [WebSocket APIs](#websocket-apis)
25+
- [Lambda WebSocket Integration](#lambda-websocket-integration)
2426

2527
## HTTP APIs
2628

@@ -146,3 +148,32 @@ const httpEndpoint = new HttpApi(stack, 'HttpProxyPrivateApi', {
146148
}),
147149
});
148150
```
151+
152+
## WebSocket APIs
153+
154+
WebSocket integrations connect a route to backend resources. The following integrations are supported in the CDK.
155+
156+
### Lambda WebSocket Integration
157+
158+
Lambda integrations enable integrating a WebSocket API route with a Lambda function. When a client connects/disconnects
159+
or sends message specific to a route, the API Gateway service forwards the request to the Lambda function
160+
161+
The API Gateway service will invoke the lambda function with an event payload of a specific format.
162+
163+
The following code configures a `sendmessage` route with a Lambda integration
164+
165+
```ts
166+
const webSocketApi = new WebSocketApi(stack, 'mywsapi');
167+
new WebSocketStage(stack, 'mystage', {
168+
webSocketApi,
169+
stageName: 'dev',
170+
autoDeploy: true,
171+
});
172+
173+
const messageHandler = new lambda.Function(stack, 'MessageHandler', {...});
174+
webSocketApi.addRoute('sendmessage', {
175+
integration: new LambdaWebSocketIntegration({
176+
handler: connectHandler,
177+
}),
178+
});
179+
```

packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/lambda.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class LambdaProxyIntegration implements IHttpRouteIntegration {
4141
principal: new ServicePrincipal('apigateway.amazonaws.com'),
4242
sourceArn: Stack.of(route).formatArn({
4343
service: 'execute-api',
44-
resource: route.httpApi.httpApiId,
44+
resource: route.httpApi.apiId,
4545
resourceName: `*/*${route.path ?? ''}`, // empty string in the case of the catch-all route $default
4646
}),
4747
});
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from './http';
2+
export * from './websocket';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './lambda';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import {
2+
IWebSocketRouteIntegration,
3+
WebSocketIntegrationType,
4+
WebSocketRouteIntegrationBindOptions,
5+
WebSocketRouteIntegrationConfig,
6+
} from '@aws-cdk/aws-apigatewayv2';
7+
import { ServicePrincipal } from '@aws-cdk/aws-iam';
8+
import { IFunction } from '@aws-cdk/aws-lambda';
9+
import { Names, Stack } from '@aws-cdk/core';
10+
11+
/**
12+
* Lambda WebSocket Integration props
13+
*/
14+
export interface LambdaWebSocketIntegrationProps {
15+
/**
16+
* The handler for this integration.
17+
*/
18+
readonly handler: IFunction
19+
}
20+
21+
/**
22+
* Lambda WebSocket Integration
23+
*/
24+
export class LambdaWebSocketIntegration implements IWebSocketRouteIntegration {
25+
constructor(private props: LambdaWebSocketIntegrationProps) {}
26+
27+
bind(options: WebSocketRouteIntegrationBindOptions): WebSocketRouteIntegrationConfig {
28+
const route = options.route;
29+
this.props.handler.addPermission(`${Names.nodeUniqueId(route.node)}-Permission`, {
30+
scope: options.scope,
31+
principal: new ServicePrincipal('apigateway.amazonaws.com'),
32+
sourceArn: Stack.of(route).formatArn({
33+
service: 'execute-api',
34+
resource: route.webSocketApi.apiId,
35+
resourceName: `*/*${route.routeKey}`,
36+
}),
37+
});
38+
39+
return {
40+
type: WebSocketIntegrationType.AWS_PROXY,
41+
uri: this.props.handler.functionArn,
42+
};
43+
}
44+
}

0 commit comments

Comments
 (0)