aws_sdk_eks/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::describe_cluster::builders::DescribeClusterInputBuilder,
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 DescribeCluster as a reference.
28    pub fn as_input(&self) -> &crate::operation::describe_cluster::builders::DescribeClusterInputBuilder {
29        &self.inner
30    }
31    /// Wait for `cluster_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::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","expected":"DELETING","comparator":"stringEquals"}}
60            if crate::waiters::matchers::match_describe_cluster_2e0bd61808cbeec1a(result) {
61                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
62            }
63            // Matches: {"output":{"path":"cluster.status","expected":"FAILED","comparator":"stringEquals"}}
64            if crate::waiters::matchers::match_describe_cluster_06c799b34731ffd71(result) {
65                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
66            }
67            // Matches: {"output":{"path":"cluster.status","expected":"ACTIVE","comparator":"stringEquals"}}
68            if crate::waiters::matchers::match_describe_cluster_8e9a63e8d6f5374c3(result) {
69                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
70            }
71            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
72        };
73        let operation = move || {
74            let input = input.clone();
75            let runtime_plugins = runtime_plugins.clone();
76            async move { crate::operation::describe_cluster::DescribeCluster::orchestrate(&runtime_plugins, input).await }
77        };
78        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
79            .min_delay(::std::time::Duration::from_secs(30))
80            .max_delay(::std::time::Duration::from_secs(120))
81            .max_wait(max_wait)
82            .time_source(time_source)
83            .sleep_impl(sleep_impl)
84            .acceptor(acceptor)
85            .operation(operation)
86            .build();
87        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
88    }
89    /// <p>The name of your cluster.</p>
90    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
91        self.inner = self.inner.name(input.into());
92        self
93    }
94    /// <p>The name of your cluster.</p>
95    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
96        self.inner = self.inner.set_name(input);
97        self
98    }
99    /// <p>The name of your cluster.</p>
100    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
101        self.inner.get_name()
102    }
103}
104
105/// Successful return type for the `cluster_active` waiter.
106pub type ClusterActiveFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
107    crate::operation::describe_cluster::DescribeClusterOutput,
108    ::aws_smithy_runtime_api::client::result::SdkError<
109        crate::operation::describe_cluster::DescribeClusterError,
110        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
111    >,
112>;
113
114/// Error type for the `cluster_active` waiter.
115pub type WaitUntilClusterActiveError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
116    crate::operation::describe_cluster::DescribeClusterOutput,
117    crate::operation::describe_cluster::DescribeClusterError,
118>;