aws_sdk_lambda/waiters/
function_exists.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `function_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 FunctionExistsFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::get_function::builders::GetFunctionInputBuilder,
18}
19impl FunctionExistsFluentBuilder {
20    /// Creates a new `FunctionExistsFluentBuilder`.
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 GetFunction as a reference.
28    pub fn as_input(&self) -> &crate::operation::get_function::builders::GetFunctionInputBuilder {
29        &self.inner
30    }
31    /// Wait for `function_exists`
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<crate::waiters::function_exists::FunctionExistsFinalPoll, crate::waiters::function_exists::WaitUntilFunctionExistsError>
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_function::GetFunction::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_function::GetFunctionOutput,
57            &crate::operation::get_function::GetFunctionError,
58        >| {
59            // Matches: {"success":true}
60            if crate::waiters::matchers::match_get_function_c955e57777ec0d736(result) {
61                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
62            }
63            // Matches: {"errorType":"ResourceNotFoundException"}
64            if crate::waiters::matchers::match_get_function_1cce2c05524fb92d4(result) {
65                return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
66            }
67            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
68        };
69        let operation = move || {
70            let input = input.clone();
71            let runtime_plugins = runtime_plugins.clone();
72            async move { crate::operation::get_function::GetFunction::orchestrate(&runtime_plugins, input).await }
73        };
74        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
75            .min_delay(::std::time::Duration::from_secs(1))
76            .max_delay(::std::time::Duration::from_secs(120))
77            .max_wait(max_wait)
78            .time_source(time_source)
79            .sleep_impl(sleep_impl)
80            .acceptor(acceptor)
81            .operation(operation)
82            .build();
83        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
84    }
85    /// <p>The name or ARN of the Lambda function, version, or alias.</p>
86    /// <p class="title"><b>Name formats</b></p>
87    /// <ul>
88    /// <li>
89    /// <p><b>Function name</b> – <code>my-function</code> (name-only), <code>my-function:v1</code> (with alias).</p></li>
90    /// <li>
91    /// <p><b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p></li>
92    /// <li>
93    /// <p><b>Partial ARN</b> – <code>123456789012:function:my-function</code>.</p></li>
94    /// </ul>
95    /// <p>You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.</p>
96    pub fn function_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
97        self.inner = self.inner.function_name(input.into());
98        self
99    }
100    /// <p>The name or ARN of the Lambda function, version, or alias.</p>
101    /// <p class="title"><b>Name formats</b></p>
102    /// <ul>
103    /// <li>
104    /// <p><b>Function name</b> – <code>my-function</code> (name-only), <code>my-function:v1</code> (with alias).</p></li>
105    /// <li>
106    /// <p><b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p></li>
107    /// <li>
108    /// <p><b>Partial ARN</b> – <code>123456789012:function:my-function</code>.</p></li>
109    /// </ul>
110    /// <p>You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.</p>
111    pub fn set_function_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
112        self.inner = self.inner.set_function_name(input);
113        self
114    }
115    /// <p>The name or ARN of the Lambda function, version, or alias.</p>
116    /// <p class="title"><b>Name formats</b></p>
117    /// <ul>
118    /// <li>
119    /// <p><b>Function name</b> – <code>my-function</code> (name-only), <code>my-function:v1</code> (with alias).</p></li>
120    /// <li>
121    /// <p><b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p></li>
122    /// <li>
123    /// <p><b>Partial ARN</b> – <code>123456789012:function:my-function</code>.</p></li>
124    /// </ul>
125    /// <p>You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.</p>
126    pub fn get_function_name(&self) -> &::std::option::Option<::std::string::String> {
127        self.inner.get_function_name()
128    }
129    /// <p>Specify a version or alias to get details about a published version of the function.</p>
130    pub fn qualifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.inner = self.inner.qualifier(input.into());
132        self
133    }
134    /// <p>Specify a version or alias to get details about a published version of the function.</p>
135    pub fn set_qualifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.inner = self.inner.set_qualifier(input);
137        self
138    }
139    /// <p>Specify a version or alias to get details about a published version of the function.</p>
140    pub fn get_qualifier(&self) -> &::std::option::Option<::std::string::String> {
141        self.inner.get_qualifier()
142    }
143}
144
145/// Successful return type for the `function_exists` waiter.
146pub type FunctionExistsFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
147    crate::operation::get_function::GetFunctionOutput,
148    ::aws_smithy_runtime_api::client::result::SdkError<
149        crate::operation::get_function::GetFunctionError,
150        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
151    >,
152>;
153
154/// Error type for the `function_exists` waiter.
155pub type WaitUntilFunctionExistsError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
156    crate::operation::get_function::GetFunctionOutput,
157    crate::operation::get_function::GetFunctionError,
158>;