-
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.
feat(apigatewayv2): AWS type websocket api integration in http api (#…
…28718) Currently, Amazon.CDK.AWS.Apigatewayv2 lacks support for AWS option as the [IntegrationType](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-integration.html#cfn-apigatewayv2-integration-integrationtype) for WebSocket Apigateway. Added the capability that allows user to create a WebSocket Apigateway that calls directly other AWS services without a Lambda function middleware. Closes #27164. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
14 changed files
with
1,211 additions
and
1 deletion.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
...s.snapshot/apigatewayv2awsintegrationintegtestDefaultTestDeployAssert2B785EAB.assets.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
...snapshot/apigatewayv2awsintegrationintegtestDefaultTestDeployAssert2B785EAB.template.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...ork-integ/test/aws-apigatewayv2-integrations/test/websocket/integ.aws.js.snapshot/cdk.out
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
...grations/test/websocket/integ.aws.js.snapshot/integ-aws-websocket-integration.assets.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
202 changes: 202 additions & 0 deletions
202
...ations/test/websocket/integ.aws.js.snapshot/integ-aws-websocket-integration.template.json
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,202 @@ | ||
{ | ||
"Resources": { | ||
"MyTable794EDED1": { | ||
"Type": "AWS::DynamoDB::Table", | ||
"Properties": { | ||
"AttributeDefinitions": [ | ||
{ | ||
"AttributeName": "id", | ||
"AttributeType": "S" | ||
} | ||
], | ||
"BillingMode": "PAY_PER_REQUEST", | ||
"KeySchema": [ | ||
{ | ||
"AttributeName": "id", | ||
"KeyType": "HASH" | ||
} | ||
], | ||
"TableName": "MyTable" | ||
}, | ||
"UpdateReplacePolicy": "Delete", | ||
"DeletionPolicy": "Delete" | ||
}, | ||
"ApiGatewayRoleD2518903": { | ||
"Type": "AWS::IAM::Role", | ||
"Properties": { | ||
"AssumeRolePolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "sts:AssumeRole", | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "apigateway.amazonaws.com" | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"ManagedPolicyArns": [ | ||
{ | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":iam::aws:policy/AmazonDynamoDBFullAccess" | ||
] | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"mywsapi32E6CE11": { | ||
"Type": "AWS::ApiGatewayV2::Api", | ||
"Properties": { | ||
"Name": "mywsapi", | ||
"ProtocolType": "WEBSOCKET", | ||
"RouteSelectionExpression": "$request.body.action" | ||
} | ||
}, | ||
"mywsapidefaultRouteDefaultIntegrationFFCB3BA9": { | ||
"Type": "AWS::ApiGatewayV2::Integration", | ||
"Properties": { | ||
"ApiId": { | ||
"Ref": "mywsapi32E6CE11" | ||
}, | ||
"IntegrationType": "MOCK", | ||
"IntegrationUri": "" | ||
} | ||
}, | ||
"mywsapidefaultRouteE9382DF8": { | ||
"Type": "AWS::ApiGatewayV2::Route", | ||
"Properties": { | ||
"ApiId": { | ||
"Ref": "mywsapi32E6CE11" | ||
}, | ||
"AuthorizationType": "NONE", | ||
"RouteKey": "$default", | ||
"Target": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"integrations/", | ||
{ | ||
"Ref": "mywsapidefaultRouteDefaultIntegrationFFCB3BA9" | ||
} | ||
] | ||
] | ||
} | ||
} | ||
}, | ||
"mywsapiconnectRouteDynamodbPutItem9E189A39": { | ||
"Type": "AWS::ApiGatewayV2::Integration", | ||
"Properties": { | ||
"ApiId": { | ||
"Ref": "mywsapi32E6CE11" | ||
}, | ||
"CredentialsArn": { | ||
"Fn::GetAtt": [ | ||
"ApiGatewayRoleD2518903", | ||
"Arn" | ||
] | ||
}, | ||
"IntegrationMethod": "POST", | ||
"IntegrationType": "AWS", | ||
"IntegrationUri": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:aws:apigateway:", | ||
{ | ||
"Ref": "AWS::Region" | ||
}, | ||
":dynamodb:action/PutItem" | ||
] | ||
] | ||
}, | ||
"RequestTemplates": { | ||
"application/json": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"{\"TableName\":\"", | ||
{ | ||
"Ref": "MyTable794EDED1" | ||
}, | ||
"\",\"Item\":{\"id\":{\"S\":\"$context.requestId\"}}}" | ||
] | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"mywsapiconnectRoute45A0ED6A": { | ||
"Type": "AWS::ApiGatewayV2::Route", | ||
"Properties": { | ||
"ApiId": { | ||
"Ref": "mywsapi32E6CE11" | ||
}, | ||
"AuthorizationType": "NONE", | ||
"RouteKey": "$connect", | ||
"Target": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"integrations/", | ||
{ | ||
"Ref": "mywsapiconnectRouteDynamodbPutItem9E189A39" | ||
} | ||
] | ||
] | ||
} | ||
} | ||
}, | ||
"DevStage520A913F": { | ||
"Type": "AWS::ApiGatewayV2::Stage", | ||
"Properties": { | ||
"ApiId": { | ||
"Ref": "mywsapi32E6CE11" | ||
}, | ||
"AutoDeploy": true, | ||
"StageName": "dev" | ||
} | ||
} | ||
}, | ||
"Parameters": { | ||
"BootstrapVersion": { | ||
"Type": "AWS::SSM::Parameter::Value<String>", | ||
"Default": "/cdk-bootstrap/hnb659fds/version", | ||
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" | ||
} | ||
}, | ||
"Rules": { | ||
"CheckBootstrapVersion": { | ||
"Assertions": [ | ||
{ | ||
"Assert": { | ||
"Fn::Not": [ | ||
{ | ||
"Fn::Contains": [ | ||
[ | ||
"1", | ||
"2", | ||
"3", | ||
"4", | ||
"5" | ||
], | ||
{ | ||
"Ref": "BootstrapVersion" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." | ||
} | ||
] | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...-integ/test/aws-apigatewayv2-integrations/test/websocket/integ.aws.js.snapshot/integ.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.