Skip to content

Commit

Permalink
Update aws-sam-translator Dependency (#1448)
Browse files Browse the repository at this point in the history
* Added test templates as a part of SAM 1.15.1 release

* removed templates of application resource type and corrected the errors in sam template validator

* removed the application resource yaml files

* fix: set isolated.txt to have aws-sam-translator (1.15.1)

* Bump start-api integ tests from 300 to 600
  • Loading branch information
Shreya authored and sriram-mv committed Oct 21, 2019
1 parent ec80eb0 commit 0464b27
Show file tree
Hide file tree
Showing 39 changed files with 970 additions and 87 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 @@ Flask~=1.0.2
boto3~=1.9, >=1.9.56
PyYAML~=5.1
cookiecutter~=1.6.0
aws-sam-translator==1.14.0
aws-sam-translator==1.15.1
docker~=4.0
dateparser~=0.7
python-dateutil~=2.6
Expand Down
2 changes: 1 addition & 1 deletion requirements/isolated.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
arrow==0.15.2
attrs==19.1.0
aws-lambda-builders==0.5.0
aws-sam-translator==1.14.0
aws-sam-translator==1.15.1
binaryornot==0.4.4
boto3==1.9.228
botocore==1.12.228
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ Resources:

- CloudWatchDashboardPolicy: {}

- RekognitionFacesPolicy:
CollectionId: collection
- RekognitionFacesPolicy: {}

- RekognitionLabelsPolicy: {}

Expand Down Expand Up @@ -146,3 +145,9 @@ Resources:

- StepFunctionsExecutionPolicy:
StateMachineName: name

- CodeCommitCrudPolicy:
RepositoryName: name

- CodeCommitReadPolicy:
RepositoryName: name
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ Resources:
type: object
properties:
username:
type: string
type: string
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Resources:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
OpenApiVersion: '3.0.1'
OpenApiVersion: 3.0
Models:
User:
type: object
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Resources:
MyApiWithAuth:
Type: "AWS::Serverless::Api"
Properties:
StageName: Prod
Auth:
ApiKeyRequired: true

MyFunctionWithApiKeyRequiredDefault:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://bucket/key
Handler: index.handler
Runtime: nodejs8.10
Events:
MyApiWithApiKeyRequiredDefault:
Type: Api
Properties:
RestApiId: !Ref MyApiWithAuth
Path: /ApiKeyDefault
Method: get
MyFunctionWithApiKeyRequiredTrue:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://bucket/key
Handler: index.handler
Runtime: nodejs8.10
Events:
MyApiWithApiKeyRequiredTrue:
Type: Api
Properties:
RestApiId: !Ref MyApiWithAuth
Path: /ApiKeyTrue
Method: get
Auth:
ApiKeyRequired: true
MyFunctionWithApiKeyRequiredFalse:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://bucket/key
Handler: index.handler
Runtime: nodejs8.10
Events:
MyApiWithApiKeyRequiredFalse:
Type: Api
Properties:
RestApiId: !Ref MyApiWithAuth
Path: /ApiKeyFalse
Method: get
Auth:
ApiKeyRequired: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Resources:
MyApiWithoutAuth:
Type: "AWS::Serverless::Api"
Properties:
StageName: Prod

MyFunctionWithApiKeyRequired:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://bucket/key
Handler: index.handler
Runtime: nodejs8.10
Events:
MyApiWithApiKeyRequired:
Type: Api
Properties:
RestApiId: !Ref MyApiWithoutAuth
Path: /ApiKeyRequiredTrue
Method: get
Auth:
ApiKeyRequired: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Resources:
MyApiWithoutAuth:
Type: "AWS::Serverless::Api"
Properties:
StageName: Prod
OpenApiVersion: '3.0.1'

MyFunctionWithApiKeyRequired:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://bucket/key
Handler: index.handler
Runtime: nodejs8.10
Events:
MyApiWithApiKeyRequired:
Type: Api
Properties:
RestApiId: !Ref MyApiWithoutAuth
Path: /ApiKeyRequiredTrue
Method: get
Auth:
ApiKeyRequired: true
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Resources:
StageName: Prod
Auth:
DefaultAuthorizer: MyCognitoAuth
ApiKeyRequired: true
Authorizers:
MyCognitoAuth:
UserPoolArn: arn:aws:1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Resources:
OpenApiVersion: '3.0.1'
Auth:
DefaultAuthorizer: MyCognitoAuth
ApiKeyRequired: true
Authorizers:
MyCognitoAuth:
UserPoolArn: arn:aws:1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Globals:
Api:
Auth:
ResourcePolicy:
AwsAccountBlacklist: ['12345']
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: nodejs8.10
Events:
Api:
Type: Api
Properties:
Method: Put
Path: /get
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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: nodejs8.10
Events:
Api:
Type: Api
Properties:
Auth:
ResourcePolicy:
AwsAccountWhitelist: [
"12345"
]
AwsAccountBlacklist: [
"67890"
]
Method: Put
Path: /get
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
Resources:
MyApiWithAwsIamAuthNoCallerCredentials:
Type: "AWS::Serverless::Api"
Properties:
StageName: Prod
Auth:
DefaultAuthorizer: AWS_IAM
InvokeRole: NONE
MyApiWithAwsIamAuth:
Type: "AWS::Serverless::Api"
Properties:
Expand Down Expand Up @@ -84,3 +91,64 @@ Resources:
Auth:
Authorizer: AWS_IAM
InvokeRole: arn:aws:iam::456::role/something-else
MyFunctionNONEInvokeRole:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://bucket/key
Handler: index.handler
Runtime: nodejs8.10
Events:
API3:
Type: Api
Properties:
RestApiId: !Ref MyApiWithAwsIamAuth
Method: get
Path: /MyFunctionNONEInvokeRole
Auth:
Authorizer: AWS_IAM
InvokeRole: NONE
MyFunctionNullInvokeRole:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://bucket/key
Handler: index.handler
Runtime: nodejs8.10
Events:
API3:
Type: Api
Properties:
RestApiId: !Ref MyApiWithAwsIamAuth
Method: get
Path: /MyFunctionNullInvokeRole
Auth:
Authorizer: AWS_IAM
InvokeRole: null
MyFunctionCallerCredentialsOverride:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://bucket/key
Handler: index.handler
Runtime: nodejs8.10
Events:
API3:
Type: Api
Properties:
RestApiId: !Ref MyApiWithAwsIamAuthNoCallerCredentials
Method: get
Path: /
Auth:
Authorizer: AWS_IAM
InvokeRole: CALLER_CREDENTIALS
MyFunctionNoCallerCredentials:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://bucket/key
Handler: index.handler
Runtime: nodejs8.10
Events:
API3:
Type: Api
Properties:
RestApiId: !Ref MyApiWithAwsIamAuthNoCallerCredentials
Method: post
Path: /
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Resources:
MyApiWithAwsIamAuth:
Type: "AWS::Serverless::Api"
Properties:
StageName: Prod
Auth:
DefaultAuthorizer: AWS_IAM

MyFunctionWithAwsIamAuth:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://bucket/key
Handler: index.handler
Runtime: nodejs8.10
Events:
MyApiWithAwsIamAuth:
Type: Api
Properties:
RestApiId: !Ref MyApiWithAwsIamAuth
Path: /
Method: post
MyApiWithNoAuth:
Type: Api
Properties:
RestApiId: !Ref MyApiWithAwsIamAuth
Path: /
Method: get
Auth:
Authorizer: 'NONE'
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Resources:
HyphenFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://sam-demo-bucket/member_portal.zip
Handler: index.gethtml
Runtime: nodejs4.3
Events:
GetHtml:
Type: Api
Properties:
RestApiId: HyphenApi
Path: /
Method: get
RequestModel:
Model: User
Required: true

HyphenApi:
Type: AWS::Serverless::Api
Properties:
StageName: hoge-fuga
Models:
User:
type: object
properties:
username:
type: string

UnderscoreFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://sam-demo-bucket/member_portal.zip
Handler: index.gethtml
Runtime: nodejs4.3
Events:
GetHtml:
Type: Api
Properties:
RestApiId: UnderscoreApi
Path: /
Method: get
RequestModel:
Model: User
Required: true

UnderscoreApi:
Type: AWS::Serverless::Api
Properties:
StageName: hoge_fuga
Models:
User:
type: object
properties:
username:
type: string
Loading

0 comments on commit 0464b27

Please sign in to comment.