aws_sdk_ec2/waiters/vpc_exists.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `vpc_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 VpcExistsFluentBuilder {
16 handle: ::std::sync::Arc<crate::client::Handle>,
17 inner: crate::operation::describe_vpcs::builders::DescribeVpcsInputBuilder,
18}
19impl VpcExistsFluentBuilder {
20 /// Creates a new `VpcExistsFluentBuilder`.
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 DescribeVpcs as a reference.
28 pub fn as_input(&self) -> &crate::operation::describe_vpcs::builders::DescribeVpcsInputBuilder {
29 &self.inner
30 }
31 /// Wait for `vpc_exists`
32 pub async fn wait(
33 self,
34 max_wait: ::std::time::Duration,
35 ) -> ::std::result::Result<crate::waiters::vpc_exists::VpcExistsFinalPoll, crate::waiters::vpc_exists::WaitUntilVpcExistsError> {
36 let input = self
37 .inner
38 .build()
39 .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
40 let runtime_plugins = crate::operation::describe_vpcs::DescribeVpcs::operation_runtime_plugins(
41 self.handle.runtime_plugins.clone(),
42 &self.handle.conf,
43 ::std::option::Option::None,
44 )
45 .with_operation_plugin(crate::sdk_feature_tracker::waiter::WaiterFeatureTrackerRuntimePlugin::new());
46 let mut cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
47 let runtime_components_builder = runtime_plugins
48 .apply_client_configuration(&mut cfg)
49 .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
50 let time_components = runtime_components_builder.into_time_components();
51 let sleep_impl = time_components.sleep_impl().expect("a sleep impl is required by waiters");
52 let time_source = time_components.time_source().expect("a time source is required by waiters");
53
54 let acceptor = move |result: ::std::result::Result<
55 &crate::operation::describe_vpcs::DescribeVpcsOutput,
56 &crate::operation::describe_vpcs::DescribeVpcsError,
57 >| {
58 // Matches: {"success":true}
59 if crate::waiters::matchers::match_describe_vpcs_c955e57777ec0d736(result) {
60 return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
61 }
62 // Matches: {"errorType":"InvalidVpcID.NotFound"}
63 if crate::waiters::matchers::match_describe_vpcs_f51411a22e164d79b(result) {
64 return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
65 }
66 ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
67 };
68 let operation = move || {
69 let input = input.clone();
70 let runtime_plugins = runtime_plugins.clone();
71 async move { crate::operation::describe_vpcs::DescribeVpcs::orchestrate(&runtime_plugins, input).await }
72 };
73 let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
74 .min_delay(::std::time::Duration::from_secs(1))
75 .max_delay(::std::time::Duration::from_secs(120))
76 .max_wait(max_wait)
77 .time_source(time_source)
78 .sleep_impl(sleep_impl)
79 .acceptor(acceptor)
80 .operation(operation)
81 .build();
82 ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
83 }
84 ///
85 /// Appends an item to `Filters`.
86 ///
87 /// To override the contents of this collection use [`set_filters`](Self::set_filters).
88 ///
89 /// <p>The filters.</p>
90 /// <ul>
91 /// <li>
92 /// <p><code>cidr</code> - The primary IPv4 CIDR block of the VPC. The CIDR block you specify must exactly match the VPC's CIDR block for information to be returned for the VPC. Must contain the slash followed by one or two digits (for example, <code>/28</code>).</p></li>
93 /// <li>
94 /// <p><code>cidr-block-association.cidr-block</code> - An IPv4 CIDR block associated with the VPC.</p></li>
95 /// <li>
96 /// <p><code>cidr-block-association.association-id</code> - The association ID for an IPv4 CIDR block associated with the VPC.</p></li>
97 /// <li>
98 /// <p><code>cidr-block-association.state</code> - The state of an IPv4 CIDR block associated with the VPC.</p></li>
99 /// <li>
100 /// <p><code>dhcp-options-id</code> - The ID of a set of DHCP options.</p></li>
101 /// <li>
102 /// <p><code>ipv6-cidr-block-association.ipv6-cidr-block</code> - An IPv6 CIDR block associated with the VPC.</p></li>
103 /// <li>
104 /// <p><code>ipv6-cidr-block-association.ipv6-pool</code> - The ID of the IPv6 address pool from which the IPv6 CIDR block is allocated.</p></li>
105 /// <li>
106 /// <p><code>ipv6-cidr-block-association.association-id</code> - The association ID for an IPv6 CIDR block associated with the VPC.</p></li>
107 /// <li>
108 /// <p><code>ipv6-cidr-block-association.state</code> - The state of an IPv6 CIDR block associated with the VPC.</p></li>
109 /// <li>
110 /// <p><code>is-default</code> - Indicates whether the VPC is the default VPC.</p></li>
111 /// <li>
112 /// <p><code>owner-id</code> - The ID of the Amazon Web Services account that owns the VPC.</p></li>
113 /// <li>
114 /// <p><code>state</code> - The state of the VPC (<code>pending</code> | <code>available</code>).</p></li>
115 /// <li>
116 /// <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>
117 /// <li>
118 /// <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>
119 /// <li>
120 /// <p><code>vpc-id</code> - The ID of the VPC.</p></li>
121 /// </ul>
122 pub fn filters(mut self, input: crate::types::Filter) -> Self {
123 self.inner = self.inner.filters(input);
124 self
125 }
126 /// <p>The filters.</p>
127 /// <ul>
128 /// <li>
129 /// <p><code>cidr</code> - The primary IPv4 CIDR block of the VPC. The CIDR block you specify must exactly match the VPC's CIDR block for information to be returned for the VPC. Must contain the slash followed by one or two digits (for example, <code>/28</code>).</p></li>
130 /// <li>
131 /// <p><code>cidr-block-association.cidr-block</code> - An IPv4 CIDR block associated with the VPC.</p></li>
132 /// <li>
133 /// <p><code>cidr-block-association.association-id</code> - The association ID for an IPv4 CIDR block associated with the VPC.</p></li>
134 /// <li>
135 /// <p><code>cidr-block-association.state</code> - The state of an IPv4 CIDR block associated with the VPC.</p></li>
136 /// <li>
137 /// <p><code>dhcp-options-id</code> - The ID of a set of DHCP options.</p></li>
138 /// <li>
139 /// <p><code>ipv6-cidr-block-association.ipv6-cidr-block</code> - An IPv6 CIDR block associated with the VPC.</p></li>
140 /// <li>
141 /// <p><code>ipv6-cidr-block-association.ipv6-pool</code> - The ID of the IPv6 address pool from which the IPv6 CIDR block is allocated.</p></li>
142 /// <li>
143 /// <p><code>ipv6-cidr-block-association.association-id</code> - The association ID for an IPv6 CIDR block associated with the VPC.</p></li>
144 /// <li>
145 /// <p><code>ipv6-cidr-block-association.state</code> - The state of an IPv6 CIDR block associated with the VPC.</p></li>
146 /// <li>
147 /// <p><code>is-default</code> - Indicates whether the VPC is the default VPC.</p></li>
148 /// <li>
149 /// <p><code>owner-id</code> - The ID of the Amazon Web Services account that owns the VPC.</p></li>
150 /// <li>
151 /// <p><code>state</code> - The state of the VPC (<code>pending</code> | <code>available</code>).</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.</p></li>
158 /// </ul>
159 pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
160 self.inner = self.inner.set_filters(input);
161 self
162 }
163 /// <p>The filters.</p>
164 /// <ul>
165 /// <li>
166 /// <p><code>cidr</code> - The primary IPv4 CIDR block of the VPC. The CIDR block you specify must exactly match the VPC's CIDR block for information to be returned for the VPC. Must contain the slash followed by one or two digits (for example, <code>/28</code>).</p></li>
167 /// <li>
168 /// <p><code>cidr-block-association.cidr-block</code> - An IPv4 CIDR block associated with the VPC.</p></li>
169 /// <li>
170 /// <p><code>cidr-block-association.association-id</code> - The association ID for an IPv4 CIDR block associated with the VPC.</p></li>
171 /// <li>
172 /// <p><code>cidr-block-association.state</code> - The state of an IPv4 CIDR block associated with the VPC.</p></li>
173 /// <li>
174 /// <p><code>dhcp-options-id</code> - The ID of a set of DHCP options.</p></li>
175 /// <li>
176 /// <p><code>ipv6-cidr-block-association.ipv6-cidr-block</code> - An IPv6 CIDR block associated with the VPC.</p></li>
177 /// <li>
178 /// <p><code>ipv6-cidr-block-association.ipv6-pool</code> - The ID of the IPv6 address pool from which the IPv6 CIDR block is allocated.</p></li>
179 /// <li>
180 /// <p><code>ipv6-cidr-block-association.association-id</code> - The association ID for an IPv6 CIDR block associated with the VPC.</p></li>
181 /// <li>
182 /// <p><code>ipv6-cidr-block-association.state</code> - The state of an IPv6 CIDR block associated with the VPC.</p></li>
183 /// <li>
184 /// <p><code>is-default</code> - Indicates whether the VPC is the default VPC.</p></li>
185 /// <li>
186 /// <p><code>owner-id</code> - The ID of the Amazon Web Services account that owns the VPC.</p></li>
187 /// <li>
188 /// <p><code>state</code> - The state of the VPC (<code>pending</code> | <code>available</code>).</p></li>
189 /// <li>
190 /// <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>
191 /// <li>
192 /// <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>
193 /// <li>
194 /// <p><code>vpc-id</code> - The ID of the VPC.</p></li>
195 /// </ul>
196 pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
197 self.inner.get_filters()
198 }
199 ///
200 /// Appends an item to `VpcIds`.
201 ///
202 /// To override the contents of this collection use [`set_vpc_ids`](Self::set_vpc_ids).
203 ///
204 /// <p>The IDs of the VPCs.</p>
205 pub fn vpc_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
206 self.inner = self.inner.vpc_ids(input.into());
207 self
208 }
209 /// <p>The IDs of the VPCs.</p>
210 pub fn set_vpc_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
211 self.inner = self.inner.set_vpc_ids(input);
212 self
213 }
214 /// <p>The IDs of the VPCs.</p>
215 pub fn get_vpc_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
216 self.inner.get_vpc_ids()
217 }
218 /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
219 pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
220 self.inner = self.inner.next_token(input.into());
221 self
222 }
223 /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
224 pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
225 self.inner = self.inner.set_next_token(input);
226 self
227 }
228 /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
229 pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
230 self.inner.get_next_token()
231 }
232 /// <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>
233 pub fn max_results(mut self, input: i32) -> Self {
234 self.inner = self.inner.max_results(input);
235 self
236 }
237 /// <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>
238 pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
239 self.inner = self.inner.set_max_results(input);
240 self
241 }
242 /// <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>
243 pub fn get_max_results(&self) -> &::std::option::Option<i32> {
244 self.inner.get_max_results()
245 }
246 /// <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>
247 pub fn dry_run(mut self, input: bool) -> Self {
248 self.inner = self.inner.dry_run(input);
249 self
250 }
251 /// <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>
252 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
253 self.inner = self.inner.set_dry_run(input);
254 self
255 }
256 /// <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>
257 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
258 self.inner.get_dry_run()
259 }
260}
261
262/// Successful return type for the `vpc_exists` waiter.
263pub type VpcExistsFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
264 crate::operation::describe_vpcs::DescribeVpcsOutput,
265 ::aws_smithy_runtime_api::client::result::SdkError<
266 crate::operation::describe_vpcs::DescribeVpcsError,
267 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
268 >,
269>;
270
271/// Error type for the `vpc_exists` waiter.
272pub type WaitUntilVpcExistsError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
273 crate::operation::describe_vpcs::DescribeVpcsOutput,
274 crate::operation::describe_vpcs::DescribeVpcsError,
275>;