-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add NoCredentialsCache
that offers no caching ability
#2720
Conversation
This commit updates `SsoCredentialsProvider`, `AssumeRoleProvider`, and `WebIdentityTokenCredentialsProvider` to use `NoCredentialsCache` for an internal STS client to fetch credentials. They used `LazyCredentialsCache` internally for STS, which caused double-caching when they were wrapped in an outer `LazyCredentialsCache` when a service client was created.
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
did not closely review PR–I think I prefer something like |
Yeah, naming is hard. I unnecessarily tried sticking to UPDATE: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
A new generated diff is ready to view.
A new doc preview is ready to view. |
Related to awslabs/aws-sdk-rust#809 It has been discovered that when `AssumeRoleProvider` is used, the Rust SDK emits `credentials cache miss occurred` twice per request. The reason why that log is shown twice is illustrated in the following diagram: ![Screenshot 2023-05-19 at 4 10 20 PM](https://github.com/awslabs/smithy-rs/assets/15333866/c6cce018-c821-4b46-8d47-b414af7b4d1e) One of the cache miss messages is due to the fact `AssumeRoleProvider` internally uses an STS client, which, in turn, is wrapped by a `LazyCredentialsCache` by default. However, that use of `LazyCredentialsCache` is pointless because caching is already in effect with the outermost `LazyCredentialsCache`. This PR adds a new kind of `CredentialsCache`, `NoCredentialsCache`. As its name suggests, it simplify delegates `provide_cached_credentials` to the underlying provider's `provide_credentials` with no caching functionality. We then update `SsoCredentialsProvider`, `AssumeRoleProvider`, and `WebIdentityTokenCredentialsProvider` to use `NoCredentialsCache` for their STS clients so the logs won't show `credentials cache miss occurred` twice per request. - Added unit tests for `NoCredentialsCache` - Updated unit test for `AssumeRoleProvider` to verify `NoCredentialsCache` is used by default - [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._ --------- Co-authored-by: Yuki Saito <[email protected]>
Motivation and Context
Related to awslabs/aws-sdk-rust#809
Description
It has been discovered that when
AssumeRoleProvider
is used, the Rust SDK emitscredentials cache miss occurred
twice per request. The reason why that log is shown twice is illustrated in the following diagram:One of the cache miss messages is due to the fact
AssumeRoleProvider
internally uses an STS client, which, in turn, is wrapped by aLazyCredentialsCache
by default. However, that use ofLazyCredentialsCache
is pointless because caching is already in effect with the outermostLazyCredentialsCache
.This PR adds a new kind of
CredentialsCache
,NoCredentialsCache
. As its name suggests, it simplify delegatesprovide_cached_credentials
to the underlying provider'sprovide_credentials
with no caching functionality. We then updateSsoCredentialsProvider
,AssumeRoleProvider
, andWebIdentityTokenCredentialsProvider
to useNoCredentialsCache
for their STS clients so the logs won't showcredentials cache miss occurred
twice per request.Testing
NoCredentialsCache
AssumeRoleProvider
to verifyNoCredentialsCache
is used by defaultChecklist
CHANGELOG.next.toml
if I made changes to the AWS SDK, generated SDK code, or SDK runtime cratesBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.