aws_sdk_cloudformation/waiters/
stack_delete_complete.rs

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