aws_sdk_opsworks/waiters/
instance_terminated.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `instance_terminated` 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 InstanceTerminatedFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_instances::builders::DescribeInstancesInputBuilder,
18}
19impl InstanceTerminatedFluentBuilder {
20    /// Creates a new `InstanceTerminatedFluentBuilder`.
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 DescribeInstances as a reference.
28    pub fn as_input(&self) -> &crate::operation::describe_instances::builders::DescribeInstancesInputBuilder {
29        &self.inner
30    }
31    /// Wait until OpsWorks instance is terminated.
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::instance_terminated::InstanceTerminatedFinalPoll,
37        crate::waiters::instance_terminated::WaitUntilInstanceTerminatedError,
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_instances::DescribeInstances::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_instances::DescribeInstancesOutput,
59            &crate::operation::describe_instances::DescribeInstancesError,
60        >| {
61            // Matches: {"output":{"path":"Instances[].Status","expected":"terminated","comparator":"allStringEquals"}}
62            if crate::waiters::matchers::match_describe_instances_7510952b0735ba013(result) {
63                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64            }
65            // Matches: {"errorType":"ResourceNotFoundException"}
66            if crate::waiters::matchers::match_describe_instances_1cce2c05524fb92d4(result) {
67                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
68            }
69            // Matches: {"output":{"path":"Instances[].Status","expected":"booting","comparator":"anyStringEquals"}}
70            if crate::waiters::matchers::match_describe_instances_3d4fffbbb77860e29(result) {
71                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
72            }
73            // Matches: {"output":{"path":"Instances[].Status","expected":"online","comparator":"anyStringEquals"}}
74            if crate::waiters::matchers::match_describe_instances_0ec6c686a5d9310f4(result) {
75                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
76            }
77            // Matches: {"output":{"path":"Instances[].Status","expected":"pending","comparator":"anyStringEquals"}}
78            if crate::waiters::matchers::match_describe_instances_a139a4c958fa25611(result) {
79                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
80            }
81            // Matches: {"output":{"path":"Instances[].Status","expected":"rebooting","comparator":"anyStringEquals"}}
82            if crate::waiters::matchers::match_describe_instances_5e5e2df8010ad623d(result) {
83                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
84            }
85            // Matches: {"output":{"path":"Instances[].Status","expected":"requested","comparator":"anyStringEquals"}}
86            if crate::waiters::matchers::match_describe_instances_23c8afba15d15ee2a(result) {
87                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
88            }
89            // Matches: {"output":{"path":"Instances[].Status","expected":"running_setup","comparator":"anyStringEquals"}}
90            if crate::waiters::matchers::match_describe_instances_0f39a1b9274d8ccda(result) {
91                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
92            }
93            // Matches: {"output":{"path":"Instances[].Status","expected":"setup_failed","comparator":"anyStringEquals"}}
94            if crate::waiters::matchers::match_describe_instances_ae8d9fe9dcb532dd4(result) {
95                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
96            }
97            // Matches: {"output":{"path":"Instances[].Status","expected":"start_failed","comparator":"anyStringEquals"}}
98            if crate::waiters::matchers::match_describe_instances_c942b3f1e73dfae7f(result) {
99                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
100            }
101            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
102        };
103        let operation = move || {
104            let input = input.clone();
105            let runtime_plugins = runtime_plugins.clone();
106            async move { crate::operation::describe_instances::DescribeInstances::orchestrate(&runtime_plugins, input).await }
107        };
108        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
109            .min_delay(::std::time::Duration::from_secs(15))
110            .max_delay(::std::time::Duration::from_secs(120))
111            .max_wait(max_wait)
112            .time_source(time_source)
113            .sleep_impl(sleep_impl)
114            .acceptor(acceptor)
115            .operation(operation)
116            .build();
117        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
118    }
119    /// <p>A stack ID. If you use this parameter, <code>DescribeInstances</code> returns descriptions of the instances associated with the specified stack.</p>
120    pub fn stack_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
121        self.inner = self.inner.stack_id(input.into());
122        self
123    }
124    /// <p>A stack ID. If you use this parameter, <code>DescribeInstances</code> returns descriptions of the instances associated with the specified stack.</p>
125    pub fn set_stack_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
126        self.inner = self.inner.set_stack_id(input);
127        self
128    }
129    /// <p>A stack ID. If you use this parameter, <code>DescribeInstances</code> returns descriptions of the instances associated with the specified stack.</p>
130    pub fn get_stack_id(&self) -> &::std::option::Option<::std::string::String> {
131        self.inner.get_stack_id()
132    }
133    /// <p>A layer ID. If you use this parameter, <code>DescribeInstances</code> returns descriptions of the instances associated with the specified layer.</p>
134    pub fn layer_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
135        self.inner = self.inner.layer_id(input.into());
136        self
137    }
138    /// <p>A layer ID. If you use this parameter, <code>DescribeInstances</code> returns descriptions of the instances associated with the specified layer.</p>
139    pub fn set_layer_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140        self.inner = self.inner.set_layer_id(input);
141        self
142    }
143    /// <p>A layer ID. If you use this parameter, <code>DescribeInstances</code> returns descriptions of the instances associated with the specified layer.</p>
144    pub fn get_layer_id(&self) -> &::std::option::Option<::std::string::String> {
145        self.inner.get_layer_id()
146    }
147    ///
148    /// Appends an item to `InstanceIds`.
149    ///
150    /// To override the contents of this collection use [`set_instance_ids`](Self::set_instance_ids).
151    ///
152    /// <p>An array of instance IDs to be described. If you use this parameter, <code>DescribeInstances</code> returns a description of the specified instances. Otherwise, it returns a description of every instance.</p>
153    pub fn instance_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
154        self.inner = self.inner.instance_ids(input.into());
155        self
156    }
157    /// <p>An array of instance IDs to be described. If you use this parameter, <code>DescribeInstances</code> returns a description of the specified instances. Otherwise, it returns a description of every instance.</p>
158    pub fn set_instance_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
159        self.inner = self.inner.set_instance_ids(input);
160        self
161    }
162    /// <p>An array of instance IDs to be described. If you use this parameter, <code>DescribeInstances</code> returns a description of the specified instances. Otherwise, it returns a description of every instance.</p>
163    pub fn get_instance_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
164        self.inner.get_instance_ids()
165    }
166}
167
168/// Successful return type for the `instance_terminated` waiter.
169pub type InstanceTerminatedFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
170    crate::operation::describe_instances::DescribeInstancesOutput,
171    ::aws_smithy_runtime_api::client::result::SdkError<
172        crate::operation::describe_instances::DescribeInstancesError,
173        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
174    >,
175>;
176
177/// Error type for the `instance_terminated` waiter.
178pub type WaitUntilInstanceTerminatedError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
179    crate::operation::describe_instances::DescribeInstancesOutput,
180    crate::operation::describe_instances::DescribeInstancesError,
181>;