aws_sdk_ec2/waiters/
bundle_task_complete.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `bundle_task_complete` 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 BundleTaskCompleteFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_bundle_tasks::builders::DescribeBundleTasksInputBuilder,
18}
19impl BundleTaskCompleteFluentBuilder {
20    /// Creates a new `BundleTaskCompleteFluentBuilder`.
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 DescribeBundleTasks as a reference.
28    pub fn as_input(&self) -> &crate::operation::describe_bundle_tasks::builders::DescribeBundleTasksInputBuilder {
29        &self.inner
30    }
31    /// Wait for `bundle_task_complete`
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::bundle_task_complete::BundleTaskCompleteFinalPoll,
37        crate::waiters::bundle_task_complete::WaitUntilBundleTaskCompleteError,
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_bundle_tasks::DescribeBundleTasks::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_bundle_tasks::DescribeBundleTasksOutput,
59            &crate::operation::describe_bundle_tasks::DescribeBundleTasksError,
60        >| {
61            // Matches: {"output":{"path":"BundleTasks[].State","expected":"complete","comparator":"allStringEquals"}}
62            if crate::waiters::matchers::match_describe_bundle_tasks_ab301da50ed1fbce6(result) {
63                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64            }
65            // Matches: {"output":{"path":"BundleTasks[].State","expected":"failed","comparator":"anyStringEquals"}}
66            if crate::waiters::matchers::match_describe_bundle_tasks_7d073988185526d00(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_bundle_tasks::DescribeBundleTasks::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 `BundleIds`.
89    ///
90    /// To override the contents of this collection use [`set_bundle_ids`](Self::set_bundle_ids).
91    ///
92    /// <p>The bundle task IDs.</p>
93    /// <p>Default: Describes all your bundle tasks.</p>
94    pub fn bundle_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
95        self.inner = self.inner.bundle_ids(input.into());
96        self
97    }
98    /// <p>The bundle task IDs.</p>
99    /// <p>Default: Describes all your bundle tasks.</p>
100    pub fn set_bundle_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
101        self.inner = self.inner.set_bundle_ids(input);
102        self
103    }
104    /// <p>The bundle task IDs.</p>
105    /// <p>Default: Describes all your bundle tasks.</p>
106    pub fn get_bundle_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
107        self.inner.get_bundle_ids()
108    }
109    /// <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>
110    pub fn dry_run(mut self, input: bool) -> Self {
111        self.inner = self.inner.dry_run(input);
112        self
113    }
114    /// <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>
115    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
116        self.inner = self.inner.set_dry_run(input);
117        self
118    }
119    /// <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>
120    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
121        self.inner.get_dry_run()
122    }
123    ///
124    /// Appends an item to `Filters`.
125    ///
126    /// To override the contents of this collection use [`set_filters`](Self::set_filters).
127    ///
128    /// <p>The filters.</p>
129    /// <ul>
130    /// <li>
131    /// <p><code>bundle-id</code> - The ID of the bundle task.</p></li>
132    /// <li>
133    /// <p><code>error-code</code> - If the task failed, the error code returned.</p></li>
134    /// <li>
135    /// <p><code>error-message</code> - If the task failed, the error message returned.</p></li>
136    /// <li>
137    /// <p><code>instance-id</code> - The ID of the instance.</p></li>
138    /// <li>
139    /// <p><code>progress</code> - The level of task completion, as a percentage (for example, 20%).</p></li>
140    /// <li>
141    /// <p><code>s3-bucket</code> - The Amazon S3 bucket to store the AMI.</p></li>
142    /// <li>
143    /// <p><code>s3-prefix</code> - The beginning of the AMI name.</p></li>
144    /// <li>
145    /// <p><code>start-time</code> - The time the task started (for example, 2013-09-15T17:15:20.000Z).</p></li>
146    /// <li>
147    /// <p><code>state</code> - The state of the task (<code>pending</code> | <code>waiting-for-shutdown</code> | <code>bundling</code> | <code>storing</code> | <code>cancelling</code> | <code>complete</code> | <code>failed</code>).</p></li>
148    /// <li>
149    /// <p><code>update-time</code> - The time of the most recent update for the task.</p></li>
150    /// </ul>
151    pub fn filters(mut self, input: crate::types::Filter) -> Self {
152        self.inner = self.inner.filters(input);
153        self
154    }
155    /// <p>The filters.</p>
156    /// <ul>
157    /// <li>
158    /// <p><code>bundle-id</code> - The ID of the bundle task.</p></li>
159    /// <li>
160    /// <p><code>error-code</code> - If the task failed, the error code returned.</p></li>
161    /// <li>
162    /// <p><code>error-message</code> - If the task failed, the error message returned.</p></li>
163    /// <li>
164    /// <p><code>instance-id</code> - The ID of the instance.</p></li>
165    /// <li>
166    /// <p><code>progress</code> - The level of task completion, as a percentage (for example, 20%).</p></li>
167    /// <li>
168    /// <p><code>s3-bucket</code> - The Amazon S3 bucket to store the AMI.</p></li>
169    /// <li>
170    /// <p><code>s3-prefix</code> - The beginning of the AMI name.</p></li>
171    /// <li>
172    /// <p><code>start-time</code> - The time the task started (for example, 2013-09-15T17:15:20.000Z).</p></li>
173    /// <li>
174    /// <p><code>state</code> - The state of the task (<code>pending</code> | <code>waiting-for-shutdown</code> | <code>bundling</code> | <code>storing</code> | <code>cancelling</code> | <code>complete</code> | <code>failed</code>).</p></li>
175    /// <li>
176    /// <p><code>update-time</code> - The time of the most recent update for the task.</p></li>
177    /// </ul>
178    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
179        self.inner = self.inner.set_filters(input);
180        self
181    }
182    /// <p>The filters.</p>
183    /// <ul>
184    /// <li>
185    /// <p><code>bundle-id</code> - The ID of the bundle task.</p></li>
186    /// <li>
187    /// <p><code>error-code</code> - If the task failed, the error code returned.</p></li>
188    /// <li>
189    /// <p><code>error-message</code> - If the task failed, the error message returned.</p></li>
190    /// <li>
191    /// <p><code>instance-id</code> - The ID of the instance.</p></li>
192    /// <li>
193    /// <p><code>progress</code> - The level of task completion, as a percentage (for example, 20%).</p></li>
194    /// <li>
195    /// <p><code>s3-bucket</code> - The Amazon S3 bucket to store the AMI.</p></li>
196    /// <li>
197    /// <p><code>s3-prefix</code> - The beginning of the AMI name.</p></li>
198    /// <li>
199    /// <p><code>start-time</code> - The time the task started (for example, 2013-09-15T17:15:20.000Z).</p></li>
200    /// <li>
201    /// <p><code>state</code> - The state of the task (<code>pending</code> | <code>waiting-for-shutdown</code> | <code>bundling</code> | <code>storing</code> | <code>cancelling</code> | <code>complete</code> | <code>failed</code>).</p></li>
202    /// <li>
203    /// <p><code>update-time</code> - The time of the most recent update for the task.</p></li>
204    /// </ul>
205    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
206        self.inner.get_filters()
207    }
208}
209
210/// Successful return type for the `bundle_task_complete` waiter.
211pub type BundleTaskCompleteFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
212    crate::operation::describe_bundle_tasks::DescribeBundleTasksOutput,
213    ::aws_smithy_runtime_api::client::result::SdkError<
214        crate::operation::describe_bundle_tasks::DescribeBundleTasksError,
215        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
216    >,
217>;
218
219/// Error type for the `bundle_task_complete` waiter.
220pub type WaitUntilBundleTaskCompleteError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
221    crate::operation::describe_bundle_tasks::DescribeBundleTasksOutput,
222    crate::operation::describe_bundle_tasks::DescribeBundleTasksError,
223>;