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