Skip to main content

aws_sdk_directory/operation/reset_user_password/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::reset_user_password::_reset_user_password_output::ResetUserPasswordOutputBuilder;
3
4pub use crate::operation::reset_user_password::_reset_user_password_input::ResetUserPasswordInputBuilder;
5
6impl crate::operation::reset_user_password::builders::ResetUserPasswordInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::reset_user_password::ResetUserPasswordOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::reset_user_password::ResetUserPasswordError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.reset_user_password();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ResetUserPassword`.
24///
25/// <p>Resets the password for any user in your Managed Microsoft AD or Simple AD directory. Disabled users will become enabled and can be authenticated following the API call.</p>
26/// <p>You can reset the password for any user in your directory with the following exceptions:</p>
27/// <ul>
28/// <li>
29/// <p>For Simple AD, you cannot reset the password for any user that is a member of either the <b>Domain Admins</b> or <b>Enterprise Admins</b> group except for the administrator user.</p></li>
30/// <li>
31/// <p>For Managed Microsoft AD, you can only reset the password for a user that is in an OU based off of the NetBIOS name that you typed when you created your directory. For example, you cannot reset the password for a user in the <b>Amazon Web Services Reserved</b> OU. For more information about the OU structure for an Managed Microsoft AD directory, see <a href="https://docs.aws.amazon.com/directoryservice/latest/admin-guide/ms_ad_getting_started_what_gets_created.html">What Gets Created</a> in the <i>Directory Service Administration Guide</i>.</p></li>
32/// </ul>
33#[derive(::std::clone::Clone, ::std::fmt::Debug)]
34pub struct ResetUserPasswordFluentBuilder {
35    handle: ::std::sync::Arc<crate::client::Handle>,
36    inner: crate::operation::reset_user_password::builders::ResetUserPasswordInputBuilder,
37    config_override: ::std::option::Option<crate::config::Builder>,
38}
39impl
40    crate::client::customize::internal::CustomizableSend<
41        crate::operation::reset_user_password::ResetUserPasswordOutput,
42        crate::operation::reset_user_password::ResetUserPasswordError,
43    > for ResetUserPasswordFluentBuilder
44{
45    fn send(
46        self,
47        config_override: crate::config::Builder,
48    ) -> crate::client::customize::internal::BoxFuture<
49        crate::client::customize::internal::SendResult<
50            crate::operation::reset_user_password::ResetUserPasswordOutput,
51            crate::operation::reset_user_password::ResetUserPasswordError,
52        >,
53    > {
54        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
55    }
56}
57impl ResetUserPasswordFluentBuilder {
58    /// Creates a new `ResetUserPasswordFluentBuilder`.
59    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
60        Self {
61            handle,
62            inner: ::std::default::Default::default(),
63            config_override: ::std::option::Option::None,
64        }
65    }
66    /// Access the ResetUserPassword as a reference.
67    pub fn as_input(&self) -> &crate::operation::reset_user_password::builders::ResetUserPasswordInputBuilder {
68        &self.inner
69    }
70    /// Sends the request and returns the response.
71    ///
72    /// If an error occurs, an `SdkError` will be returned with additional details that
73    /// can be matched against.
74    ///
75    /// By default, any retryable failures will be retried twice. Retry behavior
76    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
77    /// set when configuring the client.
78    pub async fn send(
79        self,
80    ) -> ::std::result::Result<
81        crate::operation::reset_user_password::ResetUserPasswordOutput,
82        ::aws_smithy_runtime_api::client::result::SdkError<
83            crate::operation::reset_user_password::ResetUserPasswordError,
84            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
85        >,
86    > {
87        let input = self
88            .inner
89            .build()
90            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
91        let runtime_plugins = crate::operation::reset_user_password::ResetUserPassword::operation_runtime_plugins(
92            self.handle.runtime_plugins.clone(),
93            &self.handle.conf,
94            self.config_override,
95        );
96        crate::operation::reset_user_password::ResetUserPassword::orchestrate(&runtime_plugins, input).await
97    }
98
99    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
100    pub fn customize(
101        self,
102    ) -> crate::client::customize::CustomizableOperation<
103        crate::operation::reset_user_password::ResetUserPasswordOutput,
104        crate::operation::reset_user_password::ResetUserPasswordError,
105        Self,
106    > {
107        crate::client::customize::CustomizableOperation::new(self)
108    }
109    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
110        self.set_config_override(::std::option::Option::Some(config_override.into()));
111        self
112    }
113
114    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
115        self.config_override = config_override;
116        self
117    }
118    /// <p>Identifier of the Managed Microsoft AD or Simple AD directory in which the user resides.</p>
119    pub fn directory_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
120        self.inner = self.inner.directory_id(input.into());
121        self
122    }
123    /// <p>Identifier of the Managed Microsoft AD or Simple AD directory in which the user resides.</p>
124    pub fn set_directory_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
125        self.inner = self.inner.set_directory_id(input);
126        self
127    }
128    /// <p>Identifier of the Managed Microsoft AD or Simple AD directory in which the user resides.</p>
129    pub fn get_directory_id(&self) -> &::std::option::Option<::std::string::String> {
130        self.inner.get_directory_id()
131    }
132    /// <p>The user name of the user whose password will be reset.</p>
133    pub fn user_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
134        self.inner = self.inner.user_name(input.into());
135        self
136    }
137    /// <p>The user name of the user whose password will be reset.</p>
138    pub fn set_user_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
139        self.inner = self.inner.set_user_name(input);
140        self
141    }
142    /// <p>The user name of the user whose password will be reset.</p>
143    pub fn get_user_name(&self) -> &::std::option::Option<::std::string::String> {
144        self.inner.get_user_name()
145    }
146    /// <p>The new password that will be reset.</p>
147    pub fn new_password(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
148        self.inner = self.inner.new_password(input.into());
149        self
150    }
151    /// <p>The new password that will be reset.</p>
152    pub fn set_new_password(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
153        self.inner = self.inner.set_new_password(input);
154        self
155    }
156    /// <p>The new password that will be reset.</p>
157    pub fn get_new_password(&self) -> &::std::option::Option<::std::string::String> {
158        self.inner.get_new_password()
159    }
160}