[v2] Add ability to set properties in subsections#10109
[v2] Add ability to set properties in subsections#10109kdaily wants to merge 1 commit intofeature-configure-subsectionsfrom
Conversation
| # Validate mutual exclusivity of sub-section type parameters | ||
| groups = [[param] for param in SUBSECTION_TYPE_ALLOWLIST.values()] | ||
| validate_mutually_exclusive(args, *groups) |
There was a problem hiding this comment.
Usually, mutually exclusive parameter validation is done through an event handler. Example:
aws-cli/awscli/customizations/cloudfront.py
Lines 35 to 38 in 9fcb197
This uses the operation-args-parsed event in clidriver.ServiceOperation:
Line 849 in 9fcb197
However, the classes here do not have an event registered anywhere near where parameter arg-parsing is performed. We could register a new event, if its thought that this is too deep in the stack for performing this check. This is where it would need to go:
aws-cli/awscli/customizations/commands.py
Line 158 in 9fcb197
|
|
||
| def get_subsection_from_args(args): | ||
| # Validate mutual exclusivity of sub-section type parameters | ||
| groups = [[param] for param in SUBSECTION_TYPE_ALLOWLIST.values()] |
There was a problem hiding this comment.
Initially, I had proposed that mutual exclusivity also account for --profile. Unfortunately, profile resolution happens before, and we've lost any context of where the user set the profile.
4aa4c78 to
7eddac8
Compare
7eddac8 to
dc2611d
Compare
This change adds new parameters to the `aws configure set`` command to specify a sub-section for setting a property. These parameters are analogous to the existing `--profile` parameter. A parameter will be added for each sub-section type and take a value of the subsection name. Following is the generic pattern for the `aws configure set` command: ``` aws configure set --<sub-section-type> <sub-section-name> \ <property> <value> ``` For example, the following command should set the property `sso_region` to the value `us-west-2` in the `sso-session` sub-section named `my-sso-session`: ``` aws configure set --sso-session my-sso-session \ sso_region us-west-2 ``` Following is an example setting a nested property in a sub-section: ``` aws configure set \ --<sub-section-type> <sub-section-name> \ <nested-section>.<property> value ``` The only sub-section types allowed are `services` and `sso-session`.
dc2611d to
3360369
Compare
This change adds new parameters to the
aws configure setcommand to specify a sub-section for setting a property. These parameters are analogous to the existing--profileparameter. A parameter will be added for each sub-section type and take a value of the subsection name. Following is the generic pattern for theaws configure setcommand:For example, the following command should set the property
sso_regionto the valueus-west-2in thesso-sessionsub-section namedmy-sso-session:Following is an example setting a nested property in a sub-section:
The only sub-section types allowed are
servicesandsso-session.Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.