aws_sdk_cloudformation/waiters/
stack_create_complete.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `stack_create_complete` 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 StackCreateCompleteFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_stacks::builders::DescribeStacksInputBuilder,
18}
19impl StackCreateCompleteFluentBuilder {
20    /// Creates a new `StackCreateCompleteFluentBuilder`.
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 until stack status is CREATE_COMPLETE.
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::stack_create_complete::StackCreateCompleteFinalPoll,
37        crate::waiters::stack_create_complete::WaitUntilStackCreateCompleteError,
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_stacks::DescribeStacks::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_stacks::DescribeStacksOutput,
59            &crate::operation::describe_stacks::DescribeStacksError,
60        >| {
61            // Matches: {"output":{"path":"Stacks[].StackStatus","expected":"CREATE_COMPLETE","comparator":"allStringEquals"}}
62            if crate::waiters::matchers::match_describe_stacks_f35395f0327f376d6(result) {
63                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64            }
65            // Matches: {"output":{"path":"Stacks[].StackStatus","expected":"UPDATE_COMPLETE","comparator":"allStringEquals"}}
66            if crate::waiters::matchers::match_describe_stacks_dc87c5ac7c6a902ad(result) {
67                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
68            }
69            // Matches: {"output":{"path":"Stacks[].StackStatus","expected":"UPDATE_IN_PROGRESS","comparator":"allStringEquals"}}
70            if crate::waiters::matchers::match_describe_stacks_f8f6b044b99cc99bd(result) {
71                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
72            }
73            // Matches: {"output":{"path":"Stacks[].StackStatus","expected":"UPDATE_COMPLETE_CLEANUP_IN_PROGRESS","comparator":"allStringEquals"}}
74            if crate::waiters::matchers::match_describe_stacks_22b439202b116871b(result) {
75                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
76            }
77            // Matches: {"output":{"path":"Stacks[].StackStatus","expected":"UPDATE_FAILED","comparator":"allStringEquals"}}
78            if crate::waiters::matchers::match_describe_stacks_37db6852203f32d7f(result) {
79                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
80            }
81            // Matches: {"output":{"path":"Stacks[].StackStatus","expected":"UPDATE_ROLLBACK_IN_PROGRESS","comparator":"allStringEquals"}}
82            if crate::waiters::matchers::match_describe_stacks_e7d5a7b6d4760fc28(result) {
83                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
84            }
85            // Matches: {"output":{"path":"Stacks[].StackStatus","expected":"UPDATE_ROLLBACK_FAILED","comparator":"allStringEquals"}}
86            if crate::waiters::matchers::match_describe_stacks_3f3b8409d19eae7ad(result) {
87                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
88            }
89            // Matches: {"output":{"path":"Stacks[].StackStatus","expected":"UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS","comparator":"allStringEquals"}}
90            if crate::waiters::matchers::match_describe_stacks_f24e3cfbe8d3960ee(result) {
91                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
92            }
93            // Matches: {"output":{"path":"Stacks[].StackStatus","expected":"UPDATE_ROLLBACK_COMPLETE","comparator":"allStringEquals"}}
94            if crate::waiters::matchers::match_describe_stacks_eff5471a4e628d191(result) {
95                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
96            }
97            // Matches: {"output":{"path":"Stacks[].StackStatus","expected":"CREATE_FAILED","comparator":"anyStringEquals"}}
98            if crate::waiters::matchers::match_describe_stacks_60fe420bf487ae5bb(result) {
99                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
100            }
101            // Matches: {"output":{"path":"Stacks[].StackStatus","expected":"DELETE_COMPLETE","comparator":"anyStringEquals"}}
102            if crate::waiters::matchers::match_describe_stacks_f00be7fd1d73ae94d(result) {
103                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
104            }
105            // Matches: {"output":{"path":"Stacks[].StackStatus","expected":"DELETE_FAILED","comparator":"anyStringEquals"}}
106            if crate::waiters::matchers::match_describe_stacks_306ff5cd7dcb0b2f9(result) {
107                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
108            }
109            // Matches: {"output":{"path":"Stacks[].StackStatus","expected":"ROLLBACK_FAILED","comparator":"anyStringEquals"}}
110            if crate::waiters::matchers::match_describe_stacks_13ac2c766136b1660(result) {
111                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
112            }
113            // Matches: {"output":{"path":"Stacks[].StackStatus","expected":"ROLLBACK_COMPLETE","comparator":"anyStringEquals"}}
114            if crate::waiters::matchers::match_describe_stacks_682ca8dbac14bdcb2(result) {
115                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
116            }
117            // Matches: {"errorType":"ValidationError"}
118            if crate::waiters::matchers::match_describe_stacks_67b5dc55bf035ef25(result) {
119                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
120            }
121            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
122        };
123        let operation = move || {
124            let input = input.clone();
125            let runtime_plugins = runtime_plugins.clone();
126            async move { crate::operation::describe_stacks::DescribeStacks::orchestrate(&runtime_plugins, input).await }
127        };
128        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
129            .min_delay(::std::time::Duration::from_secs(30))
130            .max_delay(::std::time::Duration::from_secs(120))
131            .max_wait(max_wait)
132            .time_source(time_source)
133            .sleep_impl(sleep_impl)
134            .acceptor(acceptor)
135            .operation(operation)
136            .build();
137        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
138    }
139    /// <note>
140    /// <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>
141    /// <p>Consider using the <code>ListStacks</code> API if you're not passing a parameter to <code>StackName</code>.</p>
142    /// <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>
143    /// <p>{ "Version": "2012-10-17", "Statement": \[{ "Effect": "Deny", "Action": "cloudformation:DescribeStacks", "NotResource": "arn:aws:cloudformation:*:*:stack/*/*" }\] }</p>
144    /// </note>
145    /// <p>The name or the unique stack ID that's associated with the stack, which aren't always interchangeable:</p>
146    /// <ul>
147    /// <li>
148    /// <p>Running stacks: You can specify either the stack's name or its unique stack ID.</p></li>
149    /// <li>
150    /// <p>Deleted stacks: You must specify the unique stack ID.</p></li>
151    /// </ul>
152    /// <p>Default: There is no default value.</p>
153    pub fn stack_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
154        self.inner = self.inner.stack_name(input.into());
155        self
156    }
157    /// <note>
158    /// <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>
159    /// <p>Consider using the <code>ListStacks</code> API if you're not passing a parameter to <code>StackName</code>.</p>
160    /// <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>
161    /// <p>{ "Version": "2012-10-17", "Statement": \[{ "Effect": "Deny", "Action": "cloudformation:DescribeStacks", "NotResource": "arn:aws:cloudformation:*:*:stack/*/*" }\] }</p>
162    /// </note>
163    /// <p>The name or the unique stack ID that's associated with the stack, which aren't always interchangeable:</p>
164    /// <ul>
165    /// <li>
166    /// <p>Running stacks: You can specify either the stack's name or its unique stack ID.</p></li>
167    /// <li>
168    /// <p>Deleted stacks: You must specify the unique stack ID.</p></li>
169    /// </ul>
170    /// <p>Default: There is no default value.</p>
171    pub fn set_stack_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
172        self.inner = self.inner.set_stack_name(input);
173        self
174    }
175    /// <note>
176    /// <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>
177    /// <p>Consider using the <code>ListStacks</code> API if you're not passing a parameter to <code>StackName</code>.</p>
178    /// <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>
179    /// <p>{ "Version": "2012-10-17", "Statement": \[{ "Effect": "Deny", "Action": "cloudformation:DescribeStacks", "NotResource": "arn:aws:cloudformation:*:*:stack/*/*" }\] }</p>
180    /// </note>
181    /// <p>The name or the unique stack ID that's associated with the stack, which aren't always interchangeable:</p>
182    /// <ul>
183    /// <li>
184    /// <p>Running stacks: You can specify either the stack's name or its unique stack ID.</p></li>
185    /// <li>
186    /// <p>Deleted stacks: You must specify the unique stack ID.</p></li>
187    /// </ul>
188    /// <p>Default: There is no default value.</p>
189    pub fn get_stack_name(&self) -> &::std::option::Option<::std::string::String> {
190        self.inner.get_stack_name()
191    }
192    /// <p>A string that identifies the next page of stacks that you want to retrieve.</p>
193    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
194        self.inner = self.inner.next_token(input.into());
195        self
196    }
197    /// <p>A string that identifies the next page of stacks that you want to retrieve.</p>
198    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
199        self.inner = self.inner.set_next_token(input);
200        self
201    }
202    /// <p>A string that identifies the next page of stacks that you want to retrieve.</p>
203    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
204        self.inner.get_next_token()
205    }
206}
207
208/// Successful return type for the `stack_create_complete` waiter.
209pub type StackCreateCompleteFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
210    crate::operation::describe_stacks::DescribeStacksOutput,
211    ::aws_smithy_runtime_api::client::result::SdkError<
212        crate::operation::describe_stacks::DescribeStacksError,
213        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
214    >,
215>;
216
217/// Error type for the `stack_create_complete` waiter.
218pub type WaitUntilStackCreateCompleteError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
219    crate::operation::describe_stacks::DescribeStacksOutput,
220    crate::operation::describe_stacks::DescribeStacksError,
221>;