From 81773a556847caaac74e18047320d46e558ddede Mon Sep 17 00:00:00 2001 From: Christian Thiel Date: Fri, 3 Oct 2025 17:12:01 +0200 Subject: [PATCH 01/10] feat(rust): Add tags to AssumeRoleProviderBuilder --- .../aws-config/src/sts/assume_role.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/aws/rust-runtime/aws-config/src/sts/assume_role.rs b/aws/rust-runtime/aws-config/src/sts/assume_role.rs index f67be223766..ca33d95e922 100644 --- a/aws/rust-runtime/aws-config/src/sts/assume_role.rs +++ b/aws/rust-runtime/aws-config/src/sts/assume_role.rs @@ -11,7 +11,7 @@ use aws_credential_types::provider::{ }; use aws_sdk_sts::operation::assume_role::builders::AssumeRoleFluentBuilder; use aws_sdk_sts::operation::assume_role::AssumeRoleError; -use aws_sdk_sts::types::PolicyDescriptorType; +use aws_sdk_sts::types::{PolicyDescriptorType, Tag}; use aws_sdk_sts::Client as StsClient; use aws_smithy_runtime::client::identity::IdentityCache; use aws_smithy_runtime_api::client::result::SdkError; @@ -103,6 +103,7 @@ pub struct AssumeRoleProviderBuilder { policy_arns: Option>, region_override: Option, sdk_config: Option, + tags: Option>, } impl AssumeRoleProviderBuilder { @@ -123,6 +124,7 @@ impl AssumeRoleProviderBuilder { policy_arns: None, sdk_config: None, region_override: None, + tags: None, } } @@ -198,6 +200,15 @@ impl AssumeRoleProviderBuilder { self } + /// Set the session tags + /// + /// A list of session tags that you want to pass. Each session tag consists of a key name and an associated value. + /// For more information, see `[Tag]`. + pub fn tags(mut self, tags: Vec) -> Self { + self.tags = Some(tags); + self + } + /// Sets the configuration used for this provider /// /// This enables overriding the connection used to communicate with STS in addition to other internal @@ -256,7 +267,8 @@ impl AssumeRoleProviderBuilder { .set_role_session_name(Some(session_name)) .set_policy(self.policy) .set_policy_arns(self.policy_arns) - .set_duration_seconds(self.session_length.map(|dur| dur.as_secs() as i32)); + .set_duration_seconds(self.session_length.map(|dur| dur.as_secs() as i32)) + .set_tags(self.tags); AssumeRoleProvider { inner: Inner { fluent_builder }, From 42dc27ed0b827e3661f200cda13aa9b3041eaa5e Mon Sep 17 00:00:00 2001 From: Christian Thiel Date: Fri, 3 Oct 2025 17:18:09 +0200 Subject: [PATCH 02/10] add changelog --- .changelog/changelog.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .changelog/changelog.md diff --git a/.changelog/changelog.md b/.changelog/changelog.md new file mode 100644 index 00000000000..a6fb72eaefa --- /dev/null +++ b/.changelog/changelog.md @@ -0,0 +1,10 @@ +# Add tags to AssumeRoleProviderBuilder +# --- +# applies_to: ["aws-sdk-rust"] +# authors: ["c-thiel"] +# references: ["aws-rust-sdk#1366"] +# breaking: false +# new_feature: true +# bug_fix: false +# --- +# Add tags to AssumeRoleProviderBuilder From f166e6cbe5bc1aad79c8a1c0953f6725b654b981 Mon Sep 17 00:00:00 2001 From: Christian Thiel Date: Fri, 3 Oct 2025 17:32:13 +0200 Subject: [PATCH 03/10] improve ergonomy with impl Into> --- aws/rust-runtime/aws-config/src/sts/assume_role.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aws/rust-runtime/aws-config/src/sts/assume_role.rs b/aws/rust-runtime/aws-config/src/sts/assume_role.rs index ca33d95e922..5ff53a9be47 100644 --- a/aws/rust-runtime/aws-config/src/sts/assume_role.rs +++ b/aws/rust-runtime/aws-config/src/sts/assume_role.rs @@ -204,8 +204,8 @@ impl AssumeRoleProviderBuilder { /// /// A list of session tags that you want to pass. Each session tag consists of a key name and an associated value. /// For more information, see `[Tag]`. - pub fn tags(mut self, tags: Vec) -> Self { - self.tags = Some(tags); + pub fn tags(mut self, tags: impl Into>) -> Self { + self.tags = Some(tags.into()); self } From af0e9996c954712b5fe80f51eeb68779a2081906 Mon Sep 17 00:00:00 2001 From: ysaito1001 Date: Fri, 3 Oct 2025 15:57:36 -0500 Subject: [PATCH 04/10] Runs `cargo fmt` on the changed file --- aws/rust-runtime/aws-config/src/sts/assume_role.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/rust-runtime/aws-config/src/sts/assume_role.rs b/aws/rust-runtime/aws-config/src/sts/assume_role.rs index 5ff53a9be47..b95b726bae3 100644 --- a/aws/rust-runtime/aws-config/src/sts/assume_role.rs +++ b/aws/rust-runtime/aws-config/src/sts/assume_role.rs @@ -201,7 +201,7 @@ impl AssumeRoleProviderBuilder { } /// Set the session tags - /// + /// /// A list of session tags that you want to pass. Each session tag consists of a key name and an associated value. /// For more information, see `[Tag]`. pub fn tags(mut self, tags: impl Into>) -> Self { From bd4366b7385d201bb6638aa8f1778219353860f1 Mon Sep 17 00:00:00 2001 From: ysaito1001 Date: Fri, 3 Oct 2025 16:00:08 -0500 Subject: [PATCH 05/10] Bump the `aws-config` crate --- aws/rust-runtime/aws-config/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/rust-runtime/aws-config/Cargo.toml b/aws/rust-runtime/aws-config/Cargo.toml index a689efb4dd4..cdbc51bdfb2 100644 --- a/aws/rust-runtime/aws-config/Cargo.toml +++ b/aws/rust-runtime/aws-config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aws-config" -version = "1.8.7" +version = "1.8.8" authors = [ "AWS Rust SDK Team ", "Russell Cohen ", From 92ce9017f963a57e9f078c67f4e9800043478f7c Mon Sep 17 00:00:00 2001 From: ysaito1001 Date: Fri, 3 Oct 2025 16:13:13 -0500 Subject: [PATCH 06/10] Update changelog --- .changelog/changelog.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.changelog/changelog.md b/.changelog/changelog.md index a6fb72eaefa..4abfb5c25eb 100644 --- a/.changelog/changelog.md +++ b/.changelog/changelog.md @@ -1,10 +1,9 @@ -# Add tags to AssumeRoleProviderBuilder -# --- -# applies_to: ["aws-sdk-rust"] -# authors: ["c-thiel"] -# references: ["aws-rust-sdk#1366"] -# breaking: false -# new_feature: true -# bug_fix: false -# --- -# Add tags to AssumeRoleProviderBuilder +--- +applies_to: ["aws-sdk-rust"] +authors: ["c-thiel"] +references: ["aws-sdk-rust#1366"] +breaking: false +new_feature: true +bug_fix: false +--- +Add tags to `AssumeRoleProviderBuilder` From f0bb8378fbf8090460bfd1f6feec3c6ad0107cb1 Mon Sep 17 00:00:00 2001 From: Christian Thiel Date: Sun, 5 Oct 2025 08:42:34 +0200 Subject: [PATCH 07/10] Remove Tag from exposed type --- aws/rust-runtime/aws-config/src/sts/assume_role.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/aws/rust-runtime/aws-config/src/sts/assume_role.rs b/aws/rust-runtime/aws-config/src/sts/assume_role.rs index b95b726bae3..1d8e9c38d09 100644 --- a/aws/rust-runtime/aws-config/src/sts/assume_role.rs +++ b/aws/rust-runtime/aws-config/src/sts/assume_role.rs @@ -204,8 +204,17 @@ impl AssumeRoleProviderBuilder { /// /// A list of session tags that you want to pass. Each session tag consists of a key name and an associated value. /// For more information, see `[Tag]`. - pub fn tags(mut self, tags: impl Into>) -> Self { - self.tags = Some(tags.into()); + pub fn tags(mut self, tags: impl IntoIterator) -> Self + where + K: Into, + V: Into{ + self.tags = Some( + tags.into_iter() + // Unwrap won't fail as both key and value are specified. + // Currently Tag does not have an infallible build method. + .map(|(k, v)| Tag::builder().key(k).value(v).build().unwrap()) + .collect::>(), + ); self } From be1db164184bde49f9f96bbbbbbf8ec74cd443ff Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 6 Oct 2025 17:23:06 +0200 Subject: [PATCH 08/10] Update aws/rust-runtime/aws-config/src/sts/assume_role.rs Co-authored-by: Russell Cohen --- aws/rust-runtime/aws-config/src/sts/assume_role.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/rust-runtime/aws-config/src/sts/assume_role.rs b/aws/rust-runtime/aws-config/src/sts/assume_role.rs index 1d8e9c38d09..a0f591915f9 100644 --- a/aws/rust-runtime/aws-config/src/sts/assume_role.rs +++ b/aws/rust-runtime/aws-config/src/sts/assume_role.rs @@ -212,7 +212,7 @@ impl AssumeRoleProviderBuilder { tags.into_iter() // Unwrap won't fail as both key and value are specified. // Currently Tag does not have an infallible build method. - .map(|(k, v)| Tag::builder().key(k).value(v).build().unwrap()) + .map(|(k, v)| Tag::builder().key(k).value(v).build().expect("this is unreachable: both k and v are set")) .collect::>(), ); self From 61b52da49723d9b339b6ce6f68984762780cbc5f Mon Sep 17 00:00:00 2001 From: ysaito1001 Date: Mon, 6 Oct 2025 18:22:30 -0500 Subject: [PATCH 09/10] Run `cargo fmt` on `assume_role.rs` --- aws/rust-runtime/aws-config/src/sts/assume_role.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/aws/rust-runtime/aws-config/src/sts/assume_role.rs b/aws/rust-runtime/aws-config/src/sts/assume_role.rs index a0f591915f9..8b644199874 100644 --- a/aws/rust-runtime/aws-config/src/sts/assume_role.rs +++ b/aws/rust-runtime/aws-config/src/sts/assume_role.rs @@ -204,15 +204,22 @@ impl AssumeRoleProviderBuilder { /// /// A list of session tags that you want to pass. Each session tag consists of a key name and an associated value. /// For more information, see `[Tag]`. - pub fn tags(mut self, tags: impl IntoIterator) -> Self + pub fn tags(mut self, tags: impl IntoIterator) -> Self where K: Into, - V: Into{ + V: Into, + { self.tags = Some( tags.into_iter() // Unwrap won't fail as both key and value are specified. // Currently Tag does not have an infallible build method. - .map(|(k, v)| Tag::builder().key(k).value(v).build().expect("this is unreachable: both k and v are set")) + .map(|(k, v)| { + Tag::builder() + .key(k) + .value(v) + .build() + .expect("this is unreachable: both k and v are set") + }) .collect::>(), ); self From fc5619643f6a047501470a8b2f7f6a19fa38ea74 Mon Sep 17 00:00:00 2001 From: ysaito1001 Date: Mon, 6 Oct 2025 20:09:39 -0500 Subject: [PATCH 10/10] Bump the `aws-config` crate --- aws/rust-runtime/aws-config/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/rust-runtime/aws-config/Cargo.toml b/aws/rust-runtime/aws-config/Cargo.toml index cdbc51bdfb2..9859d4bd91c 100644 --- a/aws/rust-runtime/aws-config/Cargo.toml +++ b/aws/rust-runtime/aws-config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aws-config" -version = "1.8.8" +version = "1.8.9" authors = [ "AWS Rust SDK Team ", "Russell Cohen ",