aws_sdk_elasticloadbalancingv2/waiters/
load_balancer_exists.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `load_balancer_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 LoadBalancerExistsFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_load_balancers::builders::DescribeLoadBalancersInputBuilder,
18}
19impl LoadBalancerExistsFluentBuilder {
20    /// Creates a new `LoadBalancerExistsFluentBuilder`.
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 DescribeLoadBalancers as a reference.
28    pub fn as_input(&self) -> &crate::operation::describe_load_balancers::builders::DescribeLoadBalancersInputBuilder {
29        &self.inner
30    }
31    /// Wait for `load_balancer_exists`
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::load_balancer_exists::LoadBalancerExistsFinalPoll,
37        crate::waiters::load_balancer_exists::WaitUntilLoadBalancerExistsError,
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_load_balancers::DescribeLoadBalancers::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_load_balancers::DescribeLoadBalancersOutput,
59            &crate::operation::describe_load_balancers::DescribeLoadBalancersError,
60        >| {
61            // Matches: {"success":true}
62            if crate::waiters::matchers::match_describe_load_balancers_c955e57777ec0d736(result) {
63                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64            }
65            // Matches: {"errorType":"LoadBalancerNotFound"}
66            if crate::waiters::matchers::match_describe_load_balancers_5d8e90ea6f1c3cb8d(result) {
67                return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
68            }
69            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
70        };
71        let operation = move || {
72            let input = input.clone();
73            let runtime_plugins = runtime_plugins.clone();
74            async move { crate::operation::describe_load_balancers::DescribeLoadBalancers::orchestrate(&runtime_plugins, input).await }
75        };
76        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
77            .min_delay(::std::time::Duration::from_secs(15))
78            .max_delay(::std::time::Duration::from_secs(120))
79            .max_wait(max_wait)
80            .time_source(time_source)
81            .sleep_impl(sleep_impl)
82            .acceptor(acceptor)
83            .operation(operation)
84            .build();
85        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
86    }
87    ///
88    /// Appends an item to `LoadBalancerArns`.
89    ///
90    /// To override the contents of this collection use [`set_load_balancer_arns`](Self::set_load_balancer_arns).
91    ///
92    /// <p>The Amazon Resource Names (ARN) of the load balancers. You can specify up to 20 load balancers in a single call.</p>
93    pub fn load_balancer_arns(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
94        self.inner = self.inner.load_balancer_arns(input.into());
95        self
96    }
97    /// <p>The Amazon Resource Names (ARN) of the load balancers. You can specify up to 20 load balancers in a single call.</p>
98    pub fn set_load_balancer_arns(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
99        self.inner = self.inner.set_load_balancer_arns(input);
100        self
101    }
102    /// <p>The Amazon Resource Names (ARN) of the load balancers. You can specify up to 20 load balancers in a single call.</p>
103    pub fn get_load_balancer_arns(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
104        self.inner.get_load_balancer_arns()
105    }
106    ///
107    /// Appends an item to `Names`.
108    ///
109    /// To override the contents of this collection use [`set_names`](Self::set_names).
110    ///
111    /// <p>The names of the load balancers.</p>
112    pub fn names(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.inner = self.inner.names(input.into());
114        self
115    }
116    /// <p>The names of the load balancers.</p>
117    pub fn set_names(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
118        self.inner = self.inner.set_names(input);
119        self
120    }
121    /// <p>The names of the load balancers.</p>
122    pub fn get_names(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
123        self.inner.get_names()
124    }
125    /// <p>The marker for the next set of results. (You received this marker from a previous call.)</p>
126    pub fn marker(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127        self.inner = self.inner.marker(input.into());
128        self
129    }
130    /// <p>The marker for the next set of results. (You received this marker from a previous call.)</p>
131    pub fn set_marker(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
132        self.inner = self.inner.set_marker(input);
133        self
134    }
135    /// <p>The marker for the next set of results. (You received this marker from a previous call.)</p>
136    pub fn get_marker(&self) -> &::std::option::Option<::std::string::String> {
137        self.inner.get_marker()
138    }
139    /// <p>The maximum number of results to return with this call.</p>
140    pub fn page_size(mut self, input: i32) -> Self {
141        self.inner = self.inner.page_size(input);
142        self
143    }
144    /// <p>The maximum number of results to return with this call.</p>
145    pub fn set_page_size(mut self, input: ::std::option::Option<i32>) -> Self {
146        self.inner = self.inner.set_page_size(input);
147        self
148    }
149    /// <p>The maximum number of results to return with this call.</p>
150    pub fn get_page_size(&self) -> &::std::option::Option<i32> {
151        self.inner.get_page_size()
152    }
153}
154
155/// Successful return type for the `load_balancer_exists` waiter.
156pub type LoadBalancerExistsFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
157    crate::operation::describe_load_balancers::DescribeLoadBalancersOutput,
158    ::aws_smithy_runtime_api::client::result::SdkError<
159        crate::operation::describe_load_balancers::DescribeLoadBalancersError,
160        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
161    >,
162>;
163
164/// Error type for the `load_balancer_exists` waiter.
165pub type WaitUntilLoadBalancerExistsError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
166    crate::operation::describe_load_balancers::DescribeLoadBalancersOutput,
167    crate::operation::describe_load_balancers::DescribeLoadBalancersError,
168>;