aws_sdk_cloudformation/waiters/
stack_import_complete.rs

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