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

Remove ProviderConfig as the configuration source for AssumeRoleProvider #3014

Merged
merged 5 commits into from
Oct 2, 2023

Conversation

rcoh
Copy link
Collaborator

@rcoh rcoh commented Sep 29, 2023

Motivation and Context

AssumeRoleProvider currently uses ProviderConfig as a source of configuration, but that API is hard use and not intended for external consumption.

This fixes the Assume Role issue but only for AssumeRoleProvider

Description

Update the API (see changelog) to be more ergonomic and derive configuration from SdkConfig instead.

Testing

Existing tests + new unit tests

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.

aws/rust-runtime/aws-config/src/sts/assume_role.rs Outdated Show resolved Hide resolved
Comment on lines +399 to +401
panic!("don't call me — will be overridden");
#[allow(unreachable_code)]
Ok(Credentials::for_tests())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
panic!("don't call me — will be overridden");
#[allow(unreachable_code)]
Ok(Credentials::for_tests())
panic!("don't call me — will be overridden")

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

you need this for inference

@@ -602,4 +602,22 @@ impl SdkConfig {
pub fn builder() -> Builder {
Builder::default()
}

/// Convert this [`SdkConfig`] back to a builder to enable modification
pub fn to_builder(self) -> Builder {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is awesome!

The to_builder() on the generated configs takes &self rather than self. Should this be consistent?

@@ -51,6 +51,11 @@ impl StaticTimeSource {
pub fn new(time: SystemTime) -> Self {
Self { time }
}

/// Creates a new static time source from the provided number of seconds since the UNIX epoch
pub fn new_from_epoch(epoch_secs: u64) -> Self {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is called from_secs on our DateTime. Should we use the same name here?

@rcoh rcoh force-pushed the assume-role-provider branch from a59412c to df9496a Compare September 29, 2023 19:06
@rcoh rcoh marked this pull request as ready for review September 29, 2023 19:13
@rcoh rcoh requested review from a team as code owners September 29, 2023 19:13
@github-actions
Copy link

A new generated diff is ready to view.

  • AWS SDK (ignoring whitespace)
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

@rcoh rcoh force-pushed the assume-role-provider branch from b795ee7 to 22f1b4b Compare September 29, 2023 19:49
@github-actions
Copy link

A new generated diff is ready to view.

  • AWS SDK (ignoring whitespace)
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

@rcoh rcoh added the breaking-change This will require a breaking change label Sep 29, 2023
Copy link
Contributor

@ysaito1001 ysaito1001 left a comment

Choose a reason for hiding this comment

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

Less mental cost with ProviderConfig gone. Thanks for adding examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change This will require a breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants