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