aws_sdk_ec2/waiters/
image_usage_report_available.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `image_usage_report_available` 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 ImageUsageReportAvailableFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_image_usage_reports::builders::DescribeImageUsageReportsInputBuilder,
18}
19impl ImageUsageReportAvailableFluentBuilder {
20    /// Creates a new `ImageUsageReportAvailableFluentBuilder`.
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 DescribeImageUsageReports as a reference.
28    pub fn as_input(&self) -> &crate::operation::describe_image_usage_reports::builders::DescribeImageUsageReportsInputBuilder {
29        &self.inner
30    }
31    /// Wait for `image_usage_report_available`
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::image_usage_report_available::ImageUsageReportAvailableFinalPoll,
37        crate::waiters::image_usage_report_available::WaitUntilImageUsageReportAvailableError,
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_image_usage_reports::DescribeImageUsageReports::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_image_usage_reports::DescribeImageUsageReportsOutput,
59            &crate::operation::describe_image_usage_reports::DescribeImageUsageReportsError,
60        >| {
61            // Matches: {"output":{"path":"ImageUsageReports[].State","expected":"available","comparator":"allStringEquals"}}
62            if crate::waiters::matchers::match_describe_image_usage_reports_aed9ba9e6d7822b30(result) {
63                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64            }
65            // Matches: {"output":{"path":"ImageUsageReports[].State","expected":"failed","comparator":"anyStringEquals"}}
66            if crate::waiters::matchers::match_describe_image_usage_reports_9bae9b0fa5ea9f50d(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_image_usage_reports::DescribeImageUsageReports::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 `ImageIds`.
89    ///
90    /// To override the contents of this collection use [`set_image_ids`](Self::set_image_ids).
91    ///
92    /// <p>The IDs of the images for filtering the reports. If specified, only reports containing these images are returned.</p>
93    pub fn image_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
94        self.inner = self.inner.image_ids(input.into());
95        self
96    }
97    /// <p>The IDs of the images for filtering the reports. If specified, only reports containing these images are returned.</p>
98    pub fn set_image_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
99        self.inner = self.inner.set_image_ids(input);
100        self
101    }
102    /// <p>The IDs of the images for filtering the reports. If specified, only reports containing these images are returned.</p>
103    pub fn get_image_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
104        self.inner.get_image_ids()
105    }
106    ///
107    /// Appends an item to `ReportIds`.
108    ///
109    /// To override the contents of this collection use [`set_report_ids`](Self::set_report_ids).
110    ///
111    /// <p>The IDs of the image usage reports.</p>
112    pub fn report_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.inner = self.inner.report_ids(input.into());
114        self
115    }
116    /// <p>The IDs of the image usage reports.</p>
117    pub fn set_report_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
118        self.inner = self.inner.set_report_ids(input);
119        self
120    }
121    /// <p>The IDs of the image usage reports.</p>
122    pub fn get_report_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
123        self.inner.get_report_ids()
124    }
125    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
126    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127        self.inner = self.inner.next_token(input.into());
128        self
129    }
130    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
131    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
132        self.inner = self.inner.set_next_token(input);
133        self
134    }
135    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
136    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
137        self.inner.get_next_token()
138    }
139    ///
140    /// Appends an item to `Filters`.
141    ///
142    /// To override the contents of this collection use [`set_filters`](Self::set_filters).
143    ///
144    /// <p>The filters.</p>
145    /// <ul>
146    /// <li>
147    /// <p><code>creation-time</code> - The time when the report was created, in the ISO 8601 format in the UTC time zone (YYYY-MM-DDThh:mm:ss.sssZ), for example, <code>2025-11-29T11:04:43.305Z</code>. You can use a wildcard (<code>*</code>), for example, <code>2025-11-29T*</code>, which matches an entire day.</p></li>
148    /// <li>
149    /// <p><code>state</code> - The state of the report (<code>available</code> | <code>pending</code> | <code>error</code>).</p></li>
150    /// <li>
151    /// <p><code>tag:<key></key></code> - 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 <code>Owner</code> and the value <code>TeamA</code>, specify <code>tag:Owner</code> for the filter name and <code>TeamA</code> for the filter value.</p></li>
152    /// <li>
153    /// <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>
154    /// </ul>
155    pub fn filters(mut self, input: crate::types::Filter) -> Self {
156        self.inner = self.inner.filters(input);
157        self
158    }
159    /// <p>The filters.</p>
160    /// <ul>
161    /// <li>
162    /// <p><code>creation-time</code> - The time when the report was created, in the ISO 8601 format in the UTC time zone (YYYY-MM-DDThh:mm:ss.sssZ), for example, <code>2025-11-29T11:04:43.305Z</code>. You can use a wildcard (<code>*</code>), for example, <code>2025-11-29T*</code>, which matches an entire day.</p></li>
163    /// <li>
164    /// <p><code>state</code> - The state of the report (<code>available</code> | <code>pending</code> | <code>error</code>).</p></li>
165    /// <li>
166    /// <p><code>tag:<key></key></code> - 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 <code>Owner</code> and the value <code>TeamA</code>, specify <code>tag:Owner</code> for the filter name and <code>TeamA</code> for the filter value.</p></li>
167    /// <li>
168    /// <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>
169    /// </ul>
170    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
171        self.inner = self.inner.set_filters(input);
172        self
173    }
174    /// <p>The filters.</p>
175    /// <ul>
176    /// <li>
177    /// <p><code>creation-time</code> - The time when the report was created, in the ISO 8601 format in the UTC time zone (YYYY-MM-DDThh:mm:ss.sssZ), for example, <code>2025-11-29T11:04:43.305Z</code>. You can use a wildcard (<code>*</code>), for example, <code>2025-11-29T*</code>, which matches an entire day.</p></li>
178    /// <li>
179    /// <p><code>state</code> - The state of the report (<code>available</code> | <code>pending</code> | <code>error</code>).</p></li>
180    /// <li>
181    /// <p><code>tag:<key></key></code> - 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 <code>Owner</code> and the value <code>TeamA</code>, specify <code>tag:Owner</code> for the filter name and <code>TeamA</code> for the filter value.</p></li>
182    /// <li>
183    /// <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>
184    /// </ul>
185    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
186        self.inner.get_filters()
187    }
188    /// <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>
189    pub fn dry_run(mut self, input: bool) -> Self {
190        self.inner = self.inner.dry_run(input);
191        self
192    }
193    /// <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>
194    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
195        self.inner = self.inner.set_dry_run(input);
196        self
197    }
198    /// <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>
199    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
200        self.inner.get_dry_run()
201    }
202    /// <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>
203    pub fn max_results(mut self, input: i32) -> Self {
204        self.inner = self.inner.max_results(input);
205        self
206    }
207    /// <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>
208    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
209        self.inner = self.inner.set_max_results(input);
210        self
211    }
212    /// <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>
213    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
214        self.inner.get_max_results()
215    }
216}
217
218/// Successful return type for the `image_usage_report_available` waiter.
219pub type ImageUsageReportAvailableFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
220    crate::operation::describe_image_usage_reports::DescribeImageUsageReportsOutput,
221    ::aws_smithy_runtime_api::client::result::SdkError<
222        crate::operation::describe_image_usage_reports::DescribeImageUsageReportsError,
223        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
224    >,
225>;
226
227/// Error type for the `image_usage_report_available` waiter.
228pub type WaitUntilImageUsageReportAvailableError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
229    crate::operation::describe_image_usage_reports::DescribeImageUsageReportsOutput,
230    crate::operation::describe_image_usage_reports::DescribeImageUsageReportsError,
231>;