aws_sdk_omics/waiters/
reference_import_job_completed.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `reference_import_job_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 ReferenceImportJobCompletedFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::get_reference_import_job::builders::GetReferenceImportJobInputBuilder,
18}
19impl ReferenceImportJobCompletedFluentBuilder {
20    /// Creates a new `ReferenceImportJobCompletedFluentBuilder`.
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 GetReferenceImportJob as a reference.
28    pub fn as_input(&self) -> &crate::operation::get_reference_import_job::builders::GetReferenceImportJobInputBuilder {
29        &self.inner
30    }
31    /// Wait until a job is completed.
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::reference_import_job_completed::ReferenceImportJobCompletedFinalPoll,
37        crate::waiters::reference_import_job_completed::WaitUntilReferenceImportJobCompletedError,
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::get_reference_import_job::GetReferenceImportJob::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::get_reference_import_job::GetReferenceImportJobOutput,
59            &crate::operation::get_reference_import_job::GetReferenceImportJobError,
60        >| {
61            // Matches: {"output":{"path":"status","expected":"COMPLETED","comparator":"stringEquals"}}
62            if crate::waiters::matchers::match_get_reference_import_job_861efe6eafdf84171(result) {
63                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64            }
65            // Matches: {"output":{"path":"status","expected":"SUBMITTED","comparator":"stringEquals"}}
66            if crate::waiters::matchers::match_get_reference_import_job_356ef1344449272fc(result) {
67                return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
68            }
69            // Matches: {"output":{"path":"status","expected":"IN_PROGRESS","comparator":"stringEquals"}}
70            if crate::waiters::matchers::match_get_reference_import_job_186ea1225d80a357d(result) {
71                return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
72            }
73            // Matches: {"output":{"path":"status","expected":"CANCELLING","comparator":"stringEquals"}}
74            if crate::waiters::matchers::match_get_reference_import_job_0ae5c8c61ddb0b59e(result) {
75                return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
76            }
77            // Matches: {"output":{"path":"status","expected":"CANCELLED","comparator":"stringEquals"}}
78            if crate::waiters::matchers::match_get_reference_import_job_4ddbeb25cc5547dc0(result) {
79                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
80            }
81            // Matches: {"output":{"path":"status","expected":"FAILED","comparator":"stringEquals"}}
82            if crate::waiters::matchers::match_get_reference_import_job_f9c483f08ce8cb218(result) {
83                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
84            }
85            // Matches: {"output":{"path":"status","expected":"COMPLETED_WITH_FAILURES","comparator":"stringEquals"}}
86            if crate::waiters::matchers::match_get_reference_import_job_7dcd07fa125c42eff(result) {
87                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
88            }
89            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
90        };
91        let operation = move || {
92            let input = input.clone();
93            let runtime_plugins = runtime_plugins.clone();
94            async move { crate::operation::get_reference_import_job::GetReferenceImportJob::orchestrate(&runtime_plugins, input).await }
95        };
96        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
97            .min_delay(::std::time::Duration::from_secs(30))
98            .max_delay(::std::time::Duration::from_secs(600))
99            .max_wait(max_wait)
100            .time_source(time_source)
101            .sleep_impl(sleep_impl)
102            .acceptor(acceptor)
103            .operation(operation)
104            .build();
105        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
106    }
107    /// <p>The job's ID.</p>
108    pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
109        self.inner = self.inner.id(input.into());
110        self
111    }
112    /// <p>The job's ID.</p>
113    pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
114        self.inner = self.inner.set_id(input);
115        self
116    }
117    /// <p>The job's ID.</p>
118    pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
119        self.inner.get_id()
120    }
121    /// <p>The job's reference store ID.</p>
122    pub fn reference_store_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
123        self.inner = self.inner.reference_store_id(input.into());
124        self
125    }
126    /// <p>The job's reference store ID.</p>
127    pub fn set_reference_store_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
128        self.inner = self.inner.set_reference_store_id(input);
129        self
130    }
131    /// <p>The job's reference store ID.</p>
132    pub fn get_reference_store_id(&self) -> &::std::option::Option<::std::string::String> {
133        self.inner.get_reference_store_id()
134    }
135}
136
137/// Successful return type for the `reference_import_job_completed` waiter.
138pub type ReferenceImportJobCompletedFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
139    crate::operation::get_reference_import_job::GetReferenceImportJobOutput,
140    ::aws_smithy_runtime_api::client::result::SdkError<
141        crate::operation::get_reference_import_job::GetReferenceImportJobError,
142        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
143    >,
144>;
145
146/// Error type for the `reference_import_job_completed` waiter.
147pub type WaitUntilReferenceImportJobCompletedError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
148    crate::operation::get_reference_import_job::GetReferenceImportJobOutput,
149    crate::operation::get_reference_import_job::GetReferenceImportJobError,
150>;