aws_sdk_ecr/waiters/
image_scan_complete.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `image_scan_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 ImageScanCompleteFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_image_scan_findings::builders::DescribeImageScanFindingsInputBuilder,
18}
19impl ImageScanCompleteFluentBuilder {
20    /// Creates a new `ImageScanCompleteFluentBuilder`.
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 DescribeImageScanFindings as a reference.
28    pub fn as_input(&self) -> &crate::operation::describe_image_scan_findings::builders::DescribeImageScanFindingsInputBuilder {
29        &self.inner
30    }
31    /// Wait until an image scan is complete and findings can be accessed
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::image_scan_complete::ImageScanCompleteFinalPoll,
37        crate::waiters::image_scan_complete::WaitUntilImageScanCompleteError,
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_scan_findings::DescribeImageScanFindings::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_scan_findings::DescribeImageScanFindingsOutput,
59            &crate::operation::describe_image_scan_findings::DescribeImageScanFindingsError,
60        >| {
61            // Matches: {"output":{"path":"imageScanStatus.status","expected":"COMPLETE","comparator":"stringEquals"}}
62            if crate::waiters::matchers::match_describe_image_scan_findings_e6f570cf50c93ebe8(result) {
63                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64            }
65            // Matches: {"output":{"path":"imageScanStatus.status","expected":"FAILED","comparator":"stringEquals"}}
66            if crate::waiters::matchers::match_describe_image_scan_findings_98a640e82b81483b5(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_scan_findings::DescribeImageScanFindings::orchestrate(&runtime_plugins, input).await }
75        };
76        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
77            .min_delay(::std::time::Duration::from_secs(5))
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 Amazon Web Services account ID associated with the registry that contains the repository in which to describe the image scan findings for. If you do not specify a registry, the default registry is assumed.</p>
88    pub fn registry_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
89        self.inner = self.inner.registry_id(input.into());
90        self
91    }
92    /// <p>The Amazon Web Services account ID associated with the registry that contains the repository in which to describe the image scan findings for. If you do not specify a registry, the default registry is assumed.</p>
93    pub fn set_registry_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
94        self.inner = self.inner.set_registry_id(input);
95        self
96    }
97    /// <p>The Amazon Web Services account ID associated with the registry that contains the repository in which to describe the image scan findings for. If you do not specify a registry, the default registry is assumed.</p>
98    pub fn get_registry_id(&self) -> &::std::option::Option<::std::string::String> {
99        self.inner.get_registry_id()
100    }
101    /// <p>The repository for the image for which to describe the scan findings.</p>
102    pub fn repository_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
103        self.inner = self.inner.repository_name(input.into());
104        self
105    }
106    /// <p>The repository for the image for which to describe the scan findings.</p>
107    pub fn set_repository_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
108        self.inner = self.inner.set_repository_name(input);
109        self
110    }
111    /// <p>The repository for the image for which to describe the scan findings.</p>
112    pub fn get_repository_name(&self) -> &::std::option::Option<::std::string::String> {
113        self.inner.get_repository_name()
114    }
115    /// <p>An object with identifying information for an image in an Amazon ECR repository.</p>
116    pub fn image_id(mut self, input: crate::types::ImageIdentifier) -> Self {
117        self.inner = self.inner.image_id(input);
118        self
119    }
120    /// <p>An object with identifying information for an image in an Amazon ECR repository.</p>
121    pub fn set_image_id(mut self, input: ::std::option::Option<crate::types::ImageIdentifier>) -> Self {
122        self.inner = self.inner.set_image_id(input);
123        self
124    }
125    /// <p>An object with identifying information for an image in an Amazon ECR repository.</p>
126    pub fn get_image_id(&self) -> &::std::option::Option<crate::types::ImageIdentifier> {
127        self.inner.get_image_id()
128    }
129    /// <p>The <code>nextToken</code> value returned from a previous paginated <code>DescribeImageScanFindings</code> request where <code>maxResults</code> was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the <code>nextToken</code> value. This value is null when there are no more results to return.</p>
130    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.inner = self.inner.next_token(input.into());
132        self
133    }
134    /// <p>The <code>nextToken</code> value returned from a previous paginated <code>DescribeImageScanFindings</code> request where <code>maxResults</code> was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the <code>nextToken</code> value. This value is null when there are no more results to return.</p>
135    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.inner = self.inner.set_next_token(input);
137        self
138    }
139    /// <p>The <code>nextToken</code> value returned from a previous paginated <code>DescribeImageScanFindings</code> request where <code>maxResults</code> was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the <code>nextToken</code> value. This value is null when there are no more results to return.</p>
140    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
141        self.inner.get_next_token()
142    }
143    /// <p>The maximum number of image scan results returned by <code>DescribeImageScanFindings</code> in paginated output. When this parameter is used, <code>DescribeImageScanFindings</code> only returns <code>maxResults</code> results in a single page along with a <code>nextToken</code> response element. The remaining results of the initial request can be seen by sending another <code>DescribeImageScanFindings</code> request with the returned <code>nextToken</code> value. This value can be between 1 and 1000. If this parameter is not used, then <code>DescribeImageScanFindings</code> returns up to 100 results and a <code>nextToken</code> value, if applicable.</p>
144    pub fn max_results(mut self, input: i32) -> Self {
145        self.inner = self.inner.max_results(input);
146        self
147    }
148    /// <p>The maximum number of image scan results returned by <code>DescribeImageScanFindings</code> in paginated output. When this parameter is used, <code>DescribeImageScanFindings</code> only returns <code>maxResults</code> results in a single page along with a <code>nextToken</code> response element. The remaining results of the initial request can be seen by sending another <code>DescribeImageScanFindings</code> request with the returned <code>nextToken</code> value. This value can be between 1 and 1000. If this parameter is not used, then <code>DescribeImageScanFindings</code> returns up to 100 results and a <code>nextToken</code> value, if applicable.</p>
149    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
150        self.inner = self.inner.set_max_results(input);
151        self
152    }
153    /// <p>The maximum number of image scan results returned by <code>DescribeImageScanFindings</code> in paginated output. When this parameter is used, <code>DescribeImageScanFindings</code> only returns <code>maxResults</code> results in a single page along with a <code>nextToken</code> response element. The remaining results of the initial request can be seen by sending another <code>DescribeImageScanFindings</code> request with the returned <code>nextToken</code> value. This value can be between 1 and 1000. If this parameter is not used, then <code>DescribeImageScanFindings</code> returns up to 100 results and a <code>nextToken</code> value, if applicable.</p>
154    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
155        self.inner.get_max_results()
156    }
157}
158
159/// Successful return type for the `image_scan_complete` waiter.
160pub type ImageScanCompleteFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
161    crate::operation::describe_image_scan_findings::DescribeImageScanFindingsOutput,
162    ::aws_smithy_runtime_api::client::result::SdkError<
163        crate::operation::describe_image_scan_findings::DescribeImageScanFindingsError,
164        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
165    >,
166>;
167
168/// Error type for the `image_scan_complete` waiter.
169pub type WaitUntilImageScanCompleteError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
170    crate::operation::describe_image_scan_findings::DescribeImageScanFindingsOutput,
171    crate::operation::describe_image_scan_findings::DescribeImageScanFindingsError,
172>;