aws_sdk_iam/operation/delete_user/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::delete_user::_delete_user_output::DeleteUserOutputBuilder;
3
4pub use crate::operation::delete_user::_delete_user_input::DeleteUserInputBuilder;
5
6impl crate::operation::delete_user::builders::DeleteUserInputBuilder {
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::delete_user::DeleteUserOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::delete_user::DeleteUserError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.delete_user();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `DeleteUser`.
24///
25/// <p>Deletes the specified IAM user. Unlike the Amazon Web Services Management Console, when you delete a user programmatically, you must delete the items attached to the user manually, or the deletion fails. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_manage.html#id_users_deleting_cli">Deleting an IAM user</a>. Before attempting to delete a user, remove the following items:</p>
26/// <ul>
27/// <li>
28/// <p>Password (<a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteLoginProfile.html">DeleteLoginProfile</a>)</p></li>
29/// <li>
30/// <p>Access keys (<a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteAccessKey.html">DeleteAccessKey</a>)</p></li>
31/// <li>
32/// <p>Signing certificate (<a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteSigningCertificate.html">DeleteSigningCertificate</a>)</p></li>
33/// <li>
34/// <p>SSH public key (<a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteSSHPublicKey.html">DeleteSSHPublicKey</a>)</p></li>
35/// <li>
36/// <p>Git credentials (<a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteServiceSpecificCredential.html">DeleteServiceSpecificCredential</a>)</p></li>
37/// <li>
38/// <p>Multi-factor authentication (MFA) device (<a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeactivateMFADevice.html">DeactivateMFADevice</a>, <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteVirtualMFADevice.html">DeleteVirtualMFADevice</a>)</p></li>
39/// <li>
40/// <p>Inline policies (<a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteUserPolicy.html">DeleteUserPolicy</a>)</p></li>
41/// <li>
42/// <p>Attached managed policies (<a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_DetachUserPolicy.html">DetachUserPolicy</a>)</p></li>
43/// <li>
44/// <p>Group memberships (<a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_RemoveUserFromGroup.html">RemoveUserFromGroup</a>)</p></li>
45/// </ul>
46#[derive(::std::clone::Clone, ::std::fmt::Debug)]
47pub struct DeleteUserFluentBuilder {
48 handle: ::std::sync::Arc<crate::client::Handle>,
49 inner: crate::operation::delete_user::builders::DeleteUserInputBuilder,
50 config_override: ::std::option::Option<crate::config::Builder>,
51}
52impl
53 crate::client::customize::internal::CustomizableSend<
54 crate::operation::delete_user::DeleteUserOutput,
55 crate::operation::delete_user::DeleteUserError,
56 > for DeleteUserFluentBuilder
57{
58 fn send(
59 self,
60 config_override: crate::config::Builder,
61 ) -> crate::client::customize::internal::BoxFuture<
62 crate::client::customize::internal::SendResult<
63 crate::operation::delete_user::DeleteUserOutput,
64 crate::operation::delete_user::DeleteUserError,
65 >,
66 > {
67 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
68 }
69}
70impl DeleteUserFluentBuilder {
71 /// Creates a new `DeleteUserFluentBuilder`.
72 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
73 Self {
74 handle,
75 inner: ::std::default::Default::default(),
76 config_override: ::std::option::Option::None,
77 }
78 }
79 /// Access the DeleteUser as a reference.
80 pub fn as_input(&self) -> &crate::operation::delete_user::builders::DeleteUserInputBuilder {
81 &self.inner
82 }
83 /// Sends the request and returns the response.
84 ///
85 /// If an error occurs, an `SdkError` will be returned with additional details that
86 /// can be matched against.
87 ///
88 /// By default, any retryable failures will be retried twice. Retry behavior
89 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
90 /// set when configuring the client.
91 pub async fn send(
92 self,
93 ) -> ::std::result::Result<
94 crate::operation::delete_user::DeleteUserOutput,
95 ::aws_smithy_runtime_api::client::result::SdkError<
96 crate::operation::delete_user::DeleteUserError,
97 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
98 >,
99 > {
100 let input = self
101 .inner
102 .build()
103 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
104 let runtime_plugins = crate::operation::delete_user::DeleteUser::operation_runtime_plugins(
105 self.handle.runtime_plugins.clone(),
106 &self.handle.conf,
107 self.config_override,
108 );
109 crate::operation::delete_user::DeleteUser::orchestrate(&runtime_plugins, input).await
110 }
111
112 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
113 pub fn customize(
114 self,
115 ) -> crate::client::customize::CustomizableOperation<
116 crate::operation::delete_user::DeleteUserOutput,
117 crate::operation::delete_user::DeleteUserError,
118 Self,
119 > {
120 crate::client::customize::CustomizableOperation::new(self)
121 }
122 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
123 self.set_config_override(::std::option::Option::Some(config_override.into()));
124 self
125 }
126
127 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
128 self.config_override = config_override;
129 self
130 }
131 /// <p>The name of the user to delete.</p>
132 /// <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-</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 name of the user to delete.</p>
138 /// <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-</p>
139 pub fn set_user_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140 self.inner = self.inner.set_user_name(input);
141 self
142 }
143 /// <p>The name of the user to delete.</p>
144 /// <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-</p>
145 pub fn get_user_name(&self) -> &::std::option::Option<::std::string::String> {
146 self.inner.get_user_name()
147 }
148}