aws_sdk_ec2/waiters/
customer_gateway_available.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `customer_gateway_available` 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 CustomerGatewayAvailableFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_customer_gateways::builders::DescribeCustomerGatewaysInputBuilder,
18}
19impl CustomerGatewayAvailableFluentBuilder {
20    /// Creates a new `CustomerGatewayAvailableFluentBuilder`.
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 DescribeCustomerGateways as a reference.
28    pub fn as_input(&self) -> &crate::operation::describe_customer_gateways::builders::DescribeCustomerGatewaysInputBuilder {
29        &self.inner
30    }
31    /// Wait for `customer_gateway_available`
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::customer_gateway_available::CustomerGatewayAvailableFinalPoll,
37        crate::waiters::customer_gateway_available::WaitUntilCustomerGatewayAvailableError,
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_customer_gateways::DescribeCustomerGateways::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_customer_gateways::DescribeCustomerGatewaysOutput,
59            &crate::operation::describe_customer_gateways::DescribeCustomerGatewaysError,
60        >| {
61            // Matches: {"output":{"path":"CustomerGateways[].State","expected":"available","comparator":"allStringEquals"}}
62            if crate::waiters::matchers::match_describe_customer_gateways_6da987821df1a37ea(result) {
63                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64            }
65            // Matches: {"output":{"path":"CustomerGateways[].State","expected":"deleted","comparator":"anyStringEquals"}}
66            if crate::waiters::matchers::match_describe_customer_gateways_9229a1e6757cb96ef(result) {
67                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
68            }
69            // Matches: {"output":{"path":"CustomerGateways[].State","expected":"deleting","comparator":"anyStringEquals"}}
70            if crate::waiters::matchers::match_describe_customer_gateways_3a2b89947afd15ad8(result) {
71                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
72            }
73            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
74        };
75        let operation = move || {
76            let input = input.clone();
77            let runtime_plugins = runtime_plugins.clone();
78            async move { crate::operation::describe_customer_gateways::DescribeCustomerGateways::orchestrate(&runtime_plugins, input).await }
79        };
80        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
81            .min_delay(::std::time::Duration::from_secs(15))
82            .max_delay(::std::time::Duration::from_secs(120))
83            .max_wait(max_wait)
84            .time_source(time_source)
85            .sleep_impl(sleep_impl)
86            .acceptor(acceptor)
87            .operation(operation)
88            .build();
89        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
90    }
91    ///
92    /// Appends an item to `CustomerGatewayIds`.
93    ///
94    /// To override the contents of this collection use [`set_customer_gateway_ids`](Self::set_customer_gateway_ids).
95    ///
96    /// <p>One or more customer gateway IDs.</p>
97    /// <p>Default: Describes all your customer gateways.</p>
98    pub fn customer_gateway_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
99        self.inner = self.inner.customer_gateway_ids(input.into());
100        self
101    }
102    /// <p>One or more customer gateway IDs.</p>
103    /// <p>Default: Describes all your customer gateways.</p>
104    pub fn set_customer_gateway_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
105        self.inner = self.inner.set_customer_gateway_ids(input);
106        self
107    }
108    /// <p>One or more customer gateway IDs.</p>
109    /// <p>Default: Describes all your customer gateways.</p>
110    pub fn get_customer_gateway_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
111        self.inner.get_customer_gateway_ids()
112    }
113    ///
114    /// Appends an item to `Filters`.
115    ///
116    /// To override the contents of this collection use [`set_filters`](Self::set_filters).
117    ///
118    /// <p>One or more filters.</p>
119    /// <ul>
120    /// <li>
121    /// <p><code>bgp-asn</code> - The customer gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).</p></li>
122    /// <li>
123    /// <p><code>customer-gateway-id</code> - The ID of the customer gateway.</p></li>
124    /// <li>
125    /// <p><code>ip-address</code> - The IP address of the customer gateway device's external interface.</p></li>
126    /// <li>
127    /// <p><code>state</code> - The state of the customer gateway (<code>pending</code> | <code>available</code> | <code>deleting</code> | <code>deleted</code>).</p></li>
128    /// <li>
129    /// <p><code>type</code> - The type of customer gateway. Currently, the only supported type is <code>ipsec.1</code>.</p></li>
130    /// <li>
131    /// <p><code>tag</code>:<key>
132    /// - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key
133    /// <code>Owner</code> and the value
134    /// <code>TeamA</code>, specify
135    /// <code>tag:Owner</code> for the filter name and
136    /// <code>TeamA</code> for the filter value.
137    /// </key></p></li>
138    /// <li>
139    /// <p><code>tag-key</code> - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.</p></li>
140    /// </ul>
141    pub fn filters(mut self, input: crate::types::Filter) -> Self {
142        self.inner = self.inner.filters(input);
143        self
144    }
145    /// <p>One or more filters.</p>
146    /// <ul>
147    /// <li>
148    /// <p><code>bgp-asn</code> - The customer gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).</p></li>
149    /// <li>
150    /// <p><code>customer-gateway-id</code> - The ID of the customer gateway.</p></li>
151    /// <li>
152    /// <p><code>ip-address</code> - The IP address of the customer gateway device's external interface.</p></li>
153    /// <li>
154    /// <p><code>state</code> - The state of the customer gateway (<code>pending</code> | <code>available</code> | <code>deleting</code> | <code>deleted</code>).</p></li>
155    /// <li>
156    /// <p><code>type</code> - The type of customer gateway. Currently, the only supported type is <code>ipsec.1</code>.</p></li>
157    /// <li>
158    /// <p><code>tag</code>:<key>
159    /// - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key
160    /// <code>Owner</code> and the value
161    /// <code>TeamA</code>, specify
162    /// <code>tag:Owner</code> for the filter name and
163    /// <code>TeamA</code> for the filter value.
164    /// </key></p></li>
165    /// <li>
166    /// <p><code>tag-key</code> - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.</p></li>
167    /// </ul>
168    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
169        self.inner = self.inner.set_filters(input);
170        self
171    }
172    /// <p>One or more filters.</p>
173    /// <ul>
174    /// <li>
175    /// <p><code>bgp-asn</code> - The customer gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).</p></li>
176    /// <li>
177    /// <p><code>customer-gateway-id</code> - The ID of the customer gateway.</p></li>
178    /// <li>
179    /// <p><code>ip-address</code> - The IP address of the customer gateway device's external interface.</p></li>
180    /// <li>
181    /// <p><code>state</code> - The state of the customer gateway (<code>pending</code> | <code>available</code> | <code>deleting</code> | <code>deleted</code>).</p></li>
182    /// <li>
183    /// <p><code>type</code> - The type of customer gateway. Currently, the only supported type is <code>ipsec.1</code>.</p></li>
184    /// <li>
185    /// <p><code>tag</code>:<key>
186    /// - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key
187    /// <code>Owner</code> and the value
188    /// <code>TeamA</code>, specify
189    /// <code>tag:Owner</code> for the filter name and
190    /// <code>TeamA</code> for the filter value.
191    /// </key></p></li>
192    /// <li>
193    /// <p><code>tag-key</code> - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.</p></li>
194    /// </ul>
195    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
196        self.inner.get_filters()
197    }
198    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
199    pub fn dry_run(mut self, input: bool) -> Self {
200        self.inner = self.inner.dry_run(input);
201        self
202    }
203    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
204    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
205        self.inner = self.inner.set_dry_run(input);
206        self
207    }
208    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
209    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
210        self.inner.get_dry_run()
211    }
212}
213
214/// Successful return type for the `customer_gateway_available` waiter.
215pub type CustomerGatewayAvailableFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
216    crate::operation::describe_customer_gateways::DescribeCustomerGatewaysOutput,
217    ::aws_smithy_runtime_api::client::result::SdkError<
218        crate::operation::describe_customer_gateways::DescribeCustomerGatewaysError,
219        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
220    >,
221>;
222
223/// Error type for the `customer_gateway_available` waiter.
224pub type WaitUntilCustomerGatewayAvailableError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
225    crate::operation::describe_customer_gateways::DescribeCustomerGatewaysOutput,
226    crate::operation::describe_customer_gateways::DescribeCustomerGatewaysError,
227>;