Skip to content
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

Ability to override the IMDS client in DefaultCredentialsChain #1867

Merged
merged 3 commits into from
Oct 18, 2022
Merged

Ability to override the IMDS client in DefaultCredentialsChain #1867

merged 3 commits into from
Oct 18, 2022

Conversation

kevinpark1217
Copy link
Contributor

@kevinpark1217 kevinpark1217 commented Oct 18, 2022

Motivation and Context

This is an alternative method for me to implement necessary retry and timeout for the IMDS client, rather than through environment variables and profile as attempted in #1821 and outlined in aws-sdk-rust#625.

This should give me enough flexibility to navigate around some limitations and be able to implement timeout and retry attempts in code.

Description

Simple additional helper method to set the IMDS client with custom retry and timeout settings.

Testing

let attempts = 10;
let timeout = Duration::from_secs(60);

let imds_client = imds::Client::builder()
    .max_attempts(attempts)
    .connect_timeout(timeout)
    .read_timeout(timeout)
    .build()
    .await?;

let chain = DefaultCredentialsChain::builder()
    .region(region)
    .imds_client(imds_client);

Checklist

  • I have updated CHANGELOG.next.toml if I made changes to the smithy-rs codegen or runtime crates
  • 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.

@kevinpark1217 kevinpark1217 requested a review from a team as a code owner October 18, 2022 02:52
Copy link
Collaborator

@jdisanti jdisanti left a comment

Choose a reason for hiding this comment

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

This seems reasonable to me.

@jdisanti jdisanti merged commit 374a0a2 into smithy-lang:main Oct 18, 2022
@jdisanti
Copy link
Collaborator

Thank you for the contribution!

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