Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allow Ref in CompatibleRuntimes property of AWS::Serverless::LayerVersion #1683

Merged
merged 1 commit into from
Aug 21, 2020

Conversation

wchengru
Copy link
Contributor

@wchengru wchengru commented Aug 12, 2020

Issue #, if available:
#809

Description of changes:
Allow intrinsics/objects in property "CompatibleRuntimes".
#810 is not merged since 2019. I created a new one.

Description of how you validated changes:
Updated and verified test cases in TestTranslatorEndToEnd.

Checklist:

  • Write/update tests
  • make pr passes
  • Update documentation
  • Verify transformed template deploys and application functions as expected

Examples?

Please reach out in the comments, if you want to add an example. Examples will be
added to sam init through https://github.com/awslabs/aws-sam-cli-app-templates/

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@wchengru wchengru requested a review from jfuss August 12, 2020 22:20
@codecov-commenter
Copy link

codecov-commenter commented Aug 12, 2020

Codecov Report

Merging #1683 into develop will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #1683   +/-   ##
========================================
  Coverage    94.08%   94.09%           
========================================
  Files           86       86           
  Lines         5414     5418    +4     
  Branches      1082     1084    +2     
========================================
+ Hits          5094     5098    +4     
  Misses         148      148           
  Partials       172      172           
