Skip to content

Commit

Permalink
Merge branch 'master' into shivlaks/sfn-tasks-compile-snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Mar 9, 2021
2 parents ebe8e99 + 57e5404 commit e58994e
Show file tree
Hide file tree
Showing 117 changed files with 6,227 additions and 642 deletions.
1 change: 1 addition & 0 deletions .gitallowed
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ account: '772975370895'
account: '856666278305'
account: '840364872350'
account: '422531588944'
account: '924023996002'
10 changes: 9 additions & 1 deletion .github/workflows/pr-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
# https://github.com/actions/toolkit/blob/master/packages/github/src/context.ts

name: PR Linter
on: pull_request
on:
pull_request:
types:
- labeled
- unlabeled
- edited
- opened
- synchronize
- reopened

jobs:
validate-pr:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/yarn-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v2

- name: Set up Node
uses: actions/setup-node@v2.1.4
uses: actions/setup-node@v2.1.5
with:
node-version: 10

Expand Down
82 changes: 82 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export class AppMeshExtension extends ServiceExtension {

'me-south-1': this.accountIdForRegion('me-south-1'),
'ap-east-1': this.accountIdForRegion('ap-east-1'),
'af-south-1': this.accountIdForRegion('af-south-1'),
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3354,6 +3354,9 @@
},
"ap-east-1": {
"ecrRepo": "856666278305"
},
"af-south-1": {
"ecrRepo": "924023996002"
}
},
"greetingenvoyimageaccountmapping": {
Expand Down Expand Up @@ -3413,6 +3416,9 @@
},
"ap-east-1": {
"ecrRepo": "856666278305"
},
"af-south-1": {
"ecrRepo": "924023996002"
}
},
"greeterenvoyimageaccountmapping": {
Expand Down Expand Up @@ -3472,6 +3478,9 @@
},
"ap-east-1": {
"ecrRepo": "856666278305"
},
"af-south-1": {
"ecrRepo": "924023996002"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2173,6 +2173,9 @@
},
"ap-east-1": {
"ecrRepo": "856666278305"
},
"af-south-1": {
"ecrRepo": "924023996002"
}
},
"namedevelopmentenvoyimageaccountmapping": {
Expand Down Expand Up @@ -2232,6 +2235,9 @@
},
"ap-east-1": {
"ecrRepo": "856666278305"
},
"af-south-1": {
"ecrRepo": "924023996002"
}
}
}
Expand Down
1 change: 0 additions & 1 deletion packages/@aws-cdk/assets/lib/fs/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export interface CopyOptions {
* A strategy for how to handle symlinks.
*
* @default Never
* @deprecated use `followSymlinks` instead
*/
readonly follow?: FollowMode;

Expand Down
31 changes: 31 additions & 0 deletions packages/@aws-cdk/aws-apigatewayv2-integrations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
- [Lambda Integration](#lambda)
- [HTTP Proxy Integration](#http-proxy)
- [Private Integration](#private-integration)
- [WebSocket APIs](#websocket-apis)
- [Lambda WebSocket Integration](#lambda-websocket-integration)

## HTTP APIs

Expand Down Expand Up @@ -146,3 +148,32 @@ const httpEndpoint = new HttpApi(stack, 'HttpProxyPrivateApi', {
}),
});
```

## WebSocket APIs

WebSocket integrations connect a route to backend resources. The following integrations are supported in the CDK.

### Lambda WebSocket Integration

Lambda integrations enable integrating a WebSocket API route with a Lambda function. When a client connects/disconnects
or sends message specific to a route, the API Gateway service forwards the request to the Lambda function

The API Gateway service will invoke the lambda function with an event payload of a specific format.

The following code configures a `sendmessage` route with a Lambda integration

```ts
const webSocketApi = new WebSocketApi(stack, 'mywsapi');
new WebSocketStage(stack, 'mystage', {
webSocketApi,
stageName: 'dev',
autoDeploy: true,
});

const messageHandler = new lambda.Function(stack, 'MessageHandler', {...});
webSocketApi.addRoute('sendmessage', {
integration: new LambdaWebSocketIntegration({
handler: connectHandler,
}),
});
```
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class LambdaProxyIntegration implements IHttpRouteIntegration {
principal: new ServicePrincipal('apigateway.amazonaws.com'),
sourceArn: Stack.of(route).formatArn({
service: 'execute-api',
resource: route.httpApi.httpApiId,
resource: route.httpApi.apiId,
resourceName: `*/*${route.path ?? ''}`, // empty string in the case of the catch-all route $default
}),
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './http';
export * from './websocket';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lambda';
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import {
IWebSocketRouteIntegration,
WebSocketIntegrationType,
WebSocketRouteIntegrationBindOptions,
WebSocketRouteIntegrationConfig,
} from '@aws-cdk/aws-apigatewayv2';
import { ServicePrincipal } from '@aws-cdk/aws-iam';
import { IFunction } from '@aws-cdk/aws-lambda';
import { Names, Stack } from '@aws-cdk/core';

/**
* Lambda WebSocket Integration props
*/
export interface LambdaWebSocketIntegrationProps {
/**
* The handler for this integration.
*/
readonly handler: IFunction
}

/**
* Lambda WebSocket Integration
*/
export class LambdaWebSocketIntegration implements IWebSocketRouteIntegration {
constructor(private props: LambdaWebSocketIntegrationProps) {}

bind(options: WebSocketRouteIntegrationBindOptions): WebSocketRouteIntegrationConfig {
const route = options.route;
this.props.handler.addPermission(`${Names.nodeUniqueId(route.node)}-Permission`, {
scope: options.scope,
principal: new ServicePrincipal('apigateway.amazonaws.com'),
sourceArn: Stack.of(route).formatArn({
service: 'execute-api',
resource: route.webSocketApi.apiId,
resourceName: `*/*${route.routeKey}`,
}),
});

return {
type: WebSocketIntegrationType.AWS_PROXY,
uri: this.props.handler.functionArn,
};
}
}
Loading

0 comments on commit e58994e

Please sign in to comment.