aws_sdk_iam/waiters/
user_exists.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `user_exists` waiter.
5///
6/// This builder is intended to be used similar to the other fluent builders for
7/// normal operations on the client. However, instead of a `send` method, it has
8/// a `wait` method that takes a maximum amount of time to wait.
9///
10/// Construct this fluent builder using the client by importing the
11/// [`Waiters`](crate::client::Waiters) trait and calling the methods
12/// prefixed with `wait_until`.
13///
14#[derive(::std::clone::Clone, ::std::fmt::Debug)]
15pub struct UserExistsFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::get_user::builders::GetUserInputBuilder,
18}
19impl UserExistsFluentBuilder {
20    /// Creates a new `UserExistsFluentBuilder`.
21    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
22        Self {
23            handle,
24            inner: ::std::default::Default::default(),
25        }
26    }
27    /// Access the GetUser as a reference.
28    pub fn as_input(&self) -> &crate::operation::get_user::builders::GetUserInputBuilder {
29        &self.inner
30    }
31    /// Wait for `user_exists`
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<crate::waiters::user_exists::UserExistsFinalPoll, crate::waiters::user_exists::WaitUntilUserExistsError> {
36        let input = self
37            .inner
38            .build()
39            .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
40        let runtime_plugins = crate::operation::get_user::GetUser::operation_runtime_plugins(
41            self.handle.runtime_plugins.clone(),
42            &self.handle.conf,
43            ::std::option::Option::None,
44        )
45        .with_operation_plugin(crate::sdk_feature_tracker::waiter::WaiterFeatureTrackerRuntimePlugin::new());
46        let mut cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
47        let runtime_components_builder = runtime_plugins
48            .apply_client_configuration(&mut cfg)
49            .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
50        let time_components = runtime_components_builder.into_time_components();
51        let sleep_impl = time_components.sleep_impl().expect("a sleep impl is required by waiters");
52        let time_source = time_components.time_source().expect("a time source is required by waiters");
53
54        let acceptor = move |result: ::std::result::Result<&crate::operation::get_user::GetUserOutput, &crate::operation::get_user::GetUserError>| {
55            // Matches: {"success":true}
56            if crate::waiters::matchers::match_get_user_c955e57777ec0d736(result) {
57                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
58            }
59            // Matches: {"errorType":"NoSuchEntity"}
60            if crate::waiters::matchers::match_get_user_606386b4be9df73c9(result) {
61                return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
62            }
63            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
64        };
65        let operation = move || {
66            let input = input.clone();
67            let runtime_plugins = runtime_plugins.clone();
68            async move { crate::operation::get_user::GetUser::orchestrate(&runtime_plugins, input).await }
69        };
70        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
71            .min_delay(::std::time::Duration::from_secs(1))
72            .max_delay(::std::time::Duration::from_secs(120))
73            .max_wait(max_wait)
74            .time_source(time_source)
75            .sleep_impl(sleep_impl)
76            .acceptor(acceptor)
77            .operation(operation)
78            .build();
79        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
80    }
81    /// <p>The name of the user to get information about.</p>
82    /// <p>This parameter is optional. If it is not included, it defaults to the user making the request. 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>
83    pub fn user_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
84        self.inner = self.inner.user_name(input.into());
85        self
86    }
87    /// <p>The name of the user to get information about.</p>
88    /// <p>This parameter is optional. If it is not included, it defaults to the user making the request. 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>
89    pub fn set_user_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
90        self.inner = self.inner.set_user_name(input);
91        self
92    }
93    /// <p>The name of the user to get information about.</p>
94    /// <p>This parameter is optional. If it is not included, it defaults to the user making the request. 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>
95    pub fn get_user_name(&self) -> &::std::option::Option<::std::string::String> {
96        self.inner.get_user_name()
97    }
98}
99
100/// Successful return type for the `user_exists` waiter.
101pub type UserExistsFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
102    crate::operation::get_user::GetUserOutput,
103    ::aws_smithy_runtime_api::client::result::SdkError<
104        crate::operation::get_user::GetUserError,
105        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
106    >,
107>;
108
109/// Error type for the `user_exists` waiter.
110pub type WaitUntilUserExistsError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
111    crate::operation::get_user::GetUserOutput,
112    crate::operation::get_user::GetUserError,
113>;