Impacted Files Coverage Δ
samtranslator/model/lambda_.py 93.10% <ø> (ø)
samtranslator/model/sam_resources.py 93.37% <ø> (ø)
samtranslator/model/apigateway.py 97.12% <0.00%> (+0.02%) ⬆️
samtranslator/model/apigatewayv2.py 94.28% <0.00%> (+0.34%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 39be0a6...a403d00. Read the comment docs.

@wchengru wchengru marked this pull request as draft August 12, 2020 23:32
@wchengru wchengru marked this pull request as ready for review August 13, 2020 18:04
@@ -66,7 +66,7 @@ class SamFunction(SamResourceMacro):
"VpcConfig": PropertyType(False, is_type(dict)),
"Role": PropertyType(False, is_str()),
"AssumeRolePolicyDocument": PropertyType(False, is_type(dict)),
"Policies": PropertyType(False, one_of(is_str(), list_of(one_of(is_str(), is_type(dict), is_type(dict))))),
"Policies": PropertyType(False, one_of(is_str(), is_type(dict), list_of(one_of(is_str(), is_type(dict))))),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Is this just a reorder? It is hard to tell from the diff.

Copy link
Contributor Author

@wchengru wchengru Aug 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a typo inside one_of(is_str(), is_type(dict), is_type(dict)). Two repeated is_type(dict) are meaningless. I checked property "Policies" in AWS::Serverless::Function, the acceptable type is String | List | Map, so this property should be one of the three types: is_str(), is_type(dict), or list of one_of(is_str(), is_type(dict)). I moved out the extra is_type(dict) to let it also allow maps.

@jfuss jfuss merged commit ed2f24e into aws:develop Aug 21, 2020
hawflau added a commit to hawflau/serverless-application-model that referenced this pull request Nov 5, 2020
* docs: fix link to all_policy_templates example file (aws#1682)

* fix: Enhance CompatibleRuntimes property of AWS::Serverless::LayerVersion (aws#1683)

* Adding Tracing property to State Machine resource (aws#1697)

* Step Functions: Adding support for X-Ray tracing

* Renaming TracingConfiguration to Tracing

Co-authored-by: Vaib Suri <surivaib@amazon.com>

* add new arguments to allow vpc/vpce endpoints as intrinsics (aws#1689)

* add new arguments to allow vpc/vpce endpoints as intrinsics

* Add more unit tests

* Add more test cases, and code changes according to comments.

* Fix: Updated Slack Invite Link (aws#1712)

* Updated Slack Invite Link

* Restricted jsonschema to Python 2

* Forced pyrsistent to 0.16 in Python 2

* Reverted Changes to enum34

* Merge master back to develop (aws#1734)

* Release v1.26.0 (aws#1680)

* feat: add support for VPCEndpointIds in EndpointConfiguration

* fix: update formatting with black

* docs: update 2016-10-31.md

* docs: added api endpointconfiguration example

* docs: make example more generic

* fix: remove nested EndpointConfiguration types from output

* fix: only allow one EndpointConfiguration Type

* doc: update example to reflect only allowing one EndpointConfiguration
Type

* fix : missing UserPool properties (aws#1506) (aws#1581)

* fix: resource policy generation for {path+} (aws#1580)

* refactor: Remove 2016-10-31 examples

* update PR template

* adjust pr template

* Adding authorization scopes as list validation in ApiGatewayAuthorizer (v1 and v2). (aws#1670)

* Adding authorization scopes as list validation in ApiGatewayAuthorizer and ApiGatewayV2Authorizer.

* make black.

* Adding functional test for invalid auth scope.

* adding error condition for invalid test.

* removing test template file.

* feat: MSK event type support for AWS::Serverless::Function (aws#52)

Co-authored-by: Steve Brown <steve@fabric.com>
Co-authored-by: jtaylor00 <joetaylor00@gmail.com>
Co-authored-by: Jacob Fuss <jfuss@users.noreply.github.com>
Co-authored-by: Alex Wood <awood45@gmail.com>
Co-authored-by: Tarun <c2tarun@users.noreply.github.com>

* Update __init__.py (aws#1704)

* Release/v1.27.0 resolveconflict (aws#1717)

* Release v1.26.0 (aws#1680)

* feat: add support for VPCEndpointIds in EndpointConfiguration

* fix: update formatting with black

* docs: update 2016-10-31.md

* docs: added api endpointconfiguration example

* docs: make example more generic

* fix: remove nested EndpointConfiguration types from output

* fix: only allow one EndpointConfiguration Type

* doc: update example to reflect only allowing one EndpointConfiguration
Type

* fix : missing UserPool properties (aws#1506) (aws#1581)

* fix: resource policy generation for {path+} (aws#1580)

* refactor: Remove 2016-10-31 examples

* update PR template

* adjust pr template

* Adding authorization scopes as list validation in ApiGatewayAuthorizer (v1 and v2). (aws#1670)

* Adding authorization scopes as list validation in ApiGatewayAuthorizer and ApiGatewayV2Authorizer.

* make black.

* Adding functional test for invalid auth scope.

* adding error condition for invalid test.

* removing test template file.

* feat: MSK event type support for AWS::Serverless::Function (aws#52)

Co-authored-by: Steve Brown <steve@fabric.com>
Co-authored-by: jtaylor00 <joetaylor00@gmail.com>
Co-authored-by: Jacob Fuss <jfuss@users.noreply.github.com>
Co-authored-by: Alex Wood <awood45@gmail.com>
Co-authored-by: Tarun <c2tarun@users.noreply.github.com>

* Fix: Updated Slack Invite Link (aws#1712)

* Updated Slack Invite Link

* Restricted jsonschema to Python 2

* Forced pyrsistent to 0.16 in Python 2

* Reverted Changes to enum34

Co-authored-by: Sriram Madapusi Vasudevan <3770774+sriram-mv@users.noreply.github.com>
Co-authored-by: Steve Brown <steve@fabric.com>
Co-authored-by: jtaylor00 <joetaylor00@gmail.com>
Co-authored-by: Jacob Fuss <jfuss@users.noreply.github.com>
Co-authored-by: Alex Wood <awood45@gmail.com>
Co-authored-by: Tarun <c2tarun@users.noreply.github.com>
Co-authored-by: Cosh_ <CoshUS@users.noreply.github.com>

Co-authored-by: Sriram Madapusi Vasudevan <3770774+sriram-mv@users.noreply.github.com>
Co-authored-by: Steve Brown <steve@fabric.com>
Co-authored-by: jtaylor00 <joetaylor00@gmail.com>
Co-authored-by: Jacob Fuss <jfuss@users.noreply.github.com>
Co-authored-by: Alex Wood <awood45@gmail.com>
Co-authored-by: Tarun <c2tarun@users.noreply.github.com>
Co-authored-by: Mehmet Nuri Deveci <5735811+mndeveci@users.noreply.github.com>
Co-authored-by: Cosh_ <CoshUS@users.noreply.github.com>

* Lambdaauth (aws#1733)

* Add support for Lambda Authorizers in HttpAPI

* Address comments and fix formatting

* fix version

* Validate input parameters. Update tests

* black reformat

Co-authored-by: Raymond Wang <14915548+wchengru@users.noreply.github.com>

* Feature toggle (aws#1737)

* Adding logic to pipe app config providers. Unit test pending

* Adding some documentation to config providers.

* Adding some unit tests and making black ignore json files.

* minor cleanup.

* Addressing PR comments.

* feature: Support MTLS auth properties in REST and HTTP API domain names (aws#1725)

* feature: Support MTLS auth properties in REST and HTTP API domain names

* fix unicode != str issue in py2.7

* add SecurityPolicy because default RESTAPI is using TLS1.0

* Add new property DisableExecuteApiEndpoint

* black reformat

* Address comments

* Add tests on invalid templates

* address test failures in py2.7

* restart travis tests

* fix: adding support for passing target id to EventBridgeRule (aws#1747)

* Manage black version using requirement file (aws#1748)

* chore: Manage black version in dev.txt

- config pre-commit
- config development guide
- config travis

Refer to the commit below in aws-sam-cli
aws/aws-sam-cli@d725db5fbfc698a9f0c7582

* Format using black 20.8b1

* Opt-out black fron dev.txt for Python 2

Co-authored-by: Patrick Greenwell <patrickgreenwell@users.noreply.github.com>
Co-authored-by: Raymond Wang <14915548+wchengru@users.noreply.github.com>
Co-authored-by: vaib-amz <55562387+vaib-amz@users.noreply.github.com>
Co-authored-by: Vaib Suri <surivaib@amazon.com>
Co-authored-by: Cosh_ <CoshUS@users.noreply.github.com>
Co-authored-by: Sriram Madapusi Vasudevan <3770774+sriram-mv@users.noreply.github.com>
Co-authored-by: Steve Brown <steve@fabric.com>
Co-authored-by: jtaylor00 <joetaylor00@gmail.com>
Co-authored-by: Jacob Fuss <jfuss@users.noreply.github.com>
Co-authored-by: Alex Wood <awood45@gmail.com>
Co-authored-by: Tarun <c2tarun@users.noreply.github.com>
Co-authored-by: Mehmet Nuri Deveci <5735811+mndeveci@users.noreply.github.com>
Co-authored-by: Tolledo <ps.tolledo@gmail.com>
Co-authored-by: _sam <3804518+aahung@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants