aws_sdk_ec2/waiters/security_group_exists.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `security_group_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 SecurityGroupExistsFluentBuilder {
16 handle: ::std::sync::Arc<crate::client::Handle>,
17 inner: crate::operation::describe_security_groups::builders::DescribeSecurityGroupsInputBuilder,
18}
19impl SecurityGroupExistsFluentBuilder {
20 /// Creates a new `SecurityGroupExistsFluentBuilder`.
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 DescribeSecurityGroups as a reference.
28 pub fn as_input(&self) -> &crate::operation::describe_security_groups::builders::DescribeSecurityGroupsInputBuilder {
29 &self.inner
30 }
31 /// Wait for `security_group_exists`
32 pub async fn wait(
33 self,
34 max_wait: ::std::time::Duration,
35 ) -> ::std::result::Result<
36 crate::waiters::security_group_exists::SecurityGroupExistsFinalPoll,
37 crate::waiters::security_group_exists::WaitUntilSecurityGroupExistsError,
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_security_groups::DescribeSecurityGroups::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_security_groups::DescribeSecurityGroupsOutput,
59 &crate::operation::describe_security_groups::DescribeSecurityGroupsError,
60 >| {
61 // Matches: {"output":{"path":"length(SecurityGroups[].GroupId) > `0`","expected":"true","comparator":"booleanEquals"}}
62 if crate::waiters::matchers::match_describe_security_groups_0e75760caea410eed(result) {
63 return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64 }
65 // Matches: {"errorType":"InvalidGroup.NotFound"}
66 if crate::waiters::matchers::match_describe_security_groups_f735c42a19b31c377(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_security_groups::DescribeSecurityGroups::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 ///
88 /// Appends an item to `GroupIds`.
89 ///
90 /// To override the contents of this collection use [`set_group_ids`](Self::set_group_ids).
91 ///
92 /// <p>The IDs of the security groups. Required for security groups in a nondefault VPC.</p>
93 /// <p>Default: Describes all of your security groups.</p>
94 pub fn group_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
95 self.inner = self.inner.group_ids(input.into());
96 self
97 }
98 /// <p>The IDs of the security groups. Required for security groups in a nondefault VPC.</p>
99 /// <p>Default: Describes all of your security groups.</p>
100 pub fn set_group_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
101 self.inner = self.inner.set_group_ids(input);
102 self
103 }
104 /// <p>The IDs of the security groups. Required for security groups in a nondefault VPC.</p>
105 /// <p>Default: Describes all of your security groups.</p>
106 pub fn get_group_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
107 self.inner.get_group_ids()
108 }
109 ///
110 /// Appends an item to `GroupNames`.
111 ///
112 /// To override the contents of this collection use [`set_group_names`](Self::set_group_names).
113 ///
114 /// <p>\[Default VPC\] The names of the security groups. You can specify either the security group name or the security group ID.</p>
115 /// <p>Default: Describes all of your security groups.</p>
116 pub fn group_names(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117 self.inner = self.inner.group_names(input.into());
118 self
119 }
120 /// <p>\[Default VPC\] The names of the security groups. You can specify either the security group name or the security group ID.</p>
121 /// <p>Default: Describes all of your security groups.</p>
122 pub fn set_group_names(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
123 self.inner = self.inner.set_group_names(input);
124 self
125 }
126 /// <p>\[Default VPC\] The names of the security groups. You can specify either the security group name or the security group ID.</p>
127 /// <p>Default: Describes all of your security groups.</p>
128 pub fn get_group_names(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
129 self.inner.get_group_names()
130 }
131 /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
132 pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
133 self.inner = self.inner.next_token(input.into());
134 self
135 }
136 /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
137 pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
138 self.inner = self.inner.set_next_token(input);
139 self
140 }
141 /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
142 pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
143 self.inner.get_next_token()
144 }
145 /// <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. This value can be between 5 and 1000. If this parameter is not specified, then all items are returned. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
146 pub fn max_results(mut self, input: i32) -> Self {
147 self.inner = self.inner.max_results(input);
148 self
149 }
150 /// <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. This value can be between 5 and 1000. If this parameter is not specified, then all items are returned. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
151 pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
152 self.inner = self.inner.set_max_results(input);
153 self
154 }
155 /// <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. This value can be between 5 and 1000. If this parameter is not specified, then all items are returned. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
156 pub fn get_max_results(&self) -> &::std::option::Option<i32> {
157 self.inner.get_max_results()
158 }
159 /// <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>
160 pub fn dry_run(mut self, input: bool) -> Self {
161 self.inner = self.inner.dry_run(input);
162 self
163 }
164 /// <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>
165 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
166 self.inner = self.inner.set_dry_run(input);
167 self
168 }
169 /// <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>
170 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
171 self.inner.get_dry_run()
172 }
173 ///
174 /// Appends an item to `Filters`.
175 ///
176 /// To override the contents of this collection use [`set_filters`](Self::set_filters).
177 ///
178 /// <p>The filters. If using multiple filters for rules, the results include security groups for which any combination of rules - not necessarily a single rule - match all filters.</p>
179 /// <ul>
180 /// <li>
181 /// <p><code>description</code> - The description of the security group.</p></li>
182 /// <li>
183 /// <p><code>egress.ip-permission.cidr</code> - An IPv4 CIDR block for an outbound security group rule.</p></li>
184 /// <li>
185 /// <p><code>egress.ip-permission.from-port</code> - For an outbound rule, the start of port range for the TCP and UDP protocols, or an ICMP type number.</p></li>
186 /// <li>
187 /// <p><code>egress.ip-permission.group-id</code> - The ID of a security group that has been referenced in an outbound security group rule.</p></li>
188 /// <li>
189 /// <p><code>egress.ip-permission.group-name</code> - The name of a security group that is referenced in an outbound security group rule.</p></li>
190 /// <li>
191 /// <p><code>egress.ip-permission.ipv6-cidr</code> - An IPv6 CIDR block for an outbound security group rule.</p></li>
192 /// <li>
193 /// <p><code>egress.ip-permission.prefix-list-id</code> - The ID of a prefix list to which a security group rule allows outbound access.</p></li>
194 /// <li>
195 /// <p><code>egress.ip-permission.protocol</code> - The IP protocol for an outbound security group rule (<code>tcp</code> | <code>udp</code> | <code>icmp</code>, a protocol number, or -1 for all protocols).</p></li>
196 /// <li>
197 /// <p><code>egress.ip-permission.to-port</code> - For an outbound rule, the end of port range for the TCP and UDP protocols, or an ICMP code.</p></li>
198 /// <li>
199 /// <p><code>egress.ip-permission.user-id</code> - The ID of an Amazon Web Services account that has been referenced in an outbound security group rule.</p></li>
200 /// <li>
201 /// <p><code>group-id</code> - The ID of the security group.</p></li>
202 /// <li>
203 /// <p><code>group-name</code> - The name of the security group.</p></li>
204 /// <li>
205 /// <p><code>ip-permission.cidr</code> - An IPv4 CIDR block for an inbound security group rule.</p></li>
206 /// <li>
207 /// <p><code>ip-permission.from-port</code> - For an inbound rule, the start of port range for the TCP and UDP protocols, or an ICMP type number.</p></li>
208 /// <li>
209 /// <p><code>ip-permission.group-id</code> - The ID of a security group that has been referenced in an inbound security group rule.</p></li>
210 /// <li>
211 /// <p><code>ip-permission.group-name</code> - The name of a security group that is referenced in an inbound security group rule.</p></li>
212 /// <li>
213 /// <p><code>ip-permission.ipv6-cidr</code> - An IPv6 CIDR block for an inbound security group rule.</p></li>
214 /// <li>
215 /// <p><code>ip-permission.prefix-list-id</code> - The ID of a prefix list from which a security group rule allows inbound access.</p></li>
216 /// <li>
217 /// <p><code>ip-permission.protocol</code> - The IP protocol for an inbound security group rule (<code>tcp</code> | <code>udp</code> | <code>icmp</code>, a protocol number, or -1 for all protocols).</p></li>
218 /// <li>
219 /// <p><code>ip-permission.to-port</code> - For an inbound rule, the end of port range for the TCP and UDP protocols, or an ICMP code.</p></li>
220 /// <li>
221 /// <p><code>ip-permission.user-id</code> - The ID of an Amazon Web Services account that has been referenced in an inbound security group rule.</p></li>
222 /// <li>
223 /// <p><code>owner-id</code> - The Amazon Web Services account ID of the owner of the security group.</p></li>
224 /// <li>
225 /// <p><code>tag</code>:<key>
226 /// - 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
227 /// <code>Owner</code> and the value
228 /// <code>TeamA</code>, specify
229 /// <code>tag:Owner</code> for the filter name and
230 /// <code>TeamA</code> for the filter value.
231 /// </key></p></li>
232 /// <li>
233 /// <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>
234 /// <li>
235 /// <p><code>vpc-id</code> - The ID of the VPC specified when the security group was created.</p></li>
236 /// </ul>
237 pub fn filters(mut self, input: crate::types::Filter) -> Self {
238 self.inner = self.inner.filters(input);
239 self
240 }
241 /// <p>The filters. If using multiple filters for rules, the results include security groups for which any combination of rules - not necessarily a single rule - match all filters.</p>
242 /// <ul>
243 /// <li>
244 /// <p><code>description</code> - The description of the security group.</p></li>
245 /// <li>
246 /// <p><code>egress.ip-permission.cidr</code> - An IPv4 CIDR block for an outbound security group rule.</p></li>
247 /// <li>
248 /// <p><code>egress.ip-permission.from-port</code> - For an outbound rule, the start of port range for the TCP and UDP protocols, or an ICMP type number.</p></li>
249 /// <li>
250 /// <p><code>egress.ip-permission.group-id</code> - The ID of a security group that has been referenced in an outbound security group rule.</p></li>
251 /// <li>
252 /// <p><code>egress.ip-permission.group-name</code> - The name of a security group that is referenced in an outbound security group rule.</p></li>
253 /// <li>
254 /// <p><code>egress.ip-permission.ipv6-cidr</code> - An IPv6 CIDR block for an outbound security group rule.</p></li>
255 /// <li>
256 /// <p><code>egress.ip-permission.prefix-list-id</code> - The ID of a prefix list to which a security group rule allows outbound access.</p></li>
257 /// <li>
258 /// <p><code>egress.ip-permission.protocol</code> - The IP protocol for an outbound security group rule (<code>tcp</code> | <code>udp</code> | <code>icmp</code>, a protocol number, or -1 for all protocols).</p></li>
259 /// <li>
260 /// <p><code>egress.ip-permission.to-port</code> - For an outbound rule, the end of port range for the TCP and UDP protocols, or an ICMP code.</p></li>
261 /// <li>
262 /// <p><code>egress.ip-permission.user-id</code> - The ID of an Amazon Web Services account that has been referenced in an outbound security group rule.</p></li>
263 /// <li>
264 /// <p><code>group-id</code> - The ID of the security group.</p></li>
265 /// <li>
266 /// <p><code>group-name</code> - The name of the security group.</p></li>
267 /// <li>
268 /// <p><code>ip-permission.cidr</code> - An IPv4 CIDR block for an inbound security group rule.</p></li>
269 /// <li>
270 /// <p><code>ip-permission.from-port</code> - For an inbound rule, the start of port range for the TCP and UDP protocols, or an ICMP type number.</p></li>
271 /// <li>
272 /// <p><code>ip-permission.group-id</code> - The ID of a security group that has been referenced in an inbound security group rule.</p></li>
273 /// <li>
274 /// <p><code>ip-permission.group-name</code> - The name of a security group that is referenced in an inbound security group rule.</p></li>
275 /// <li>
276 /// <p><code>ip-permission.ipv6-cidr</code> - An IPv6 CIDR block for an inbound security group rule.</p></li>
277 /// <li>
278 /// <p><code>ip-permission.prefix-list-id</code> - The ID of a prefix list from which a security group rule allows inbound access.</p></li>
279 /// <li>
280 /// <p><code>ip-permission.protocol</code> - The IP protocol for an inbound security group rule (<code>tcp</code> | <code>udp</code> | <code>icmp</code>, a protocol number, or -1 for all protocols).</p></li>
281 /// <li>
282 /// <p><code>ip-permission.to-port</code> - For an inbound rule, the end of port range for the TCP and UDP protocols, or an ICMP code.</p></li>
283 /// <li>
284 /// <p><code>ip-permission.user-id</code> - The ID of an Amazon Web Services account that has been referenced in an inbound security group rule.</p></li>
285 /// <li>
286 /// <p><code>owner-id</code> - The Amazon Web Services account ID of the owner of the security group.</p></li>
287 /// <li>
288 /// <p><code>tag</code>:<key>
289 /// - 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
290 /// <code>Owner</code> and the value
291 /// <code>TeamA</code>, specify
292 /// <code>tag:Owner</code> for the filter name and
293 /// <code>TeamA</code> for the filter value.
294 /// </key></p></li>
295 /// <li>
296 /// <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>
297 /// <li>
298 /// <p><code>vpc-id</code> - The ID of the VPC specified when the security group was created.</p></li>
299 /// </ul>
300 pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
301 self.inner = self.inner.set_filters(input);
302 self
303 }
304 /// <p>The filters. If using multiple filters for rules, the results include security groups for which any combination of rules - not necessarily a single rule - match all filters.</p>
305 /// <ul>
306 /// <li>
307 /// <p><code>description</code> - The description of the security group.</p></li>
308 /// <li>
309 /// <p><code>egress.ip-permission.cidr</code> - An IPv4 CIDR block for an outbound security group rule.</p></li>
310 /// <li>
311 /// <p><code>egress.ip-permission.from-port</code> - For an outbound rule, the start of port range for the TCP and UDP protocols, or an ICMP type number.</p></li>
312 /// <li>
313 /// <p><code>egress.ip-permission.group-id</code> - The ID of a security group that has been referenced in an outbound security group rule.</p></li>
314 /// <li>
315 /// <p><code>egress.ip-permission.group-name</code> - The name of a security group that is referenced in an outbound security group rule.</p></li>
316 /// <li>
317 /// <p><code>egress.ip-permission.ipv6-cidr</code> - An IPv6 CIDR block for an outbound security group rule.</p></li>
318 /// <li>
319 /// <p><code>egress.ip-permission.prefix-list-id</code> - The ID of a prefix list to which a security group rule allows outbound access.</p></li>
320 /// <li>
321 /// <p><code>egress.ip-permission.protocol</code> - The IP protocol for an outbound security group rule (<code>tcp</code> | <code>udp</code> | <code>icmp</code>, a protocol number, or -1 for all protocols).</p></li>
322 /// <li>
323 /// <p><code>egress.ip-permission.to-port</code> - For an outbound rule, the end of port range for the TCP and UDP protocols, or an ICMP code.</p></li>
324 /// <li>
325 /// <p><code>egress.ip-permission.user-id</code> - The ID of an Amazon Web Services account that has been referenced in an outbound security group rule.</p></li>
326 /// <li>
327 /// <p><code>group-id</code> - The ID of the security group.</p></li>
328 /// <li>
329 /// <p><code>group-name</code> - The name of the security group.</p></li>
330 /// <li>
331 /// <p><code>ip-permission.cidr</code> - An IPv4 CIDR block for an inbound security group rule.</p></li>
332 /// <li>
333 /// <p><code>ip-permission.from-port</code> - For an inbound rule, the start of port range for the TCP and UDP protocols, or an ICMP type number.</p></li>
334 /// <li>
335 /// <p><code>ip-permission.group-id</code> - The ID of a security group that has been referenced in an inbound security group rule.</p></li>
336 /// <li>
337 /// <p><code>ip-permission.group-name</code> - The name of a security group that is referenced in an inbound security group rule.</p></li>
338 /// <li>
339 /// <p><code>ip-permission.ipv6-cidr</code> - An IPv6 CIDR block for an inbound security group rule.</p></li>
340 /// <li>
341 /// <p><code>ip-permission.prefix-list-id</code> - The ID of a prefix list from which a security group rule allows inbound access.</p></li>
342 /// <li>
343 /// <p><code>ip-permission.protocol</code> - The IP protocol for an inbound security group rule (<code>tcp</code> | <code>udp</code> | <code>icmp</code>, a protocol number, or -1 for all protocols).</p></li>
344 /// <li>
345 /// <p><code>ip-permission.to-port</code> - For an inbound rule, the end of port range for the TCP and UDP protocols, or an ICMP code.</p></li>
346 /// <li>
347 /// <p><code>ip-permission.user-id</code> - The ID of an Amazon Web Services account that has been referenced in an inbound security group rule.</p></li>
348 /// <li>
349 /// <p><code>owner-id</code> - The Amazon Web Services account ID of the owner of the security group.</p></li>
350 /// <li>
351 /// <p><code>tag</code>:<key>
352 /// - 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
353 /// <code>Owner</code> and the value
354 /// <code>TeamA</code>, specify
355 /// <code>tag:Owner</code> for the filter name and
356 /// <code>TeamA</code> for the filter value.
357 /// </key></p></li>
358 /// <li>
359 /// <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>
360 /// <li>
361 /// <p><code>vpc-id</code> - The ID of the VPC specified when the security group was created.</p></li>
362 /// </ul>
363 pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
364 self.inner.get_filters()
365 }
366}
367
368/// Successful return type for the `security_group_exists` waiter.
369pub type SecurityGroupExistsFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
370 crate::operation::describe_security_groups::DescribeSecurityGroupsOutput,
371 ::aws_smithy_runtime_api::client::result::SdkError<
372 crate::operation::describe_security_groups::DescribeSecurityGroupsError,
373 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
374 >,
375>;
376
377/// Error type for the `security_group_exists` waiter.
378pub type WaitUntilSecurityGroupExistsError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
379 crate::operation::describe_security_groups::DescribeSecurityGroupsOutput,
380 crate::operation::describe_security_groups::DescribeSecurityGroupsError,
381>;