aws_sdk_omics/waiters/
task_completed.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `task_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 TaskCompletedFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::get_run_task::builders::GetRunTaskInputBuilder,
18}
19impl TaskCompletedFluentBuilder {
20    /// Creates a new `TaskCompletedFluentBuilder`.
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 GetRunTask as a reference.
28    pub fn as_input(&self) -> &crate::operation::get_run_task::builders::GetRunTaskInputBuilder {
29        &self.inner
30    }
31    /// Wait until a task is completed.
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<crate::waiters::task_completed::TaskCompletedFinalPoll, crate::waiters::task_completed::WaitUntilTaskCompletedError>
36    {
37        let input = self
38            .inner
39            .build()
40            .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
41        let runtime_plugins = crate::operation::get_run_task::GetRunTask::operation_runtime_plugins(
42            self.handle.runtime_plugins.clone(),
43            &self.handle.conf,
44            ::std::option::Option::None,
45        )
46        .with_operation_plugin(crate::sdk_feature_tracker::waiter::WaiterFeatureTrackerRuntimePlugin::new());
47        let mut cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
48        let runtime_components_builder = runtime_plugins
49            .apply_client_configuration(&mut cfg)
50            .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
51        let time_components = runtime_components_builder.into_time_components();
52        let sleep_impl = time_components.sleep_impl().expect("a sleep impl is required by waiters");
53        let time_source = time_components.time_source().expect("a time source is required by waiters");
54
55        let acceptor = move |result: ::std::result::Result<
56            &crate::operation::get_run_task::GetRunTaskOutput,
57            &crate::operation::get_run_task::GetRunTaskError,
58        >| {
59            // Matches: {"output":{"path":"status","expected":"COMPLETED","comparator":"stringEquals"}}
60            if crate::waiters::matchers::match_get_run_task_861efe6eafdf84171(result) {
61                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
62            }
63            // Matches: {"output":{"path":"status","expected":"PENDING","comparator":"stringEquals"}}
64            if crate::waiters::matchers::match_get_run_task_cf7012a6288344f38(result) {
65                return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
66            }
67            // Matches: {"output":{"path":"status","expected":"STARTING","comparator":"stringEquals"}}
68            if crate::waiters::matchers::match_get_run_task_52681d39a0a9cabe6(result) {
69                return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
70            }
71            // Matches: {"output":{"path":"status","expected":"RUNNING","comparator":"stringEquals"}}
72            if crate::waiters::matchers::match_get_run_task_7943b3b995e719e2c(result) {
73                return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
74            }
75            // Matches: {"output":{"path":"status","expected":"STOPPING","comparator":"stringEquals"}}
76            if crate::waiters::matchers::match_get_run_task_824819fe20f7c07ec(result) {
77                return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
78            }
79            // Matches: {"output":{"path":"status","expected":"FAILED","comparator":"stringEquals"}}
80            if crate::waiters::matchers::match_get_run_task_f9c483f08ce8cb218(result) {
81                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
82            }
83            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
84        };
85        let operation = move || {
86            let input = input.clone();
87            let runtime_plugins = runtime_plugins.clone();
88            async move { crate::operation::get_run_task::GetRunTask::orchestrate(&runtime_plugins, input).await }
89        };
90        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
91            .min_delay(::std::time::Duration::from_secs(30))
92            .max_delay(::std::time::Duration::from_secs(600))
93            .max_wait(max_wait)
94            .time_source(time_source)
95            .sleep_impl(sleep_impl)
96            .acceptor(acceptor)
97            .operation(operation)
98            .build();
99        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
100    }
101    /// <p>The workflow run ID.</p>
102    pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
103        self.inner = self.inner.id(input.into());
104        self
105    }
106    /// <p>The workflow run ID.</p>
107    pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
108        self.inner = self.inner.set_id(input);
109        self
110    }
111    /// <p>The workflow run ID.</p>
112    pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
113        self.inner.get_id()
114    }
115    /// <p>The task's ID.</p>
116    pub fn task_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117        self.inner = self.inner.task_id(input.into());
118        self
119    }
120    /// <p>The task's ID.</p>
121    pub fn set_task_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122        self.inner = self.inner.set_task_id(input);
123        self
124    }
125    /// <p>The task's ID.</p>
126    pub fn get_task_id(&self) -> &::std::option::Option<::std::string::String> {
127        self.inner.get_task_id()
128    }
129}
130
131/// Successful return type for the `task_completed` waiter.
132pub type TaskCompletedFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
133    crate::operation::get_run_task::GetRunTaskOutput,
134    ::aws_smithy_runtime_api::client::result::SdkError<
135        crate::operation::get_run_task::GetRunTaskError,
136        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
137    >,
138>;
139
140/// Error type for the `task_completed` waiter.
141pub type WaitUntilTaskCompletedError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
142    crate::operation::get_run_task::GetRunTaskOutput,
143    crate::operation::get_run_task::GetRunTaskError,
144>;