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

[V2] Enable support for loading files into nested parameters #9012

Merged
merged 27 commits into from
Nov 12, 2024

Conversation

aemous
Copy link
Contributor

@aemous aemous commented Oct 25, 2024

Related Issues:

Description of changes:

  • Enable support for loading files into nested parameters via usage of file:// or fileb:// prefix.

Description of tests:

  • Added unit test cases to ensure the parser works against the expected grammar updates.
  • Added a test suite to verify that the parser correctly loads contents from local files as expected.
  • Ran and passed all existing and new tests.
  • Manually tested the feature via self-crafted input.

Usage Example:
For example, suppose there is a file named tagval.txt located at path/to/tagval.txt on the host machine with contents TagValue.

aws codecommit tag-resource --resource-arn <RESOURCE_ARN> --tags TagKey@=file://path/to/tagval.txt

The above command will parse the tags parameter as "tags": {"TagKey": "TagValue"}}. Notice the need for the assignment operator @=. This operator is required to prevent breaking existing customers that may be using a nested parameter value that happens to start with file:// already.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

awscli/shorthand.py Outdated Show resolved Hide resolved
awscli/shorthand.py Outdated Show resolved Hide resolved
Copy link
Contributor

@hssyoo hssyoo left a comment

Choose a reason for hiding this comment

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

I only had time to review the implementation for parsing the @= operator. I should be able to take a look at the implementation for quoted keys, tests, and the questions you had later this week.

Moving forward, we should try to cut separate PRs targeting a feature branch when implementing multiple features. IMO, support for shorthand paramfiles and quoted keys are related, but distinct features.

awscli/shorthand.py Outdated Show resolved Hide resolved
@aemous aemous force-pushed the v2-nested-params-file-quoted-keys branch 2 times, most recently from 85eba4d to 88e1f9c Compare October 31, 2024 14:11
.changes/next-release/feature-shorthand-14127.json Outdated Show resolved Hide resolved
awscli/shorthand.py Outdated Show resolved Hide resolved
awscli/shorthand.py Outdated Show resolved Hide resolved
awscli/shorthand.py Outdated Show resolved Hide resolved
awscli/shorthand.py Show resolved Hide resolved
awscli/shorthand.py Outdated Show resolved Hide resolved
awscli/shorthand.py Outdated Show resolved Hide resolved
awscli/paramfile.py Show resolved Hide resolved
awscli/shorthand.py Outdated Show resolved Hide resolved
tests/unit/test_shorthand.py Outdated Show resolved Hide resolved
@aemous aemous force-pushed the v2-nested-params-file-quoted-keys branch from bec8cf7 to ddacb06 Compare November 7, 2024 15:15
@@ -15,8 +15,7 @@
import copy

from awscli.compat import compat_open
from awscli.argprocess import ParamError

from awscli import argprocess
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reviewer, this change was made to avoid a circular import error.

awscli/shorthand.py Outdated Show resolved Hide resolved
awscli/shorthand.py Outdated Show resolved Hide resolved
tests/unit/test_shorthand.py Show resolved Hide resolved
@aemous aemous force-pushed the v2-nested-params-file-quoted-keys branch from b6339ce to 9d0e256 Compare November 7, 2024 21:21
@aemous aemous requested a review from hssyoo November 8, 2024 14:17
@aemous aemous force-pushed the v2-nested-params-file-quoted-keys branch from 9d0e256 to 53aa7d5 Compare November 8, 2024 16:04
tests/unit/test_shorthand.py Outdated Show resolved Hide resolved
awscli/shorthand.py Outdated Show resolved Hide resolved
@aemous aemous requested a review from hssyoo November 8, 2024 17:48
awscli/shorthand.py Outdated Show resolved Hide resolved
tests/unit/test_shorthand.py Show resolved Hide resolved
@aemous aemous merged commit d855090 into aws:v2 Nov 12, 2024
45 checks passed
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.

2 participants