-
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.
fix(apigateway): allow multiple api keys to the same usage plan (#4903)
* fix(apigateway): allow multiple api keys to the same usage plan fixes #4860 * Updated to not change physical ids on existing UsagePlanKey * Changed to use uniqueId
- Loading branch information
1 parent
a56f4cc
commit 142bd0e
Showing
5 changed files
with
108 additions
and
3 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
44 changes: 44 additions & 0 deletions
44
packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.multikey.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,44 @@ | ||
{ | ||
"Resources": { | ||
"myusageplan4B391740": { | ||
"Type": "AWS::ApiGateway::UsagePlan", | ||
"Properties": {} | ||
}, | ||
"myusageplanUsagePlanKeyResource095B4EA9": { | ||
"Type": "AWS::ApiGateway::UsagePlanKey", | ||
"Properties": { | ||
"KeyId": { | ||
"Ref": "myapikey18B056ACE" | ||
}, | ||
"KeyType": "API_KEY", | ||
"UsagePlanId": { | ||
"Ref": "myusageplan4B391740" | ||
} | ||
} | ||
}, | ||
"myusageplanUsagePlanKeyResourcetestapigatewayusageplanmultikeymyapikey29D6460C6AE8DE59D": { | ||
"Type": "AWS::ApiGateway::UsagePlanKey", | ||
"Properties": { | ||
"KeyId": { | ||
"Ref": "myapikey250C8F11B" | ||
}, | ||
"KeyType": "API_KEY", | ||
"UsagePlanId": { | ||
"Ref": "myusageplan4B391740" | ||
} | ||
} | ||
}, | ||
"myapikey18B056ACE": { | ||
"Type": "AWS::ApiGateway::ApiKey", | ||
"Properties": { | ||
"Enabled": true | ||
} | ||
}, | ||
"myapikey250C8F11B": { | ||
"Type": "AWS::ApiGateway::ApiKey", | ||
"Properties": { | ||
"Enabled": true | ||
} | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.multikey.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,20 @@ | ||
import cdk = require('@aws-cdk/core'); | ||
import apigateway = require('../lib'); | ||
|
||
class Test extends cdk.Stack { | ||
constructor(scope: cdk.App, id: string) { | ||
super(scope, id); | ||
|
||
const usageplan = new apigateway.UsagePlan(this, 'myusageplan'); | ||
const apikey1 = new apigateway.ApiKey(this, 'myapikey1'); | ||
const apikey2 = new apigateway.ApiKey(this, 'myapikey2'); | ||
usageplan.addApiKey(apikey1); | ||
usageplan.addApiKey(apikey2); | ||
} | ||
} | ||
|
||
const app = new cdk.App(); | ||
|
||
new Test(app, 'test-apigateway-usageplan-multikey'); | ||
|
||
app.synth(); |
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