Skip to content

[v2] Add ability to set properties in subsections#10109

Open
kdaily wants to merge 1 commit intofeature-configure-subsectionsfrom
add-configure-set-subsections
Open

[v2] Add ability to set properties in subsections#10109
kdaily wants to merge 1 commit intofeature-configure-subsectionsfrom
add-configure-set-subsections

Conversation

@kdaily
Copy link
Member

@kdaily kdaily commented Feb 26, 2026

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.

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.

Comment on lines 69 to 71
# Validate mutual exclusivity of sub-section type parameters
groups = [[param] for param in SUBSECTION_TYPE_ALLOWLIST.values()]
validate_mutually_exclusive(args, *groups)
Copy link
Member Author

Choose a reason for hiding this comment

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

Usually, mutually exclusive parameter validation is done through an event handler. Example:

event_handler.register(
'operation-args-parsed.cloudfront.create-invalidation',
validate_mutually_exclusive_handler(['invalidation_batch'], ['paths']),
)

This uses the operation-args-parsed event in clidriver.ServiceOperation:

event = f'operation-args-parsed.{self._parent_name}.{self._name}'

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:


def get_subsection_from_args(args):
# Validate mutual exclusivity of sub-section type parameters
groups = [[param] for param in SUBSECTION_TYPE_ALLOWLIST.values()]
Copy link
Member Author

Choose a reason for hiding this comment

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

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.

@kdaily kdaily force-pushed the add-configure-set-subsections branch 2 times, most recently from 4aa4c78 to 7eddac8 Compare February 26, 2026 22:41
@kdaily kdaily marked this pull request as draft February 27, 2026 17:26
@kdaily kdaily force-pushed the add-configure-set-subsections branch from 7eddac8 to dc2611d Compare February 27, 2026 17:49
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`.
@kdaily kdaily force-pushed the add-configure-set-subsections branch from dc2611d to 3360369 Compare February 27, 2026 17:56
@kdaily kdaily marked this pull request as ready for review February 27, 2026 18:08
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.

1 participant