aws_sdk_sts/operation/assume_root/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::assume_root::_assume_root_output::AssumeRootOutputBuilder;
3
4pub use crate::operation::assume_root::_assume_root_input::AssumeRootInputBuilder;
5
6impl crate::operation::assume_root::builders::AssumeRootInputBuilder {
7                    /// Sends a request with this input using the given client.
8                    pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result<
9                        crate::operation::assume_root::AssumeRootOutput,
10                        ::aws_smithy_runtime_api::client::result::SdkError<
11                            crate::operation::assume_root::AssumeRootError,
12                            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse
13                        >
14                    > {
15                        let mut fluent_builder = client.assume_root();
16                        fluent_builder.inner = self;
17                        fluent_builder.send().await
18                    }
19                }
20/// Fluent builder constructing a request to `AssumeRoot`.
21/// 
22/// <p>Returns a set of short term credentials you can use to perform privileged tasks on a member account in your organization.</p>
23/// <p>Before you can launch a privileged session, you must have centralized root access in your organization. For steps to enable this feature, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-enable-root-access.html">Centralize root access for member accounts</a> in the <i>IAM User Guide</i>.</p><note>
24/// <p>The STS global endpoint is not supported for AssumeRoot. You must send this request to a Regional STS endpoint. For more information, see <a href="https://docs.aws.amazon.com/STS/latest/APIReference/welcome.html#sts-endpoints">Endpoints</a>.</p>
25/// </note>
26/// <p>You can track AssumeRoot in CloudTrail logs to determine what actions were performed in a session. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-track-privileged-tasks.html">Track privileged tasks in CloudTrail</a> in the <i>IAM User Guide</i>.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct AssumeRootFluentBuilder {
29                handle: ::std::sync::Arc<crate::client::Handle>,
30                inner: crate::operation::assume_root::builders::AssumeRootInputBuilder,
31config_override: ::std::option::Option<crate::config::Builder>,
32            }
33impl
34                crate::client::customize::internal::CustomizableSend<
35                    crate::operation::assume_root::AssumeRootOutput,
36                    crate::operation::assume_root::AssumeRootError,
37                > for AssumeRootFluentBuilder
38            {
39                fn send(
40                    self,
41                    config_override: crate::config::Builder,
42                ) -> crate::client::customize::internal::BoxFuture<
43                    crate::client::customize::internal::SendResult<
44                        crate::operation::assume_root::AssumeRootOutput,
45                        crate::operation::assume_root::AssumeRootError,
46                    >,
47                > {
48                    ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49                }
50            }
51impl AssumeRootFluentBuilder {
52    /// Creates a new `AssumeRootFluentBuilder`.
53                    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54                        Self {
55                            handle,
56                            inner: ::std::default::Default::default(),
57    config_override: ::std::option::Option::None,
58                        }
59                    }
60    /// Access the AssumeRoot as a reference.
61                    pub fn as_input(&self) -> &crate::operation::assume_root::builders::AssumeRootInputBuilder {
62                        &self.inner
63                    }
64    /// Sends the request and returns the response.
65                    ///
66                    /// If an error occurs, an `SdkError` will be returned with additional details that
67                    /// can be matched against.
68                    ///
69                    /// By default, any retryable failures will be retried twice. Retry behavior
70                    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71                    /// set when configuring the client.
72                    pub async fn send(self) -> ::std::result::Result<crate::operation::assume_root::AssumeRootOutput, ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::assume_root::AssumeRootError, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> {
73                        let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
74                        let runtime_plugins = crate::operation::assume_root::AssumeRoot::operation_runtime_plugins(
75                            self.handle.runtime_plugins.clone(),
76                            &self.handle.conf,
77                            self.config_override,
78                        );
79                        crate::operation::assume_root::AssumeRoot::orchestrate(&runtime_plugins, input).await
80                    }
81    
82                    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
83                    pub fn customize(
84                        self,
85                    ) -> crate::client::customize::CustomizableOperation<crate::operation::assume_root::AssumeRootOutput, crate::operation::assume_root::AssumeRootError, Self> {
86                        crate::client::customize::CustomizableOperation::new(self)
87                    }
88    pub(crate) fn config_override(
89                            mut self,
90                            config_override: impl ::std::convert::Into<crate::config::Builder>,
91                        ) -> Self {
92                            self.set_config_override(::std::option::Option::Some(config_override.into()));
93                            self
94                        }
95    
96                        pub(crate) fn set_config_override(
97                            &mut self,
98                            config_override: ::std::option::Option<crate::config::Builder>,
99                        ) -> &mut Self {
100                            self.config_override = config_override;
101                            self
102                        }
103    /// <p>The member account principal ARN or account ID.</p>
104    pub fn target_principal(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
105                    self.inner = self.inner.target_principal(input.into());
106                    self
107                }
108    /// <p>The member account principal ARN or account ID.</p>
109    pub fn set_target_principal(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
110                    self.inner = self.inner.set_target_principal(input);
111                    self
112                }
113    /// <p>The member account principal ARN or account ID.</p>
114    pub fn get_target_principal(&self) -> &::std::option::Option<::std::string::String> {
115                    self.inner.get_target_principal()
116                }
117    /// <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>
118    /// <ul>
119    /// <li>
120    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMAuditRootUserCredentials">IAMAuditRootUserCredentials</a></p></li>
121    /// <li>
122    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMCreateRootUserPassword">IAMCreateRootUserPassword</a></p></li>
123    /// <li>
124    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMDeleteRootUserCredentials">IAMDeleteRootUserCredentials</a></p></li>
125    /// <li>
126    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-S3UnlockBucketPolicy">S3UnlockBucketPolicy</a></p></li>
127    /// <li>
128    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-SQSUnlockQueuePolicy">SQSUnlockQueuePolicy</a></p></li>
129    /// </ul>
130    pub fn task_policy_arn(mut self, input: crate::types::PolicyDescriptorType) -> Self {
131                    self.inner = self.inner.task_policy_arn(input);
132                    self
133                }
134    /// <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>
135    /// <ul>
136    /// <li>
137    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMAuditRootUserCredentials">IAMAuditRootUserCredentials</a></p></li>
138    /// <li>
139    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMCreateRootUserPassword">IAMCreateRootUserPassword</a></p></li>
140    /// <li>
141    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMDeleteRootUserCredentials">IAMDeleteRootUserCredentials</a></p></li>
142    /// <li>
143    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-S3UnlockBucketPolicy">S3UnlockBucketPolicy</a></p></li>
144    /// <li>
145    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-SQSUnlockQueuePolicy">SQSUnlockQueuePolicy</a></p></li>
146    /// </ul>
147    pub fn set_task_policy_arn(mut self, input: ::std::option::Option<crate::types::PolicyDescriptorType>) -> Self {
148                    self.inner = self.inner.set_task_policy_arn(input);
149                    self
150                }
151    /// <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>
152    /// <ul>
153    /// <li>
154    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMAuditRootUserCredentials">IAMAuditRootUserCredentials</a></p></li>
155    /// <li>
156    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMCreateRootUserPassword">IAMCreateRootUserPassword</a></p></li>
157    /// <li>
158    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-IAMDeleteRootUserCredentials">IAMDeleteRootUserCredentials</a></p></li>
159    /// <li>
160    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-S3UnlockBucketPolicy">S3UnlockBucketPolicy</a></p></li>
161    /// <li>
162    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-iam-awsmanpol.html#security-iam-awsmanpol-SQSUnlockQueuePolicy">SQSUnlockQueuePolicy</a></p></li>
163    /// </ul>
164    pub fn get_task_policy_arn(&self) -> &::std::option::Option<crate::types::PolicyDescriptorType> {
165                    self.inner.get_task_policy_arn()
166                }
167    /// <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>
168    /// <p>By default, the value is set to <code>900</code> seconds.</p>
169    pub fn duration_seconds(mut self, input: i32) -> Self {
170                    self.inner = self.inner.duration_seconds(input);
171                    self
172                }
173    /// <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>
174    /// <p>By default, the value is set to <code>900</code> seconds.</p>
175    pub fn set_duration_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
176                    self.inner = self.inner.set_duration_seconds(input);
177                    self
178                }
179    /// <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>
180    /// <p>By default, the value is set to <code>900</code> seconds.</p>
181    pub fn get_duration_seconds(&self) -> &::std::option::Option<i32> {
182                    self.inner.get_duration_seconds()
183                }
184}
185