aws_sdk_docdb/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-provided instance identifier. If this parameter is specified, information from only the specific instance is returned. This parameter isn't case sensitive.</p>
104 /// <p>Constraints:</p>
105 /// <ul>
106 /// <li>
107 /// <p>If provided, must match the identifier of an existing <code>DBInstance</code>.</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-provided instance identifier. If this parameter is specified, information from only the specific instance is returned. This parameter isn't case sensitive.</p>
114 /// <p>Constraints:</p>
115 /// <ul>
116 /// <li>
117 /// <p>If provided, must match the identifier of an existing <code>DBInstance</code>.</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-provided instance identifier. If this parameter is specified, information from only the specific instance is returned. This parameter isn't case sensitive.</p>
124 /// <p>Constraints:</p>
125 /// <ul>
126 /// <li>
127 /// <p>If provided, must match the identifier of an existing <code>DBInstance</code>.</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 instances to describe.</p>
138 /// <p>Supported filters:</p>
139 /// <ul>
140 /// <li>
141 /// <p><code>db-cluster-id</code> - Accepts cluster identifiers and cluster Amazon Resource Names (ARNs). The results list includes only the information about the instances that are associated with the clusters that are identified by these ARNs.</p></li>
142 /// <li>
143 /// <p><code>db-instance-id</code> - Accepts instance identifiers and instance ARNs. The results list includes only the information about the instances that are identified by these ARNs.</p></li>
144 /// </ul>
145 pub fn filters(mut self, input: crate::types::Filter) -> Self {
146 self.inner = self.inner.filters(input);
147 self
148 }
149 /// <p>A filter that specifies one or more instances to describe.</p>
150 /// <p>Supported filters:</p>
151 /// <ul>
152 /// <li>
153 /// <p><code>db-cluster-id</code> - Accepts cluster identifiers and cluster Amazon Resource Names (ARNs). The results list includes only the information about the instances that are associated with the clusters that are identified by these ARNs.</p></li>
154 /// <li>
155 /// <p><code>db-instance-id</code> - Accepts instance identifiers and instance ARNs. The results list includes only the information about the instances that are identified by these ARNs.</p></li>
156 /// </ul>
157 pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
158 self.inner = self.inner.set_filters(input);
159 self
160 }
161 /// <p>A filter that specifies one or more instances to describe.</p>
162 /// <p>Supported filters:</p>
163 /// <ul>
164 /// <li>
165 /// <p><code>db-cluster-id</code> - Accepts cluster identifiers and cluster Amazon Resource Names (ARNs). The results list includes only the information about the instances that are associated with the clusters that are identified by these ARNs.</p></li>
166 /// <li>
167 /// <p><code>db-instance-id</code> - Accepts instance identifiers and instance ARNs. The results list includes only the information about the instances that are identified by these ARNs.</p></li>
168 /// </ul>
169 pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
170 self.inner.get_filters()
171 }
172 /// <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 (marker) is included in the response so that the remaining results can be retrieved.</p>
173 /// <p>Default: 100</p>
174 /// <p>Constraints: Minimum 20, maximum 100.</p>
175 pub fn max_records(mut self, input: i32) -> Self {
176 self.inner = self.inner.max_records(input);
177 self
178 }
179 /// <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 (marker) is included in the response so that the remaining results can be retrieved.</p>
180 /// <p>Default: 100</p>
181 /// <p>Constraints: Minimum 20, maximum 100.</p>
182 pub fn set_max_records(mut self, input: ::std::option::Option<i32>) -> Self {
183 self.inner = self.inner.set_max_records(input);
184 self
185 }
186 /// <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 (marker) is included in the response so that the remaining results can be retrieved.</p>
187 /// <p>Default: 100</p>
188 /// <p>Constraints: Minimum 20, maximum 100.</p>
189 pub fn get_max_records(&self) -> &::std::option::Option<i32> {
190 self.inner.get_max_records()
191 }
192 /// <p>An optional pagination token provided by a previous request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by <code>MaxRecords</code>.</p>
193 pub fn marker(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
194 self.inner = self.inner.marker(input.into());
195 self
196 }
197 /// <p>An optional pagination token provided by a previous request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by <code>MaxRecords</code>.</p>
198 pub fn set_marker(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
199 self.inner = self.inner.set_marker(input);
200 self
201 }
202 /// <p>An optional pagination token provided by a previous request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by <code>MaxRecords</code>.</p>
203 pub fn get_marker(&self) -> &::std::option::Option<::std::string::String> {
204 self.inner.get_marker()
205 }
206}
207
208/// Successful return type for the `db_instance_available` waiter.
209pub type DbInstanceAvailableFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
210 crate::operation::describe_db_instances::DescribeDbInstancesOutput,
211 ::aws_smithy_runtime_api::client::result::SdkError<
212 crate::operation::describe_db_instances::DescribeDBInstancesError,
213 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
214 >,
215>;
216
217/// Error type for the `db_instance_available` waiter.
218pub type WaitUntilDbInstanceAvailableError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
219 crate::operation::describe_db_instances::DescribeDbInstancesOutput,
220 crate::operation::describe_db_instances::DescribeDBInstancesError,
221>;