aws_sdk_dsql/waiters/
cluster_active.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `cluster_active` 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 ClusterActiveFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::get_cluster::builders::GetClusterInputBuilder,
18}
19impl ClusterActiveFluentBuilder {
20    /// Creates a new `ClusterActiveFluentBuilder`.
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 GetCluster as a reference.
28    pub fn as_input(&self) -> &crate::operation::get_cluster::builders::GetClusterInputBuilder {
29        &self.inner
30    }
31    /// Wait until a Cluster is ACTIVE
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<crate::waiters::cluster_active::ClusterActiveFinalPoll, crate::waiters::cluster_active::WaitUntilClusterActiveError>
36    {
37        let input = self
38            .inner
39            .build()
40            .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
41        let runtime_plugins = crate::operation::get_cluster::GetCluster::operation_runtime_plugins(
42            self.handle.runtime_plugins.clone(),
43            &self.handle.conf,
44            ::std::option::Option::None,
45        )
46        .with_operation_plugin(crate::sdk_feature_tracker::waiter::WaiterFeatureTrackerRuntimePlugin::new());
47        let mut cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
48        let runtime_components_builder = runtime_plugins
49            .apply_client_configuration(&mut cfg)
50            .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
51        let time_components = runtime_components_builder.into_time_components();
52        let sleep_impl = time_components.sleep_impl().expect("a sleep impl is required by waiters");
53        let time_source = time_components.time_source().expect("a time source is required by waiters");
54
55        let acceptor = move |result: ::std::result::Result<
56            &crate::operation::get_cluster::GetClusterOutput,
57            &crate::operation::get_cluster::GetClusterError,
58        >| {
59            // Matches: {"output":{"path":"status","expected":"ACTIVE","comparator":"stringEquals"}}
60            if crate::waiters::matchers::match_get_cluster_a0b9c099115634691(result) {
61                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
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_cluster::GetCluster::orchestrate(&runtime_plugins, input).await }
69        };
70        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
71            .min_delay(::std::time::Duration::from_secs(2))
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 ID of the cluster to retrieve.</p>
82    pub fn identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
83        self.inner = self.inner.identifier(input.into());
84        self
85    }
86    /// <p>The ID of the cluster to retrieve.</p>
87    pub fn set_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
88        self.inner = self.inner.set_identifier(input);
89        self
90    }
91    /// <p>The ID of the cluster to retrieve.</p>
92    pub fn get_identifier(&self) -> &::std::option::Option<::std::string::String> {
93        self.inner.get_identifier()
94    }
95}
96
97/// Successful return type for the `cluster_active` waiter.
98pub type ClusterActiveFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
99    crate::operation::get_cluster::GetClusterOutput,
100    ::aws_smithy_runtime_api::client::result::SdkError<
101        crate::operation::get_cluster::GetClusterError,
102        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
103    >,
104>;
105
106/// Error type for the `cluster_active` waiter.
107pub type WaitUntilClusterActiveError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
108    crate::operation::get_cluster::GetClusterOutput,
109    crate::operation::get_cluster::GetClusterError,
110>;