aws_sdk_ec2/waiters/
internet_gateway_exists.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `internet_gateway_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 InternetGatewayExistsFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_internet_gateways::builders::DescribeInternetGatewaysInputBuilder,
18}
19impl InternetGatewayExistsFluentBuilder {
20    /// Creates a new `InternetGatewayExistsFluentBuilder`.
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 DescribeInternetGateways as a reference.
28    pub fn as_input(&self) -> &crate::operation::describe_internet_gateways::builders::DescribeInternetGatewaysInputBuilder {
29        &self.inner
30    }
31    /// Wait for `internet_gateway_exists`
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::internet_gateway_exists::InternetGatewayExistsFinalPoll,
37        crate::waiters::internet_gateway_exists::WaitUntilInternetGatewayExistsError,
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_internet_gateways::DescribeInternetGateways::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_internet_gateways::DescribeInternetGatewaysOutput,
59            &crate::operation::describe_internet_gateways::DescribeInternetGatewaysError,
60        >| {
61            // Matches: {"output":{"path":"length(InternetGateways[].InternetGatewayId) > `0`","expected":"true","comparator":"booleanEquals"}}
62            if crate::waiters::matchers::match_describe_internet_gateways_87ee24c169b4061c3(result) {
63                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64            }
65            // Matches: {"errorType":"InvalidInternetGateway.NotFound"}
66            if crate::waiters::matchers::match_describe_internet_gateways_23a231f190ff00c20(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_internet_gateways::DescribeInternetGateways::orchestrate(&runtime_plugins, input).await }
75        };
76        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
77            .min_delay(::std::time::Duration::from_secs(5))
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>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
88    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
89        self.inner = self.inner.next_token(input.into());
90        self
91    }
92    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
93    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
94        self.inner = self.inner.set_next_token(input);
95        self
96    }
97    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
98    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
99        self.inner.get_next_token()
100    }
101    /// <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>
102    pub fn max_results(mut self, input: i32) -> Self {
103        self.inner = self.inner.max_results(input);
104        self
105    }
106    /// <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>
107    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
108        self.inner = self.inner.set_max_results(input);
109        self
110    }
111    /// <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>
112    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
113        self.inner.get_max_results()
114    }
115    /// <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>
116    pub fn dry_run(mut self, input: bool) -> Self {
117        self.inner = self.inner.dry_run(input);
118        self
119    }
120    /// <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>
121    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
122        self.inner = self.inner.set_dry_run(input);
123        self
124    }
125    /// <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>
126    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
127        self.inner.get_dry_run()
128    }
129    ///
130    /// Appends an item to `InternetGatewayIds`.
131    ///
132    /// To override the contents of this collection use [`set_internet_gateway_ids`](Self::set_internet_gateway_ids).
133    ///
134    /// <p>The IDs of the internet gateways.</p>
135    /// <p>Default: Describes all your internet gateways.</p>
136    pub fn internet_gateway_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
137        self.inner = self.inner.internet_gateway_ids(input.into());
138        self
139    }
140    /// <p>The IDs of the internet gateways.</p>
141    /// <p>Default: Describes all your internet gateways.</p>
142    pub fn set_internet_gateway_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
143        self.inner = self.inner.set_internet_gateway_ids(input);
144        self
145    }
146    /// <p>The IDs of the internet gateways.</p>
147    /// <p>Default: Describes all your internet gateways.</p>
148    pub fn get_internet_gateway_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
149        self.inner.get_internet_gateway_ids()
150    }
151    ///
152    /// Appends an item to `Filters`.
153    ///
154    /// To override the contents of this collection use [`set_filters`](Self::set_filters).
155    ///
156    /// <p>The filters.</p>
157    /// <ul>
158    /// <li>
159    /// <p><code>attachment.state</code> - The current state of the attachment between the gateway and the VPC (<code>available</code>). Present only if a VPC is attached.</p></li>
160    /// <li>
161    /// <p><code>attachment.vpc-id</code> - The ID of an attached VPC.</p></li>
162    /// <li>
163    /// <p><code>internet-gateway-id</code> - The ID of the Internet gateway.</p></li>
164    /// <li>
165    /// <p><code>owner-id</code> - The ID of the Amazon Web Services account that owns the internet gateway.</p></li>
166    /// <li>
167    /// <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>
168    /// <li>
169    /// <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>
170    /// </ul>
171    pub fn filters(mut self, input: crate::types::Filter) -> Self {
172        self.inner = self.inner.filters(input);
173        self
174    }
175    /// <p>The filters.</p>
176    /// <ul>
177    /// <li>
178    /// <p><code>attachment.state</code> - The current state of the attachment between the gateway and the VPC (<code>available</code>). Present only if a VPC is attached.</p></li>
179    /// <li>
180    /// <p><code>attachment.vpc-id</code> - The ID of an attached VPC.</p></li>
181    /// <li>
182    /// <p><code>internet-gateway-id</code> - The ID of the Internet gateway.</p></li>
183    /// <li>
184    /// <p><code>owner-id</code> - The ID of the Amazon Web Services account that owns the internet gateway.</p></li>
185    /// <li>
186    /// <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>
187    /// <li>
188    /// <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>
189    /// </ul>
190    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
191        self.inner = self.inner.set_filters(input);
192        self
193    }
194    /// <p>The filters.</p>
195    /// <ul>
196    /// <li>
197    /// <p><code>attachment.state</code> - The current state of the attachment between the gateway and the VPC (<code>available</code>). Present only if a VPC is attached.</p></li>
198    /// <li>
199    /// <p><code>attachment.vpc-id</code> - The ID of an attached VPC.</p></li>
200    /// <li>
201    /// <p><code>internet-gateway-id</code> - The ID of the Internet gateway.</p></li>
202    /// <li>
203    /// <p><code>owner-id</code> - The ID of the Amazon Web Services account that owns the internet gateway.</p></li>
204    /// <li>
205    /// <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>
206    /// <li>
207    /// <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>
208    /// </ul>
209    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
210        self.inner.get_filters()
211    }
212}
213
214/// Successful return type for the `internet_gateway_exists` waiter.
215pub type InternetGatewayExistsFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
216    crate::operation::describe_internet_gateways::DescribeInternetGatewaysOutput,
217    ::aws_smithy_runtime_api::client::result::SdkError<
218        crate::operation::describe_internet_gateways::DescribeInternetGatewaysError,
219        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
220    >,
221>;
222
223/// Error type for the `internet_gateway_exists` waiter.
224pub type WaitUntilInternetGatewayExistsError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
225    crate::operation::describe_internet_gateways::DescribeInternetGatewaysOutput,
226    crate::operation::describe_internet_gateways::DescribeInternetGatewaysError,
227>;