aws_sdk_redshift/waiters/
cluster_available.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `cluster_available` 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 ClusterAvailableFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_clusters::builders::DescribeClustersInputBuilder,
18}
19impl ClusterAvailableFluentBuilder {
20    /// Creates a new `ClusterAvailableFluentBuilder`.
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 DescribeClusters as a reference.
28    pub fn as_input(&self) -> &crate::operation::describe_clusters::builders::DescribeClustersInputBuilder {
29        &self.inner
30    }
31    /// Wait for `cluster_available`
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::cluster_available::ClusterAvailableFinalPoll,
37        crate::waiters::cluster_available::WaitUntilClusterAvailableError,
38    > {
39        let input = self
40            .inner
41            .build()
42            .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
43        let runtime_plugins = crate::operation::describe_clusters::DescribeClusters::operation_runtime_plugins(
44            self.handle.runtime_plugins.clone(),
45            &self.handle.conf,
46            ::std::option::Option::None,
47        )
48        .with_operation_plugin(crate::sdk_feature_tracker::waiter::WaiterFeatureTrackerRuntimePlugin::new());
49        let mut cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
50        let runtime_components_builder = runtime_plugins
51            .apply_client_configuration(&mut cfg)
52            .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
53        let time_components = runtime_components_builder.into_time_components();
54        let sleep_impl = time_components.sleep_impl().expect("a sleep impl is required by waiters");
55        let time_source = time_components.time_source().expect("a time source is required by waiters");
56
57        let acceptor = move |result: ::std::result::Result<
58            &crate::operation::describe_clusters::DescribeClustersOutput,
59            &crate::operation::describe_clusters::DescribeClustersError,
60        >| {
61            // Matches: {"output":{"path":"Clusters[].ClusterStatus","expected":"available","comparator":"allStringEquals"}}
62            if crate::waiters::matchers::match_describe_clusters_d94f699084f934f23(result) {
63                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64            }
65            // Matches: {"output":{"path":"Clusters[].ClusterStatus","expected":"deleting","comparator":"anyStringEquals"}}
66            if crate::waiters::matchers::match_describe_clusters_36fb459f8f7fb96c3(result) {
67                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
68            }
69            // Matches: {"errorType":"ClusterNotFound"}
70            if crate::waiters::matchers::match_describe_clusters_f8bb8a172c7bfc68f(result) {
71                return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
72            }
73            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
74        };
75        let operation = move || {
76            let input = input.clone();
77            let runtime_plugins = runtime_plugins.clone();
78            async move { crate::operation::describe_clusters::DescribeClusters::orchestrate(&runtime_plugins, input).await }
79        };
80        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
81            .min_delay(::std::time::Duration::from_secs(60))
82            .max_delay(::std::time::Duration::from_secs(120))
83            .max_wait(max_wait)
84            .time_source(time_source)
85            .sleep_impl(sleep_impl)
86            .acceptor(acceptor)
87            .operation(operation)
88            .build();
89        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
90    }
91    /// <p>The unique identifier of a cluster whose properties you are requesting. This parameter is case sensitive.</p>
92    /// <p>The default is that all clusters defined for an account are returned.</p>
93    pub fn cluster_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
94        self.inner = self.inner.cluster_identifier(input.into());
95        self
96    }
97    /// <p>The unique identifier of a cluster whose properties you are requesting. This parameter is case sensitive.</p>
98    /// <p>The default is that all clusters defined for an account are returned.</p>
99    pub fn set_cluster_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
100        self.inner = self.inner.set_cluster_identifier(input);
101        self
102    }
103    /// <p>The unique identifier of a cluster whose properties you are requesting. This parameter is case sensitive.</p>
104    /// <p>The default is that all clusters defined for an account are returned.</p>
105    pub fn get_cluster_identifier(&self) -> &::std::option::Option<::std::string::String> {
106        self.inner.get_cluster_identifier()
107    }
108    /// <p>The maximum number of response records to return in each call. If the number of remaining response records exceeds the specified <code>MaxRecords</code> value, a value is returned in a <code>marker</code> field of the response. You can retrieve the next set of records by retrying the command with the returned marker value.</p>
109    /// <p>Default: <code>100</code></p>
110    /// <p>Constraints: minimum 20, maximum 100.</p>
111    pub fn max_records(mut self, input: i32) -> Self {
112        self.inner = self.inner.max_records(input);
113        self
114    }
115    /// <p>The maximum number of response records to return in each call. If the number of remaining response records exceeds the specified <code>MaxRecords</code> value, a value is returned in a <code>marker</code> field of the response. You can retrieve the next set of records by retrying the command with the returned marker value.</p>
116    /// <p>Default: <code>100</code></p>
117    /// <p>Constraints: minimum 20, maximum 100.</p>
118    pub fn set_max_records(mut self, input: ::std::option::Option<i32>) -> Self {
119        self.inner = self.inner.set_max_records(input);
120        self
121    }
122    /// <p>The maximum number of response records to return in each call. If the number of remaining response records exceeds the specified <code>MaxRecords</code> value, a value is returned in a <code>marker</code> field of the response. You can retrieve the next set of records by retrying the command with the returned marker value.</p>
123    /// <p>Default: <code>100</code></p>
124    /// <p>Constraints: minimum 20, maximum 100.</p>
125    pub fn get_max_records(&self) -> &::std::option::Option<i32> {
126        self.inner.get_max_records()
127    }
128    /// <p>An optional parameter that specifies the starting point to return a set of response records. When the results of a <code>DescribeClusters</code> request exceed the value specified in <code>MaxRecords</code>, Amazon Web Services returns a value in the <code>Marker</code> field of the response. You can retrieve the next set of response records by providing the returned marker value in the <code>Marker</code> parameter and retrying the request.</p>
129    /// <p>Constraints: You can specify either the <b>ClusterIdentifier</b> parameter or the <b>Marker</b> parameter, but not both.</p>
130    pub fn marker(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.inner = self.inner.marker(input.into());
132        self
133    }
134    /// <p>An optional parameter that specifies the starting point to return a set of response records. When the results of a <code>DescribeClusters</code> request exceed the value specified in <code>MaxRecords</code>, Amazon Web Services returns a value in the <code>Marker</code> field of the response. You can retrieve the next set of response records by providing the returned marker value in the <code>Marker</code> parameter and retrying the request.</p>
135    /// <p>Constraints: You can specify either the <b>ClusterIdentifier</b> parameter or the <b>Marker</b> parameter, but not both.</p>
136    pub fn set_marker(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137        self.inner = self.inner.set_marker(input);
138        self
139    }
140    /// <p>An optional parameter that specifies the starting point to return a set of response records. When the results of a <code>DescribeClusters</code> request exceed the value specified in <code>MaxRecords</code>, Amazon Web Services returns a value in the <code>Marker</code> field of the response. You can retrieve the next set of response records by providing the returned marker value in the <code>Marker</code> parameter and retrying the request.</p>
141    /// <p>Constraints: You can specify either the <b>ClusterIdentifier</b> parameter or the <b>Marker</b> parameter, but not both.</p>
142    pub fn get_marker(&self) -> &::std::option::Option<::std::string::String> {
143        self.inner.get_marker()
144    }
145    ///
146    /// Appends an item to `TagKeys`.
147    ///
148    /// To override the contents of this collection use [`set_tag_keys`](Self::set_tag_keys).
149    ///
150    /// <p>A tag key or keys for which you want to return all matching clusters that are associated with the specified key or keys. For example, suppose that you have clusters that are tagged with keys called <code>owner</code> and <code>environment</code>. If you specify both of these tag keys in the request, Amazon Redshift returns a response with the clusters that have either or both of these tag keys associated with them.</p>
151    pub fn tag_keys(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
152        self.inner = self.inner.tag_keys(input.into());
153        self
154    }
155    /// <p>A tag key or keys for which you want to return all matching clusters that are associated with the specified key or keys. For example, suppose that you have clusters that are tagged with keys called <code>owner</code> and <code>environment</code>. If you specify both of these tag keys in the request, Amazon Redshift returns a response with the clusters that have either or both of these tag keys associated with them.</p>
156    pub fn set_tag_keys(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
157        self.inner = self.inner.set_tag_keys(input);
158        self
159    }
160    /// <p>A tag key or keys for which you want to return all matching clusters that are associated with the specified key or keys. For example, suppose that you have clusters that are tagged with keys called <code>owner</code> and <code>environment</code>. If you specify both of these tag keys in the request, Amazon Redshift returns a response with the clusters that have either or both of these tag keys associated with them.</p>
161    pub fn get_tag_keys(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
162        self.inner.get_tag_keys()
163    }
164    ///
165    /// Appends an item to `TagValues`.
166    ///
167    /// To override the contents of this collection use [`set_tag_values`](Self::set_tag_values).
168    ///
169    /// <p>A tag value or values for which you want to return all matching clusters that are associated with the specified tag value or values. For example, suppose that you have clusters that are tagged with values called <code>admin</code> and <code>test</code>. If you specify both of these tag values in the request, Amazon Redshift returns a response with the clusters that have either or both of these tag values associated with them.</p>
170    pub fn tag_values(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
171        self.inner = self.inner.tag_values(input.into());
172        self
173    }
174    /// <p>A tag value or values for which you want to return all matching clusters that are associated with the specified tag value or values. For example, suppose that you have clusters that are tagged with values called <code>admin</code> and <code>test</code>. If you specify both of these tag values in the request, Amazon Redshift returns a response with the clusters that have either or both of these tag values associated with them.</p>
175    pub fn set_tag_values(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
176        self.inner = self.inner.set_tag_values(input);
177        self
178    }
179    /// <p>A tag value or values for which you want to return all matching clusters that are associated with the specified tag value or values. For example, suppose that you have clusters that are tagged with values called <code>admin</code> and <code>test</code>. If you specify both of these tag values in the request, Amazon Redshift returns a response with the clusters that have either or both of these tag values associated with them.</p>
180    pub fn get_tag_values(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
181        self.inner.get_tag_values()
182    }
183}
184
185/// Successful return type for the `cluster_available` waiter.
186pub type ClusterAvailableFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
187    crate::operation::describe_clusters::DescribeClustersOutput,
188    ::aws_smithy_runtime_api::client::result::SdkError<
189        crate::operation::describe_clusters::DescribeClustersError,
190        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
191    >,
192>;
193
194/// Error type for the `cluster_available` waiter.
195pub type WaitUntilClusterAvailableError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
196    crate::operation::describe_clusters::DescribeClustersOutput,
197    crate::operation::describe_clusters::DescribeClustersError,
198>;