aws_sdk_schemas/waiters/
code_binding_exists.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `code_binding_exists` 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 CodeBindingExistsFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_code_binding::builders::DescribeCodeBindingInputBuilder,
18}
19impl CodeBindingExistsFluentBuilder {
20    /// Creates a new `CodeBindingExistsFluentBuilder`.
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 DescribeCodeBinding as a reference.
28    pub fn as_input(&self) -> &crate::operation::describe_code_binding::builders::DescribeCodeBindingInputBuilder {
29        &self.inner
30    }
31    /// Wait until code binding is generated
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::code_binding_exists::CodeBindingExistsFinalPoll,
37        crate::waiters::code_binding_exists::WaitUntilCodeBindingExistsError,
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_code_binding::DescribeCodeBinding::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_code_binding::DescribeCodeBindingOutput,
59            &crate::operation::describe_code_binding::DescribeCodeBindingError,
60        >| {
61            // Matches: {"output":{"path":"Status","expected":"CREATE_COMPLETE","comparator":"stringEquals"}}
62            if crate::waiters::matchers::match_describe_code_binding_ee24601e746b68869(result) {
63                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64            }
65            // Matches: {"output":{"path":"Status","expected":"CREATE_IN_PROGRESS","comparator":"stringEquals"}}
66            if crate::waiters::matchers::match_describe_code_binding_fd38fc0610d7a1d7e(result) {
67                return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
68            }
69            // Matches: {"output":{"path":"Status","expected":"CREATE_FAILED","comparator":"stringEquals"}}
70            if crate::waiters::matchers::match_describe_code_binding_22c66a56e806df25e(result) {
71                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
72            }
73            // Matches: {"errorType":"NotFoundException"}
74            if crate::waiters::matchers::match_describe_code_binding_bcffe71d9077ffaa1(result) {
75                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
76            }
77            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
78        };
79        let operation = move || {
80            let input = input.clone();
81            let runtime_plugins = runtime_plugins.clone();
82            async move { crate::operation::describe_code_binding::DescribeCodeBinding::orchestrate(&runtime_plugins, input).await }
83        };
84        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
85            .min_delay(::std::time::Duration::from_secs(2))
86            .max_delay(::std::time::Duration::from_secs(120))
87            .max_wait(max_wait)
88            .time_source(time_source)
89            .sleep_impl(sleep_impl)
90            .acceptor(acceptor)
91            .operation(operation)
92            .build();
93        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
94    }
95    /// <p>The language of the code binding.</p>
96    pub fn language(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
97        self.inner = self.inner.language(input.into());
98        self
99    }
100    /// <p>The language of the code binding.</p>
101    pub fn set_language(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
102        self.inner = self.inner.set_language(input);
103        self
104    }
105    /// <p>The language of the code binding.</p>
106    pub fn get_language(&self) -> &::std::option::Option<::std::string::String> {
107        self.inner.get_language()
108    }
109    /// <p>The name of the registry.</p>
110    pub fn registry_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
111        self.inner = self.inner.registry_name(input.into());
112        self
113    }
114    /// <p>The name of the registry.</p>
115    pub fn set_registry_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
116        self.inner = self.inner.set_registry_name(input);
117        self
118    }
119    /// <p>The name of the registry.</p>
120    pub fn get_registry_name(&self) -> &::std::option::Option<::std::string::String> {
121        self.inner.get_registry_name()
122    }
123    /// <p>The name of the schema.</p>
124    pub fn schema_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
125        self.inner = self.inner.schema_name(input.into());
126        self
127    }
128    /// <p>The name of the schema.</p>
129    pub fn set_schema_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
130        self.inner = self.inner.set_schema_name(input);
131        self
132    }
133    /// <p>The name of the schema.</p>
134    pub fn get_schema_name(&self) -> &::std::option::Option<::std::string::String> {
135        self.inner.get_schema_name()
136    }
137    /// <p>Specifying this limits the results to only this schema version.</p>
138    pub fn schema_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
139        self.inner = self.inner.schema_version(input.into());
140        self
141    }
142    /// <p>Specifying this limits the results to only this schema version.</p>
143    pub fn set_schema_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
144        self.inner = self.inner.set_schema_version(input);
145        self
146    }
147    /// <p>Specifying this limits the results to only this schema version.</p>
148    pub fn get_schema_version(&self) -> &::std::option::Option<::std::string::String> {
149        self.inner.get_schema_version()
150    }
151}
152
153/// Successful return type for the `code_binding_exists` waiter.
154pub type CodeBindingExistsFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
155    crate::operation::describe_code_binding::DescribeCodeBindingOutput,
156    ::aws_smithy_runtime_api::client::result::SdkError<
157        crate::operation::describe_code_binding::DescribeCodeBindingError,
158        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
159    >,
160>;
161
162/// Error type for the `code_binding_exists` waiter.
163pub type WaitUntilCodeBindingExistsError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
164    crate::operation::describe_code_binding::DescribeCodeBindingOutput,
165    crate::operation::describe_code_binding::DescribeCodeBindingError,
166>;