-
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): set throttling on stages (#19776)
fixes #19626 added integ tests let me know if change to readme is necessary ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)? * [x] Did you use `cdk-integ` to deploy the infrastructure and generate the snapshot (i.e. `cdk-integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
1 parent
87ca3ab
commit 9e05478
Showing
17 changed files
with
466 additions
and
1 deletion.
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
24 changes: 24 additions & 0 deletions
24
packages/@aws-cdk/aws-apigatewayv2/test/http/integ.stage.expected.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,24 @@ | ||
{ | ||
"Resources": { | ||
"HttpApiF5A9A8A7": { | ||
"Type": "AWS::ApiGatewayV2::Api", | ||
"Properties": { | ||
"Name": "HttpApi", | ||
"ProtocolType": "HTTP" | ||
} | ||
}, | ||
"HttpStageWithPropertiesC0AABA83": { | ||
"Type": "AWS::ApiGatewayV2::Stage", | ||
"Properties": { | ||
"ApiId": { | ||
"Ref": "HttpApiF5A9A8A7" | ||
}, | ||
"StageName": "$default", | ||
"DefaultRouteSettings": { | ||
"ThrottlingBurstLimit": 1000, | ||
"ThrottlingRateLimit": 1000 | ||
} | ||
} | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/@aws-cdk/aws-apigatewayv2/test/http/integ.stage.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,17 @@ | ||
#!/usr/bin/env node | ||
import * as cdk from '@aws-cdk/core'; | ||
import * as apigw from '../../lib'; | ||
|
||
const app = new cdk.App(); | ||
const stack = new cdk.Stack(app, 'aws-cdk-aws-apigatewayv2-http-stage'); | ||
|
||
const httpApi = new apigw.HttpApi(stack, 'HttpApi', { createDefaultStage: false }); | ||
new apigw.HttpStage(stack, 'HttpStageWithProperties', { | ||
httpApi, | ||
throttle: { | ||
rateLimit: 1000, | ||
burstLimit: 1000, | ||
}, | ||
}); | ||
|
||
app.synth(); |
24 changes: 24 additions & 0 deletions
24
...atewayv2/test/http/stage.integ.snapshot/aws-cdk-aws-apigatewayv2-http-stage.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,24 @@ | ||
{ | ||
"Resources": { | ||
"HttpApiF5A9A8A7": { | ||
"Type": "AWS::ApiGatewayV2::Api", | ||
"Properties": { | ||
"Name": "HttpApi", | ||
"ProtocolType": "HTTP" | ||
} | ||
}, | ||
"HttpStageWithPropertiesC0AABA83": { | ||
"Type": "AWS::ApiGatewayV2::Stage", | ||
"Properties": { | ||
"ApiId": { | ||
"Ref": "HttpApiF5A9A8A7" | ||
}, | ||
"StageName": "$default", | ||
"DefaultRouteSettings": { | ||
"ThrottlingBurstLimit": 1000, | ||
"ThrottlingRateLimit": 1000 | ||
} | ||
} | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
packages/@aws-cdk/aws-apigatewayv2/test/http/stage.integ.snapshot/cdk.out
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 @@ | ||
{"version":"17.0.0"} |
35 changes: 35 additions & 0 deletions
35
packages/@aws-cdk/aws-apigatewayv2/test/http/stage.integ.snapshot/manifest.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,35 @@ | ||
{ | ||
"version": "17.0.0", | ||
"artifacts": { | ||
"Tree": { | ||
"type": "cdk:tree", | ||
"properties": { | ||
"file": "tree.json" | ||
}, | ||
"metadata": {} | ||
}, | ||
"aws-cdk-aws-apigatewayv2-http-stage": { | ||
"type": "aws:cloudformation:stack", | ||
"environment": "aws://unknown-account/unknown-region", | ||
"properties": { | ||
"templateFile": "aws-cdk-aws-apigatewayv2-http-stage.template.json", | ||
"validateOnSynth": false | ||
}, | ||
"metadata": { | ||
"/aws-cdk-aws-apigatewayv2-http-stage/HttpApi/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "HttpApiF5A9A8A7" | ||
} | ||
], | ||
"/aws-cdk-aws-apigatewayv2-http-stage/HttpStageWithProperties/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "HttpStageWithPropertiesC0AABA83" | ||
} | ||
] | ||
}, | ||
"displayName": "aws-cdk-aws-apigatewayv2-http-stage" | ||
} | ||
} | ||
} |
87 changes: 87 additions & 0 deletions
87
packages/@aws-cdk/aws-apigatewayv2/test/http/stage.integ.snapshot/tree.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,87 @@ | ||
{ | ||
"version": "tree-0.1", | ||
"tree": { | ||
"id": "App", | ||
"path": "", | ||
"children": { | ||
"Tree": { | ||
"id": "Tree", | ||
"path": "Tree", | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/core.Construct", | ||
"version": "0.0.0" | ||
} | ||
}, | ||
"aws-cdk-aws-apigatewayv2-http-stage": { | ||
"id": "aws-cdk-aws-apigatewayv2-http-stage", | ||
"path": "aws-cdk-aws-apigatewayv2-http-stage", | ||
"children": { | ||
"HttpApi": { | ||
"id": "HttpApi", | ||
"path": "aws-cdk-aws-apigatewayv2-http-stage/HttpApi", | ||
"children": { | ||
"Resource": { | ||
"id": "Resource", | ||
"path": "aws-cdk-aws-apigatewayv2-http-stage/HttpApi/Resource", | ||
"attributes": { | ||
"aws:cdk:cloudformation:type": "AWS::ApiGatewayV2::Api", | ||
"aws:cdk:cloudformation:props": { | ||
"name": "HttpApi", | ||
"protocolType": "HTTP" | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/aws-apigatewayv2.CfnApi", | ||
"version": "0.0.0" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/aws-apigatewayv2.HttpApi", | ||
"version": "0.0.0" | ||
} | ||
}, | ||
"HttpStageWithProperties": { | ||
"id": "HttpStageWithProperties", | ||
"path": "aws-cdk-aws-apigatewayv2-http-stage/HttpStageWithProperties", | ||
"children": { | ||
"Resource": { | ||
"id": "Resource", | ||
"path": "aws-cdk-aws-apigatewayv2-http-stage/HttpStageWithProperties/Resource", | ||
"attributes": { | ||
"aws:cdk:cloudformation:type": "AWS::ApiGatewayV2::Stage", | ||
"aws:cdk:cloudformation:props": { | ||
"apiId": { | ||
"Ref": "HttpApiF5A9A8A7" | ||
}, | ||
"stageName": "$default", | ||
"defaultRouteSettings": { | ||
"throttlingBurstLimit": 1000, | ||
"throttlingRateLimit": 1000 | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/aws-apigatewayv2.CfnStage", | ||
"version": "0.0.0" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/aws-apigatewayv2.HttpStage", | ||
"version": "0.0.0" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/core.Stack", | ||
"version": "0.0.0" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/core.App", | ||
"version": "0.0.0" | ||
} | ||
} | ||
} |
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
25 changes: 25 additions & 0 deletions
25
packages/@aws-cdk/aws-apigatewayv2/test/websocket/integ.stage.expected.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,25 @@ | ||
{ | ||
"Resources": { | ||
"WebSocketApi34BCF99B": { | ||
"Type": "AWS::ApiGatewayV2::Api", | ||
"Properties": { | ||
"Name": "WebSocketApi", | ||
"ProtocolType": "WEBSOCKET", | ||
"RouteSelectionExpression": "$request.body.action" | ||
} | ||
}, | ||
"WebSocketStageC46B7E43": { | ||
"Type": "AWS::ApiGatewayV2::Stage", | ||
"Properties": { | ||
"ApiId": { | ||
"Ref": "WebSocketApi34BCF99B" | ||
}, | ||
"StageName": "dev", | ||
"DefaultRouteSettings": { | ||
"ThrottlingBurstLimit": 1000, | ||
"ThrottlingRateLimit": 1000 | ||
} | ||
} | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
packages/@aws-cdk/aws-apigatewayv2/test/websocket/integ.stage.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,18 @@ | ||
#!/usr/bin/env node | ||
import * as cdk from '@aws-cdk/core'; | ||
import * as apigw from '../../lib'; | ||
|
||
const app = new cdk.App(); | ||
const stack = new cdk.Stack(app, 'aws-cdk-aws-apigatewayv2-websocket-stage'); | ||
|
||
const webSocketApi = new apigw.WebSocketApi(stack, 'WebSocketApi'); | ||
new apigw.WebSocketStage(stack, 'WebSocketStage', { | ||
webSocketApi, | ||
stageName: 'dev', | ||
throttle: { | ||
rateLimit: 1000, | ||
burstLimit: 1000, | ||
}, | ||
}); | ||
|
||
app.synth(); |
25 changes: 25 additions & 0 deletions
25
...est/websocket/stage.integ.snapshot/aws-cdk-aws-apigatewayv2-websocket-stage.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,25 @@ | ||
{ | ||
"Resources": { | ||
"WebSocketApi34BCF99B": { | ||
"Type": "AWS::ApiGatewayV2::Api", | ||
"Properties": { | ||
"Name": "WebSocketApi", | ||
"ProtocolType": "WEBSOCKET", | ||
"RouteSelectionExpression": "$request.body.action" | ||
} | ||
}, | ||
"WebSocketStageC46B7E43": { | ||
"Type": "AWS::ApiGatewayV2::Stage", | ||
"Properties": { | ||
"ApiId": { | ||
"Ref": "WebSocketApi34BCF99B" | ||
}, | ||
"StageName": "dev", | ||
"DefaultRouteSettings": { | ||
"ThrottlingBurstLimit": 1000, | ||
"ThrottlingRateLimit": 1000 | ||
} | ||
} | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
packages/@aws-cdk/aws-apigatewayv2/test/websocket/stage.integ.snapshot/cdk.out
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 @@ | ||
{"version":"17.0.0"} |
Oops, something went wrong.