aws_sdk_opsworks/waiters/
instance_stopped.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `instance_stopped` 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 InstanceStoppedFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_instances::builders::DescribeInstancesInputBuilder,
18}
19impl InstanceStoppedFluentBuilder {
20    /// Creates a new `InstanceStoppedFluentBuilder`.
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 stopped.
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::instance_stopped::InstanceStoppedFinalPoll,
37        crate::waiters::instance_stopped::WaitUntilInstanceStoppedError,
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":"stopped","comparator":"allStringEquals"}}
62            if crate::waiters::matchers::match_describe_instances_e418e6a07b1ce7336(result) {
63                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64            }
65            // Matches: {"output":{"path":"Instances[].Status","expected":"booting","comparator":"anyStringEquals"}}
66            if crate::waiters::matchers::match_describe_instances_3d4fffbbb77860e29(result) {
67                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
68            }
69            // Matches: {"output":{"path":"Instances[].Status","expected":"pending","comparator":"anyStringEquals"}}
70            if crate::waiters::matchers::match_describe_instances_a139a4c958fa25611(result) {
71                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
72            }
73            // Matches: {"output":{"path":"Instances[].Status","expected":"rebooting","comparator":"anyStringEquals"}}
74            if crate::waiters::matchers::match_describe_instances_5e5e2df8010ad623d(result) {
75                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
76            }
77            // Matches: {"output":{"path":"Instances[].Status","expected":"requested","comparator":"anyStringEquals"}}
78            if crate::waiters::matchers::match_describe_instances_23c8afba15d15ee2a(result) {
79                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
80            }
81            // Matches: {"output":{"path":"Instances[].Status","expected":"running_setup","comparator":"anyStringEquals"}}
82            if crate::waiters::matchers::match_describe_instances_0f39a1b9274d8ccda(result) {
83                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
84            }
85            // Matches: {"output":{"path":"Instances[].Status","expected":"setup_failed","comparator":"anyStringEquals"}}
86            if crate::waiters::matchers::match_describe_instances_ae8d9fe9dcb532dd4(result) {
87                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
88            }
89            // Matches: {"output":{"path":"Instances[].Status","expected":"start_failed","comparator":"anyStringEquals"}}
90            if crate::waiters::matchers::match_describe_instances_c942b3f1e73dfae7f(result) {
91                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
92            }
93            // Matches: {"output":{"path":"Instances[].Status","expected":"stop_failed","comparator":"anyStringEquals"}}
94            if crate::waiters::matchers::match_describe_instances_8d7f49fcbbbfabdf5(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_instances::DescribeInstances::orchestrate(&runtime_plugins, input).await }
103        };
104        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
105            .min_delay(::std::time::Duration::from_secs(15))
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    /// <p>A stack ID. If you use this parameter, <code>DescribeInstances</code> returns descriptions of the instances associated with the specified stack.</p>
116    pub fn stack_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117        self.inner = self.inner.stack_id(input.into());
118        self
119    }
120    /// <p>A stack ID. If you use this parameter, <code>DescribeInstances</code> returns descriptions of the instances associated with the specified stack.</p>
121    pub fn set_stack_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122        self.inner = self.inner.set_stack_id(input);
123        self
124    }
125    /// <p>A stack ID. If you use this parameter, <code>DescribeInstances</code> returns descriptions of the instances associated with the specified stack.</p>
126    pub fn get_stack_id(&self) -> &::std::option::Option<::std::string::String> {
127        self.inner.get_stack_id()
128    }
129    /// <p>A layer ID. If you use this parameter, <code>DescribeInstances</code> returns descriptions of the instances associated with the specified layer.</p>
130    pub fn layer_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.inner = self.inner.layer_id(input.into());
132        self
133    }
134    /// <p>A layer ID. If you use this parameter, <code>DescribeInstances</code> returns descriptions of the instances associated with the specified layer.</p>
135    pub fn set_layer_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.inner = self.inner.set_layer_id(input);
137        self
138    }
139    /// <p>A layer ID. If you use this parameter, <code>DescribeInstances</code> returns descriptions of the instances associated with the specified layer.</p>
140    pub fn get_layer_id(&self) -> &::std::option::Option<::std::string::String> {
141        self.inner.get_layer_id()
142    }
143    ///
144    /// Appends an item to `InstanceIds`.
145    ///
146    /// To override the contents of this collection use [`set_instance_ids`](Self::set_instance_ids).
147    ///
148    /// <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>
149    pub fn instance_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
150        self.inner = self.inner.instance_ids(input.into());
151        self
152    }
153    /// <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>
154    pub fn set_instance_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
155        self.inner = self.inner.set_instance_ids(input);
156        self
157    }
158    /// <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>
159    pub fn get_instance_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
160        self.inner.get_instance_ids()
161    }
162}
163
164/// Successful return type for the `instance_stopped` waiter.
165pub type InstanceStoppedFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
166    crate::operation::describe_instances::DescribeInstancesOutput,
167    ::aws_smithy_runtime_api::client::result::SdkError<
168        crate::operation::describe_instances::DescribeInstancesError,
169        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
170    >,
171>;
172
173/// Error type for the `instance_stopped` waiter.
174pub type WaitUntilInstanceStoppedError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
175    crate::operation::describe_instances::DescribeInstancesOutput,
176    crate::operation::describe_instances::DescribeInstancesError,
177>;