aws_sdk_ec2/waiters/volume_available.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `volume_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 VolumeAvailableFluentBuilder {
16 handle: ::std::sync::Arc<crate::client::Handle>,
17 inner: crate::operation::describe_volumes::builders::DescribeVolumesInputBuilder,
18}
19impl VolumeAvailableFluentBuilder {
20 /// Creates a new `VolumeAvailableFluentBuilder`.
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 DescribeVolumes as a reference.
28 pub fn as_input(&self) -> &crate::operation::describe_volumes::builders::DescribeVolumesInputBuilder {
29 &self.inner
30 }
31 /// Wait for `volume_available`
32 pub async fn wait(
33 self,
34 max_wait: ::std::time::Duration,
35 ) -> ::std::result::Result<
36 crate::waiters::volume_available::VolumeAvailableFinalPoll,
37 crate::waiters::volume_available::WaitUntilVolumeAvailableError,
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_volumes::DescribeVolumes::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_volumes::DescribeVolumesOutput,
59 &crate::operation::describe_volumes::DescribeVolumesError,
60 >| {
61 // Matches: {"output":{"path":"Volumes[].State","expected":"available","comparator":"allStringEquals"}}
62 if crate::waiters::matchers::match_describe_volumes_006c29de4d9c462c7(result) {
63 return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64 }
65 // Matches: {"output":{"path":"Volumes[].State","expected":"deleted","comparator":"anyStringEquals"}}
66 if crate::waiters::matchers::match_describe_volumes_9cbb763f624bb2e82(result) {
67 return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
68 }
69 ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
70 };
71 let operation = move || {
72 let input = input.clone();
73 let runtime_plugins = runtime_plugins.clone();
74 async move { crate::operation::describe_volumes::DescribeVolumes::orchestrate(&runtime_plugins, input).await }
75 };
76 let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
77 .min_delay(::std::time::Duration::from_secs(15))
78 .max_delay(::std::time::Duration::from_secs(120))
79 .max_wait(max_wait)
80 .time_source(time_source)
81 .sleep_impl(sleep_impl)
82 .acceptor(acceptor)
83 .operation(operation)
84 .build();
85 ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
86 }
87 ///
88 /// Appends an item to `VolumeIds`.
89 ///
90 /// To override the contents of this collection use [`set_volume_ids`](Self::set_volume_ids).
91 ///
92 /// <p>The volume IDs. If not specified, then all volumes are included in the response.</p>
93 pub fn volume_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
94 self.inner = self.inner.volume_ids(input.into());
95 self
96 }
97 /// <p>The volume IDs. If not specified, then all volumes are included in the response.</p>
98 pub fn set_volume_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
99 self.inner = self.inner.set_volume_ids(input);
100 self
101 }
102 /// <p>The volume IDs. If not specified, then all volumes are included in the response.</p>
103 pub fn get_volume_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
104 self.inner.get_volume_ids()
105 }
106 /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
107 pub fn dry_run(mut self, input: bool) -> Self {
108 self.inner = self.inner.dry_run(input);
109 self
110 }
111 /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
112 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
113 self.inner = self.inner.set_dry_run(input);
114 self
115 }
116 /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
117 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
118 self.inner.get_dry_run()
119 }
120 ///
121 /// Appends an item to `Filters`.
122 ///
123 /// To override the contents of this collection use [`set_filters`](Self::set_filters).
124 ///
125 /// <p>The filters.</p>
126 /// <ul>
127 /// <li>
128 /// <p><code>attachment.attach-time</code> - The time stamp when the attachment initiated.</p></li>
129 /// <li>
130 /// <p><code>attachment.delete-on-termination</code> - Whether the volume is deleted on instance termination.</p></li>
131 /// <li>
132 /// <p><code>attachment.device</code> - The device name specified in the block device mapping (for example, <code>/dev/sda1</code>).</p></li>
133 /// <li>
134 /// <p><code>attachment.instance-id</code> - The ID of the instance the volume is attached to.</p></li>
135 /// <li>
136 /// <p><code>attachment.status</code> - The attachment state (<code>attaching</code> | <code>attached</code> | <code>detaching</code>).</p></li>
137 /// <li>
138 /// <p><code>availability-zone</code> - The Availability Zone in which the volume was created.</p></li>
139 /// <li>
140 /// <p><code>availability-zone-id</code> - The ID of the Availability Zone in which the volume was created.</p></li>
141 /// <li>
142 /// <p><code>create-time</code> - The time stamp when the volume was created.</p></li>
143 /// <li>
144 /// <p><code>encrypted</code> - Indicates whether the volume is encrypted (<code>true</code> | <code>false</code>)</p></li>
145 /// <li>
146 /// <p><code>fast-restored</code> - Indicates whether the volume was created from a snapshot that is enabled for fast snapshot restore (<code>true</code> | <code>false</code>).</p></li>
147 /// <li>
148 /// <p><code>multi-attach-enabled</code> - Indicates whether the volume is enabled for Multi-Attach (<code>true</code> | <code>false</code>)</p></li>
149 /// <li>
150 /// <p><code>operator.managed</code> - A Boolean that indicates whether this is a managed volume.</p></li>
151 /// <li>
152 /// <p><code>operator.principal</code> - The principal that manages the volume. Only valid for managed volumes, where <code>managed</code> is <code>true</code>.</p></li>
153 /// <li>
154 /// <p><code>size</code> - The size of the volume, in GiB.</p></li>
155 /// <li>
156 /// <p><code>snapshot-id</code> - The snapshot from which the volume was created.</p></li>
157 /// <li>
158 /// <p><code>status</code> - The state of the volume (<code>creating</code> | <code>available</code> | <code>in-use</code> | <code>deleting</code> | <code>deleted</code> | <code>error</code>).</p></li>
159 /// <li>
160 /// <p><code>tag</code>:<key>
161 /// - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key
162 /// <code>Owner</code> and the value
163 /// <code>TeamA</code>, specify
164 /// <code>tag:Owner</code> for the filter name and
165 /// <code>TeamA</code> for the filter value.
166 /// </key></p></li>
167 /// <li>
168 /// <p><code>tag-key</code> - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.</p></li>
169 /// <li>
170 /// <p><code>volume-id</code> - The volume ID.</p></li>
171 /// <li>
172 /// <p><code>volume-type</code> - The Amazon EBS volume type (<code>gp2</code> | <code>gp3</code> | <code>io1</code> | <code>io2</code> | <code>st1</code> | <code>sc1</code>| <code>standard</code>)</p></li>
173 /// </ul>
174 pub fn filters(mut self, input: crate::types::Filter) -> Self {
175 self.inner = self.inner.filters(input);
176 self
177 }
178 /// <p>The filters.</p>
179 /// <ul>
180 /// <li>
181 /// <p><code>attachment.attach-time</code> - The time stamp when the attachment initiated.</p></li>
182 /// <li>
183 /// <p><code>attachment.delete-on-termination</code> - Whether the volume is deleted on instance termination.</p></li>
184 /// <li>
185 /// <p><code>attachment.device</code> - The device name specified in the block device mapping (for example, <code>/dev/sda1</code>).</p></li>
186 /// <li>
187 /// <p><code>attachment.instance-id</code> - The ID of the instance the volume is attached to.</p></li>
188 /// <li>
189 /// <p><code>attachment.status</code> - The attachment state (<code>attaching</code> | <code>attached</code> | <code>detaching</code>).</p></li>
190 /// <li>
191 /// <p><code>availability-zone</code> - The Availability Zone in which the volume was created.</p></li>
192 /// <li>
193 /// <p><code>availability-zone-id</code> - The ID of the Availability Zone in which the volume was created.</p></li>
194 /// <li>
195 /// <p><code>create-time</code> - The time stamp when the volume was created.</p></li>
196 /// <li>
197 /// <p><code>encrypted</code> - Indicates whether the volume is encrypted (<code>true</code> | <code>false</code>)</p></li>
198 /// <li>
199 /// <p><code>fast-restored</code> - Indicates whether the volume was created from a snapshot that is enabled for fast snapshot restore (<code>true</code> | <code>false</code>).</p></li>
200 /// <li>
201 /// <p><code>multi-attach-enabled</code> - Indicates whether the volume is enabled for Multi-Attach (<code>true</code> | <code>false</code>)</p></li>
202 /// <li>
203 /// <p><code>operator.managed</code> - A Boolean that indicates whether this is a managed volume.</p></li>
204 /// <li>
205 /// <p><code>operator.principal</code> - The principal that manages the volume. Only valid for managed volumes, where <code>managed</code> is <code>true</code>.</p></li>
206 /// <li>
207 /// <p><code>size</code> - The size of the volume, in GiB.</p></li>
208 /// <li>
209 /// <p><code>snapshot-id</code> - The snapshot from which the volume was created.</p></li>
210 /// <li>
211 /// <p><code>status</code> - The state of the volume (<code>creating</code> | <code>available</code> | <code>in-use</code> | <code>deleting</code> | <code>deleted</code> | <code>error</code>).</p></li>
212 /// <li>
213 /// <p><code>tag</code>:<key>
214 /// - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key
215 /// <code>Owner</code> and the value
216 /// <code>TeamA</code>, specify
217 /// <code>tag:Owner</code> for the filter name and
218 /// <code>TeamA</code> for the filter value.
219 /// </key></p></li>
220 /// <li>
221 /// <p><code>tag-key</code> - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.</p></li>
222 /// <li>
223 /// <p><code>volume-id</code> - The volume ID.</p></li>
224 /// <li>
225 /// <p><code>volume-type</code> - The Amazon EBS volume type (<code>gp2</code> | <code>gp3</code> | <code>io1</code> | <code>io2</code> | <code>st1</code> | <code>sc1</code>| <code>standard</code>)</p></li>
226 /// </ul>
227 pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
228 self.inner = self.inner.set_filters(input);
229 self
230 }
231 /// <p>The filters.</p>
232 /// <ul>
233 /// <li>
234 /// <p><code>attachment.attach-time</code> - The time stamp when the attachment initiated.</p></li>
235 /// <li>
236 /// <p><code>attachment.delete-on-termination</code> - Whether the volume is deleted on instance termination.</p></li>
237 /// <li>
238 /// <p><code>attachment.device</code> - The device name specified in the block device mapping (for example, <code>/dev/sda1</code>).</p></li>
239 /// <li>
240 /// <p><code>attachment.instance-id</code> - The ID of the instance the volume is attached to.</p></li>
241 /// <li>
242 /// <p><code>attachment.status</code> - The attachment state (<code>attaching</code> | <code>attached</code> | <code>detaching</code>).</p></li>
243 /// <li>
244 /// <p><code>availability-zone</code> - The Availability Zone in which the volume was created.</p></li>
245 /// <li>
246 /// <p><code>availability-zone-id</code> - The ID of the Availability Zone in which the volume was created.</p></li>
247 /// <li>
248 /// <p><code>create-time</code> - The time stamp when the volume was created.</p></li>
249 /// <li>
250 /// <p><code>encrypted</code> - Indicates whether the volume is encrypted (<code>true</code> | <code>false</code>)</p></li>
251 /// <li>
252 /// <p><code>fast-restored</code> - Indicates whether the volume was created from a snapshot that is enabled for fast snapshot restore (<code>true</code> | <code>false</code>).</p></li>
253 /// <li>
254 /// <p><code>multi-attach-enabled</code> - Indicates whether the volume is enabled for Multi-Attach (<code>true</code> | <code>false</code>)</p></li>
255 /// <li>
256 /// <p><code>operator.managed</code> - A Boolean that indicates whether this is a managed volume.</p></li>
257 /// <li>
258 /// <p><code>operator.principal</code> - The principal that manages the volume. Only valid for managed volumes, where <code>managed</code> is <code>true</code>.</p></li>
259 /// <li>
260 /// <p><code>size</code> - The size of the volume, in GiB.</p></li>
261 /// <li>
262 /// <p><code>snapshot-id</code> - The snapshot from which the volume was created.</p></li>
263 /// <li>
264 /// <p><code>status</code> - The state of the volume (<code>creating</code> | <code>available</code> | <code>in-use</code> | <code>deleting</code> | <code>deleted</code> | <code>error</code>).</p></li>
265 /// <li>
266 /// <p><code>tag</code>:<key>
267 /// - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key
268 /// <code>Owner</code> and the value
269 /// <code>TeamA</code>, specify
270 /// <code>tag:Owner</code> for the filter name and
271 /// <code>TeamA</code> for the filter value.
272 /// </key></p></li>
273 /// <li>
274 /// <p><code>tag-key</code> - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.</p></li>
275 /// <li>
276 /// <p><code>volume-id</code> - The volume ID.</p></li>
277 /// <li>
278 /// <p><code>volume-type</code> - The Amazon EBS volume type (<code>gp2</code> | <code>gp3</code> | <code>io1</code> | <code>io2</code> | <code>st1</code> | <code>sc1</code>| <code>standard</code>)</p></li>
279 /// </ul>
280 pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
281 self.inner.get_filters()
282 }
283 /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
284 pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
285 self.inner = self.inner.next_token(input.into());
286 self
287 }
288 /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
289 pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
290 self.inner = self.inner.set_next_token(input);
291 self
292 }
293 /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
294 pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
295 self.inner.get_next_token()
296 }
297 /// <p>The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
298 pub fn max_results(mut self, input: i32) -> Self {
299 self.inner = self.inner.max_results(input);
300 self
301 }
302 /// <p>The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
303 pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
304 self.inner = self.inner.set_max_results(input);
305 self
306 }
307 /// <p>The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
308 pub fn get_max_results(&self) -> &::std::option::Option<i32> {
309 self.inner.get_max_results()
310 }
311}
312
313/// Successful return type for the `volume_available` waiter.
314pub type VolumeAvailableFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
315 crate::operation::describe_volumes::DescribeVolumesOutput,
316 ::aws_smithy_runtime_api::client::result::SdkError<
317 crate::operation::describe_volumes::DescribeVolumesError,
318 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
319 >,
320>;
321
322/// Error type for the `volume_available` waiter.
323pub type WaitUntilVolumeAvailableError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
324 crate::operation::describe_volumes::DescribeVolumesOutput,
325 crate::operation::describe_volumes::DescribeVolumesError,
326>;