aws_sdk_emr/waiters/
cluster_running.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `cluster_running` 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 ClusterRunningFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_cluster::builders::DescribeClusterInputBuilder,
18}
19impl ClusterRunningFluentBuilder {
20    /// Creates a new `ClusterRunningFluentBuilder`.
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 DescribeCluster as a reference.
28    pub fn as_input(&self) -> &crate::operation::describe_cluster::builders::DescribeClusterInputBuilder {
29        &self.inner
30    }
31    /// Wait for `cluster_running`
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<crate::waiters::cluster_running::ClusterRunningFinalPoll, crate::waiters::cluster_running::WaitUntilClusterRunningError>
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::describe_cluster::DescribeCluster::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::describe_cluster::DescribeClusterOutput,
57            &crate::operation::describe_cluster::DescribeClusterError,
58        >| {
59            // Matches: {"output":{"path":"Cluster.Status.State","expected":"RUNNING","comparator":"stringEquals"}}
60            if crate::waiters::matchers::match_describe_cluster_7197af0094d90f217(result) {
61                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
62            }
63            // Matches: {"output":{"path":"Cluster.Status.State","expected":"WAITING","comparator":"stringEquals"}}
64            if crate::waiters::matchers::match_describe_cluster_5e3cda8e30e4f9cce(result) {
65                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
66            }
67            // Matches: {"output":{"path":"Cluster.Status.State","expected":"TERMINATING","comparator":"stringEquals"}}
68            if crate::waiters::matchers::match_describe_cluster_d92e7a278f8dc25c1(result) {
69                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
70            }
71            // Matches: {"output":{"path":"Cluster.Status.State","expected":"TERMINATED","comparator":"stringEquals"}}
72            if crate::waiters::matchers::match_describe_cluster_38c4d73bbb3ebbe27(result) {
73                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
74            }
75            // Matches: {"output":{"path":"Cluster.Status.State","expected":"TERMINATED_WITH_ERRORS","comparator":"stringEquals"}}
76            if crate::waiters::matchers::match_describe_cluster_b33b33a717477077a(result) {
77                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
78            }
79            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
80        };
81        let operation = move || {
82            let input = input.clone();
83            let runtime_plugins = runtime_plugins.clone();
84            async move { crate::operation::describe_cluster::DescribeCluster::orchestrate(&runtime_plugins, input).await }
85        };
86        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
87            .min_delay(::std::time::Duration::from_secs(30))
88            .max_delay(::std::time::Duration::from_secs(120))
89            .max_wait(max_wait)
90            .time_source(time_source)
91            .sleep_impl(sleep_impl)
92            .acceptor(acceptor)
93            .operation(operation)
94            .build();
95        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
96    }
97    /// <p>The identifier of the cluster to describe.</p>
98    pub fn cluster_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
99        self.inner = self.inner.cluster_id(input.into());
100        self
101    }
102    /// <p>The identifier of the cluster to describe.</p>
103    pub fn set_cluster_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
104        self.inner = self.inner.set_cluster_id(input);
105        self
106    }
107    /// <p>The identifier of the cluster to describe.</p>
108    pub fn get_cluster_id(&self) -> &::std::option::Option<::std::string::String> {
109        self.inner.get_cluster_id()
110    }
111}
112
113/// Successful return type for the `cluster_running` waiter.
114pub type ClusterRunningFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
115    crate::operation::describe_cluster::DescribeClusterOutput,
116    ::aws_smithy_runtime_api::client::result::SdkError<
117        crate::operation::describe_cluster::DescribeClusterError,
118        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
119    >,
120>;
121
122/// Error type for the `cluster_running` waiter.
123pub type WaitUntilClusterRunningError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
124    crate::operation::describe_cluster::DescribeClusterOutput,
125    crate::operation::describe_cluster::DescribeClusterError,
126>;