Skip to content

Commit

Permalink
chore: Bump SamTranslator version to 1.63.0 (#4933)
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-sam-cli-bot authored Mar 31, 2023
1 parent b89b8e1 commit 5f818d4
Show file tree
Hide file tree
Showing 15 changed files with 458 additions and 4 deletions.
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jmespath~=0.10.0
ruamel_yaml==0.17.21
PyYAML>=5.4.1,==5.*
cookiecutter~=2.1.1
aws-sam-translator==1.62.0
aws-sam-translator==1.63.0
#docker minor version updates can include breaking changes. Auto update micro version only.
docker~=4.2.0
dateparser~=1.1
Expand Down
6 changes: 3 additions & 3 deletions requirements/reproducible-linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ aws-lambda-builders==1.28.0 \
--hash=sha256:6ea2fb607057436f03e2a8a857b5c5cbd18f7b2b907c53c2b461e65f843a4f38 \
--hash=sha256:bd6566772e7c5d887d05f32cf7e61a57293658388eef4fe8301f65bef432fe39
# via aws-sam-cli (setup.py)
aws-sam-translator==1.62.0 \
--hash=sha256:2db24633fbc76b8e6eb76adaf0c1001a0d749288af91d85e7d9007e3b05479fa \
--hash=sha256:5d198c8b4097b9210e1a44a64f55c4ee53b84f35d16ef1671b340242c41379cf
aws-sam-translator==1.63.0 \
--hash=sha256:723683828d38e8769e4db0b0566ce56e923570b2cfdb88b965ce796a4554200f \
--hash=sha256:bf3cca23b0e08e483956649302e53ae15e2021ef74a8fa1f9ecb2c53d8ce324c
# via
# aws-sam-cli (setup.py)
# cfn-lint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,7 @@ Resources:

- StepFunctionsExecutionPolicy_v2:
StateMachineName: name

- SESBulkTemplatedCrudPolicy_v2:
IdentityName: name
TemplateName: template_name
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
AWSTemplateFormatVersion: '2010-09-09'

Transform:
- AWS::Serverless-2016-10-31

Globals:
Api:
Auth:
ApiKeyRequired: true
AddApiKeyRequiredToCorsPreflight: false

Resources:

MyFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
InlineCode: |
exports.handler = async function (event) {
return {
statusCode: 200,
body: JSON.stringify({ message: "Hello, SAM!" }),
}
}
Runtime: nodejs16.x

ApiGatewayLambdaRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal: {Service: apigateway.amazonaws.com}
Action: sts:AssumeRole
Policies:
- PolicyName: AllowInvokeLambdaFunctions
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action: lambda:InvokeFunction
Resource: '*'

MyApi:
Type: AWS::Serverless::Api
Properties:
Cors:
AllowMethods: "'methods'"
AllowHeaders: "'headers'"
AllowOrigin: "'origins'"
MaxAge: "'600'"
Auth:
ApiKeyRequired: true
StageName: dev
DefinitionBody:
openapi: 3.0.1
paths:
/apione:
get:
x-amazon-apigateway-integration:
credentials:
Fn::Sub: ${ApiGatewayLambdaRole.Arn}
uri:
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${MyFunction.Arn}/invocations
passthroughBehavior: when_no_match
httpMethod: POST
type: aws_proxy
/apitwo:
get:
x-amazon-apigateway-integration:
credentials:
Fn::Sub: ${ApiGatewayLambdaRole.Arn}
uri:
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${MyFunction.Arn}/invocations
passthroughBehavior: when_no_match
httpMethod: POST
type: aws_proxy



Outputs:
ApiUrl:
Description: URL of your API endpoint
Value: !Sub "https://${MyApi}.execute-api.${AWS::Region}.amazonaws.com/dev/"
Metadata:
SamTransformTest: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
AWSTemplateFormatVersion: '2010-09-09'

Transform:
- AWS::Serverless-2016-10-31

Resources:

MyFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
InlineCode: |
exports.handler = async function (event) {
return {
statusCode: 200,
body: JSON.stringify({ message: "Hello, SAM!" }),
}
}
Runtime: nodejs16.x

ApiGatewayLambdaRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal: {Service: apigateway.amazonaws.com}
Action: sts:AssumeRole
Policies:
- PolicyName: AllowInvokeLambdaFunctions
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action: lambda:InvokeFunction
Resource: '*'

MyApi:
Type: AWS::Serverless::Api
Properties:
Cors: "'*'"
Auth:
ApiKeyRequired: true
AddApiKeyRequiredToCorsPreflight: false
StageName: dev
DefinitionBody:
openapi: 3.0.1
paths:
/hello:
get:
x-amazon-apigateway-integration:
credentials:
Fn::Sub: ${ApiGatewayLambdaRole.Arn}
uri:
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${MyFunction.Arn}/invocations
passthroughBehavior: when_no_match
httpMethod: POST
type: aws_proxy



Outputs:
WebEndpoint:
Description: API Gateway endpoint URL
Value: !Sub "https://${MyApi}.execute-api.${AWS::Region}.amazonaws.com/dev/hello"
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
Parameters:
MyRestRegionalDomainName:
Type: String
MyRestRegionalDomainCert:
Type: String
HostedZoneId:
Type: String

Globals:
Api:
Domain:
DomainName:
Ref: MyRestRegionalDomainName
CertificateArn:
Ref: MyRestRegionalDomainCert
EndpointConfiguration: REGIONAL
MutualTlsAuthentication:
TruststoreUri: ${mtlsuri}
TruststoreVersion: 0
SecurityPolicy: TLS_1_2
BasePath:
- /get
- /post
Route53:
HostedZoneId:
Ref: HostedZoneId
Region: eu-west-2
SetIdentifier: eu-west-2
DistributionDomainName: test.domain.com

Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:
InlineCode: |
exports.handler = async (event) => {
const response = {
statusCode: 200,
body: JSON.stringify('Hello from Lambda!'),
};
return response;
};
Handler: index.handler
Runtime: nodejs14.x
Events:
ImplicitGet:
Type: Api
Properties:
Method: Get
Path: /get
ImplicitPost:
Type: Api
Properties:
Method: Post
Path: /post
Metadata:
SamTransformTest: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Parameters:
MyRestRegionalDomainName:
Type: String
MyRestRegionalDomainCert:
Type: String
HostedZoneId:
Type: String

Globals:
Api:
Domain:
DomainName:
Ref: MyRestRegionalDomainName
CertificateArn:
Ref: MyRestRegionalDomainCert
EndpointConfiguration: REGIONAL
MutualTlsAuthentication:
TruststoreUri: ${mtlsuri}
TruststoreVersion: 0
SecurityPolicy: TLS_1_2
BasePath:
- /get
- /post
Route53:
HostedZoneId:
Ref: HostedZoneId
Region: eu-west-2
SetIdentifier: eu-west-2
DistributionDomainName: test.domain.com
IpV6: true

Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:
InlineCode: |
exports.handler = async (event) => {
const response = {
statusCode: 200,
body: JSON.stringify('Hello from Lambda!'),
};
return response;
};
Handler: index.handler
Runtime: nodejs14.x
Events:
ImplicitGet:
Type: Api
Properties:
Method: Get
Path: /get
ImplicitPost:
Type: Api
Properties:
Method: Post
Path: /post
Metadata:
SamTransformTest: true
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ Resources:
- numeric:
- '>='
- 100
FilterPolicyScope: MessageAttributes
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
Loading

0 comments on commit 5f818d4

Please sign in to comment.