-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Shared Usage Plan scenarios for Resource Level Attribute Support (…
…#2040) * do not propagate attributes to CognitoUserPool * shared usage plan with propagated resource level attributes * add unit tests * Added test templates for shared usage plan with resource attributes * Black reformatting * Removing unused import * fix python2 hashes Co-authored-by: Qingchuan Ma <[email protected]>
- Loading branch information
Showing
13 changed files
with
3,203 additions
and
10 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
102 changes: 102 additions & 0 deletions
102
tests/translator/input/api_with_usageplans_shared_attributes_three.yaml
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,102 @@ | ||
Globals: | ||
Api: | ||
Auth: | ||
ApiKeyRequired: true | ||
UsagePlan: | ||
CreateUsagePlan: SHARED | ||
|
||
Conditions: | ||
C1: | ||
Fn::Equals: | ||
- test | ||
- test | ||
C2: | ||
Fn::Equals: | ||
- test | ||
- test | ||
|
||
Resources: | ||
MyApiOne: | ||
Type: AWS::Serverless::Api | ||
Condition: C1 | ||
UpdateReplacePolicy: Delete | ||
Properties: | ||
StageName: Prod | ||
|
||
MyApiTwo: | ||
Type: AWS::Serverless::Api | ||
Condition: C2 | ||
UpdateReplacePolicy: Snapshot | ||
Properties: | ||
StageName: Prod | ||
|
||
MyApiThree: | ||
Type: AWS::Serverless::Api | ||
Properties: | ||
StageName: Prod | ||
|
||
MyFunctionOne: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
Handler: index.handler | ||
Runtime: nodejs12.x | ||
InlineCode: | | ||
exports.handler = async (event) => { | ||
return { | ||
statusCode: 200, | ||
body: JSON.stringify(event), | ||
headers: {} | ||
} | ||
} | ||
Events: | ||
ApiKey: | ||
Type: Api | ||
Properties: | ||
RestApiId: | ||
Ref: MyApiOne | ||
Method: get | ||
Path: /path/one | ||
|
||
MyFunctionTwo: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
Handler: index.handler | ||
Runtime: nodejs12.x | ||
InlineCode: | | ||
exports.handler = async (event) => { | ||
return { | ||
statusCode: 200, | ||
body: JSON.stringify(event), | ||
headers: {} | ||
} | ||
} | ||
Events: | ||
ApiKey: | ||
Type: Api | ||
Properties: | ||
RestApiId: | ||
Ref: MyApiTwo | ||
Method: get | ||
Path: /path/two | ||
|
||
MyFunctionThree: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
Handler: index.handler | ||
Runtime: nodejs12.x | ||
InlineCode: | | ||
exports.handler = async (event) => { | ||
return { | ||
statusCode: 200, | ||
body: JSON.stringify(event), | ||
headers: {} | ||
} | ||
} | ||
Events: | ||
ApiKey: | ||
Type: Api | ||
Properties: | ||
RestApiId: | ||
Ref: MyApiThree | ||
Method: get | ||
Path: /path/three |
75 changes: 75 additions & 0 deletions
75
tests/translator/input/api_with_usageplans_shared_attributes_two.yaml
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,75 @@ | ||
Globals: | ||
Api: | ||
Auth: | ||
ApiKeyRequired: true | ||
UsagePlan: | ||
CreateUsagePlan: SHARED | ||
|
||
Conditions: | ||
C1: | ||
Fn::Equals: | ||
- test | ||
- test | ||
C2: | ||
Fn::Equals: | ||
- test | ||
- test | ||
|
||
Resources: | ||
MyApiOne: | ||
Type: AWS::Serverless::Api | ||
DeletionPolicy: Delete | ||
Condition: C1 | ||
Properties: | ||
StageName: Prod | ||
|
||
MyApiTwo: | ||
Type: AWS::Serverless::Api | ||
DeletionPolicy: Retain | ||
Condition: C2 | ||
Properties: | ||
StageName: Prod | ||
|
||
MyFunctionOne: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
Handler: index.handler | ||
Runtime: nodejs12.x | ||
InlineCode: | | ||
exports.handler = async (event) => { | ||
return { | ||
statusCode: 200, | ||
body: JSON.stringify(event), | ||
headers: {} | ||
} | ||
} | ||
Events: | ||
ApiKey: | ||
Type: Api | ||
Properties: | ||
RestApiId: | ||
Ref: MyApiOne | ||
Method: get | ||
Path: /path/one | ||
|
||
MyFunctionTwo: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
Handler: index.handler | ||
Runtime: nodejs12.x | ||
InlineCode: | | ||
exports.handler = async (event) => { | ||
return { | ||
statusCode: 200, | ||
body: JSON.stringify(event), | ||
headers: {} | ||
} | ||
} | ||
Events: | ||
ApiKey: | ||
Type: Api | ||
Properties: | ||
RestApiId: | ||
Ref: MyApiTwo | ||
Method: get | ||
Path: /path/two |
Oops, something went wrong.