Skip to content

Commit 81773a5

Browse files
committed
feat(rust): Add tags to AssumeRoleProviderBuilder
1 parent 8b844a1 commit 81773a5

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

aws/rust-runtime/aws-config/src/sts/assume_role.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use aws_credential_types::provider::{
1111
};
1212
use aws_sdk_sts::operation::assume_role::builders::AssumeRoleFluentBuilder;
1313
use aws_sdk_sts::operation::assume_role::AssumeRoleError;
14-
use aws_sdk_sts::types::PolicyDescriptorType;
14+
use aws_sdk_sts::types::{PolicyDescriptorType, Tag};
1515
use aws_sdk_sts::Client as StsClient;
1616
use aws_smithy_runtime::client::identity::IdentityCache;
1717
use aws_smithy_runtime_api::client::result::SdkError;
@@ -103,6 +103,7 @@ pub struct AssumeRoleProviderBuilder {
103103
policy_arns: Option<Vec<PolicyDescriptorType>>,
104104
region_override: Option<Region>,
105105
sdk_config: Option<SdkConfig>,
106+
tags: Option<Vec<Tag>>,
106107
}
107108

108109
impl AssumeRoleProviderBuilder {
@@ -123,6 +124,7 @@ impl AssumeRoleProviderBuilder {
123124
policy_arns: None,
124125
sdk_config: None,
125126
region_override: None,
127+
tags: None,
126128
}
127129
}
128130

@@ -198,6 +200,15 @@ impl AssumeRoleProviderBuilder {
198200
self
199201
}
200202

203+
/// Set the session tags
204+
///
205+
/// A list of session tags that you want to pass. Each session tag consists of a key name and an associated value.
206+
/// For more information, see `[Tag]`.
207+
pub fn tags(mut self, tags: Vec<Tag>) -> Self {
208+
self.tags = Some(tags);
209+
self
210+
}
211+
201212
/// Sets the configuration used for this provider
202213
///
203214
/// This enables overriding the connection used to communicate with STS in addition to other internal
@@ -256,7 +267,8 @@ impl AssumeRoleProviderBuilder {
256267
.set_role_session_name(Some(session_name))
257268
.set_policy(self.policy)
258269
.set_policy_arns(self.policy_arns)
259-
.set_duration_seconds(self.session_length.map(|dur| dur.as_secs() as i32));
270+
.set_duration_seconds(self.session_length.map(|dur| dur.as_secs() as i32))
271+
.set_tags(self.tags);
260272

261273
AssumeRoleProvider {
262274
inner: Inner { fluent_builder },

0 commit comments

Comments
 (0)