Skip to content

Commit 4bec81e

Browse files
hawflaupatrickgreenwellwchengruvaib-amzVaib Suri
authored
Update changes from public (aws#61)
* 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 <[email protected]> * 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 <[email protected]> Co-authored-by: jtaylor00 <[email protected]> Co-authored-by: Jacob Fuss <[email protected]> Co-authored-by: Alex Wood <[email protected]> Co-authored-by: Tarun <[email protected]> * 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 <[email protected]> Co-authored-by: jtaylor00 <[email protected]> Co-authored-by: Jacob Fuss <[email protected]> Co-authored-by: Alex Wood <[email protected]> Co-authored-by: Tarun <[email protected]> * 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 <[email protected]> Co-authored-by: Steve Brown <[email protected]> Co-authored-by: jtaylor00 <[email protected]> Co-authored-by: Jacob Fuss <[email protected]> Co-authored-by: Alex Wood <[email protected]> Co-authored-by: Tarun <[email protected]> Co-authored-by: Cosh_ <[email protected]> Co-authored-by: Sriram Madapusi Vasudevan <[email protected]> Co-authored-by: Steve Brown <[email protected]> Co-authored-by: jtaylor00 <[email protected]> Co-authored-by: Jacob Fuss <[email protected]> Co-authored-by: Alex Wood <[email protected]> Co-authored-by: Tarun <[email protected]> Co-authored-by: Mehmet Nuri Deveci <[email protected]> Co-authored-by: Cosh_ <[email protected]> * 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 <[email protected]> * 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 <[email protected]> Co-authored-by: Raymond Wang <[email protected]> Co-authored-by: vaib-amz <[email protected]> Co-authored-by: Vaib Suri <[email protected]> Co-authored-by: Cosh_ <[email protected]> Co-authored-by: Sriram Madapusi Vasudevan <[email protected]> Co-authored-by: Steve Brown <[email protected]> Co-authored-by: jtaylor00 <[email protected]> Co-authored-by: Jacob Fuss <[email protected]> Co-authored-by: Alex Wood <[email protected]> Co-authored-by: Tarun <[email protected]> Co-authored-by: Mehmet Nuri Deveci <[email protected]> Co-authored-by: Tolledo <[email protected]> Co-authored-by: _sam <[email protected]>
1 parent 90a2f7d commit 4bec81e

File tree

83 files changed

+3368
-184
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+3368
-184
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
# https://pre-commit.com/#repository-local-hooks
12
repos:
2-
- repo: https://github.com/python/black
3-
rev: 19.3b0
4-
hooks:
5-
- id: black
6-
language_version: python3
7-
exclude_types: ['markdown', 'ini', 'toml', 'rst']
3+
- repo: local
4+
hooks:
5+
- id: black
6+
name: black
7+
entry: black
8+
language: system
9+
types: [python]
10+

.travis.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ matrix:
2121

2222
install:
2323
# Install the code requirements
24-
- mkdir $HOME/bin-black
25-
- wget -O $HOME/bin-black/black https://github.com/python/black/releases/download/19.10b0/black
26-
- chmod +x $HOME/bin-black/black
27-
- export PATH=$PATH:$HOME/bin-black
28-
- black --version
29-
3024
- make init
3125

3226
# Install Docs requirements

DEVELOPMENT_GUIDE.rst

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,44 @@ Setup Python locally using `pyenv`_
2828

2929
2. Install Additional Tooling
3030
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31-
1. Black
32-
~~~~~~~~
31+
Black
32+
'''''
3333
We format our code using `Black`_ and verify the source code is black compliant
34-
in Appveyor during PRs. You can find installation instructions on `Black's docs`_.
34+
in Appveyor during PRs. Black will be installed automatically with ``make init``.
3535

36-
After installing, you can check your formatting through our Makefile by running `make black-check`. To automatically update your code to match our formatting, please run `make black`. You can also integrate Black directly in your favorite IDE (instructions
37-
can be found `here`_)
36+
After installing, you can run our formatting through our Makefile by
37+
``make black`` or integrating Black directly in your favorite IDE
38+
(instructions can be found `here <https://black.readthedocs.io/en/stable/editor_integration.html>`__)
39+
40+
(workaround) Integrating Black directly in your favorite IDE
41+
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
42+
43+
Since black is installed in virtualenv, when you follow `this
44+
instruction <https://black.readthedocs.io/en/stable/editor_integration.html>`__,
45+
``which black`` might give you this
46+
47+
::
48+
49+
(samtranslator37) $ where black
50+
/Users/<username>/.pyenv/shims/black
51+
52+
However, IDEs such as PyCharm (using FileWatcher) will have a hard time
53+
invoking ``/Users/<username>/.pyenv/shims/black`` and this will happen:
54+
55+
::
56+
57+
pyenv: black: command not found
58+
59+
The `black' command exists in these Python versions:
60+
3.7.2/envs/samtranslator37
61+
samtranslator37
62+
63+
A simple workaround is to use
64+
``/Users/<username>/.pyenv/versions/samtranslator37/bin/black`` instead of
65+
``/Users/<username>/.pyenv/shims/black``.
3866

3967
Pre-commit
40-
~~~~~~~~~~
68+
''''''''''
4169
If you don't wish to manually run black on each pr or install black manually, we have integrated black into git hooks through `pre-commit`_.
4270
After installing pre-commit, run `pre-commit install` in the root of the project. This will install black for you and run the black formatting on
4371
commit.

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@ test:
99
pytest --cov samtranslator --cov-report term-missing --cov-fail-under 95 tests
1010

1111
black:
12-
black setup.py samtranslator/* tests/* bin/*
12+
black setup.py samtranslator/* tests/* bin/*.py
1313

1414
black-check:
15-
black --check setup.py samtranslator/* tests/* bin/*
15+
black --check setup.py samtranslator/* tests/* bin/*.py
1616

1717
# Command to run everytime you make changes to verify everything works
1818
dev: test
1919

2020
# Verifications to run before sending a pull request
2121
pr: black-check init dev
2222

23+
# Verifications to run before sending a pull request, skipping black check because black requires Python 3.6+
24+
pr2.7: init dev
25+
2326
define HELP_MESSAGE
2427

2528
Usage: $ make [TARGETS]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Read the [SAM Documentation Contribution Guide](https://github.com/awsdocs/aws-s
8787
started.
8888

8989
### Join the SAM Community on Slack
90-
[Join the SAM developers channel (#samdev)](https://join.slack.com/t/awsdevelopers/shared_invite/enQtMzg3NTc5OTM2MzcxLTIxNjc0ZTJkNmYyNWY3OWE4NTFiNzU1ZTM2Y2VkNmFlNjQ2YjI3YTE1ZDA5YjE5NDE2MjVmYWFlYWIxNjE2NjU) on Slack to collaborate with fellow community members and the AWS SAM team.
90+
[Join the SAM developers channel (#samdev)](https://join.slack.com/t/awsdevelopers/shared_invite/zt-h82odes6-qYN2Cxit7hBGIvC6oMjGpg) on Slack to collaborate with fellow community members and the AWS SAM team.
9191

9292

9393

bin/sam-translate.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from samtranslator.translator.transform import transform
3636
from samtranslator.yaml_helper import yaml_parse
3737
from samtranslator.model.exceptions import InvalidDocumentException
38+
from samtranslator.feature_toggle.feature_toggle import FeatureToggleLocalConfigProvider, FeatureToggle
3839

3940
LOG = logging.getLogger(__name__)
4041
cli_options = docopt(__doc__)
@@ -95,7 +96,12 @@ def transform_template(input_file_path, output_file_path):
9596
sam_template = yaml_parse(f)
9697

9798
try:
98-
cloud_formation_template = transform(sam_template, {}, ManagedPolicyLoader(iam_client))
99+
feature_toggle = FeatureToggle(
100+
FeatureToggleLocalConfigProvider(
101+
os.path.join(my_path, "..", "tests", "feature_toggle", "input", "feature_toggle_config.json")
102+
)
103+
)
104+
cloud_formation_template = transform(sam_template, {}, ManagedPolicyLoader(iam_client), feature_toggle)
99105
cloud_formation_template_prettified = json.dumps(cloud_formation_template, indent=2)
100106

101107
with open(output_file_path, "w") as f:

docs/policy_templates.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ folder.
7474
- CloudWatchPutMetricPolicy: {}
7575
7676
.. _policy_templates.json: https://github.com/awslabs/serverless-application-model/blob/develop/samtranslator/policy_templates_data/policy_templates.json
77-
.. _all_policy_templates.yaml: https://github.com/awslabs/serverless-application-model/blob/develop/examples/2016-10-31/policy_templates/all_policy_templates.yaml
77+
.. _all_policy_templates.yaml: https://github.com/awslabs/serverless-application-model/blob/develop/tests/translator/input/all_policy_templates.yaml

requirements/base.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
pyrsistent~=0.16.0; python_version<"3"
12
boto3~=1.5
23
enum34~=1.1; python_version<"3.4"
34
jsonschema~=3.0

requirements/dev.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ requests>=2.20.0
1515

1616
# CLI requirements
1717
docopt>=0.6.2
18+
19+
# formatter
20+
black==20.8b1; python_version >= '3.6'

samtranslator/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.26.0"
1+
__version__ = "1.27.0"

0 commit comments

Comments
 (0)