aws_sdk_ec2/waiters/store_image_task_complete.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `store_image_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 StoreImageTaskCompleteFluentBuilder {
16 handle: ::std::sync::Arc<crate::client::Handle>,
17 inner: crate::operation::describe_store_image_tasks::builders::DescribeStoreImageTasksInputBuilder,
18}
19impl StoreImageTaskCompleteFluentBuilder {
20 /// Creates a new `StoreImageTaskCompleteFluentBuilder`.
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 DescribeStoreImageTasks as a reference.
28 pub fn as_input(&self) -> &crate::operation::describe_store_image_tasks::builders::DescribeStoreImageTasksInputBuilder {
29 &self.inner
30 }
31 /// Wait for `store_image_task_complete`
32 pub async fn wait(
33 self,
34 max_wait: ::std::time::Duration,
35 ) -> ::std::result::Result<
36 crate::waiters::store_image_task_complete::StoreImageTaskCompleteFinalPoll,
37 crate::waiters::store_image_task_complete::WaitUntilStoreImageTaskCompleteError,
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_store_image_tasks::DescribeStoreImageTasks::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_store_image_tasks::DescribeStoreImageTasksOutput,
59 &crate::operation::describe_store_image_tasks::DescribeStoreImageTasksError,
60 >| {
61 // Matches: {"output":{"path":"StoreImageTaskResults[].StoreTaskState","expected":"Completed","comparator":"allStringEquals"}}
62 if crate::waiters::matchers::match_describe_store_image_tasks_0f3d4ac61f82ed8fe(result) {
63 return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64 }
65 // Matches: {"output":{"path":"StoreImageTaskResults[].StoreTaskState","expected":"Failed","comparator":"anyStringEquals"}}
66 if crate::waiters::matchers::match_describe_store_image_tasks_7ae5c4836498ea6aa(result) {
67 return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
68 }
69 // Matches: {"output":{"path":"StoreImageTaskResults[].StoreTaskState","expected":"InProgress","comparator":"anyStringEquals"}}
70 if crate::waiters::matchers::match_describe_store_image_tasks_1cfe383d503eb8961(result) {
71 return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
72 }
73 ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
74 };
75 let operation = move || {
76 let input = input.clone();
77 let runtime_plugins = runtime_plugins.clone();
78 async move { crate::operation::describe_store_image_tasks::DescribeStoreImageTasks::orchestrate(&runtime_plugins, input).await }
79 };
80 let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
81 .min_delay(::std::time::Duration::from_secs(5))
82 .max_delay(::std::time::Duration::from_secs(120))
83 .max_wait(max_wait)
84 .time_source(time_source)
85 .sleep_impl(sleep_impl)
86 .acceptor(acceptor)
87 .operation(operation)
88 .build();
89 ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
90 }
91 ///
92 /// Appends an item to `ImageIds`.
93 ///
94 /// To override the contents of this collection use [`set_image_ids`](Self::set_image_ids).
95 ///
96 /// <p>The AMI IDs for which to show progress. Up to 20 AMI IDs can be included in a request.</p>
97 pub fn image_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
98 self.inner = self.inner.image_ids(input.into());
99 self
100 }
101 /// <p>The AMI IDs for which to show progress. Up to 20 AMI IDs can be included in a request.</p>
102 pub fn set_image_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
103 self.inner = self.inner.set_image_ids(input);
104 self
105 }
106 /// <p>The AMI IDs for which to show progress. Up to 20 AMI IDs can be included in a request.</p>
107 pub fn get_image_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
108 self.inner.get_image_ids()
109 }
110 /// <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>
111 pub fn dry_run(mut self, input: bool) -> Self {
112 self.inner = self.inner.dry_run(input);
113 self
114 }
115 /// <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>
116 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
117 self.inner = self.inner.set_dry_run(input);
118 self
119 }
120 /// <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>
121 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
122 self.inner.get_dry_run()
123 }
124 ///
125 /// Appends an item to `Filters`.
126 ///
127 /// To override the contents of this collection use [`set_filters`](Self::set_filters).
128 ///
129 /// <p>The filters.</p>
130 /// <ul>
131 /// <li>
132 /// <p><code>task-state</code> - Returns tasks in a certain state (<code>InProgress</code> | <code>Completed</code> | <code>Failed</code>)</p></li>
133 /// <li>
134 /// <p><code>bucket</code> - Returns task information for tasks that targeted a specific bucket. For the filter value, specify the bucket name.</p></li>
135 /// </ul><note>
136 /// <p>When you specify the <code>ImageIds</code> parameter, any filters that you specify are ignored. To use the filters, you must remove the <code>ImageIds</code> parameter.</p>
137 /// </note>
138 pub fn filters(mut self, input: crate::types::Filter) -> Self {
139 self.inner = self.inner.filters(input);
140 self
141 }
142 /// <p>The filters.</p>
143 /// <ul>
144 /// <li>
145 /// <p><code>task-state</code> - Returns tasks in a certain state (<code>InProgress</code> | <code>Completed</code> | <code>Failed</code>)</p></li>
146 /// <li>
147 /// <p><code>bucket</code> - Returns task information for tasks that targeted a specific bucket. For the filter value, specify the bucket name.</p></li>
148 /// </ul><note>
149 /// <p>When you specify the <code>ImageIds</code> parameter, any filters that you specify are ignored. To use the filters, you must remove the <code>ImageIds</code> parameter.</p>
150 /// </note>
151 pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
152 self.inner = self.inner.set_filters(input);
153 self
154 }
155 /// <p>The filters.</p>
156 /// <ul>
157 /// <li>
158 /// <p><code>task-state</code> - Returns tasks in a certain state (<code>InProgress</code> | <code>Completed</code> | <code>Failed</code>)</p></li>
159 /// <li>
160 /// <p><code>bucket</code> - Returns task information for tasks that targeted a specific bucket. For the filter value, specify the bucket name.</p></li>
161 /// </ul><note>
162 /// <p>When you specify the <code>ImageIds</code> parameter, any filters that you specify are ignored. To use the filters, you must remove the <code>ImageIds</code> parameter.</p>
163 /// </note>
164 pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
165 self.inner.get_filters()
166 }
167 /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
168 pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
169 self.inner = self.inner.next_token(input.into());
170 self
171 }
172 /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
173 pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
174 self.inner = self.inner.set_next_token(input);
175 self
176 }
177 /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
178 pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
179 self.inner.get_next_token()
180 }
181 /// <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>
182 /// <p>You cannot specify this parameter and the <code>ImageIds</code> parameter in the same call.</p>
183 pub fn max_results(mut self, input: i32) -> Self {
184 self.inner = self.inner.max_results(input);
185 self
186 }
187 /// <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>
188 /// <p>You cannot specify this parameter and the <code>ImageIds</code> parameter in the same call.</p>
189 pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
190 self.inner = self.inner.set_max_results(input);
191 self
192 }
193 /// <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>
194 /// <p>You cannot specify this parameter and the <code>ImageIds</code> parameter in the same call.</p>
195 pub fn get_max_results(&self) -> &::std::option::Option<i32> {
196 self.inner.get_max_results()
197 }
198}
199
200/// Successful return type for the `store_image_task_complete` waiter.
201pub type StoreImageTaskCompleteFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
202 crate::operation::describe_store_image_tasks::DescribeStoreImageTasksOutput,
203 ::aws_smithy_runtime_api::client::result::SdkError<
204 crate::operation::describe_store_image_tasks::DescribeStoreImageTasksError,
205 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
206 >,
207>;
208
209/// Error type for the `store_image_task_complete` waiter.
210pub type WaitUntilStoreImageTaskCompleteError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
211 crate::operation::describe_store_image_tasks::DescribeStoreImageTasksOutput,
212 crate::operation::describe_store_image_tasks::DescribeStoreImageTasksError,
213>;