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 pub packed_policy_size: ::std::option::Option<i32>,
15 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
16 /// <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>
17 /// <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>
18 pub source_identity: ::std::option::Option<::std::string::String>,
19 _request_id: Option<String>,
20}
21impl AssumeRoleOutput {
22 /// <p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p><note>
23 /// <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>
24 /// </note>
25 pub fn credentials(&self) -> ::std::option::Option<&crate::types::Credentials> {
26 self.credentials.as_ref()
27 }
28 /// <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>
29 pub fn assumed_role_user(&self) -> ::std::option::Option<&crate::types::AssumedRoleUser> {
30 self.assumed_role_user.as_ref()
31 }
32 /// <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>
33 pub fn packed_policy_size(&self) -> ::std::option::Option<i32> {
34 self.packed_policy_size
35 }
36 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
37 /// <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>
38 /// <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>
39 pub fn source_identity(&self) -> ::std::option::Option<&str> {
40 self.source_identity.as_deref()
41 }
42}
43impl ::std::fmt::Debug for AssumeRoleOutput {
44 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
45 let mut formatter = f.debug_struct("AssumeRoleOutput");
46 formatter.field("credentials", &"*** Sensitive Data Redacted ***");
47 formatter.field("assumed_role_user", &self.assumed_role_user);
48 formatter.field("packed_policy_size", &self.packed_policy_size);
49 formatter.field("source_identity", &self.source_identity);
50 formatter.field("_request_id", &self._request_id);
51 formatter.finish()
52 }
53}
54static ASSUMEROLEOUTPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.sts.synthetic#AssumeRoleOutput", "com.amazonaws.sts.synthetic", "AssumeRoleOutput");
55static ASSUMEROLEOUTPUT_MEMBER_CREDENTIALS: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
56 ::aws_smithy_schema::ShapeId::from_static(
57 "com.amazonaws.sts.synthetic#AssumeRoleOutput$Credentials",
58 "com.amazonaws.sts.synthetic",
59 "AssumeRoleOutput",
60 ),
61 ::aws_smithy_schema::ShapeType::Structure,
62 "Credentials",
63 0,
64 );
65static ASSUMEROLEOUTPUT_MEMBER_ASSUMED_ROLE_USER: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
66 ::aws_smithy_schema::ShapeId::from_static(
67 "com.amazonaws.sts.synthetic#AssumeRoleOutput$AssumedRoleUser",
68 "com.amazonaws.sts.synthetic",
69 "AssumeRoleOutput",
70 ),
71 ::aws_smithy_schema::ShapeType::Structure,
72 "AssumedRoleUser",
73 1,
74 );
75static ASSUMEROLEOUTPUT_MEMBER_PACKED_POLICY_SIZE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
76 ::aws_smithy_schema::ShapeId::from_static(
77 "com.amazonaws.sts.synthetic#AssumeRoleOutput$PackedPolicySize",
78 "com.amazonaws.sts.synthetic",
79 "AssumeRoleOutput",
80 ),
81 ::aws_smithy_schema::ShapeType::Integer,
82 "PackedPolicySize",
83 2,
84 );
85static ASSUMEROLEOUTPUT_MEMBER_SOURCE_IDENTITY: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
86 ::aws_smithy_schema::ShapeId::from_static(
87 "com.amazonaws.sts.synthetic#AssumeRoleOutput$SourceIdentity",
88 "com.amazonaws.sts.synthetic",
89 "AssumeRoleOutput",
90 ),
91 ::aws_smithy_schema::ShapeType::String,
92 "SourceIdentity",
93 3,
94 );
95static ASSUMEROLEOUTPUT_MEMBER__REQUEST_ID: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
96 ::aws_smithy_schema::ShapeId::from_static(
97 "synthetic#request_id",
98 "synthetic",
99 "request_id",
100 ),
101 ::aws_smithy_schema::ShapeType::String,
102 "request_id",
103 4,
104 ).with_http_header("x-amzn-requestid");
105static ASSUMEROLEOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
106 ASSUMEROLEOUTPUT_SCHEMA_ID,
107 ::aws_smithy_schema::ShapeType::Structure,
108 &[&ASSUMEROLEOUTPUT_MEMBER_CREDENTIALS, &ASSUMEROLEOUTPUT_MEMBER_ASSUMED_ROLE_USER, &ASSUMEROLEOUTPUT_MEMBER_PACKED_POLICY_SIZE, &ASSUMEROLEOUTPUT_MEMBER_SOURCE_IDENTITY, &ASSUMEROLEOUTPUT_MEMBER__REQUEST_ID],
109 );
110impl AssumeRoleOutput {
111 /// The schema for this shape.
112 pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &ASSUMEROLEOUTPUT_SCHEMA;
113 }
114impl ::aws_smithy_schema::serde::SerializableStruct for AssumeRoleOutput {
115 #[allow(unused_variables, clippy::diverging_sub_expression)]
116 fn serialize_members(&self, ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
117 if let Some(ref val) = self.credentials {
118 ser.write_struct(&ASSUMEROLEOUTPUT_MEMBER_CREDENTIALS, val)?;
119 }
120if let Some(ref val) = self.assumed_role_user {
121 ser.write_struct(&ASSUMEROLEOUTPUT_MEMBER_ASSUMED_ROLE_USER, val)?;
122 }
123if let Some(ref val) = self.packed_policy_size {
124 ser.write_integer(&ASSUMEROLEOUTPUT_MEMBER_PACKED_POLICY_SIZE, *val)?;
125 }
126if let Some(ref val) = self.source_identity {
127 ser.write_string(&ASSUMEROLEOUTPUT_MEMBER_SOURCE_IDENTITY, val)?;
128 }
129 Ok(())
130 }
131 }
132impl AssumeRoleOutput {
133 /// Deserializes this structure from a [`ShapeDeserializer`].
134 pub fn deserialize(deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
135 #[allow(unused_variables, unused_mut)]
136 let mut builder = Self::builder();
137 #[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding, clippy::diverging_sub_expression)]
138 deserializer.read_struct(&ASSUMEROLEOUTPUT_SCHEMA, &mut |member, deser| {
139 match member.member_index() {
140 Some(0) => {
141 builder.credentials = Some(crate::types::Credentials::deserialize(deser)?);
142 }
143Some(1) => {
144 builder.assumed_role_user = Some(crate::types::AssumedRoleUser::deserialize(deser)?);
145 }
146Some(2) => {
147 builder.packed_policy_size = Some(deser.read_integer(member)?);
148 }
149Some(3) => {
150 builder.source_identity = Some(deser.read_string(member)?);
151 }
152Some(4) => {
153 builder._request_id = Some(deser.read_string(member)?);
154 }
155 _ => {}
156 }
157 Ok(())
158 })?;
159 Ok(builder.build())
160 }
161 }
162impl AssumeRoleOutput {
163 /// Deserializes this structure from a body deserializer and HTTP response headers.
164 /// Header-bound members are read directly from headers, avoiding runtime
165 /// member iteration overhead. Body members are read via the deserializer.
166 pub fn deserialize_with_response(
167 deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
168 headers: &::aws_smithy_runtime_api::http::Headers,
169 _status: u16,
170 _body: &[u8],
171 ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
172 #[allow(unused_variables, unused_mut)]
173 let mut builder = Self::builder();
174if let Some(val) = headers.get("x-amzn-requestid") {
175 builder._request_id = Some(val.to_string());
176 }
177#[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding, clippy::diverging_sub_expression)]
178 deserializer.read_struct(&ASSUMEROLEOUTPUT_SCHEMA, &mut |member, deser| {
179 match member.member_index() {
180 Some(0) => { builder.credentials = Some(crate::types::Credentials::deserialize(deser)?); }
181Some(1) => { builder.assumed_role_user = Some(crate::types::AssumedRoleUser::deserialize(deser)?); }
182Some(2) => { builder.packed_policy_size = Some(deser.read_integer(member)?); }
183Some(3) => { builder.source_identity = Some(deser.read_string(member)?); }
184 _ => {}
185 }
186 Ok(())
187 })?;
188 Ok(builder.build())
189 }
190 }
191impl ::aws_types::request_id::RequestId for AssumeRoleOutput {
192 fn request_id(&self) -> Option<&str> {
193 self._request_id.as_deref()
194 }
195 }
196impl AssumeRoleOutput {
197 /// Creates a new builder-style object to manufacture [`AssumeRoleOutput`](crate::operation::assume_role::AssumeRoleOutput).
198 pub fn builder() -> crate::operation::assume_role::builders::AssumeRoleOutputBuilder {
199 crate::operation::assume_role::builders::AssumeRoleOutputBuilder::default()
200 }
201}
202
203/// A builder for [`AssumeRoleOutput`](crate::operation::assume_role::AssumeRoleOutput).
204#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
205#[non_exhaustive]
206pub struct AssumeRoleOutputBuilder {
207 pub(crate) credentials: ::std::option::Option<crate::types::Credentials>,
208 pub(crate) assumed_role_user: ::std::option::Option<crate::types::AssumedRoleUser>,
209 pub(crate) packed_policy_size: ::std::option::Option<i32>,
210 pub(crate) source_identity: ::std::option::Option<::std::string::String>,
211 _request_id: Option<String>,
212}
213impl AssumeRoleOutputBuilder {
214 /// <p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p><note>
215 /// <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>
216 /// </note>
217 pub fn credentials(mut self, input: crate::types::Credentials) -> Self {
218 self.credentials = ::std::option::Option::Some(input);
219 self
220 }
221 /// <p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p><note>
222 /// <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>
223 /// </note>
224 pub fn set_credentials(mut self, input: ::std::option::Option<crate::types::Credentials>) -> Self {
225 self.credentials = input; self
226 }
227 /// <p>The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.</p><note>
228 /// <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>
229 /// </note>
230 pub fn get_credentials(&self) -> &::std::option::Option<crate::types::Credentials> {
231 &self.credentials
232 }
233 /// <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>
234 pub fn assumed_role_user(mut self, input: crate::types::AssumedRoleUser) -> Self {
235 self.assumed_role_user = ::std::option::Option::Some(input);
236 self
237 }
238 /// <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>
239 pub fn set_assumed_role_user(mut self, input: ::std::option::Option<crate::types::AssumedRoleUser>) -> Self {
240 self.assumed_role_user = input; self
241 }
242 /// <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>
243 pub fn get_assumed_role_user(&self) -> &::std::option::Option<crate::types::AssumedRoleUser> {
244 &self.assumed_role_user
245 }
246 /// <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>
247 pub fn packed_policy_size(mut self, input: i32) -> Self {
248 self.packed_policy_size = ::std::option::Option::Some(input);
249 self
250 }
251 /// <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>
252 pub fn set_packed_policy_size(mut self, input: ::std::option::Option<i32>) -> Self {
253 self.packed_policy_size = input; self
254 }
255 /// <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>
256 pub fn get_packed_policy_size(&self) -> &::std::option::Option<i32> {
257 &self.packed_policy_size
258 }
259 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
260 /// <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>
261 /// <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>
262 pub fn source_identity(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
263 self.source_identity = ::std::option::Option::Some(input.into());
264 self
265 }
266 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
267 /// <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>
268 /// <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>
269 pub fn set_source_identity(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
270 self.source_identity = input; self
271 }
272 /// <p>The source identity specified by the principal that is calling the <code>AssumeRole</code> operation.</p>
273 /// <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>
274 /// <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>
275 pub fn get_source_identity(&self) -> &::std::option::Option<::std::string::String> {
276 &self.source_identity
277 }
278 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
279 self._request_id = Some(request_id.into());
280 self
281 }
282
283 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
284 self._request_id = request_id;
285 self
286 }
287 /// Consumes the builder and constructs a [`AssumeRoleOutput`](crate::operation::assume_role::AssumeRoleOutput).
288 pub fn build(self) -> crate::operation::assume_role::AssumeRoleOutput {
289 crate::operation::assume_role::AssumeRoleOutput {
290 credentials: self.credentials
291 ,
292 assumed_role_user: self.assumed_role_user
293 ,
294 packed_policy_size: self.packed_policy_size
295 ,
296 source_identity: self.source_identity
297 ,
298 _request_id: self._request_id,
299 }
300 }
301}
302impl ::std::fmt::Debug for AssumeRoleOutputBuilder {
303 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
304 let mut formatter = f.debug_struct("AssumeRoleOutputBuilder");
305 formatter.field("credentials", &"*** Sensitive Data Redacted ***");
306 formatter.field("assumed_role_user", &self.assumed_role_user);
307 formatter.field("packed_policy_size", &self.packed_policy_size);
308 formatter.field("source_identity", &self.source_identity);
309 formatter.field("_request_id", &self._request_id);
310 formatter.finish()
311 }
312}
313