Skip to content

Commit

Permalink
feat: add ReservedConcurrentExecutions to globals (#808)
Browse files Browse the repository at this point in the history
  • Loading branch information
merzwilliam authored and jlhood committed Mar 22, 2019
1 parent 3442906 commit 0fc2ca6
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/globals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Currently, the following resources and properties are being supported:
AutoPublishAlias:
DeploymentPreference:
PermissionsBoundary:
ReservedConcurrentExecutions:
Api:
# Properties of AWS::Serverless::Api
Expand Down
3 changes: 2 additions & 1 deletion samtranslator/plugins/globals/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class Globals(object):
"AutoPublishAlias",
"Layers",
"DeploymentPreference",
"PermissionsBoundary"
"PermissionsBoundary",
"ReservedConcurrentExecutions"
],

# Everything except
Expand Down
2 changes: 2 additions & 0 deletions tests/translator/input/globals_for_function.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Globals:
PermissionsBoundary: arn:aws:1234:iam:boundary/CustomerCreatedPermissionsBoundary
Layers:
- !Sub arn:${AWS:Partition}:lambda:${AWS:Region}:${AWS:AccountId}:layer:MyLayer:1
ReservedConcurrentExecutions: 50

Resources:
MinimalFunction:
Expand All @@ -45,4 +46,5 @@ Resources:
PermissionsBoundary: arn:aws:1234:iam:boundary/OverridePermissionsBoundary
Layers:
- !Sub arn:${AWS:Partition}:lambda:${AWS:Region}:${AWS:AccountId}:layer:MyLayer2:2
ReservedConcurrentExecutions: 100

2 changes: 2 additions & 0 deletions tests/translator/output/aws-cn/globals_for_function.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
}
],
"MemorySize": 512,
"ReservedConcurrentExecutions": 100,
"Environment": {
"Variables": {
"Var1": "value1",
Expand Down Expand Up @@ -146,6 +147,7 @@
}
],
"MemorySize": 1024,
"ReservedConcurrentExecutions": 50,
"Environment": {
"Variables": {
"Var1": "value1",
Expand Down
2 changes: 2 additions & 0 deletions tests/translator/output/aws-us-gov/globals_for_function.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
}
],
"MemorySize": 512,
"ReservedConcurrentExecutions": 100,
"Environment": {
"Variables": {
"Var1": "value1",
Expand Down Expand Up @@ -146,6 +147,7 @@
}
],
"MemorySize": 1024,
"ReservedConcurrentExecutions": 50,
"Environment": {
"Variables": {
"Var1": "value1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"errors": [
{
"errorMessage": "'Globals' section is invalid. 'SomeKey' is not a supported property of 'Function'. Must be one of the following values - ['Handler', 'Runtime', 'CodeUri', 'DeadLetterQueue', 'Description', 'MemorySize', 'Timeout', 'VpcConfig', 'Environment', 'Tags', 'Tracing', 'KmsKeyArn', 'AutoPublishAlias', 'Layers', 'DeploymentPreference', 'PermissionsBoundary']"
"errorMessage": "'Globals' section is invalid. 'SomeKey' is not a supported property of 'Function'. Must be one of the following values - ['Handler', 'Runtime', 'CodeUri', 'DeadLetterQueue', 'Description', 'MemorySize', 'Timeout', 'VpcConfig', 'Environment', 'Tags', 'Tracing', 'KmsKeyArn', 'AutoPublishAlias', 'Layers', 'DeploymentPreference', 'PermissionsBoundary', 'ReservedConcurrentExecutions']"
}
],
"errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 1. 'Globals' section is invalid. 'SomeKey' is not a supported property of 'Function'. Must be one of the following values - ['Handler', 'Runtime', 'CodeUri', 'DeadLetterQueue', 'Description', 'MemorySize', 'Timeout', 'VpcConfig', 'Environment', 'Tags', 'Tracing', 'KmsKeyArn', 'AutoPublishAlias', 'Layers', 'DeploymentPreference', 'PermissionsBoundary']"
"errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 1. 'Globals' section is invalid. 'SomeKey' is not a supported property of 'Function'. Must be one of the following values - ['Handler', 'Runtime', 'CodeUri', 'DeadLetterQueue', 'Description', 'MemorySize', 'Timeout', 'VpcConfig', 'Environment', 'Tags', 'Tracing', 'KmsKeyArn', 'AutoPublishAlias', 'Layers', 'DeploymentPreference', 'PermissionsBoundary', 'ReservedConcurrentExecutions']"
}
2 changes: 2 additions & 0 deletions tests/translator/output/globals_for_function.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
}
],
"MemorySize": 512,
"ReservedConcurrentExecutions": 100,
"Environment": {
"Variables": {
"Var1": "value1",
Expand Down Expand Up @@ -146,6 +147,7 @@
}
],
"MemorySize": 1024,
"ReservedConcurrentExecutions": 50,
"Environment": {
"Variables": {
"Var1": "value1",
Expand Down

0 comments on commit 0fc2ca6

Please sign in to comment.