aws_sdk_ec2/waiters/
nat_gateway_available.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `nat_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 NatGatewayAvailableFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_nat_gateways::builders::DescribeNatGatewaysInputBuilder,
18}
19impl NatGatewayAvailableFluentBuilder {
20    /// Creates a new `NatGatewayAvailableFluentBuilder`.
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 DescribeNatGateways as a reference.
28    pub fn as_input(&self) -> &crate::operation::describe_nat_gateways::builders::DescribeNatGatewaysInputBuilder {
29        &self.inner
30    }
31    /// Wait for `nat_gateway_available`
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::nat_gateway_available::NatGatewayAvailableFinalPoll,
37        crate::waiters::nat_gateway_available::WaitUntilNatGatewayAvailableError,
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_nat_gateways::DescribeNatGateways::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_nat_gateways::DescribeNatGatewaysOutput,
59            &crate::operation::describe_nat_gateways::DescribeNatGatewaysError,
60        >| {
61            // Matches: {"output":{"path":"NatGateways[].State","expected":"available","comparator":"allStringEquals"}}
62            if crate::waiters::matchers::match_describe_nat_gateways_dfea3cee6f1637ebe(result) {
63                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64            }
65            // Matches: {"output":{"path":"NatGateways[].State","expected":"failed","comparator":"anyStringEquals"}}
66            if crate::waiters::matchers::match_describe_nat_gateways_5b87bc23bcc1575a0(result) {
67                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
68            }
69            // Matches: {"output":{"path":"NatGateways[].State","expected":"deleting","comparator":"anyStringEquals"}}
70            if crate::waiters::matchers::match_describe_nat_gateways_c2eb75989f812bc12(result) {
71                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
72            }
73            // Matches: {"output":{"path":"NatGateways[].State","expected":"deleted","comparator":"anyStringEquals"}}
74            if crate::waiters::matchers::match_describe_nat_gateways_70354630633fbe807(result) {
75                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
76            }
77            // Matches: {"errorType":"NatGatewayNotFound"}
78            if crate::waiters::matchers::match_describe_nat_gateways_6513b45eeacbec860(result) {
79                return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
80            }
81            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
82        };
83        let operation = move || {
84            let input = input.clone();
85            let runtime_plugins = runtime_plugins.clone();
86            async move { crate::operation::describe_nat_gateways::DescribeNatGateways::orchestrate(&runtime_plugins, input).await }
87        };
88        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
89            .min_delay(::std::time::Duration::from_secs(15))
90            .max_delay(::std::time::Duration::from_secs(120))
91            .max_wait(max_wait)
92            .time_source(time_source)
93            .sleep_impl(sleep_impl)
94            .acceptor(acceptor)
95            .operation(operation)
96            .build();
97        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
98    }
99    /// <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>
100    pub fn dry_run(mut self, input: bool) -> Self {
101        self.inner = self.inner.dry_run(input);
102        self
103    }
104    /// <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>
105    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
106        self.inner = self.inner.set_dry_run(input);
107        self
108    }
109    /// <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>
110    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
111        self.inner.get_dry_run()
112    }
113    ///
114    /// Appends an item to `Filter`.
115    ///
116    /// To override the contents of this collection use [`set_filter`](Self::set_filter).
117    ///
118    /// <p>The filters.</p>
119    /// <ul>
120    /// <li>
121    /// <p><code>nat-gateway-id</code> - The ID of the NAT gateway.</p></li>
122    /// <li>
123    /// <p><code>state</code> - The state of the NAT gateway (<code>pending</code> | <code>failed</code> | <code>available</code> | <code>deleting</code> | <code>deleted</code>).</p></li>
124    /// <li>
125    /// <p><code>subnet-id</code> - The ID of the subnet in which the NAT gateway resides.</p></li>
126    /// <li>
127    /// <p><code>tag</code> - 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 <code>Owner</code> and the value <code>TeamA</code>, specify <code>tag:Owner</code> for the filter name and <code>TeamA</code> for the filter value.</p></li>
128    /// <li>
129    /// <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>
130    /// <li>
131    /// <p><code>vpc-id</code> - The ID of the VPC in which the NAT gateway resides.</p></li>
132    /// </ul>
133    pub fn filter(mut self, input: crate::types::Filter) -> Self {
134        self.inner = self.inner.filter(input);
135        self
136    }
137    /// <p>The filters.</p>
138    /// <ul>
139    /// <li>
140    /// <p><code>nat-gateway-id</code> - The ID of the NAT gateway.</p></li>
141    /// <li>
142    /// <p><code>state</code> - The state of the NAT gateway (<code>pending</code> | <code>failed</code> | <code>available</code> | <code>deleting</code> | <code>deleted</code>).</p></li>
143    /// <li>
144    /// <p><code>subnet-id</code> - The ID of the subnet in which the NAT gateway resides.</p></li>
145    /// <li>
146    /// <p><code>tag</code> - 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 <code>Owner</code> and the value <code>TeamA</code>, specify <code>tag:Owner</code> for the filter name and <code>TeamA</code> for the filter value.</p></li>
147    /// <li>
148    /// <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>
149    /// <li>
150    /// <p><code>vpc-id</code> - The ID of the VPC in which the NAT gateway resides.</p></li>
151    /// </ul>
152    pub fn set_filter(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
153        self.inner = self.inner.set_filter(input);
154        self
155    }
156    /// <p>The filters.</p>
157    /// <ul>
158    /// <li>
159    /// <p><code>nat-gateway-id</code> - The ID of the NAT gateway.</p></li>
160    /// <li>
161    /// <p><code>state</code> - The state of the NAT gateway (<code>pending</code> | <code>failed</code> | <code>available</code> | <code>deleting</code> | <code>deleted</code>).</p></li>
162    /// <li>
163    /// <p><code>subnet-id</code> - The ID of the subnet in which the NAT gateway resides.</p></li>
164    /// <li>
165    /// <p><code>tag</code> - 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 <code>Owner</code> and the value <code>TeamA</code>, specify <code>tag:Owner</code> for the filter name and <code>TeamA</code> for the filter value.</p></li>
166    /// <li>
167    /// <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>
168    /// <li>
169    /// <p><code>vpc-id</code> - The ID of the VPC in which the NAT gateway resides.</p></li>
170    /// </ul>
171    pub fn get_filter(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
172        self.inner.get_filter()
173    }
174    /// <p>The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
175    pub fn max_results(mut self, input: i32) -> Self {
176        self.inner = self.inner.max_results(input);
177        self
178    }
179    /// <p>The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
180    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
181        self.inner = self.inner.set_max_results(input);
182        self
183    }
184    /// <p>The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
185    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
186        self.inner.get_max_results()
187    }
188    ///
189    /// Appends an item to `NatGatewayIds`.
190    ///
191    /// To override the contents of this collection use [`set_nat_gateway_ids`](Self::set_nat_gateway_ids).
192    ///
193    /// <p>The IDs of the NAT gateways.</p>
194    pub fn nat_gateway_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
195        self.inner = self.inner.nat_gateway_ids(input.into());
196        self
197    }
198    /// <p>The IDs of the NAT gateways.</p>
199    pub fn set_nat_gateway_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
200        self.inner = self.inner.set_nat_gateway_ids(input);
201        self
202    }
203    /// <p>The IDs of the NAT gateways.</p>
204    pub fn get_nat_gateway_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
205        self.inner.get_nat_gateway_ids()
206    }
207    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
208    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
209        self.inner = self.inner.next_token(input.into());
210        self
211    }
212    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
213    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
214        self.inner = self.inner.set_next_token(input);
215        self
216    }
217    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
218    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
219        self.inner.get_next_token()
220    }
221}
222
223/// Successful return type for the `nat_gateway_available` waiter.
224pub type NatGatewayAvailableFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
225    crate::operation::describe_nat_gateways::DescribeNatGatewaysOutput,
226    ::aws_smithy_runtime_api::client::result::SdkError<
227        crate::operation::describe_nat_gateways::DescribeNatGatewaysError,
228        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
229    >,
230>;
231
232/// Error type for the `nat_gateway_available` waiter.
233pub type WaitUntilNatGatewayAvailableError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
234    crate::operation::describe_nat_gateways::DescribeNatGatewaysOutput,
235    crate::operation::describe_nat_gateways::DescribeNatGatewaysError,
236>;