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 /// <p>Default: There is no default value.</p>
121 pub fn stack_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
122 self.inner = self.inner.stack_name(input.into());
123 self
124 }
125 /// <note>
126 /// <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>
127 /// <p>Consider using the <code>ListStacks</code> API if you're not passing a parameter to <code>StackName</code>.</p>
128 /// <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>
129 /// <p>{ "Version": "2012-10-17", "Statement": \[{ "Effect": "Deny", "Action": "cloudformation:DescribeStacks", "NotResource": "arn:aws:cloudformation:*:*:stack/*/*" }\] }</p>
130 /// </note>
131 /// <p>The name or the unique stack ID that's associated with the stack, which aren't always interchangeable:</p>
132 /// <ul>
133 /// <li>
134 /// <p>Running stacks: You can specify either the stack's name or its unique stack ID.</p></li>
135 /// <li>
136 /// <p>Deleted stacks: You must specify the unique stack ID.</p></li>
137 /// </ul>
138 /// <p>Default: There is no default value.</p>
139 pub fn set_stack_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140 self.inner = self.inner.set_stack_name(input);
141 self
142 }
143 /// <note>
144 /// <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>
145 /// <p>Consider using the <code>ListStacks</code> API if you're not passing a parameter to <code>StackName</code>.</p>
146 /// <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>
147 /// <p>{ "Version": "2012-10-17", "Statement": \[{ "Effect": "Deny", "Action": "cloudformation:DescribeStacks", "NotResource": "arn:aws:cloudformation:*:*:stack/*/*" }\] }</p>
148 /// </note>
149 /// <p>The name or the unique stack ID that's associated with the stack, which aren't always interchangeable:</p>
150 /// <ul>
151 /// <li>
152 /// <p>Running stacks: You can specify either the stack's name or its unique stack ID.</p></li>
153 /// <li>
154 /// <p>Deleted stacks: You must specify the unique stack ID.</p></li>
155 /// </ul>
156 /// <p>Default: There is no default value.</p>
157 pub fn get_stack_name(&self) -> &::std::option::Option<::std::string::String> {
158 self.inner.get_stack_name()
159 }
160 /// <p>A string that identifies the next page of stacks that you want to retrieve.</p>
161 pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
162 self.inner = self.inner.next_token(input.into());
163 self
164 }
165 /// <p>A string that identifies the next page of stacks that you want to retrieve.</p>
166 pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
167 self.inner = self.inner.set_next_token(input);
168 self
169 }
170 /// <p>A string that identifies the next page of stacks that you want to retrieve.</p>
171 pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
172 self.inner.get_next_token()
173 }
174}
175
176/// Successful return type for the `stack_import_complete` waiter.
177pub type StackImportCompleteFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
178 crate::operation::describe_stacks::DescribeStacksOutput,
179 ::aws_smithy_runtime_api::client::result::SdkError<
180 crate::operation::describe_stacks::DescribeStacksError,
181 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
182 >,
183>;
184
185/// Error type for the `stack_import_complete` waiter.
186pub type WaitUntilStackImportCompleteError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
187 crate::operation::describe_stacks::DescribeStacksOutput,
188 crate::operation::describe_stacks::DescribeStacksError,
189>;