aws_sdk_ec2/waiters/
snapshot_completed.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `snapshot_completed` 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 SnapshotCompletedFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_snapshots::builders::DescribeSnapshotsInputBuilder,
18}
19impl SnapshotCompletedFluentBuilder {
20    /// Creates a new `SnapshotCompletedFluentBuilder`.
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 DescribeSnapshots as a reference.
28    pub fn as_input(&self) -> &crate::operation::describe_snapshots::builders::DescribeSnapshotsInputBuilder {
29        &self.inner
30    }
31    /// Wait for `snapshot_completed`
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::snapshot_completed::SnapshotCompletedFinalPoll,
37        crate::waiters::snapshot_completed::WaitUntilSnapshotCompletedError,
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_snapshots::DescribeSnapshots::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_snapshots::DescribeSnapshotsOutput,
59            &crate::operation::describe_snapshots::DescribeSnapshotsError,
60        >| {
61            // Matches: {"output":{"path":"Snapshots[].State","expected":"completed","comparator":"allStringEquals"}}
62            if crate::waiters::matchers::match_describe_snapshots_a0b4c167203a8805f(result) {
63                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64            }
65            // Matches: {"output":{"path":"Snapshots[].State","expected":"error","comparator":"anyStringEquals"}}
66            if crate::waiters::matchers::match_describe_snapshots_8bfc549023d126af0(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_snapshots::DescribeSnapshots::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    /// <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>
88    pub fn max_results(mut self, input: i32) -> Self {
89        self.inner = self.inner.max_results(input);
90        self
91    }
92    /// <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>
93    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
94        self.inner = self.inner.set_max_results(input);
95        self
96    }
97    /// <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>
98    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
99        self.inner.get_max_results()
100    }
101    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
102    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
103        self.inner = self.inner.next_token(input.into());
104        self
105    }
106    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
107    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
108        self.inner = self.inner.set_next_token(input);
109        self
110    }
111    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
112    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
113        self.inner.get_next_token()
114    }
115    ///
116    /// Appends an item to `OwnerIds`.
117    ///
118    /// To override the contents of this collection use [`set_owner_ids`](Self::set_owner_ids).
119    ///
120    /// <p>Scopes the results to snapshots with the specified owners. You can specify a combination of Amazon Web Services account IDs, <code>self</code>, and <code>amazon</code>.</p>
121    pub fn owner_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
122        self.inner = self.inner.owner_ids(input.into());
123        self
124    }
125    /// <p>Scopes the results to snapshots with the specified owners. You can specify a combination of Amazon Web Services account IDs, <code>self</code>, and <code>amazon</code>.</p>
126    pub fn set_owner_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
127        self.inner = self.inner.set_owner_ids(input);
128        self
129    }
130    /// <p>Scopes the results to snapshots with the specified owners. You can specify a combination of Amazon Web Services account IDs, <code>self</code>, and <code>amazon</code>.</p>
131    pub fn get_owner_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
132        self.inner.get_owner_ids()
133    }
134    ///
135    /// Appends an item to `RestorableByUserIds`.
136    ///
137    /// To override the contents of this collection use [`set_restorable_by_user_ids`](Self::set_restorable_by_user_ids).
138    ///
139    /// <p>The IDs of the Amazon Web Services accounts that can create volumes from the snapshot.</p>
140    pub fn restorable_by_user_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141        self.inner = self.inner.restorable_by_user_ids(input.into());
142        self
143    }
144    /// <p>The IDs of the Amazon Web Services accounts that can create volumes from the snapshot.</p>
145    pub fn set_restorable_by_user_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
146        self.inner = self.inner.set_restorable_by_user_ids(input);
147        self
148    }
149    /// <p>The IDs of the Amazon Web Services accounts that can create volumes from the snapshot.</p>
150    pub fn get_restorable_by_user_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
151        self.inner.get_restorable_by_user_ids()
152    }
153    ///
154    /// Appends an item to `SnapshotIds`.
155    ///
156    /// To override the contents of this collection use [`set_snapshot_ids`](Self::set_snapshot_ids).
157    ///
158    /// <p>The snapshot IDs.</p>
159    /// <p>Default: Describes the snapshots for which you have create volume permissions.</p>
160    pub fn snapshot_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161        self.inner = self.inner.snapshot_ids(input.into());
162        self
163    }
164    /// <p>The snapshot IDs.</p>
165    /// <p>Default: Describes the snapshots for which you have create volume permissions.</p>
166    pub fn set_snapshot_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
167        self.inner = self.inner.set_snapshot_ids(input);
168        self
169    }
170    /// <p>The snapshot IDs.</p>
171    /// <p>Default: Describes the snapshots for which you have create volume permissions.</p>
172    pub fn get_snapshot_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
173        self.inner.get_snapshot_ids()
174    }
175    /// <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>
176    pub fn dry_run(mut self, input: bool) -> Self {
177        self.inner = self.inner.dry_run(input);
178        self
179    }
180    /// <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>
181    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
182        self.inner = self.inner.set_dry_run(input);
183        self
184    }
185    /// <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>
186    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
187        self.inner.get_dry_run()
188    }
189    ///
190    /// Appends an item to `Filters`.
191    ///
192    /// To override the contents of this collection use [`set_filters`](Self::set_filters).
193    ///
194    /// <p>The filters.</p>
195    /// <ul>
196    /// <li>
197    /// <p><code>description</code> - A description of the snapshot.</p></li>
198    /// <li>
199    /// <p><code>encrypted</code> - Indicates whether the snapshot is encrypted (<code>true</code> | <code>false</code>)</p></li>
200    /// <li>
201    /// <p><code>owner-alias</code> - The owner alias, from an Amazon-maintained list (<code>amazon</code>). This is not the user-configured Amazon Web Services account alias set using the IAM console. We recommend that you use the related parameter instead of this filter.</p></li>
202    /// <li>
203    /// <p><code>owner-id</code> - The Amazon Web Services account ID of the owner. We recommend that you use the related parameter instead of this filter.</p></li>
204    /// <li>
205    /// <p><code>progress</code> - The progress of the snapshot, as a percentage (for example, 80%).</p></li>
206    /// <li>
207    /// <p><code>snapshot-id</code> - The snapshot ID.</p></li>
208    /// <li>
209    /// <p><code>start-time</code> - The time stamp when the snapshot was initiated.</p></li>
210    /// <li>
211    /// <p><code>status</code> - The status of the snapshot (<code>pending</code> | <code>completed</code> | <code>error</code>).</p></li>
212    /// <li>
213    /// <p><code>storage-tier</code> - The storage tier of the snapshot (<code>archive</code> | <code>standard</code>).</p></li>
214    /// <li>
215    /// <p><code>transfer-type</code> - The type of operation used to create the snapshot (<code>time-based</code> | <code>standard</code>).</p></li>
216    /// <li>
217    /// <p><code>tag</code>:<key>
218    /// - 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
219    /// <code>Owner</code> and the value
220    /// <code>TeamA</code>, specify
221    /// <code>tag:Owner</code> for the filter name and
222    /// <code>TeamA</code> for the filter value.
223    /// </key></p></li>
224    /// <li>
225    /// <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>
226    /// <li>
227    /// <p><code>volume-id</code> - The ID of the volume the snapshot is for.</p></li>
228    /// <li>
229    /// <p><code>volume-size</code> - The size of the volume, in GiB.</p></li>
230    /// </ul>
231    pub fn filters(mut self, input: crate::types::Filter) -> Self {
232        self.inner = self.inner.filters(input);
233        self
234    }
235    /// <p>The filters.</p>
236    /// <ul>
237    /// <li>
238    /// <p><code>description</code> - A description of the snapshot.</p></li>
239    /// <li>
240    /// <p><code>encrypted</code> - Indicates whether the snapshot is encrypted (<code>true</code> | <code>false</code>)</p></li>
241    /// <li>
242    /// <p><code>owner-alias</code> - The owner alias, from an Amazon-maintained list (<code>amazon</code>). This is not the user-configured Amazon Web Services account alias set using the IAM console. We recommend that you use the related parameter instead of this filter.</p></li>
243    /// <li>
244    /// <p><code>owner-id</code> - The Amazon Web Services account ID of the owner. We recommend that you use the related parameter instead of this filter.</p></li>
245    /// <li>
246    /// <p><code>progress</code> - The progress of the snapshot, as a percentage (for example, 80%).</p></li>
247    /// <li>
248    /// <p><code>snapshot-id</code> - The snapshot ID.</p></li>
249    /// <li>
250    /// <p><code>start-time</code> - The time stamp when the snapshot was initiated.</p></li>
251    /// <li>
252    /// <p><code>status</code> - The status of the snapshot (<code>pending</code> | <code>completed</code> | <code>error</code>).</p></li>
253    /// <li>
254    /// <p><code>storage-tier</code> - The storage tier of the snapshot (<code>archive</code> | <code>standard</code>).</p></li>
255    /// <li>
256    /// <p><code>transfer-type</code> - The type of operation used to create the snapshot (<code>time-based</code> | <code>standard</code>).</p></li>
257    /// <li>
258    /// <p><code>tag</code>:<key>
259    /// - 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
260    /// <code>Owner</code> and the value
261    /// <code>TeamA</code>, specify
262    /// <code>tag:Owner</code> for the filter name and
263    /// <code>TeamA</code> for the filter value.
264    /// </key></p></li>
265    /// <li>
266    /// <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>
267    /// <li>
268    /// <p><code>volume-id</code> - The ID of the volume the snapshot is for.</p></li>
269    /// <li>
270    /// <p><code>volume-size</code> - The size of the volume, in GiB.</p></li>
271    /// </ul>
272    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
273        self.inner = self.inner.set_filters(input);
274        self
275    }
276    /// <p>The filters.</p>
277    /// <ul>
278    /// <li>
279    /// <p><code>description</code> - A description of the snapshot.</p></li>
280    /// <li>
281    /// <p><code>encrypted</code> - Indicates whether the snapshot is encrypted (<code>true</code> | <code>false</code>)</p></li>
282    /// <li>
283    /// <p><code>owner-alias</code> - The owner alias, from an Amazon-maintained list (<code>amazon</code>). This is not the user-configured Amazon Web Services account alias set using the IAM console. We recommend that you use the related parameter instead of this filter.</p></li>
284    /// <li>
285    /// <p><code>owner-id</code> - The Amazon Web Services account ID of the owner. We recommend that you use the related parameter instead of this filter.</p></li>
286    /// <li>
287    /// <p><code>progress</code> - The progress of the snapshot, as a percentage (for example, 80%).</p></li>
288    /// <li>
289    /// <p><code>snapshot-id</code> - The snapshot ID.</p></li>
290    /// <li>
291    /// <p><code>start-time</code> - The time stamp when the snapshot was initiated.</p></li>
292    /// <li>
293    /// <p><code>status</code> - The status of the snapshot (<code>pending</code> | <code>completed</code> | <code>error</code>).</p></li>
294    /// <li>
295    /// <p><code>storage-tier</code> - The storage tier of the snapshot (<code>archive</code> | <code>standard</code>).</p></li>
296    /// <li>
297    /// <p><code>transfer-type</code> - The type of operation used to create the snapshot (<code>time-based</code> | <code>standard</code>).</p></li>
298    /// <li>
299    /// <p><code>tag</code>:<key>
300    /// - 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
301    /// <code>Owner</code> and the value
302    /// <code>TeamA</code>, specify
303    /// <code>tag:Owner</code> for the filter name and
304    /// <code>TeamA</code> for the filter value.
305    /// </key></p></li>
306    /// <li>
307    /// <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>
308    /// <li>
309    /// <p><code>volume-id</code> - The ID of the volume the snapshot is for.</p></li>
310    /// <li>
311    /// <p><code>volume-size</code> - The size of the volume, in GiB.</p></li>
312    /// </ul>
313    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
314        self.inner.get_filters()
315    }
316}
317
318/// Successful return type for the `snapshot_completed` waiter.
319pub type SnapshotCompletedFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
320    crate::operation::describe_snapshots::DescribeSnapshotsOutput,
321    ::aws_smithy_runtime_api::client::result::SdkError<
322        crate::operation::describe_snapshots::DescribeSnapshotsError,
323        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
324    >,
325>;
326
327/// Error type for the `snapshot_completed` waiter.
328pub type WaitUntilSnapshotCompletedError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
329    crate::operation::describe_snapshots::DescribeSnapshotsOutput,
330    crate::operation::describe_snapshots::DescribeSnapshotsError,
331>;