aws_sdk_rds/waiters/
db_instance_available.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `db_instance_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 DbInstanceAvailableFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_db_instances::builders::DescribeDbInstancesInputBuilder,
18}
19impl DbInstanceAvailableFluentBuilder {
20    /// Creates a new `DbInstanceAvailableFluentBuilder`.
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 DescribeDBInstances as a reference.
28    pub fn as_input(&self) -> &crate::operation::describe_db_instances::builders::DescribeDbInstancesInputBuilder {
29        &self.inner
30    }
31    /// Wait for `db_instance_available`
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::db_instance_available::DbInstanceAvailableFinalPoll,
37        crate::waiters::db_instance_available::WaitUntilDbInstanceAvailableError,
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_db_instances::DescribeDBInstances::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_db_instances::DescribeDbInstancesOutput,
59            &crate::operation::describe_db_instances::DescribeDBInstancesError,
60        >| {
61            // Matches: {"output":{"path":"DBInstances[].DBInstanceStatus","expected":"available","comparator":"allStringEquals"}}
62            if crate::waiters::matchers::match_describe_db_instances_1a49e96ac4906b298(result) {
63                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64            }
65            // Matches: {"output":{"path":"DBInstances[].DBInstanceStatus","expected":"deleted","comparator":"anyStringEquals"}}
66            if crate::waiters::matchers::match_describe_db_instances_77e0187886e602da9(result) {
67                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
68            }
69            // Matches: {"output":{"path":"DBInstances[].DBInstanceStatus","expected":"deleting","comparator":"anyStringEquals"}}
70            if crate::waiters::matchers::match_describe_db_instances_5ec9c383b459d62a0(result) {
71                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
72            }
73            // Matches: {"output":{"path":"DBInstances[].DBInstanceStatus","expected":"failed","comparator":"anyStringEquals"}}
74            if crate::waiters::matchers::match_describe_db_instances_545820a6bb186e52b(result) {
75                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
76            }
77            // Matches: {"output":{"path":"DBInstances[].DBInstanceStatus","expected":"incompatible-restore","comparator":"anyStringEquals"}}
78            if crate::waiters::matchers::match_describe_db_instances_608daadbd71b65910(result) {
79                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
80            }
81            // Matches: {"output":{"path":"DBInstances[].DBInstanceStatus","expected":"incompatible-parameters","comparator":"anyStringEquals"}}
82            if crate::waiters::matchers::match_describe_db_instances_fe252904aec70cd63(result) {
83                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
84            }
85            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
86        };
87        let operation = move || {
88            let input = input.clone();
89            let runtime_plugins = runtime_plugins.clone();
90            async move { crate::operation::describe_db_instances::DescribeDBInstances::orchestrate(&runtime_plugins, input).await }
91        };
92        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
93            .min_delay(::std::time::Duration::from_secs(30))
94            .max_delay(::std::time::Duration::from_secs(120))
95            .max_wait(max_wait)
96            .time_source(time_source)
97            .sleep_impl(sleep_impl)
98            .acceptor(acceptor)
99            .operation(operation)
100            .build();
101        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
102    }
103    /// <p>The user-supplied instance identifier or the Amazon Resource Name (ARN) of the DB instance. If this parameter is specified, information from only the specific DB instance is returned. This parameter isn't case-sensitive.</p>
104    /// <p>Constraints:</p>
105    /// <ul>
106    /// <li>
107    /// <p>If supplied, must match the identifier of an existing DB instance.</p></li>
108    /// </ul>
109    pub fn db_instance_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
110        self.inner = self.inner.db_instance_identifier(input.into());
111        self
112    }
113    /// <p>The user-supplied instance identifier or the Amazon Resource Name (ARN) of the DB instance. If this parameter is specified, information from only the specific DB instance is returned. This parameter isn't case-sensitive.</p>
114    /// <p>Constraints:</p>
115    /// <ul>
116    /// <li>
117    /// <p>If supplied, must match the identifier of an existing DB instance.</p></li>
118    /// </ul>
119    pub fn set_db_instance_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120        self.inner = self.inner.set_db_instance_identifier(input);
121        self
122    }
123    /// <p>The user-supplied instance identifier or the Amazon Resource Name (ARN) of the DB instance. If this parameter is specified, information from only the specific DB instance is returned. This parameter isn't case-sensitive.</p>
124    /// <p>Constraints:</p>
125    /// <ul>
126    /// <li>
127    /// <p>If supplied, must match the identifier of an existing DB instance.</p></li>
128    /// </ul>
129    pub fn get_db_instance_identifier(&self) -> &::std::option::Option<::std::string::String> {
130        self.inner.get_db_instance_identifier()
131    }
132    ///
133    /// Appends an item to `Filters`.
134    ///
135    /// To override the contents of this collection use [`set_filters`](Self::set_filters).
136    ///
137    /// <p>A filter that specifies one or more DB instances to describe.</p>
138    /// <p>Supported Filters:</p>
139    /// <ul>
140    /// <li>
141    /// <p><code>db-cluster-id</code> - Accepts DB cluster identifiers and DB cluster Amazon Resource Names (ARNs). The results list only includes information about the DB instances associated with the DB clusters identified by these ARNs.</p></li>
142    /// <li>
143    /// <p><code>db-instance-id</code> - Accepts DB instance identifiers and DB instance Amazon Resource Names (ARNs). The results list only includes information about the DB instances identified by these ARNs.</p></li>
144    /// <li>
145    /// <p><code>dbi-resource-id</code> - Accepts DB instance resource identifiers. The results list only includes information about the DB instances identified by these DB instance resource identifiers.</p></li>
146    /// <li>
147    /// <p><code>domain</code> - Accepts Active Directory directory IDs. The results list only includes information about the DB instances associated with these domains.</p></li>
148    /// <li>
149    /// <p><code>engine</code> - Accepts engine names. The results list only includes information about the DB instances for these engines.</p></li>
150    /// </ul>
151    pub fn filters(mut self, input: crate::types::Filter) -> Self {
152        self.inner = self.inner.filters(input);
153        self
154    }
155    /// <p>A filter that specifies one or more DB instances to describe.</p>
156    /// <p>Supported Filters:</p>
157    /// <ul>
158    /// <li>
159    /// <p><code>db-cluster-id</code> - Accepts DB cluster identifiers and DB cluster Amazon Resource Names (ARNs). The results list only includes information about the DB instances associated with the DB clusters identified by these ARNs.</p></li>
160    /// <li>
161    /// <p><code>db-instance-id</code> - Accepts DB instance identifiers and DB instance Amazon Resource Names (ARNs). The results list only includes information about the DB instances identified by these ARNs.</p></li>
162    /// <li>
163    /// <p><code>dbi-resource-id</code> - Accepts DB instance resource identifiers. The results list only includes information about the DB instances identified by these DB instance resource identifiers.</p></li>
164    /// <li>
165    /// <p><code>domain</code> - Accepts Active Directory directory IDs. The results list only includes information about the DB instances associated with these domains.</p></li>
166    /// <li>
167    /// <p><code>engine</code> - Accepts engine names. The results list only includes information about the DB instances for these engines.</p></li>
168    /// </ul>
169    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
170        self.inner = self.inner.set_filters(input);
171        self
172    }
173    /// <p>A filter that specifies one or more DB instances to describe.</p>
174    /// <p>Supported Filters:</p>
175    /// <ul>
176    /// <li>
177    /// <p><code>db-cluster-id</code> - Accepts DB cluster identifiers and DB cluster Amazon Resource Names (ARNs). The results list only includes information about the DB instances associated with the DB clusters identified by these ARNs.</p></li>
178    /// <li>
179    /// <p><code>db-instance-id</code> - Accepts DB instance identifiers and DB instance Amazon Resource Names (ARNs). The results list only includes information about the DB instances identified by these ARNs.</p></li>
180    /// <li>
181    /// <p><code>dbi-resource-id</code> - Accepts DB instance resource identifiers. The results list only includes information about the DB instances identified by these DB instance resource identifiers.</p></li>
182    /// <li>
183    /// <p><code>domain</code> - Accepts Active Directory directory IDs. The results list only includes information about the DB instances associated with these domains.</p></li>
184    /// <li>
185    /// <p><code>engine</code> - Accepts engine names. The results list only includes information about the DB instances for these engines.</p></li>
186    /// </ul>
187    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
188        self.inner.get_filters()
189    }
190    /// <p>The maximum number of records to include in the response. If more records exist than the specified <code>MaxRecords</code> value, a pagination token called a marker is included in the response so that you can retrieve the remaining results.</p>
191    /// <p>Default: 100</p>
192    /// <p>Constraints: Minimum 20, maximum 100.</p>
193    pub fn max_records(mut self, input: i32) -> Self {
194        self.inner = self.inner.max_records(input);
195        self
196    }
197    /// <p>The maximum number of records to include in the response. If more records exist than the specified <code>MaxRecords</code> value, a pagination token called a marker is included in the response so that you can retrieve the remaining results.</p>
198    /// <p>Default: 100</p>
199    /// <p>Constraints: Minimum 20, maximum 100.</p>
200    pub fn set_max_records(mut self, input: ::std::option::Option<i32>) -> Self {
201        self.inner = self.inner.set_max_records(input);
202        self
203    }
204    /// <p>The maximum number of records to include in the response. If more records exist than the specified <code>MaxRecords</code> value, a pagination token called a marker is included in the response so that you can retrieve the remaining results.</p>
205    /// <p>Default: 100</p>
206    /// <p>Constraints: Minimum 20, maximum 100.</p>
207    pub fn get_max_records(&self) -> &::std::option::Option<i32> {
208        self.inner.get_max_records()
209    }
210    /// <p>An optional pagination token provided by a previous <code>DescribeDBInstances</code> request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by <code>MaxRecords</code>.</p>
211    pub fn marker(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
212        self.inner = self.inner.marker(input.into());
213        self
214    }
215    /// <p>An optional pagination token provided by a previous <code>DescribeDBInstances</code> request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by <code>MaxRecords</code>.</p>
216    pub fn set_marker(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
217        self.inner = self.inner.set_marker(input);
218        self
219    }
220    /// <p>An optional pagination token provided by a previous <code>DescribeDBInstances</code> request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by <code>MaxRecords</code>.</p>
221    pub fn get_marker(&self) -> &::std::option::Option<::std::string::String> {
222        self.inner.get_marker()
223    }
224}
225
226/// Successful return type for the `db_instance_available` waiter.
227pub type DbInstanceAvailableFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
228    crate::operation::describe_db_instances::DescribeDbInstancesOutput,
229    ::aws_smithy_runtime_api::client::result::SdkError<
230        crate::operation::describe_db_instances::DescribeDBInstancesError,
231        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
232    >,
233>;
234
235/// Error type for the `db_instance_available` waiter.
236pub type WaitUntilDbInstanceAvailableError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
237    crate::operation::describe_db_instances::DescribeDbInstancesOutput,
238    crate::operation::describe_db_instances::DescribeDBInstancesError,
239>;