-
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.
feat: Add EnableFunctionDefaultPermissions property to HTTP Api (#3001)
Co-authored-by: Christoffer Rehn <1280602+hoffa@users.noreply.github.com>
- Loading branch information
Showing
13 changed files
with
1,232 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
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
62 changes: 62 additions & 0 deletions
62
tests/translator/input/http_api_lambda_auth_with_permissions_resource.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,62 @@ | ||
Resources: | ||
HttpApiFunction: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
CodeUri: s3://sam-demo-bucket/todo_list.zip | ||
Handler: index.restapi | ||
Runtime: python3.7 | ||
Events: | ||
Basic: | ||
Type: HttpApi | ||
Properties: | ||
Path: /basic | ||
Method: GET | ||
ApiId: !Ref MyApi | ||
|
||
MyAuthFn: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
CodeUri: s3://bucket/key | ||
Handler: index.handler | ||
Runtime: nodejs12.x | ||
|
||
MyApi: | ||
Type: AWS::Serverless::HttpApi | ||
Properties: | ||
Tags: | ||
Tag1: value1 | ||
Tag2: value2 | ||
Auth: | ||
Authorizers: | ||
LambdaAuthWithEnablePropertyTrue: | ||
# should create permissions resource for this auth | ||
FunctionArn: !GetAtt MyAuthFn.Arn | ||
EnableFunctionDefaultPermissions: true | ||
AuthorizerPayloadFormatVersion: 1.0 | ||
LambdaAuthNoEnableProperty: | ||
# should not create permissions resource for this auth as http api doesn't create the resource by default | ||
FunctionArn: !GetAtt MyAuthFn.Arn | ||
AuthorizerPayloadFormatVersion: 1.0 | ||
LambdaAuthWithEnablePropertySetFalse: | ||
# should not create permissions resource for this auth | ||
FunctionArn: !GetAtt MyAuthFn.Arn | ||
AuthorizerPayloadFormatVersion: 1.0 | ||
EnableFunctionDefaultPermissions: false | ||
LambdaAuthFull: | ||
# should create permissions resource for this auth | ||
FunctionArn: !GetAtt MyAuthFn.Arn | ||
FunctionInvokeRole: !GetAtt MyAuthFnRole.Arn | ||
EnableFunctionDefaultPermissions: true | ||
Identity: | ||
Context: | ||
- contextVar | ||
Headers: | ||
- Authorization | ||
QueryStrings: | ||
- petId | ||
StageVariables: | ||
- stageVar | ||
ReauthorizeEvery: 60 | ||
AuthorizerPayloadFormatVersion: 2.0 | ||
EnableSimpleResponses: true | ||
DefaultAuthorizer: LambdaAuthWithEnablePropertyTrue |
Oops, something went wrong.