aws_sdk_ec2/waiters/
vpc_peering_connection_exists.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `vpc_peering_connection_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 VpcPeeringConnectionExistsFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_vpc_peering_connections::builders::DescribeVpcPeeringConnectionsInputBuilder,
18}
19impl VpcPeeringConnectionExistsFluentBuilder {
20    /// Creates a new `VpcPeeringConnectionExistsFluentBuilder`.
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 DescribeVpcPeeringConnections as a reference.
28    pub fn as_input(&self) -> &crate::operation::describe_vpc_peering_connections::builders::DescribeVpcPeeringConnectionsInputBuilder {
29        &self.inner
30    }
31    /// Wait for `vpc_peering_connection_exists`
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::vpc_peering_connection_exists::VpcPeeringConnectionExistsFinalPoll,
37        crate::waiters::vpc_peering_connection_exists::WaitUntilVpcPeeringConnectionExistsError,
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_vpc_peering_connections::DescribeVpcPeeringConnections::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_vpc_peering_connections::DescribeVpcPeeringConnectionsOutput,
59            &crate::operation::describe_vpc_peering_connections::DescribeVpcPeeringConnectionsError,
60        >| {
61            // Matches: {"success":true}
62            if crate::waiters::matchers::match_describe_vpc_peering_connections_c955e57777ec0d736(result) {
63                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64            }
65            // Matches: {"errorType":"InvalidVpcPeeringConnectionID.NotFound"}
66            if crate::waiters::matchers::match_describe_vpc_peering_connections_e0cb68a203dc3e8d0(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_vpc_peering_connections::DescribeVpcPeeringConnections::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>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 `VpcPeeringConnectionIds`.
131    ///
132    /// To override the contents of this collection use [`set_vpc_peering_connection_ids`](Self::set_vpc_peering_connection_ids).
133    ///
134    /// <p>The IDs of the VPC peering connections.</p>
135    /// <p>Default: Describes all your VPC peering connections.</p>
136    pub fn vpc_peering_connection_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
137        self.inner = self.inner.vpc_peering_connection_ids(input.into());
138        self
139    }
140    /// <p>The IDs of the VPC peering connections.</p>
141    /// <p>Default: Describes all your VPC peering connections.</p>
142    pub fn set_vpc_peering_connection_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
143        self.inner = self.inner.set_vpc_peering_connection_ids(input);
144        self
145    }
146    /// <p>The IDs of the VPC peering connections.</p>
147    /// <p>Default: Describes all your VPC peering connections.</p>
148    pub fn get_vpc_peering_connection_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
149        self.inner.get_vpc_peering_connection_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>accepter-vpc-info.cidr-block</code> - The IPv4 CIDR block of the accepter VPC.</p></li>
160    /// <li>
161    /// <p><code>accepter-vpc-info.owner-id</code> - The ID of the Amazon Web Services account that owns the accepter VPC.</p></li>
162    /// <li>
163    /// <p><code>accepter-vpc-info.vpc-id</code> - The ID of the accepter VPC.</p></li>
164    /// <li>
165    /// <p><code>expiration-time</code> - The expiration date and time for the VPC peering connection.</p></li>
166    /// <li>
167    /// <p><code>requester-vpc-info.cidr-block</code> - The IPv4 CIDR block of the requester's VPC.</p></li>
168    /// <li>
169    /// <p><code>requester-vpc-info.owner-id</code> - The ID of the Amazon Web Services account that owns the requester VPC.</p></li>
170    /// <li>
171    /// <p><code>requester-vpc-info.vpc-id</code> - The ID of the requester VPC.</p></li>
172    /// <li>
173    /// <p><code>status-code</code> - The status of the VPC peering connection (<code>pending-acceptance</code> | <code>failed</code> | <code>expired</code> | <code>provisioning</code> | <code>active</code> | <code>deleting</code> | <code>deleted</code> | <code>rejected</code>).</p></li>
174    /// <li>
175    /// <p><code>status-message</code> - A message that provides more information about the status of the VPC peering connection, if applicable.</p></li>
176    /// <li>
177    /// <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>
178    /// <li>
179    /// <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>
180    /// <li>
181    /// <p><code>vpc-peering-connection-id</code> - The ID of the VPC peering connection.</p></li>
182    /// </ul>
183    pub fn filters(mut self, input: crate::types::Filter) -> Self {
184        self.inner = self.inner.filters(input);
185        self
186    }
187    /// <p>The filters.</p>
188    /// <ul>
189    /// <li>
190    /// <p><code>accepter-vpc-info.cidr-block</code> - The IPv4 CIDR block of the accepter VPC.</p></li>
191    /// <li>
192    /// <p><code>accepter-vpc-info.owner-id</code> - The ID of the Amazon Web Services account that owns the accepter VPC.</p></li>
193    /// <li>
194    /// <p><code>accepter-vpc-info.vpc-id</code> - The ID of the accepter VPC.</p></li>
195    /// <li>
196    /// <p><code>expiration-time</code> - The expiration date and time for the VPC peering connection.</p></li>
197    /// <li>
198    /// <p><code>requester-vpc-info.cidr-block</code> - The IPv4 CIDR block of the requester's VPC.</p></li>
199    /// <li>
200    /// <p><code>requester-vpc-info.owner-id</code> - The ID of the Amazon Web Services account that owns the requester VPC.</p></li>
201    /// <li>
202    /// <p><code>requester-vpc-info.vpc-id</code> - The ID of the requester VPC.</p></li>
203    /// <li>
204    /// <p><code>status-code</code> - The status of the VPC peering connection (<code>pending-acceptance</code> | <code>failed</code> | <code>expired</code> | <code>provisioning</code> | <code>active</code> | <code>deleting</code> | <code>deleted</code> | <code>rejected</code>).</p></li>
205    /// <li>
206    /// <p><code>status-message</code> - A message that provides more information about the status of the VPC peering connection, if applicable.</p></li>
207    /// <li>
208    /// <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>
209    /// <li>
210    /// <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>
211    /// <li>
212    /// <p><code>vpc-peering-connection-id</code> - The ID of the VPC peering connection.</p></li>
213    /// </ul>
214    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
215        self.inner = self.inner.set_filters(input);
216        self
217    }
218    /// <p>The filters.</p>
219    /// <ul>
220    /// <li>
221    /// <p><code>accepter-vpc-info.cidr-block</code> - The IPv4 CIDR block of the accepter VPC.</p></li>
222    /// <li>
223    /// <p><code>accepter-vpc-info.owner-id</code> - The ID of the Amazon Web Services account that owns the accepter VPC.</p></li>
224    /// <li>
225    /// <p><code>accepter-vpc-info.vpc-id</code> - The ID of the accepter VPC.</p></li>
226    /// <li>
227    /// <p><code>expiration-time</code> - The expiration date and time for the VPC peering connection.</p></li>
228    /// <li>
229    /// <p><code>requester-vpc-info.cidr-block</code> - The IPv4 CIDR block of the requester's VPC.</p></li>
230    /// <li>
231    /// <p><code>requester-vpc-info.owner-id</code> - The ID of the Amazon Web Services account that owns the requester VPC.</p></li>
232    /// <li>
233    /// <p><code>requester-vpc-info.vpc-id</code> - The ID of the requester VPC.</p></li>
234    /// <li>
235    /// <p><code>status-code</code> - The status of the VPC peering connection (<code>pending-acceptance</code> | <code>failed</code> | <code>expired</code> | <code>provisioning</code> | <code>active</code> | <code>deleting</code> | <code>deleted</code> | <code>rejected</code>).</p></li>
236    /// <li>
237    /// <p><code>status-message</code> - A message that provides more information about the status of the VPC peering connection, if applicable.</p></li>
238    /// <li>
239    /// <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>
240    /// <li>
241    /// <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>
242    /// <li>
243    /// <p><code>vpc-peering-connection-id</code> - The ID of the VPC peering connection.</p></li>
244    /// </ul>
245    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
246        self.inner.get_filters()
247    }
248}
249
250/// Successful return type for the `vpc_peering_connection_exists` waiter.
251pub type VpcPeeringConnectionExistsFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
252    crate::operation::describe_vpc_peering_connections::DescribeVpcPeeringConnectionsOutput,
253    ::aws_smithy_runtime_api::client::result::SdkError<
254        crate::operation::describe_vpc_peering_connections::DescribeVpcPeeringConnectionsError,
255        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
256    >,
257>;
258
259/// Error type for the `vpc_peering_connection_exists` waiter.
260pub type WaitUntilVpcPeeringConnectionExistsError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
261    crate::operation::describe_vpc_peering_connections::DescribeVpcPeeringConnectionsOutput,
262    crate::operation::describe_vpc_peering_connections::DescribeVpcPeeringConnectionsError,
263>;