Skip to content

[v2] Add ability to get values from properties in subsections#10112

Draft
kdaily wants to merge 5 commits intofeature-configure-subsectionsfrom
add-configure-get-subsections
Draft

[v2] Add ability to get values from properties in subsections#10112
kdaily wants to merge 5 commits intofeature-configure-subsectionsfrom
add-configure-get-subsections

Conversation

@kdaily
Copy link
Member

@kdaily kdaily commented Feb 27, 2026

Issue #, if available:

Continuation of #10109.

Description of changes:

This change adds new parameters to the aws configure get command to specify a sub-section for getting the value of 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 get command:

aws configure get
  --<sub-section-type> <sub-section-name> \
  <property>

For example, the following command should get the property sso_region from the sso-session sub-section named my-sso-session:

aws configure get --sso-session my-sso-session sso_region 

Following is an example getting a nested property in a sub-section:

aws configure get \
  --<sub-section-type> <sub-section-name> \
  <nested-section>.<property>

The only sub-section types allowed are services and sso-session.

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

@AndrewAsseily AndrewAsseily requested a review from ashovlin March 2, 2026 19:44
Copy link
Member

@ashovlin ashovlin left a comment

Choose a reason for hiding this comment

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

Could we also add an example or two for get?

# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
import re
Copy link
Member

Choose a reason for hiding this comment

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

Don't see usage of this in the diff?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in faa74d8

else:
return None
else:
return section_config.get(varname)
Copy link
Member

Choose a reason for hiding this comment

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

aws configure get --sso-session non-existent sso_region        

'NoneType' object has no attribute 'get'

Can we throw a nicer error when the sub-section doesn't exist? And expand the test for this case to check more than exit code?

Something like we do for profiles?

aws configure get region --profile non-existent

The config profile (non-existent) could not be found

Copy link
Member Author

@kdaily kdaily Mar 17, 2026

Choose a reason for hiding this comment

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

Fixed in 43c73ba

kdaily added 3 commits March 16, 2026 14:05
Rename and add more test cases to cover non-exsistent subsections and nested properties.
@kdaily
Copy link
Member Author

kdaily commented Mar 17, 2026

Could we also add an example or two for get?

Addressed in 4574a20

@kdaily kdaily requested a review from ashovlin March 17, 2026 19:23
@kdaily kdaily marked this pull request as draft March 17, 2026 19:25
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