aws_sdk_deadline/waiters/
job_create_complete.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `job_create_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 JobCreateCompleteFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::get_job::builders::GetJobInputBuilder,
18}
19impl JobCreateCompleteFluentBuilder {
20    /// Creates a new `JobCreateCompleteFluentBuilder`.
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 GetJob as a reference.
28    pub fn as_input(&self) -> &crate::operation::get_job::builders::GetJobInputBuilder {
29        &self.inner
30    }
31    /// Wait until a Job is created. Use this after invoking CreateJob.
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::job_create_complete::JobCreateCompleteFinalPoll,
37        crate::waiters::job_create_complete::WaitUntilJobCreateCompleteError,
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_job::GetJob::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<&crate::operation::get_job::GetJobOutput, &crate::operation::get_job::GetJobError>| {
58            // Matches: {"output":{"path":"lifecycleStatus","expected":"CREATE_COMPLETE","comparator":"stringEquals"}}
59            if crate::waiters::matchers::match_get_job_2307992268de7b47c(result) {
60                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
61            }
62            // Matches: {"output":{"path":"lifecycleStatus","expected":"UPDATE_IN_PROGRESS","comparator":"stringEquals"}}
63            if crate::waiters::matchers::match_get_job_eb68ae5b6fba1fafd(result) {
64                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
65            }
66            // Matches: {"output":{"path":"lifecycleStatus","expected":"UPDATE_FAILED","comparator":"stringEquals"}}
67            if crate::waiters::matchers::match_get_job_435a1147a3fcbc7a2(result) {
68                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
69            }
70            // Matches: {"output":{"path":"lifecycleStatus","expected":"UPDATE_SUCCEEDED","comparator":"stringEquals"}}
71            if crate::waiters::matchers::match_get_job_78c97fb68ef47d336(result) {
72                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
73            }
74            // Matches: {"output":{"path":"lifecycleStatus","expected":"UPLOAD_FAILED","comparator":"stringEquals"}}
75            if crate::waiters::matchers::match_get_job_1c445702e42811f6c(result) {
76                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
77            }
78            // Matches: {"output":{"path":"lifecycleStatus","expected":"CREATE_FAILED","comparator":"stringEquals"}}
79            if crate::waiters::matchers::match_get_job_2d46005885959b4a4(result) {
80                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
81            }
82            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
83        };
84        let operation = move || {
85            let input = input.clone();
86            let runtime_plugins = runtime_plugins.clone();
87            async move { crate::operation::get_job::GetJob::orchestrate(&runtime_plugins, input).await }
88        };
89        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
90            .min_delay(::std::time::Duration::from_secs(1))
91            .max_delay(::std::time::Duration::from_secs(120))
92            .max_wait(max_wait)
93            .time_source(time_source)
94            .sleep_impl(sleep_impl)
95            .acceptor(acceptor)
96            .operation(operation)
97            .build();
98        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
99    }
100    /// <p>The farm ID of the farm in the job.</p>
101    pub fn farm_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
102        self.inner = self.inner.farm_id(input.into());
103        self
104    }
105    /// <p>The farm ID of the farm in the job.</p>
106    pub fn set_farm_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
107        self.inner = self.inner.set_farm_id(input);
108        self
109    }
110    /// <p>The farm ID of the farm in the job.</p>
111    pub fn get_farm_id(&self) -> &::std::option::Option<::std::string::String> {
112        self.inner.get_farm_id()
113    }
114    /// <p>The queue ID associated with the job.</p>
115    pub fn queue_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116        self.inner = self.inner.queue_id(input.into());
117        self
118    }
119    /// <p>The queue ID associated with the job.</p>
120    pub fn set_queue_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
121        self.inner = self.inner.set_queue_id(input);
122        self
123    }
124    /// <p>The queue ID associated with the job.</p>
125    pub fn get_queue_id(&self) -> &::std::option::Option<::std::string::String> {
126        self.inner.get_queue_id()
127    }
128    /// <p>The job ID.</p>
129    pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130        self.inner = self.inner.job_id(input.into());
131        self
132    }
133    /// <p>The job ID.</p>
134    pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135        self.inner = self.inner.set_job_id(input);
136        self
137    }
138    /// <p>The job ID.</p>
139    pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> {
140        self.inner.get_job_id()
141    }
142}
143
144/// Successful return type for the `job_create_complete` waiter.
145pub type JobCreateCompleteFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
146    crate::operation::get_job::GetJobOutput,
147    ::aws_smithy_runtime_api::client::result::SdkError<
148        crate::operation::get_job::GetJobError,
149        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
150    >,
151>;
152
153/// Error type for the `job_create_complete` waiter.
154pub type WaitUntilJobCreateCompleteError =
155    ::aws_smithy_runtime_api::client::waiters::error::WaiterError<crate::operation::get_job::GetJobOutput, crate::operation::get_job::GetJobError>;