aws_sdk_sts/operation/assume_role/_assume_role_output.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Contains the response to a successful <code>AssumeRole</code> request, including temporary Amazon Web Services credentials that can be used to make Amazon Web Services requests.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
6pub struct AssumeRoleOutput {
7 /// <p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p><note>
8 /// <p>The size of the security token that STS API operations return is not fixed. We strongly recommend that you make no assumptions about the maximum size.</p>
9 /// </note>
10 pub credentials: ::std::option::Option<crate::types::Credentials>,
11 /// <p>The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers that you can use to refer to the resulting temporary security credentials. For example, you can reference these credentials as a principal in a resource-based policy by using the ARN or assumed role ID. The ARN and ID include the <code>RoleSessionName</code> that you specified when you called <code>AssumeRole</code>.</p>
12 pub assumed_role_user: ::std::option::Option<crate::types::AssumedRoleUser>,
13 /// <p>A percentage value that indicates the packed size of the session policies and session tags combined passed in the request. The request fails if the packed size is greater than 100 percent, which means the policies and tags exceeded the allowed space.</p>
14 #[deprecated(note = "Deprecated. Replaced by SessionTokenUtilization.", since = "2026-06-17")]
15 pub packed_policy_size: ::std::option::Option<i32>,
16 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
17 /// <p>You can require users to specify a source identity when they assume a role. You do this by using the <code>sts:SourceIdentity</code> condition key in a role trust policy. You can use source identity information in CloudTrail logs to determine who took actions with a role. You can use the <code>aws:SourceIdentity</code> condition key to further control access to Amazon Web Services resources based on the value of source identity. For more information about using source identity, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html">Monitor and control actions taken with assumed roles</a> in the <i>IAM User Guide</i>.</p>
18 /// <p>The regex used to validate this parameter is a string of characters consisting of upper- and lower-case alphanumeric characters with no spaces. You can also include underscores or any of the following characters: =,.@-</p>
19 pub source_identity: ::std::option::Option<::std::string::String>,
20 /// The percentage (0-100) of the maximum allowed session token size that the returned session token consumes.
21 pub session_token_utilization: ::std::option::Option<i32>,
22 /// The size, in bytes, of the session token returned in the Credentials for this response.
23 pub session_token_size: ::std::option::Option<i32>,
24 _request_id: Option<String>,
25}
26impl AssumeRoleOutput {
27 /// <p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p><note>
28 /// <p>The size of the security token that STS API operations return is not fixed. We strongly recommend that you make no assumptions about the maximum size.</p>
29 /// </note>
30 pub fn credentials(&self) -> ::std::option::Option<&crate::types::Credentials> {
31 self.credentials.as_ref()
32 }
33 /// <p>The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers that you can use to refer to the resulting temporary security credentials. For example, you can reference these credentials as a principal in a resource-based policy by using the ARN or assumed role ID. The ARN and ID include the <code>RoleSessionName</code> that you specified when you called <code>AssumeRole</code>.</p>
34 pub fn assumed_role_user(&self) -> ::std::option::Option<&crate::types::AssumedRoleUser> {
35 self.assumed_role_user.as_ref()
36 }
37 /// <p>A percentage value that indicates the packed size of the session policies and session tags combined passed in the request. The request fails if the packed size is greater than 100 percent, which means the policies and tags exceeded the allowed space.</p>
38 #[deprecated(note = "Deprecated. Replaced by SessionTokenUtilization.", since = "2026-06-17")]
39 pub fn packed_policy_size(&self) -> ::std::option::Option<i32> {
40 self.packed_policy_size
41 }
42 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
43 /// <p>You can require users to specify a source identity when they assume a role. You do this by using the <code>sts:SourceIdentity</code> condition key in a role trust policy. You can use source identity information in CloudTrail logs to determine who took actions with a role. You can use the <code>aws:SourceIdentity</code> condition key to further control access to Amazon Web Services resources based on the value of source identity. For more information about using source identity, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html">Monitor and control actions taken with assumed roles</a> in the <i>IAM User Guide</i>.</p>
44 /// <p>The regex used to validate this parameter is a string of characters consisting of upper- and lower-case alphanumeric characters with no spaces. You can also include underscores or any of the following characters: =,.@-</p>
45 pub fn source_identity(&self) -> ::std::option::Option<&str> {
46 self.source_identity.as_deref()
47 }
48 /// The percentage (0-100) of the maximum allowed session token size that the returned session token consumes.
49 pub fn session_token_utilization(&self) -> ::std::option::Option<i32> {
50 self.session_token_utilization
51 }
52 /// The size, in bytes, of the session token returned in the Credentials for this response.
53 pub fn session_token_size(&self) -> ::std::option::Option<i32> {
54 self.session_token_size
55 }
56}
57impl ::std::fmt::Debug for AssumeRoleOutput {
58 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
59 let mut formatter = f.debug_struct("AssumeRoleOutput");
60 formatter.field("credentials", &"*** Sensitive Data Redacted ***");
61 formatter.field("assumed_role_user", &self.assumed_role_user);
62 formatter.field("packed_policy_size", &self.packed_policy_size);
63 formatter.field("source_identity", &self.source_identity);
64 formatter.field("session_token_utilization", &self.session_token_utilization);
65 formatter.field("session_token_size", &self.session_token_size);
66 formatter.field("_request_id", &self._request_id);
67 formatter.finish()
68 }
69}
70impl ::aws_types::request_id::RequestId for AssumeRoleOutput {
71 fn request_id(&self) -> Option<&str> {
72 self._request_id.as_deref()
73 }
74}
75impl AssumeRoleOutput {
76 /// Creates a new builder-style object to manufacture [`AssumeRoleOutput`](crate::operation::assume_role::AssumeRoleOutput).
77 pub fn builder() -> crate::operation::assume_role::builders::AssumeRoleOutputBuilder {
78 crate::operation::assume_role::builders::AssumeRoleOutputBuilder::default()
79 }
80}
81
82/// A builder for [`AssumeRoleOutput`](crate::operation::assume_role::AssumeRoleOutput).
83#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
84#[non_exhaustive]
85pub struct AssumeRoleOutputBuilder {
86 pub(crate) credentials: ::std::option::Option<crate::types::Credentials>,
87 pub(crate) assumed_role_user: ::std::option::Option<crate::types::AssumedRoleUser>,
88 pub(crate) packed_policy_size: ::std::option::Option<i32>,
89 pub(crate) source_identity: ::std::option::Option<::std::string::String>,
90 pub(crate) session_token_utilization: ::std::option::Option<i32>,
91 pub(crate) session_token_size: ::std::option::Option<i32>,
92 _request_id: Option<String>,
93}
94impl AssumeRoleOutputBuilder {
95 /// <p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p><note>
96 /// <p>The size of the security token that STS API operations return is not fixed. We strongly recommend that you make no assumptions about the maximum size.</p>
97 /// </note>
98 pub fn credentials(mut self, input: crate::types::Credentials) -> Self {
99 self.credentials = ::std::option::Option::Some(input);
100 self
101 }
102 /// <p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p><note>
103 /// <p>The size of the security token that STS API operations return is not fixed. We strongly recommend that you make no assumptions about the maximum size.</p>
104 /// </note>
105 pub fn set_credentials(mut self, input: ::std::option::Option<crate::types::Credentials>) -> Self {
106 self.credentials = input;
107 self
108 }
109 /// <p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p><note>
110 /// <p>The size of the security token that STS API operations return is not fixed. We strongly recommend that you make no assumptions about the maximum size.</p>
111 /// </note>
112 pub fn get_credentials(&self) -> &::std::option::Option<crate::types::Credentials> {
113 &self.credentials
114 }
115 /// <p>The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers that you can use to refer to the resulting temporary security credentials. For example, you can reference these credentials as a principal in a resource-based policy by using the ARN or assumed role ID. The ARN and ID include the <code>RoleSessionName</code> that you specified when you called <code>AssumeRole</code>.</p>
116 pub fn assumed_role_user(mut self, input: crate::types::AssumedRoleUser) -> Self {
117 self.assumed_role_user = ::std::option::Option::Some(input);
118 self
119 }
120 /// <p>The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers that you can use to refer to the resulting temporary security credentials. For example, you can reference these credentials as a principal in a resource-based policy by using the ARN or assumed role ID. The ARN and ID include the <code>RoleSessionName</code> that you specified when you called <code>AssumeRole</code>.</p>
121 pub fn set_assumed_role_user(mut self, input: ::std::option::Option<crate::types::AssumedRoleUser>) -> Self {
122 self.assumed_role_user = input;
123 self
124 }
125 /// <p>The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers that you can use to refer to the resulting temporary security credentials. For example, you can reference these credentials as a principal in a resource-based policy by using the ARN or assumed role ID. The ARN and ID include the <code>RoleSessionName</code> that you specified when you called <code>AssumeRole</code>.</p>
126 pub fn get_assumed_role_user(&self) -> &::std::option::Option<crate::types::AssumedRoleUser> {
127 &self.assumed_role_user
128 }
129 /// <p>A percentage value that indicates the packed size of the session policies and session tags combined passed in the request. The request fails if the packed size is greater than 100 percent, which means the policies and tags exceeded the allowed space.</p>
130 #[deprecated(note = "Deprecated. Replaced by SessionTokenUtilization.", since = "2026-06-17")]
131 pub fn packed_policy_size(mut self, input: i32) -> Self {
132 self.packed_policy_size = ::std::option::Option::Some(input);
133 self
134 }
135 /// <p>A percentage value that indicates the packed size of the session policies and session tags combined passed in the request. The request fails if the packed size is greater than 100 percent, which means the policies and tags exceeded the allowed space.</p>
136 #[deprecated(note = "Deprecated. Replaced by SessionTokenUtilization.", since = "2026-06-17")]
137 pub fn set_packed_policy_size(mut self, input: ::std::option::Option<i32>) -> Self {
138 self.packed_policy_size = input;
139 self
140 }
141 /// <p>A percentage value that indicates the packed size of the session policies and session tags combined passed in the request. The request fails if the packed size is greater than 100 percent, which means the policies and tags exceeded the allowed space.</p>
142 #[deprecated(note = "Deprecated. Replaced by SessionTokenUtilization.", since = "2026-06-17")]
143 pub fn get_packed_policy_size(&self) -> &::std::option::Option<i32> {
144 &self.packed_policy_size
145 }
146 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
147 /// <p>You can require users to specify a source identity when they assume a role. You do this by using the <code>sts:SourceIdentity</code> condition key in a role trust policy. You can use source identity information in CloudTrail logs to determine who took actions with a role. You can use the <code>aws:SourceIdentity</code> condition key to further control access to Amazon Web Services resources based on the value of source identity. For more information about using source identity, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html">Monitor and control actions taken with assumed roles</a> in the <i>IAM User Guide</i>.</p>
148 /// <p>The regex used to validate this parameter is a string of characters consisting of upper- and lower-case alphanumeric characters with no spaces. You can also include underscores or any of the following characters: =,.@-</p>
149 pub fn source_identity(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
150 self.source_identity = ::std::option::Option::Some(input.into());
151 self
152 }
153 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
154 /// <p>You can require users to specify a source identity when they assume a role. You do this by using the <code>sts:SourceIdentity</code> condition key in a role trust policy. You can use source identity information in CloudTrail logs to determine who took actions with a role. You can use the <code>aws:SourceIdentity</code> condition key to further control access to Amazon Web Services resources based on the value of source identity. For more information about using source identity, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html">Monitor and control actions taken with assumed roles</a> in the <i>IAM User Guide</i>.</p>
155 /// <p>The regex used to validate this parameter is a string of characters consisting of upper- and lower-case alphanumeric characters with no spaces. You can also include underscores or any of the following characters: =,.@-</p>
156 pub fn set_source_identity(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
157 self.source_identity = input;
158 self
159 }
160 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
161 /// <p>You can require users to specify a source identity when they assume a role. You do this by using the <code>sts:SourceIdentity</code> condition key in a role trust policy. You can use source identity information in CloudTrail logs to determine who took actions with a role. You can use the <code>aws:SourceIdentity</code> condition key to further control access to Amazon Web Services resources based on the value of source identity. For more information about using source identity, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html">Monitor and control actions taken with assumed roles</a> in the <i>IAM User Guide</i>.</p>
162 /// <p>The regex used to validate this parameter is a string of characters consisting of upper- and lower-case alphanumeric characters with no spaces. You can also include underscores or any of the following characters: =,.@-</p>
163 pub fn get_source_identity(&self) -> &::std::option::Option<::std::string::String> {
164 &self.source_identity
165 }
166 /// The percentage (0-100) of the maximum allowed session token size that the returned session token consumes.
167 pub fn session_token_utilization(mut self, input: i32) -> Self {
168 self.session_token_utilization = ::std::option::Option::Some(input);
169 self
170 }
171 /// The percentage (0-100) of the maximum allowed session token size that the returned session token consumes.
172 pub fn set_session_token_utilization(mut self, input: ::std::option::Option<i32>) -> Self {
173 self.session_token_utilization = input;
174 self
175 }
176 /// The percentage (0-100) of the maximum allowed session token size that the returned session token consumes.
177 pub fn get_session_token_utilization(&self) -> &::std::option::Option<i32> {
178 &self.session_token_utilization
179 }
180 /// The size, in bytes, of the session token returned in the Credentials for this response.
181 pub fn session_token_size(mut self, input: i32) -> Self {
182 self.session_token_size = ::std::option::Option::Some(input);
183 self
184 }
185 /// The size, in bytes, of the session token returned in the Credentials for this response.
186 pub fn set_session_token_size(mut self, input: ::std::option::Option<i32>) -> Self {
187 self.session_token_size = input;
188 self
189 }
190 /// The size, in bytes, of the session token returned in the Credentials for this response.
191 pub fn get_session_token_size(&self) -> &::std::option::Option<i32> {
192 &self.session_token_size
193 }
194 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
195 self._request_id = Some(request_id.into());
196 self
197 }
198
199 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
200 self._request_id = request_id;
201 self
202 }
203 /// Consumes the builder and constructs a [`AssumeRoleOutput`](crate::operation::assume_role::AssumeRoleOutput).
204 pub fn build(self) -> crate::operation::assume_role::AssumeRoleOutput {
205 crate::operation::assume_role::AssumeRoleOutput {
206 credentials: self.credentials,
207 assumed_role_user: self.assumed_role_user,
208 packed_policy_size: self.packed_policy_size,
209 source_identity: self.source_identity,
210 session_token_utilization: self.session_token_utilization,
211 session_token_size: self.session_token_size,
212 _request_id: self._request_id,
213 }
214 }
215}
216impl ::std::fmt::Debug for AssumeRoleOutputBuilder {
217 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
218 let mut formatter = f.debug_struct("AssumeRoleOutputBuilder");
219 formatter.field("credentials", &"*** Sensitive Data Redacted ***");
220 formatter.field("assumed_role_user", &self.assumed_role_user);
221 formatter.field("packed_policy_size", &self.packed_policy_size);
222 formatter.field("source_identity", &self.source_identity);
223 formatter.field("session_token_utilization", &self.session_token_utilization);
224 formatter.field("session_token_size", &self.session_token_size);
225 formatter.field("_request_id", &self._request_id);
226 formatter.finish()
227 }
228}