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>The percentage (0-100) of the maximum allowed session token size that the returned session token consumes.</p>
14 /// <p>This field is deprecated. Use <code>SessionTokenUtilization</code> instead.</p>
15 #[deprecated(note = "Deprecated. Replaced by SessionTokenUtilization.", since = "2026-06-17")]
16 pub packed_policy_size: ::std::option::Option<i32>,
17 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
18 /// <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>
19 /// <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>
20 pub source_identity: ::std::option::Option<::std::string::String>,
21 /// <p>The percentage (0-100) of the maximum allowed session token size that the returned session token consumes.</p>
22 pub session_token_utilization: ::std::option::Option<i32>,
23 /// <p>The size, in bytes, of the session token returned in the Credentials for this response.</p>
24 pub session_token_size: ::std::option::Option<i32>,
25 _request_id: Option<String>,
26}
27impl AssumeRoleOutput {
28 /// <p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p><note>
29 /// <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>
30 /// </note>
31 pub fn credentials(&self) -> ::std::option::Option<&crate::types::Credentials> {
32 self.credentials.as_ref()
33 }
34 /// <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>
35 pub fn assumed_role_user(&self) -> ::std::option::Option<&crate::types::AssumedRoleUser> {
36 self.assumed_role_user.as_ref()
37 }
38 /// <p>The percentage (0-100) of the maximum allowed session token size that the returned session token consumes.</p>
39 /// <p>This field is deprecated. Use <code>SessionTokenUtilization</code> instead.</p>
40 #[deprecated(note = "Deprecated. Replaced by SessionTokenUtilization.", since = "2026-06-17")]
41 pub fn packed_policy_size(&self) -> ::std::option::Option<i32> {
42 self.packed_policy_size
43 }
44 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
45 /// <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>
46 /// <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>
47 pub fn source_identity(&self) -> ::std::option::Option<&str> {
48 self.source_identity.as_deref()
49 }
50 /// <p>The percentage (0-100) of the maximum allowed session token size that the returned session token consumes.</p>
51 pub fn session_token_utilization(&self) -> ::std::option::Option<i32> {
52 self.session_token_utilization
53 }
54 /// <p>The size, in bytes, of the session token returned in the Credentials for this response.</p>
55 pub fn session_token_size(&self) -> ::std::option::Option<i32> {
56 self.session_token_size
57 }
58}
59impl ::std::fmt::Debug for AssumeRoleOutput {
60 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
61 let mut formatter = f.debug_struct("AssumeRoleOutput");
62 formatter.field("credentials", &"*** Sensitive Data Redacted ***");
63 formatter.field("assumed_role_user", &self.assumed_role_user);
64 formatter.field("packed_policy_size", &self.packed_policy_size);
65 formatter.field("source_identity", &self.source_identity);
66 formatter.field("session_token_utilization", &self.session_token_utilization);
67 formatter.field("session_token_size", &self.session_token_size);
68 formatter.field("_request_id", &self._request_id);
69 formatter.finish()
70 }
71}
72impl ::aws_types::request_id::RequestId for AssumeRoleOutput {
73 fn request_id(&self) -> Option<&str> {
74 self._request_id.as_deref()
75 }
76}
77impl AssumeRoleOutput {
78 /// Creates a new builder-style object to manufacture [`AssumeRoleOutput`](crate::operation::assume_role::AssumeRoleOutput).
79 pub fn builder() -> crate::operation::assume_role::builders::AssumeRoleOutputBuilder {
80 crate::operation::assume_role::builders::AssumeRoleOutputBuilder::default()
81 }
82}
83
84/// A builder for [`AssumeRoleOutput`](crate::operation::assume_role::AssumeRoleOutput).
85#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
86#[non_exhaustive]
87pub struct AssumeRoleOutputBuilder {
88 pub(crate) credentials: ::std::option::Option<crate::types::Credentials>,
89 pub(crate) assumed_role_user: ::std::option::Option<crate::types::AssumedRoleUser>,
90 pub(crate) packed_policy_size: ::std::option::Option<i32>,
91 pub(crate) source_identity: ::std::option::Option<::std::string::String>,
92 pub(crate) session_token_utilization: ::std::option::Option<i32>,
93 pub(crate) session_token_size: ::std::option::Option<i32>,
94 _request_id: Option<String>,
95}
96impl AssumeRoleOutputBuilder {
97 /// <p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p><note>
98 /// <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>
99 /// </note>
100 pub fn credentials(mut self, input: crate::types::Credentials) -> Self {
101 self.credentials = ::std::option::Option::Some(input);
102 self
103 }
104 /// <p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p><note>
105 /// <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>
106 /// </note>
107 pub fn set_credentials(mut self, input: ::std::option::Option<crate::types::Credentials>) -> Self {
108 self.credentials = input;
109 self
110 }
111 /// <p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p><note>
112 /// <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>
113 /// </note>
114 pub fn get_credentials(&self) -> &::std::option::Option<crate::types::Credentials> {
115 &self.credentials
116 }
117 /// <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>
118 pub fn assumed_role_user(mut self, input: crate::types::AssumedRoleUser) -> Self {
119 self.assumed_role_user = ::std::option::Option::Some(input);
120 self
121 }
122 /// <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>
123 pub fn set_assumed_role_user(mut self, input: ::std::option::Option<crate::types::AssumedRoleUser>) -> Self {
124 self.assumed_role_user = input;
125 self
126 }
127 /// <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>
128 pub fn get_assumed_role_user(&self) -> &::std::option::Option<crate::types::AssumedRoleUser> {
129 &self.assumed_role_user
130 }
131 /// <p>The percentage (0-100) of the maximum allowed session token size that the returned session token consumes.</p>
132 /// <p>This field is deprecated. Use <code>SessionTokenUtilization</code> instead.</p>
133 #[deprecated(note = "Deprecated. Replaced by SessionTokenUtilization.", since = "2026-06-17")]
134 pub fn packed_policy_size(mut self, input: i32) -> Self {
135 self.packed_policy_size = ::std::option::Option::Some(input);
136 self
137 }
138 /// <p>The percentage (0-100) of the maximum allowed session token size that the returned session token consumes.</p>
139 /// <p>This field is deprecated. Use <code>SessionTokenUtilization</code> instead.</p>
140 #[deprecated(note = "Deprecated. Replaced by SessionTokenUtilization.", since = "2026-06-17")]
141 pub fn set_packed_policy_size(mut self, input: ::std::option::Option<i32>) -> Self {
142 self.packed_policy_size = input;
143 self
144 }
145 /// <p>The percentage (0-100) of the maximum allowed session token size that the returned session token consumes.</p>
146 /// <p>This field is deprecated. Use <code>SessionTokenUtilization</code> instead.</p>
147 #[deprecated(note = "Deprecated. Replaced by SessionTokenUtilization.", since = "2026-06-17")]
148 pub fn get_packed_policy_size(&self) -> &::std::option::Option<i32> {
149 &self.packed_policy_size
150 }
151 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
152 /// <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>
153 /// <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>
154 pub fn source_identity(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
155 self.source_identity = ::std::option::Option::Some(input.into());
156 self
157 }
158 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
159 /// <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>
160 /// <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>
161 pub fn set_source_identity(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
162 self.source_identity = input;
163 self
164 }
165 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
166 /// <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>
167 /// <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>
168 pub fn get_source_identity(&self) -> &::std::option::Option<::std::string::String> {
169 &self.source_identity
170 }
171 /// <p>The percentage (0-100) of the maximum allowed session token size that the returned session token consumes.</p>
172 pub fn session_token_utilization(mut self, input: i32) -> Self {
173 self.session_token_utilization = ::std::option::Option::Some(input);
174 self
175 }
176 /// <p>The percentage (0-100) of the maximum allowed session token size that the returned session token consumes.</p>
177 pub fn set_session_token_utilization(mut self, input: ::std::option::Option<i32>) -> Self {
178 self.session_token_utilization = input;
179 self
180 }
181 /// <p>The percentage (0-100) of the maximum allowed session token size that the returned session token consumes.</p>
182 pub fn get_session_token_utilization(&self) -> &::std::option::Option<i32> {
183 &self.session_token_utilization
184 }
185 /// <p>The size, in bytes, of the session token returned in the Credentials for this response.</p>
186 pub fn session_token_size(mut self, input: i32) -> Self {
187 self.session_token_size = ::std::option::Option::Some(input);
188 self
189 }
190 /// <p>The size, in bytes, of the session token returned in the Credentials for this response.</p>
191 pub fn set_session_token_size(mut self, input: ::std::option::Option<i32>) -> Self {
192 self.session_token_size = input;
193 self
194 }
195 /// <p>The size, in bytes, of the session token returned in the Credentials for this response.</p>
196 pub fn get_session_token_size(&self) -> &::std::option::Option<i32> {
197 &self.session_token_size
198 }
199 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
200 self._request_id = Some(request_id.into());
201 self
202 }
203
204 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
205 self._request_id = request_id;
206 self
207 }
208 /// Consumes the builder and constructs a [`AssumeRoleOutput`](crate::operation::assume_role::AssumeRoleOutput).
209 pub fn build(self) -> crate::operation::assume_role::AssumeRoleOutput {
210 crate::operation::assume_role::AssumeRoleOutput {
211 credentials: self.credentials,
212 assumed_role_user: self.assumed_role_user,
213 packed_policy_size: self.packed_policy_size,
214 source_identity: self.source_identity,
215 session_token_utilization: self.session_token_utilization,
216 session_token_size: self.session_token_size,
217 _request_id: self._request_id,
218 }
219 }
220}
221impl ::std::fmt::Debug for AssumeRoleOutputBuilder {
222 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
223 let mut formatter = f.debug_struct("AssumeRoleOutputBuilder");
224 formatter.field("credentials", &"*** Sensitive Data Redacted ***");
225 formatter.field("assumed_role_user", &self.assumed_role_user);
226 formatter.field("packed_policy_size", &self.packed_policy_size);
227 formatter.field("source_identity", &self.source_identity);
228 formatter.field("session_token_utilization", &self.session_token_utilization);
229 formatter.field("session_token_size", &self.session_token_size);
230 formatter.field("_request_id", &self._request_id);
231 formatter.finish()
232 }
233}