aws_sdk_sts/operation/assume_root/
_assume_root_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct AssumeRootInput  {
6    /// <p>The member account principal ARN or account ID.</p>
7    pub target_principal: ::std::option::Option<::std::string::String>,
8    /// <p>The identity based policy that scopes the session to the privileged tasks that can be performed. You can use one of following Amazon Web Services managed policies to scope root session actions.</p>
9    /// <ul>
10    /// <li>
11    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMAuditRootUserCredentials">IAMAuditRootUserCredentials</a></p></li>
12    /// <li>
13    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMCreateRootUserPassword">IAMCreateRootUserPassword</a></p></li>
14    /// <li>
15    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMDeleteRootUserCredentials">IAMDeleteRootUserCredentials</a></p></li>
16    /// <li>
17    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-S3UnlockBucketPolicy">S3UnlockBucketPolicy</a></p></li>
18    /// <li>
19    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-SQSUnlockQueuePolicy">SQSUnlockQueuePolicy</a></p></li>
20    /// </ul>
21    pub task_policy_arn: ::std::option::Option<crate::types::PolicyDescriptorType>,
22    /// <p>The duration, in seconds, of the privileged session. The value can range from 0 seconds up to the maximum session duration of 900 seconds (15 minutes). If you specify a value higher than this setting, the operation fails.</p>
23    /// <p>By default, the value is set to <code>900</code> seconds.</p>
24    pub duration_seconds: ::std::option::Option<i32>,
25}
26impl  AssumeRootInput  {
27    /// <p>The member account principal ARN or account ID.</p>
28    pub fn target_principal(&self) -> ::std::option::Option<&str> {
29        self.target_principal.as_deref()
30    }
31    /// <p>The identity based policy that scopes the session to the privileged tasks that can be performed. You can use one of following Amazon Web Services managed policies to scope root session actions.</p>
32    /// <ul>
33    /// <li>
34    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMAuditRootUserCredentials">IAMAuditRootUserCredentials</a></p></li>
35    /// <li>
36    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMCreateRootUserPassword">IAMCreateRootUserPassword</a></p></li>
37    /// <li>
38    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMDeleteRootUserCredentials">IAMDeleteRootUserCredentials</a></p></li>
39    /// <li>
40    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-S3UnlockBucketPolicy">S3UnlockBucketPolicy</a></p></li>
41    /// <li>
42    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-SQSUnlockQueuePolicy">SQSUnlockQueuePolicy</a></p></li>
43    /// </ul>
44    pub fn task_policy_arn(&self) -> ::std::option::Option<&crate::types::PolicyDescriptorType> {
45        self.task_policy_arn.as_ref()
46    }
47    /// <p>The duration, in seconds, of the privileged session. The value can range from 0 seconds up to the maximum session duration of 900 seconds (15 minutes). If you specify a value higher than this setting, the operation fails.</p>
48    /// <p>By default, the value is set to <code>900</code> seconds.</p>
49    pub fn duration_seconds(&self) -> ::std::option::Option<i32> {
50        self.duration_seconds
51    }
52}
53static ASSUMEROOTINPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.sts.synthetic#AssumeRootInput", "com.amazonaws.sts.synthetic", "AssumeRootInput");
54static ASSUMEROOTINPUT_MEMBER_TARGET_PRINCIPAL: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
55                            ::aws_smithy_schema::ShapeId::from_static(
56                                "com.amazonaws.sts.synthetic#AssumeRootInput$TargetPrincipal",
57                                "com.amazonaws.sts.synthetic",
58                                "AssumeRootInput",
59                            ),
60                            ::aws_smithy_schema::ShapeType::String,
61                            "TargetPrincipal",
62                            0,
63                        );
64static ASSUMEROOTINPUT_MEMBER_TASK_POLICY_ARN: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
65                            ::aws_smithy_schema::ShapeId::from_static(
66                                "com.amazonaws.sts.synthetic#AssumeRootInput$TaskPolicyArn",
67                                "com.amazonaws.sts.synthetic",
68                                "AssumeRootInput",
69                            ),
70                            ::aws_smithy_schema::ShapeType::Structure,
71                            "TaskPolicyArn",
72                            1,
73                        );
74static ASSUMEROOTINPUT_MEMBER_DURATION_SECONDS: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
75                            ::aws_smithy_schema::ShapeId::from_static(
76                                "com.amazonaws.sts.synthetic#AssumeRootInput$DurationSeconds",
77                                "com.amazonaws.sts.synthetic",
78                                "AssumeRootInput",
79                            ),
80                            ::aws_smithy_schema::ShapeType::Integer,
81                            "DurationSeconds",
82                            2,
83                        );
84static ASSUMEROOTINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
85                            ASSUMEROOTINPUT_SCHEMA_ID,
86                            ::aws_smithy_schema::ShapeType::Structure,
87                            &[&ASSUMEROOTINPUT_MEMBER_TARGET_PRINCIPAL, &ASSUMEROOTINPUT_MEMBER_TASK_POLICY_ARN, &ASSUMEROOTINPUT_MEMBER_DURATION_SECONDS],
88                        );
89impl AssumeRootInput {
90                /// The schema for this shape.
91                pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &ASSUMEROOTINPUT_SCHEMA;
92            }
93impl ::aws_smithy_schema::serde::SerializableStruct for AssumeRootInput {
94                #[allow(unused_variables, clippy::diverging_sub_expression)]
95                fn serialize_members(&self, ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
96                    if let Some(ref val) = self.target_principal {
97                                ser.write_string(&ASSUMEROOTINPUT_MEMBER_TARGET_PRINCIPAL, val)?;
98                            }
99if let Some(ref val) = self.task_policy_arn {
100                                ser.write_struct(&ASSUMEROOTINPUT_MEMBER_TASK_POLICY_ARN, val)?;
101                            }
102if let Some(ref val) = self.duration_seconds {
103                                ser.write_integer(&ASSUMEROOTINPUT_MEMBER_DURATION_SECONDS, *val)?;
104                            }
105                    Ok(())
106                }
107            }
108impl AssumeRootInput {
109                /// Deserializes this structure from a [`ShapeDeserializer`].
110                pub fn deserialize(deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
111                    #[allow(unused_variables, unused_mut)]
112                    let mut builder = Self::builder();
113                    #[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding, clippy::diverging_sub_expression)]
114                    deserializer.read_struct(&ASSUMEROOTINPUT_SCHEMA, &mut |member, deser| {
115                        match member.member_index() {
116                            Some(0) => {
117                                    builder.target_principal = Some(deser.read_string(member)?);
118                                }
119Some(1) => {
120                                    builder.task_policy_arn = Some(crate::types::PolicyDescriptorType::deserialize(deser)?);
121                                }
122Some(2) => {
123                                    builder.duration_seconds = Some(deser.read_integer(member)?);
124                                }
125                            _ => {}
126                        }
127                        Ok(())
128                    })?;
129                    builder.target_principal = builder.target_principal.or(Some(String::new()));
130builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
131                }
132            }
133impl AssumeRootInput {
134                        /// Deserializes this structure from a body deserializer and HTTP response.
135                        pub fn deserialize_with_response(
136                            deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
137                            _headers: &::aws_smithy_runtime_api::http::Headers,
138                            _status: u16,
139                            _body: &[u8],
140                        ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
141                            Self::deserialize(deserializer)
142                        }
143                    }
144impl AssumeRootInput {
145    /// Creates a new builder-style object to manufacture [`AssumeRootInput`](crate::operation::assume_root::AssumeRootInput).
146    pub fn builder() -> crate::operation::assume_root::builders::AssumeRootInputBuilder {
147        crate::operation::assume_root::builders::AssumeRootInputBuilder::default()
148    }
149}
150
151/// A builder for [`AssumeRootInput`](crate::operation::assume_root::AssumeRootInput).
152#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
153#[non_exhaustive]
154pub struct AssumeRootInputBuilder {
155    pub(crate) target_principal: ::std::option::Option<::std::string::String>,
156    pub(crate) task_policy_arn: ::std::option::Option<crate::types::PolicyDescriptorType>,
157    pub(crate) duration_seconds: ::std::option::Option<i32>,
158}
159impl AssumeRootInputBuilder {
160    /// <p>The member account principal ARN or account ID.</p>
161    /// This field is required.
162    pub fn target_principal(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
163        self.target_principal = ::std::option::Option::Some(input.into());
164        self
165    }
166    /// <p>The member account principal ARN or account ID.</p>
167    pub fn set_target_principal(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
168        self.target_principal = input; self
169    }
170    /// <p>The member account principal ARN or account ID.</p>
171    pub fn get_target_principal(&self) -> &::std::option::Option<::std::string::String> {
172        &self.target_principal
173    }
174    /// <p>The identity based policy that scopes the session to the privileged tasks that can be performed. You can use one of following Amazon Web Services managed policies to scope root session actions.</p>
175    /// <ul>
176    /// <li>
177    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMAuditRootUserCredentials">IAMAuditRootUserCredentials</a></p></li>
178    /// <li>
179    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMCreateRootUserPassword">IAMCreateRootUserPassword</a></p></li>
180    /// <li>
181    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMDeleteRootUserCredentials">IAMDeleteRootUserCredentials</a></p></li>
182    /// <li>
183    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-S3UnlockBucketPolicy">S3UnlockBucketPolicy</a></p></li>
184    /// <li>
185    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-SQSUnlockQueuePolicy">SQSUnlockQueuePolicy</a></p></li>
186    /// </ul>
187    /// This field is required.
188    pub fn task_policy_arn(mut self, input: crate::types::PolicyDescriptorType) -> Self {
189        self.task_policy_arn = ::std::option::Option::Some(input);
190        self
191    }
192    /// <p>The identity based policy that scopes the session to the privileged tasks that can be performed. You can use one of following Amazon Web Services managed policies to scope root session actions.</p>
193    /// <ul>
194    /// <li>
195    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMAuditRootUserCredentials">IAMAuditRootUserCredentials</a></p></li>
196    /// <li>
197    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMCreateRootUserPassword">IAMCreateRootUserPassword</a></p></li>
198    /// <li>
199    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMDeleteRootUserCredentials">IAMDeleteRootUserCredentials</a></p></li>
200    /// <li>
201    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-S3UnlockBucketPolicy">S3UnlockBucketPolicy</a></p></li>
202    /// <li>
203    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-SQSUnlockQueuePolicy">SQSUnlockQueuePolicy</a></p></li>
204    /// </ul>
205    pub fn set_task_policy_arn(mut self, input: ::std::option::Option<crate::types::PolicyDescriptorType>) -> Self {
206        self.task_policy_arn = input; self
207    }
208    /// <p>The identity based policy that scopes the session to the privileged tasks that can be performed. You can use one of following Amazon Web Services managed policies to scope root session actions.</p>
209    /// <ul>
210    /// <li>
211    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMAuditRootUserCredentials">IAMAuditRootUserCredentials</a></p></li>
212    /// <li>
213    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMCreateRootUserPassword">IAMCreateRootUserPassword</a></p></li>
214    /// <li>
215    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMDeleteRootUserCredentials">IAMDeleteRootUserCredentials</a></p></li>
216    /// <li>
217    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-S3UnlockBucketPolicy">S3UnlockBucketPolicy</a></p></li>
218    /// <li>
219    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-SQSUnlockQueuePolicy">SQSUnlockQueuePolicy</a></p></li>
220    /// </ul>
221    pub fn get_task_policy_arn(&self) -> &::std::option::Option<crate::types::PolicyDescriptorType> {
222        &self.task_policy_arn
223    }
224    /// <p>The duration, in seconds, of the privileged session. The value can range from 0 seconds up to the maximum session duration of 900 seconds (15 minutes). If you specify a value higher than this setting, the operation fails.</p>
225    /// <p>By default, the value is set to <code>900</code> seconds.</p>
226    pub fn duration_seconds(mut self, input: i32) -> Self {
227        self.duration_seconds = ::std::option::Option::Some(input);
228        self
229    }
230    /// <p>The duration, in seconds, of the privileged session. The value can range from 0 seconds up to the maximum session duration of 900 seconds (15 minutes). If you specify a value higher than this setting, the operation fails.</p>
231    /// <p>By default, the value is set to <code>900</code> seconds.</p>
232    pub fn set_duration_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
233        self.duration_seconds = input; self
234    }
235    /// <p>The duration, in seconds, of the privileged session. The value can range from 0 seconds up to the maximum session duration of 900 seconds (15 minutes). If you specify a value higher than this setting, the operation fails.</p>
236    /// <p>By default, the value is set to <code>900</code> seconds.</p>
237    pub fn get_duration_seconds(&self) -> &::std::option::Option<i32> {
238        &self.duration_seconds
239    }
240    /// Consumes the builder and constructs a [`AssumeRootInput`](crate::operation::assume_root::AssumeRootInput).
241    pub fn build(self) -> ::std::result::Result<crate::operation::assume_root::AssumeRootInput, ::aws_smithy_types::error::operation::BuildError> {
242        ::std::result::Result::Ok(
243            crate::operation::assume_root::AssumeRootInput {
244                target_principal: self.target_principal
245                ,
246                task_policy_arn: self.task_policy_arn
247                ,
248                duration_seconds: self.duration_seconds
249                ,
250            }
251        )
252    }
253}
254