Skip to content

Commit

Permalink
chore: update to aws-sam-translator 1.36.0 (aws#2917)
Browse files Browse the repository at this point in the history
  • Loading branch information
qingchm authored and moelasmar committed Aug 4, 2021
1 parent cc2ce07 commit 0be9550
Show file tree
Hide file tree
Showing 12 changed files with 429 additions and 5 deletions.
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ boto3~=1.14
jmespath~=0.10.0
PyYAML~=5.3
cookiecutter~=1.7.2
aws-sam-translator==1.35.0
aws-sam-translator==1.36.0
#docker minor version updates can include breaking changes. Auto update micro version only.
docker~=4.2.0
dateparser~=0.7
Expand Down
8 changes: 4 additions & 4 deletions requirements/reproducible-linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ aws-lambda-builders==1.4.0 \
--hash=sha256:5d4e4ecb3d3290f0eec1f62b7b0d9d6b91160ae71447d95899eede392d05f75f \
--hash=sha256:d32f79cf67b189a7598793f69797f284b2eb9a9fada562175b1e854187f95aed
# via aws-sam-cli (setup.py)
aws-sam-translator==1.35.0 \
--hash=sha256:2f8904fd4a631752bc441a8fd928c444ed98ceb86b94d25ed7b84982e2eff1cd \
--hash=sha256:5cf7faab3566843f3b44ef1a42a9c106ffb50809da4002faab818076dcc7bff8 \
--hash=sha256:c35075e7e804490d6025598ed4878ad3ab8668e37cafb7ae75120b1c37a6d212
aws-sam-translator==1.36.0 \
--hash=sha256:4195ae8196f04803e7f0384a2b5ccd8c2b06ce0d8dc408aa1f1ce96c23bcf39d \
--hash=sha256:f7d51b661fe1f5613a882f4733d1c92eff4dac36a076eafd18031d209b178695 \
--hash=sha256:fa1b990d9329d19052e7b91cf0b19371ed9d31a529054b616005884cd662b584
# via aws-sam-cli (setup.py)
binaryornot==0.4.4 \
--hash=sha256:359501dfc9d40632edc9fac890e19542db1a287bbcfa58175b66658392018061 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,9 @@ Resources:

- EventBridgePutEventsPolicy:
EventBusName: name

- AcmGetCertificatePolicy:
CertificateArn: arn

- Route53ChangeResourceRecordSetsPolicy:
HostedZoneId: test
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
Resources:
MyApiWithCognitoAuth:
Type: "AWS::Serverless::Api"
Properties:
StageName: Prod
Auth:
Authorizers:
MyCognitoAuth:
UserPoolArn: !GetAtt MyUserPool.Arn
DefaultAuthorizer: MyCognitoAuth

MyApiWithLambdaTokenAuth:
Type: "AWS::Serverless::Api"
Properties:
StageName: Prod
Auth:
Authorizers:
MyLambdaTokenAuth:
FunctionArn: !GetAtt MyAuthFn.Arn
DefaultAuthorizer: MyLambdaTokenAuth

MyApiWithLambdaRequestAuth:
Type: "AWS::Serverless::Api"
Properties:
StageName: Prod
DefinitionBody:
swagger: 2.0
info:
version: '1.0'
title: !Ref AWS::StackName
schemes:
- https
paths:
"/lambda-request":
get:
x-amazon-apigateway-integration:
httpMethod: POST
type: aws_proxy
uri: !Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${MyFn.Arn}/invocations
passthroughBehavior: when_no_match
responses: {}
Auth:
Authorizers:
MyLambdaRequestAuth:
FunctionPayloadType: REQUEST
FunctionArn: !GetAtt MyAuthFn.Arn
Identity:
Headers:
- Authorization1
DefaultAuthorizer: MyLambdaRequestAuth

MyAuthFn:
Type: AWS::Serverless::Function
Properties:
InlineCode: |
exports.handler = async (event) => {
return {
statusCode: 200,
body: JSON.stringify(event),
headers: {}
}
}
Handler: index.handler
Runtime: nodejs8.10

MyFn:
Type: AWS::Serverless::Function
Properties:
InlineCode: |
exports.handler = async (event) => {
return {
statusCode: 200,
body: JSON.stringify(event),
headers: {}
}
}
Handler: index.handler
Runtime: nodejs8.10
Events:
Cognito:
Type: Api
Properties:
RestApiId: !Ref MyApiWithCognitoAuth
Method: get
Auth:
Authorizer: NONE
Path: /cognito
LambdaToken:
Type: Api
Properties:
RestApiId: !Ref MyApiWithLambdaTokenAuth
Method: get
Auth:
Authorizer: NONE
Path: /lambda-token
LambdaRequest:
Type: Api
Properties:
RestApiId: !Ref MyApiWithLambdaRequestAuth
Auth:
Authorizer: NONE
Method: get
Path: /lambda-request

MyUserPool:
Type: AWS::Cognito::UserPool
Properties:
UserPoolName: UserPoolName
Policies:
PasswordPolicy:
MinimumLength: 8
UsernameAttributes:
- email
Schema:
- AttributeDataType: String
Name: email
Required: false
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
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Conditions:
MyCondition:
Fn::Equals:
- true
- false
Resources:
MinimalFunction:
Type: "AWS::Serverless::Function"
Properties:
CodeUri: s3://sam-demo-bucket/hello.zip
Handler: hello.handler
Runtime: python2.7
AutoPublishAlias: live
DeploymentPreference:
Type: Linear10PercentEvery3Minutes
Alarms:
Fn::If:
- MyCondition
- - Alarm1
- Alarm2
- Alarm3
- - Alarm1
- Alarm5
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Resources:
RestApiFunction:
Type: AWS::Serverless::Function
DeletionPolicy: Delete
UpdateReplacePolicy: Retain
Properties:
CodeUri: s3://sam-demo-bucket/todo_list.zip
Handler: index.restapi
Runtime: nodejs12.x
Policies: AmazonDynamoDBFullAccess
Events:
GetHtml:
Type: Api
Properties:
Path: /{proxy+}
Method: any

GetHtmlFunction:
Type: AWS::Serverless::Function
DeletionPolicy: Retain
UpdateReplacePolicy: Retain
Properties:
CodeUri: s3://sam-demo-bucket/todo_list.zip
Handler: index.gethtml
Runtime: nodejs12.x
Policies: AmazonDynamoDBReadOnlyAccess
Events:
GetHtml:
Type: Api
Properties:
Path: /{proxy++}
Method: any
Loading

0 comments on commit 0be9550

Please sign in to comment.