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>create-time</code> - The time stamp when the volume was created.</p></li>
141    /// <li>
142    /// <p><code>encrypted</code> - Indicates whether the volume is encrypted (<code>true</code> | <code>false</code>)</p></li>
143    /// <li>
144    /// <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>
145    /// <li>
146    /// <p><code>multi-attach-enabled</code> - Indicates whether the volume is enabled for Multi-Attach (<code>true</code> | <code>false</code>)</p></li>
147    /// <li>
148    /// <p><code>operator.managed</code> - A Boolean that indicates whether this is a managed volume.</p></li>
149    /// <li>
150    /// <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>
151    /// <li>
152    /// <p><code>size</code> - The size of the volume, in GiB.</p></li>
153    /// <li>
154    /// <p><code>snapshot-id</code> - The snapshot from which the volume was created.</p></li>
155    /// <li>
156    /// <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>
157    /// <li>
158    /// <p><code>tag</code>:<key>
159    /// - 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
160    /// <code>Owner</code> and the value
161    /// <code>TeamA</code>, specify
162    /// <code>tag:Owner</code> for the filter name and
163    /// <code>TeamA</code> for the filter value.
164    /// </key></p></li>
165    /// <li>
166    /// <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>
167    /// <li>
168    /// <p><code>volume-id</code> - The volume ID.</p></li>
169    /// <li>
170    /// <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>
171    /// </ul>
172    pub fn filters(mut self, input: crate::types::Filter) -> Self {
173        self.inner = self.inner.filters(input);
174        self
175    }
176    /// <p>The filters.</p>
177    /// <ul>
178    /// <li>
179    /// <p><code>attachment.attach-time</code> - The time stamp when the attachment initiated.</p></li>
180    /// <li>
181    /// <p><code>attachment.delete-on-termination</code> - Whether the volume is deleted on instance termination.</p></li>
182    /// <li>
183    /// <p><code>attachment.device</code> - The device name specified in the block device mapping (for example, <code>/dev/sda1</code>).</p></li>
184    /// <li>
185    /// <p><code>attachment.instance-id</code> - The ID of the instance the volume is attached to.</p></li>
186    /// <li>
187    /// <p><code>attachment.status</code> - The attachment state (<code>attaching</code> | <code>attached</code> | <code>detaching</code>).</p></li>
188    /// <li>
189    /// <p><code>availability-zone</code> - The Availability Zone in which the volume was created.</p></li>
190    /// <li>
191    /// <p><code>create-time</code> - The time stamp when the volume was created.</p></li>
192    /// <li>
193    /// <p><code>encrypted</code> - Indicates whether the volume is encrypted (<code>true</code> | <code>false</code>)</p></li>
194    /// <li>
195    /// <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>
196    /// <li>
197    /// <p><code>multi-attach-enabled</code> - Indicates whether the volume is enabled for Multi-Attach (<code>true</code> | <code>false</code>)</p></li>
198    /// <li>
199    /// <p><code>operator.managed</code> - A Boolean that indicates whether this is a managed volume.</p></li>
200    /// <li>
201    /// <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>
202    /// <li>
203    /// <p><code>size</code> - The size of the volume, in GiB.</p></li>
204    /// <li>
205    /// <p><code>snapshot-id</code> - The snapshot from which the volume was created.</p></li>
206    /// <li>
207    /// <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>
208    /// <li>
209    /// <p><code>tag</code>:<key>
210    /// - 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
211    /// <code>Owner</code> and the value
212    /// <code>TeamA</code>, specify
213    /// <code>tag:Owner</code> for the filter name and
214    /// <code>TeamA</code> for the filter value.
215    /// </key></p></li>
216    /// <li>
217    /// <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>
218    /// <li>
219    /// <p><code>volume-id</code> - The volume ID.</p></li>
220    /// <li>
221    /// <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>
222    /// </ul>
223    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
224        self.inner = self.inner.set_filters(input);
225        self
226    }
227    /// <p>The filters.</p>
228    /// <ul>
229    /// <li>
230    /// <p><code>attachment.attach-time</code> - The time stamp when the attachment initiated.</p></li>
231    /// <li>
232    /// <p><code>attachment.delete-on-termination</code> - Whether the volume is deleted on instance termination.</p></li>
233    /// <li>
234    /// <p><code>attachment.device</code> - The device name specified in the block device mapping (for example, <code>/dev/sda1</code>).</p></li>
235    /// <li>
236    /// <p><code>attachment.instance-id</code> - The ID of the instance the volume is attached to.</p></li>
237    /// <li>
238    /// <p><code>attachment.status</code> - The attachment state (<code>attaching</code> | <code>attached</code> | <code>detaching</code>).</p></li>
239    /// <li>
240    /// <p><code>availability-zone</code> - The Availability Zone in which the volume was created.</p></li>
241    /// <li>
242    /// <p><code>create-time</code> - The time stamp when the volume was created.</p></li>
243    /// <li>
244    /// <p><code>encrypted</code> - Indicates whether the volume is encrypted (<code>true</code> | <code>false</code>)</p></li>
245    /// <li>
246    /// <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>
247    /// <li>
248    /// <p><code>multi-attach-enabled</code> - Indicates whether the volume is enabled for Multi-Attach (<code>true</code> | <code>false</code>)</p></li>
249    /// <li>
250    /// <p><code>operator.managed</code> - A Boolean that indicates whether this is a managed volume.</p></li>
251    /// <li>
252    /// <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>
253    /// <li>
254    /// <p><code>size</code> - The size of the volume, in GiB.</p></li>
255    /// <li>
256    /// <p><code>snapshot-id</code> - The snapshot from which the volume was created.</p></li>
257    /// <li>
258    /// <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>
259    /// <li>
260    /// <p><code>tag</code>:<key>
261    /// - 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
262    /// <code>Owner</code> and the value
263    /// <code>TeamA</code>, specify
264    /// <code>tag:Owner</code> for the filter name and
265    /// <code>TeamA</code> for the filter value.
266    /// </key></p></li>
267    /// <li>
268    /// <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>
269    /// <li>
270    /// <p><code>volume-id</code> - The volume ID.</p></li>
271    /// <li>
272    /// <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>
273    /// </ul>
274    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
275        self.inner.get_filters()
276    }
277    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
278    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
279        self.inner = self.inner.next_token(input.into());
280        self
281    }
282    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
283    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
284        self.inner = self.inner.set_next_token(input);
285        self
286    }
287    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
288    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
289        self.inner.get_next_token()
290    }
291    /// <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>
292    pub fn max_results(mut self, input: i32) -> Self {
293        self.inner = self.inner.max_results(input);
294        self
295    }
296    /// <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>
297    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
298        self.inner = self.inner.set_max_results(input);
299        self
300    }
301    /// <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>
302    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
303        self.inner.get_max_results()
304    }
305}
306
307/// Successful return type for the `volume_available` waiter.
308pub type VolumeAvailableFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
309    crate::operation::describe_volumes::DescribeVolumesOutput,
310    ::aws_smithy_runtime_api::client::result::SdkError<
311        crate::operation::describe_volumes::DescribeVolumesError,
312        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
313    >,
314>;
315
316/// Error type for the `volume_available` waiter.
317pub type WaitUntilVolumeAvailableError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
318    crate::operation::describe_volumes::DescribeVolumesOutput,
319    crate::operation::describe_volumes::DescribeVolumesError,
320>;