aws_sdk_cloudformation/waiters/stack_exists.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `stack_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 StackExistsFluentBuilder {
16 handle: ::std::sync::Arc<crate::client::Handle>,
17 inner: crate::operation::describe_stacks::builders::DescribeStacksInputBuilder,
18}
19impl StackExistsFluentBuilder {
20 /// Creates a new `StackExistsFluentBuilder`.
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 DescribeStacks as a reference.
28 pub fn as_input(&self) -> &crate::operation::describe_stacks::builders::DescribeStacksInputBuilder {
29 &self.inner
30 }
31 /// Wait for `stack_exists`
32 pub async fn wait(
33 self,
34 max_wait: ::std::time::Duration,
35 ) -> ::std::result::Result<crate::waiters::stack_exists::StackExistsFinalPoll, crate::waiters::stack_exists::WaitUntilStackExistsError> {
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_stacks::DescribeStacks::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_stacks::DescribeStacksOutput,
56 &crate::operation::describe_stacks::DescribeStacksError,
57 >| {
58 // Matches: {"success":true}
59 if crate::waiters::matchers::match_describe_stacks_c955e57777ec0d736(result) {
60 return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
61 }
62 // Matches: {"errorType":"ValidationError"}
63 if crate::waiters::matchers::match_describe_stacks_67b5dc55bf035ef25(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_stacks::DescribeStacks::orchestrate(&runtime_plugins, input).await }
72 };
73 let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
74 .min_delay(::std::time::Duration::from_secs(5))
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 /// <note>
85 /// <p>If you don't pass a parameter to <code>StackName</code>, the API returns a response that describes all resources in the account, which can impact performance. This requires <code>ListStacks</code> and <code>DescribeStacks</code> permissions.</p>
86 /// <p>Consider using the <code>ListStacks</code> API if you're not passing a parameter to <code>StackName</code>.</p>
87 /// <p>The IAM policy below can be added to IAM policies when you want to limit resource-level permissions and avoid returning a response when no parameter is sent in the request:</p>
88 /// <p>{ "Version": "2012-10-17", "Statement": \[{ "Effect": "Deny", "Action": "cloudformation:DescribeStacks", "NotResource": "arn:aws:cloudformation:*:*:stack/*/*" }\] }</p>
89 /// </note>
90 /// <p>The name or the unique stack ID that's associated with the stack, which aren't always interchangeable:</p>
91 /// <ul>
92 /// <li>
93 /// <p>Running stacks: You can specify either the stack's name or its unique stack ID.</p></li>
94 /// <li>
95 /// <p>Deleted stacks: You must specify the unique stack ID.</p></li>
96 /// </ul>
97 pub fn stack_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
98 self.inner = self.inner.stack_name(input.into());
99 self
100 }
101 /// <note>
102 /// <p>If you don't pass a parameter to <code>StackName</code>, the API returns a response that describes all resources in the account, which can impact performance. This requires <code>ListStacks</code> and <code>DescribeStacks</code> permissions.</p>
103 /// <p>Consider using the <code>ListStacks</code> API if you're not passing a parameter to <code>StackName</code>.</p>
104 /// <p>The IAM policy below can be added to IAM policies when you want to limit resource-level permissions and avoid returning a response when no parameter is sent in the request:</p>
105 /// <p>{ "Version": "2012-10-17", "Statement": \[{ "Effect": "Deny", "Action": "cloudformation:DescribeStacks", "NotResource": "arn:aws:cloudformation:*:*:stack/*/*" }\] }</p>
106 /// </note>
107 /// <p>The name or the unique stack ID that's associated with the stack, which aren't always interchangeable:</p>
108 /// <ul>
109 /// <li>
110 /// <p>Running stacks: You can specify either the stack's name or its unique stack ID.</p></li>
111 /// <li>
112 /// <p>Deleted stacks: You must specify the unique stack ID.</p></li>
113 /// </ul>
114 pub fn set_stack_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
115 self.inner = self.inner.set_stack_name(input);
116 self
117 }
118 /// <note>
119 /// <p>If you don't pass a parameter to <code>StackName</code>, the API returns a response that describes all resources in the account, which can impact performance. This requires <code>ListStacks</code> and <code>DescribeStacks</code> permissions.</p>
120 /// <p>Consider using the <code>ListStacks</code> API if you're not passing a parameter to <code>StackName</code>.</p>
121 /// <p>The IAM policy below can be added to IAM policies when you want to limit resource-level permissions and avoid returning a response when no parameter is sent in the request:</p>
122 /// <p>{ "Version": "2012-10-17", "Statement": \[{ "Effect": "Deny", "Action": "cloudformation:DescribeStacks", "NotResource": "arn:aws:cloudformation:*:*:stack/*/*" }\] }</p>
123 /// </note>
124 /// <p>The name or the unique stack ID that's associated with the stack, which aren't always interchangeable:</p>
125 /// <ul>
126 /// <li>
127 /// <p>Running stacks: You can specify either the stack's name or its unique stack ID.</p></li>
128 /// <li>
129 /// <p>Deleted stacks: You must specify the unique stack ID.</p></li>
130 /// </ul>
131 pub fn get_stack_name(&self) -> &::std::option::Option<::std::string::String> {
132 self.inner.get_stack_name()
133 }
134 /// <p>A string that identifies the next page of stacks that you want to retrieve.</p>
135 pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
136 self.inner = self.inner.next_token(input.into());
137 self
138 }
139 /// <p>A string that identifies the next page of stacks that you want to retrieve.</p>
140 pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
141 self.inner = self.inner.set_next_token(input);
142 self
143 }
144 /// <p>A string that identifies the next page of stacks that you want to retrieve.</p>
145 pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
146 self.inner.get_next_token()
147 }
148}
149
150/// Successful return type for the `stack_exists` waiter.
151pub type StackExistsFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
152 crate::operation::describe_stacks::DescribeStacksOutput,
153 ::aws_smithy_runtime_api::client::result::SdkError<
154 crate::operation::describe_stacks::DescribeStacksError,
155 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
156 >,
157>;
158
159/// Error type for the `stack_exists` waiter.
160pub type WaitUntilStackExistsError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
161 crate::operation::describe_stacks::DescribeStacksOutput,
162 crate::operation::describe_stacks::DescribeStacksError,
163>;