aws_sdk_omics/waiters/
workflow_active.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `workflow_active` 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 WorkflowActiveFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::get_workflow::builders::GetWorkflowInputBuilder,
18}
19impl WorkflowActiveFluentBuilder {
20    /// Creates a new `WorkflowActiveFluentBuilder`.
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 GetWorkflow as a reference.
28    pub fn as_input(&self) -> &crate::operation::get_workflow::builders::GetWorkflowInputBuilder {
29        &self.inner
30    }
31    /// Wait until a workflow is active.
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<crate::waiters::workflow_active::WorkflowActiveFinalPoll, crate::waiters::workflow_active::WaitUntilWorkflowActiveError>
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_workflow::GetWorkflow::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_workflow::GetWorkflowOutput,
57            &crate::operation::get_workflow::GetWorkflowError,
58        >| {
59            // Matches: {"output":{"path":"status","expected":"ACTIVE","comparator":"stringEquals"}}
60            if crate::waiters::matchers::match_get_workflow_a0b9c099115634691(result) {
61                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
62            }
63            // Matches: {"output":{"path":"status","expected":"CREATING","comparator":"stringEquals"}}
64            if crate::waiters::matchers::match_get_workflow_ab538ef2e7cb9d2b4(result) {
65                return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
66            }
67            // Matches: {"output":{"path":"status","expected":"UPDATING","comparator":"stringEquals"}}
68            if crate::waiters::matchers::match_get_workflow_45c85fb7765d90d16(result) {
69                return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
70            }
71            // Matches: {"output":{"path":"status","expected":"FAILED","comparator":"stringEquals"}}
72            if crate::waiters::matchers::match_get_workflow_f9c483f08ce8cb218(result) {
73                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
74            }
75            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
76        };
77        let operation = move || {
78            let input = input.clone();
79            let runtime_plugins = runtime_plugins.clone();
80            async move { crate::operation::get_workflow::GetWorkflow::orchestrate(&runtime_plugins, input).await }
81        };
82        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
83            .min_delay(::std::time::Duration::from_secs(3))
84            .max_delay(::std::time::Duration::from_secs(30))
85            .max_wait(max_wait)
86            .time_source(time_source)
87            .sleep_impl(sleep_impl)
88            .acceptor(acceptor)
89            .operation(operation)
90            .build();
91        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
92    }
93    /// <p>The workflow's ID.</p>
94    pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
95        self.inner = self.inner.id(input.into());
96        self
97    }
98    /// <p>The workflow's ID.</p>
99    pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
100        self.inner = self.inner.set_id(input);
101        self
102    }
103    /// <p>The workflow's ID.</p>
104    pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
105        self.inner.get_id()
106    }
107    /// <p>The workflow's type.</p>
108    pub fn r#type(mut self, input: crate::types::WorkflowType) -> Self {
109        self.inner = self.inner.r#type(input);
110        self
111    }
112    /// <p>The workflow's type.</p>
113    pub fn set_type(mut self, input: ::std::option::Option<crate::types::WorkflowType>) -> Self {
114        self.inner = self.inner.set_type(input);
115        self
116    }
117    /// <p>The workflow's type.</p>
118    pub fn get_type(&self) -> &::std::option::Option<crate::types::WorkflowType> {
119        self.inner.get_type()
120    }
121    ///
122    /// Appends an item to `export`.
123    ///
124    /// To override the contents of this collection use [`set_export`](Self::set_export).
125    ///
126    /// <p>The export format for the workflow.</p>
127    pub fn export(mut self, input: crate::types::WorkflowExport) -> Self {
128        self.inner = self.inner.export(input);
129        self
130    }
131    /// <p>The export format for the workflow.</p>
132    pub fn set_export(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::WorkflowExport>>) -> Self {
133        self.inner = self.inner.set_export(input);
134        self
135    }
136    /// <p>The export format for the workflow.</p>
137    pub fn get_export(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::WorkflowExport>> {
138        self.inner.get_export()
139    }
140    /// <p>The ID of the workflow owner.</p>
141    pub fn workflow_owner_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
142        self.inner = self.inner.workflow_owner_id(input.into());
143        self
144    }
145    /// <p>The ID of the workflow owner.</p>
146    pub fn set_workflow_owner_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
147        self.inner = self.inner.set_workflow_owner_id(input);
148        self
149    }
150    /// <p>The ID of the workflow owner.</p>
151    pub fn get_workflow_owner_id(&self) -> &::std::option::Option<::std::string::String> {
152        self.inner.get_workflow_owner_id()
153    }
154}
155
156/// Successful return type for the `workflow_active` waiter.
157pub type WorkflowActiveFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
158    crate::operation::get_workflow::GetWorkflowOutput,
159    ::aws_smithy_runtime_api::client::result::SdkError<
160        crate::operation::get_workflow::GetWorkflowError,
161        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
162    >,
163>;
164
165/// Error type for the `workflow_active` waiter.
166pub type WaitUntilWorkflowActiveError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
167    crate::operation::get_workflow::GetWorkflowOutput,
168    crate::operation::get_workflow::GetWorkflowError,
169>;