aws_sdk_ec2/waiters/
volume_in_use.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `volume_in_use` 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 VolumeInUseFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_volumes::builders::DescribeVolumesInputBuilder,
18}
19impl VolumeInUseFluentBuilder {
20    /// Creates a new `VolumeInUseFluentBuilder`.
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_in_use`
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<crate::waiters::volume_in_use::VolumeInUseFinalPoll, crate::waiters::volume_in_use::WaitUntilVolumeInUseError> {
36        let input = self
37            .inner
38            .build()
39            .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
40        let runtime_plugins = crate::operation::describe_volumes::DescribeVolumes::operation_runtime_plugins(
41            self.handle.runtime_plugins.clone(),
42            &self.handle.conf,
43            ::std::option::Option::None,
44        )
45        .with_operation_plugin(crate::sdk_feature_tracker::waiter::WaiterFeatureTrackerRuntimePlugin::new());
46        let mut cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
47        let runtime_components_builder = runtime_plugins
48            .apply_client_configuration(&mut cfg)
49            .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
50        let time_components = runtime_components_builder.into_time_components();
51        let sleep_impl = time_components.sleep_impl().expect("a sleep impl is required by waiters");
52        let time_source = time_components.time_source().expect("a time source is required by waiters");
53
54        let acceptor = move |result: ::std::result::Result<
55            &crate::operation::describe_volumes::DescribeVolumesOutput,
56            &crate::operation::describe_volumes::DescribeVolumesError,
57        >| {
58            // Matches: {"output":{"path":"Volumes[].State","expected":"in-use","comparator":"allStringEquals"}}
59            if crate::waiters::matchers::match_describe_volumes_e6d79e3037e927ea9(result) {
60                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
61            }
62            // Matches: {"output":{"path":"Volumes[].State","expected":"deleted","comparator":"anyStringEquals"}}
63            if crate::waiters::matchers::match_describe_volumes_9cbb763f624bb2e82(result) {
64                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
65            }
66            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
67        };
68        let operation = move || {
69            let input = input.clone();
70            let runtime_plugins = runtime_plugins.clone();
71            async move { crate::operation::describe_volumes::DescribeVolumes::orchestrate(&runtime_plugins, input).await }
72        };
73        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
74            .min_delay(::std::time::Duration::from_secs(15))
75            .max_delay(::std::time::Duration::from_secs(120))
76            .max_wait(max_wait)
77            .time_source(time_source)
78            .sleep_impl(sleep_impl)
79            .acceptor(acceptor)
80            .operation(operation)
81            .build();
82        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
83    }
84    ///
85    /// Appends an item to `VolumeIds`.
86    ///
87    /// To override the contents of this collection use [`set_volume_ids`](Self::set_volume_ids).
88    ///
89    /// <p>The volume IDs. If not specified, then all volumes are included in the response.</p>
90    pub fn volume_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
91        self.inner = self.inner.volume_ids(input.into());
92        self
93    }
94    /// <p>The volume IDs. If not specified, then all volumes are included in the response.</p>
95    pub fn set_volume_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
96        self.inner = self.inner.set_volume_ids(input);
97        self
98    }
99    /// <p>The volume IDs. If not specified, then all volumes are included in the response.</p>
100    pub fn get_volume_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
101        self.inner.get_volume_ids()
102    }
103    /// <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>
104    pub fn dry_run(mut self, input: bool) -> Self {
105        self.inner = self.inner.dry_run(input);
106        self
107    }
108    /// <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>
109    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
110        self.inner = self.inner.set_dry_run(input);
111        self
112    }
113    /// <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>
114    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
115        self.inner.get_dry_run()
116    }
117    ///
118    /// Appends an item to `Filters`.
119    ///
120    /// To override the contents of this collection use [`set_filters`](Self::set_filters).
121    ///
122    /// <p>The filters.</p>
123    /// <ul>
124    /// <li>
125    /// <p><code>attachment.attach-time</code> - The time stamp when the attachment initiated.</p></li>
126    /// <li>
127    /// <p><code>attachment.delete-on-termination</code> - Whether the volume is deleted on instance termination.</p></li>
128    /// <li>
129    /// <p><code>attachment.device</code> - The device name specified in the block device mapping (for example, <code>/dev/sda1</code>).</p></li>
130    /// <li>
131    /// <p><code>attachment.instance-id</code> - The ID of the instance the volume is attached to.</p></li>
132    /// <li>
133    /// <p><code>attachment.status</code> - The attachment state (<code>attaching</code> | <code>attached</code> | <code>detaching</code>).</p></li>
134    /// <li>
135    /// <p><code>availability-zone</code> - The Availability Zone in which the volume was created.</p></li>
136    /// <li>
137    /// <p><code>create-time</code> - The time stamp when the volume was created.</p></li>
138    /// <li>
139    /// <p><code>encrypted</code> - Indicates whether the volume is encrypted (<code>true</code> | <code>false</code>)</p></li>
140    /// <li>
141    /// <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>
142    /// <li>
143    /// <p><code>multi-attach-enabled</code> - Indicates whether the volume is enabled for Multi-Attach (<code>true</code> | <code>false</code>)</p></li>
144    /// <li>
145    /// <p><code>operator.managed</code> - A Boolean that indicates whether this is a managed volume.</p></li>
146    /// <li>
147    /// <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>
148    /// <li>
149    /// <p><code>size</code> - The size of the volume, in GiB.</p></li>
150    /// <li>
151    /// <p><code>snapshot-id</code> - The snapshot from which the volume was created.</p></li>
152    /// <li>
153    /// <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>
154    /// <li>
155    /// <p><code>tag</code>:<key>
156    /// - 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
157    /// <code>Owner</code> and the value
158    /// <code>TeamA</code>, specify
159    /// <code>tag:Owner</code> for the filter name and
160    /// <code>TeamA</code> for the filter value.
161    /// </key></p></li>
162    /// <li>
163    /// <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>
164    /// <li>
165    /// <p><code>volume-id</code> - The volume ID.</p></li>
166    /// <li>
167    /// <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>
168    /// </ul>
169    pub fn filters(mut self, input: crate::types::Filter) -> Self {
170        self.inner = self.inner.filters(input);
171        self
172    }
173    /// <p>The filters.</p>
174    /// <ul>
175    /// <li>
176    /// <p><code>attachment.attach-time</code> - The time stamp when the attachment initiated.</p></li>
177    /// <li>
178    /// <p><code>attachment.delete-on-termination</code> - Whether the volume is deleted on instance termination.</p></li>
179    /// <li>
180    /// <p><code>attachment.device</code> - The device name specified in the block device mapping (for example, <code>/dev/sda1</code>).</p></li>
181    /// <li>
182    /// <p><code>attachment.instance-id</code> - The ID of the instance the volume is attached to.</p></li>
183    /// <li>
184    /// <p><code>attachment.status</code> - The attachment state (<code>attaching</code> | <code>attached</code> | <code>detaching</code>).</p></li>
185    /// <li>
186    /// <p><code>availability-zone</code> - The Availability Zone in which the volume was created.</p></li>
187    /// <li>
188    /// <p><code>create-time</code> - The time stamp when the volume was created.</p></li>
189    /// <li>
190    /// <p><code>encrypted</code> - Indicates whether the volume is encrypted (<code>true</code> | <code>false</code>)</p></li>
191    /// <li>
192    /// <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>
193    /// <li>
194    /// <p><code>multi-attach-enabled</code> - Indicates whether the volume is enabled for Multi-Attach (<code>true</code> | <code>false</code>)</p></li>
195    /// <li>
196    /// <p><code>operator.managed</code> - A Boolean that indicates whether this is a managed volume.</p></li>
197    /// <li>
198    /// <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>
199    /// <li>
200    /// <p><code>size</code> - The size of the volume, in GiB.</p></li>
201    /// <li>
202    /// <p><code>snapshot-id</code> - The snapshot from which the volume was created.</p></li>
203    /// <li>
204    /// <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>
205    /// <li>
206    /// <p><code>tag</code>:<key>
207    /// - 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
208    /// <code>Owner</code> and the value
209    /// <code>TeamA</code>, specify
210    /// <code>tag:Owner</code> for the filter name and
211    /// <code>TeamA</code> for the filter value.
212    /// </key></p></li>
213    /// <li>
214    /// <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>
215    /// <li>
216    /// <p><code>volume-id</code> - The volume ID.</p></li>
217    /// <li>
218    /// <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>
219    /// </ul>
220    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
221        self.inner = self.inner.set_filters(input);
222        self
223    }
224    /// <p>The filters.</p>
225    /// <ul>
226    /// <li>
227    /// <p><code>attachment.attach-time</code> - The time stamp when the attachment initiated.</p></li>
228    /// <li>
229    /// <p><code>attachment.delete-on-termination</code> - Whether the volume is deleted on instance termination.</p></li>
230    /// <li>
231    /// <p><code>attachment.device</code> - The device name specified in the block device mapping (for example, <code>/dev/sda1</code>).</p></li>
232    /// <li>
233    /// <p><code>attachment.instance-id</code> - The ID of the instance the volume is attached to.</p></li>
234    /// <li>
235    /// <p><code>attachment.status</code> - The attachment state (<code>attaching</code> | <code>attached</code> | <code>detaching</code>).</p></li>
236    /// <li>
237    /// <p><code>availability-zone</code> - The Availability Zone in which the volume was created.</p></li>
238    /// <li>
239    /// <p><code>create-time</code> - The time stamp when the volume was created.</p></li>
240    /// <li>
241    /// <p><code>encrypted</code> - Indicates whether the volume is encrypted (<code>true</code> | <code>false</code>)</p></li>
242    /// <li>
243    /// <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>
244    /// <li>
245    /// <p><code>multi-attach-enabled</code> - Indicates whether the volume is enabled for Multi-Attach (<code>true</code> | <code>false</code>)</p></li>
246    /// <li>
247    /// <p><code>operator.managed</code> - A Boolean that indicates whether this is a managed volume.</p></li>
248    /// <li>
249    /// <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>
250    /// <li>
251    /// <p><code>size</code> - The size of the volume, in GiB.</p></li>
252    /// <li>
253    /// <p><code>snapshot-id</code> - The snapshot from which the volume was created.</p></li>
254    /// <li>
255    /// <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>
256    /// <li>
257    /// <p><code>tag</code>:<key>
258    /// - 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
259    /// <code>Owner</code> and the value
260    /// <code>TeamA</code>, specify
261    /// <code>tag:Owner</code> for the filter name and
262    /// <code>TeamA</code> for the filter value.
263    /// </key></p></li>
264    /// <li>
265    /// <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>
266    /// <li>
267    /// <p><code>volume-id</code> - The volume ID.</p></li>
268    /// <li>
269    /// <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>
270    /// </ul>
271    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
272        self.inner.get_filters()
273    }
274    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
275    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
276        self.inner = self.inner.next_token(input.into());
277        self
278    }
279    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
280    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
281        self.inner = self.inner.set_next_token(input);
282        self
283    }
284    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
285    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
286        self.inner.get_next_token()
287    }
288    /// <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>
289    pub fn max_results(mut self, input: i32) -> Self {
290        self.inner = self.inner.max_results(input);
291        self
292    }
293    /// <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>
294    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
295        self.inner = self.inner.set_max_results(input);
296        self
297    }
298    /// <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>
299    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
300        self.inner.get_max_results()
301    }
302}
303
304/// Successful return type for the `volume_in_use` waiter.
305pub type VolumeInUseFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
306    crate::operation::describe_volumes::DescribeVolumesOutput,
307    ::aws_smithy_runtime_api::client::result::SdkError<
308        crate::operation::describe_volumes::DescribeVolumesError,
309        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
310    >,
311>;
312
313/// Error type for the `volume_in_use` waiter.
314pub type WaitUntilVolumeInUseError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
315    crate::operation::describe_volumes::DescribeVolumesOutput,
316    crate::operation::describe_volumes::DescribeVolumesError,
317>;