Integrate identity chain into SDK client construction - #771
Conversation
| profile_name = None | ||
| if config_context is not None: | ||
| config_file = await config_context.parsed_profiles() | ||
| profile_name = config_context.profile_name |
There was a problem hiding this comment.
Flagging from #773 (comment):
Here the generated setup passes config_context.profile_name into IdentityChain.create(), but the context's profile_name is never None: it falls back to AWS_PROFILE, then "default". See
smithy-python/packages/smithy-aws-core/src/smithy_aws_core/config/context.py
Lines 184 to 201 in c0150aa
But #773's environment provider defers whenever profile_name is not None, so once both PRs land, a user with only env credentials and no profile configured would still get the environment provider skipped.
We should update this PR to pass the profile only when it comes from the explicit argument.
There was a problem hiding this comment.
Added in c5498f2. Needed to improve how we track the profile source to avoid weak string comparisons. They now use ConfigSource.
Chose not to make profile a config field since it's not a request lifecycle setting. The profile name mainly influences config resolution so the resolution context is the proper layer for it.
c5498f2 to
5b44739
Compare
Description
This PR integrates the new
IdentityChaininto generated AWS clients. A newAwsIdentityIntegrationbuilds the default chain intoaws_credentials_identity_resolverat client setup.The integration also pins the identity resolver in the config's deep-copy memo (
{id(resolver): resolver}) so it's shared by reference. Every operation deep-copies the config to isolate per-call plugin mutations, which would otherwise duplicate the resolver on each call; pinning it keeps the chain built once per client and reused across every operation.Important
This branch builds on top of #758. Only the latest commit is the change under review here. Every earlier commit belongs to #758.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.