Skip to content

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

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

[v2] Add ability to get values from properties in subsections#10112
kdaily wants to merge 1 commit 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?

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

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