aws_sdk_ec2/waiters/
nat_gateway_deleted.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `nat_gateway_deleted` 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 NatGatewayDeletedFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_nat_gateways::builders::DescribeNatGatewaysInputBuilder,
18}
19impl NatGatewayDeletedFluentBuilder {
20    /// Creates a new `NatGatewayDeletedFluentBuilder`.
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_deleted`
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::nat_gateway_deleted::NatGatewayDeletedFinalPoll,
37        crate::waiters::nat_gateway_deleted::WaitUntilNatGatewayDeletedError,
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":"deleted","comparator":"allStringEquals"}}
62            if crate::waiters::matchers::match_describe_nat_gateways_943e6d2c961eea64d(result) {
63                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64            }
65            // Matches: {"errorType":"NatGatewayNotFound"}
66            if crate::waiters::matchers::match_describe_nat_gateways_6513b45eeacbec860(result) {
67                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
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_nat_gateways::DescribeNatGateways::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    /// <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>
88    pub fn dry_run(mut self, input: bool) -> Self {
89        self.inner = self.inner.dry_run(input);
90        self
91    }
92    /// <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>
93    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
94        self.inner = self.inner.set_dry_run(input);
95        self
96    }
97    /// <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>
98    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
99        self.inner.get_dry_run()
100    }
101    ///
102    /// Appends an item to `Filter`.
103    ///
104    /// To override the contents of this collection use [`set_filter`](Self::set_filter).
105    ///
106    /// <p>The filters.</p>
107    /// <ul>
108    /// <li>
109    /// <p><code>nat-gateway-id</code> - The ID of the NAT gateway.</p></li>
110    /// <li>
111    /// <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>
112    /// <li>
113    /// <p><code>subnet-id</code> - The ID of the subnet in which the NAT gateway resides.</p></li>
114    /// <li>
115    /// <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>
116    /// <li>
117    /// <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>
118    /// <li>
119    /// <p><code>vpc-id</code> - The ID of the VPC in which the NAT gateway resides.</p></li>
120    /// </ul>
121    pub fn filter(mut self, input: crate::types::Filter) -> Self {
122        self.inner = self.inner.filter(input);
123        self
124    }
125    /// <p>The filters.</p>
126    /// <ul>
127    /// <li>
128    /// <p><code>nat-gateway-id</code> - The ID of the NAT gateway.</p></li>
129    /// <li>
130    /// <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>
131    /// <li>
132    /// <p><code>subnet-id</code> - The ID of the subnet in which the NAT gateway resides.</p></li>
133    /// <li>
134    /// <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>
135    /// <li>
136    /// <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>
137    /// <li>
138    /// <p><code>vpc-id</code> - The ID of the VPC in which the NAT gateway resides.</p></li>
139    /// </ul>
140    pub fn set_filter(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
141        self.inner = self.inner.set_filter(input);
142        self
143    }
144    /// <p>The filters.</p>
145    /// <ul>
146    /// <li>
147    /// <p><code>nat-gateway-id</code> - The ID of the NAT gateway.</p></li>
148    /// <li>
149    /// <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>
150    /// <li>
151    /// <p><code>subnet-id</code> - The ID of the subnet in which the NAT gateway resides.</p></li>
152    /// <li>
153    /// <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>
154    /// <li>
155    /// <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>
156    /// <li>
157    /// <p><code>vpc-id</code> - The ID of the VPC in which the NAT gateway resides.</p></li>
158    /// </ul>
159    pub fn get_filter(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
160        self.inner.get_filter()
161    }
162    /// <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>
163    pub fn max_results(mut self, input: i32) -> Self {
164        self.inner = self.inner.max_results(input);
165        self
166    }
167    /// <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>
168    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
169        self.inner = self.inner.set_max_results(input);
170        self
171    }
172    /// <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>
173    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
174        self.inner.get_max_results()
175    }
176    ///
177    /// Appends an item to `NatGatewayIds`.
178    ///
179    /// To override the contents of this collection use [`set_nat_gateway_ids`](Self::set_nat_gateway_ids).
180    ///
181    /// <p>The IDs of the NAT gateways.</p>
182    pub fn nat_gateway_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
183        self.inner = self.inner.nat_gateway_ids(input.into());
184        self
185    }
186    /// <p>The IDs of the NAT gateways.</p>
187    pub fn set_nat_gateway_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
188        self.inner = self.inner.set_nat_gateway_ids(input);
189        self
190    }
191    /// <p>The IDs of the NAT gateways.</p>
192    pub fn get_nat_gateway_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
193        self.inner.get_nat_gateway_ids()
194    }
195    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
196    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
197        self.inner = self.inner.next_token(input.into());
198        self
199    }
200    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
201    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
202        self.inner = self.inner.set_next_token(input);
203        self
204    }
205    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
206    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
207        self.inner.get_next_token()
208    }
209}
210
211/// Successful return type for the `nat_gateway_deleted` waiter.
212pub type NatGatewayDeletedFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
213    crate::operation::describe_nat_gateways::DescribeNatGatewaysOutput,
214    ::aws_smithy_runtime_api::client::result::SdkError<
215        crate::operation::describe_nat_gateways::DescribeNatGatewaysError,
216        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
217    >,
218>;
219
220/// Error type for the `nat_gateway_deleted` waiter.
221pub type WaitUntilNatGatewayDeletedError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
222    crate::operation::describe_nat_gateways::DescribeNatGatewaysOutput,
223    crate::operation::describe_nat_gateways::DescribeNatGatewaysError,
224>;