-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into issue-8315
- Loading branch information
Showing
101 changed files
with
4,682 additions
and
631 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './http'; | ||
export * from './websocket'; |
1 change: 1 addition & 0 deletions
1
packages/@aws-cdk/aws-apigatewayv2-integrations/lib/websocket/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './lambda'; |
44 changes: 44 additions & 0 deletions
44
packages/@aws-cdk/aws-apigatewayv2-integrations/lib/websocket/lambda.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; | ||
} | ||
} |
Oops, something went wrong.