aws_sdk_opsworks/waiters/
instance_online.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `instance_online` 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 InstanceOnlineFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_instances::builders::DescribeInstancesInputBuilder,
18}
19impl InstanceOnlineFluentBuilder {
20    /// Creates a new `InstanceOnlineFluentBuilder`.
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 online.
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<crate::waiters::instance_online::InstanceOnlineFinalPoll, crate::waiters::instance_online::WaitUntilInstanceOnlineError>
36    {
37        let input = self
38            .inner
39            .build()
40            .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
41        let runtime_plugins = crate::operation::describe_instances::DescribeInstances::operation_runtime_plugins(
42            self.handle.runtime_plugins.clone(),
43            &self.handle.conf,
44            ::std::option::Option::None,
45        )
46        .with_operation_plugin(crate::sdk_feature_tracker::waiter::WaiterFeatureTrackerRuntimePlugin::new());
47        let mut cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
48        let runtime_components_builder = runtime_plugins
49            .apply_client_configuration(&mut cfg)
50            .map_err(::aws_smithy_runtime_api::client::waiters::error::WaiterError::construction_failure)?;
51        let time_components = runtime_components_builder.into_time_components();
52        let sleep_impl = time_components.sleep_impl().expect("a sleep impl is required by waiters");
53        let time_source = time_components.time_source().expect("a time source is required by waiters");
54
55        let acceptor = move |result: ::std::result::Result<
56            &crate::operation::describe_instances::DescribeInstancesOutput,
57            &crate::operation::describe_instances::DescribeInstancesError,
58        >| {
59            // Matches: {"output":{"path":"Instances[].Status","expected":"online","comparator":"allStringEquals"}}
60            if crate::waiters::matchers::match_describe_instances_879e5860f33174a71(result) {
61                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
62            }
63            // Matches: {"output":{"path":"Instances[].Status","expected":"setup_failed","comparator":"anyStringEquals"}}
64            if crate::waiters::matchers::match_describe_instances_ae8d9fe9dcb532dd4(result) {
65                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
66            }
67            // Matches: {"output":{"path":"Instances[].Status","expected":"shutting_down","comparator":"anyStringEquals"}}
68            if crate::waiters::matchers::match_describe_instances_cb65e3427d01d7667(result) {
69                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
70            }
71            // Matches: {"output":{"path":"Instances[].Status","expected":"start_failed","comparator":"anyStringEquals"}}
72            if crate::waiters::matchers::match_describe_instances_c942b3f1e73dfae7f(result) {
73                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
74            }
75            // Matches: {"output":{"path":"Instances[].Status","expected":"stopped","comparator":"anyStringEquals"}}
76            if crate::waiters::matchers::match_describe_instances_dad92608d71b243c3(result) {
77                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
78            }
79            // Matches: {"output":{"path":"Instances[].Status","expected":"stopping","comparator":"anyStringEquals"}}
80            if crate::waiters::matchers::match_describe_instances_6eb5e99b738450c30(result) {
81                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
82            }
83            // Matches: {"output":{"path":"Instances[].Status","expected":"terminating","comparator":"anyStringEquals"}}
84            if crate::waiters::matchers::match_describe_instances_f086d9d7330075a64(result) {
85                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
86            }
87            // Matches: {"output":{"path":"Instances[].Status","expected":"terminated","comparator":"anyStringEquals"}}
88            if crate::waiters::matchers::match_describe_instances_e88d0bb4db07224fa(result) {
89                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
90            }
91            // Matches: {"output":{"path":"Instances[].Status","expected":"stop_failed","comparator":"anyStringEquals"}}
92            if crate::waiters::matchers::match_describe_instances_8d7f49fcbbbfabdf5(result) {
93                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
94            }
95            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
96        };
97        let operation = move || {
98            let input = input.clone();
99            let runtime_plugins = runtime_plugins.clone();
100            async move { crate::operation::describe_instances::DescribeInstances::orchestrate(&runtime_plugins, input).await }
101        };
102        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
103            .min_delay(::std::time::Duration::from_secs(15))
104            .max_delay(::std::time::Duration::from_secs(120))
105            .max_wait(max_wait)
106            .time_source(time_source)
107            .sleep_impl(sleep_impl)
108            .acceptor(acceptor)
109            .operation(operation)
110            .build();
111        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
112    }
113    /// <p>A stack ID. If you use this parameter, <code>DescribeInstances</code> returns descriptions of the instances associated with the specified stack.</p>
114    pub fn stack_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115        self.inner = self.inner.stack_id(input.into());
116        self
117    }
118    /// <p>A stack ID. If you use this parameter, <code>DescribeInstances</code> returns descriptions of the instances associated with the specified stack.</p>
119    pub fn set_stack_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120        self.inner = self.inner.set_stack_id(input);
121        self
122    }
123    /// <p>A stack ID. If you use this parameter, <code>DescribeInstances</code> returns descriptions of the instances associated with the specified stack.</p>
124    pub fn get_stack_id(&self) -> &::std::option::Option<::std::string::String> {
125        self.inner.get_stack_id()
126    }
127    /// <p>A layer ID. If you use this parameter, <code>DescribeInstances</code> returns descriptions of the instances associated with the specified layer.</p>
128    pub fn layer_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129        self.inner = self.inner.layer_id(input.into());
130        self
131    }
132    /// <p>A layer ID. If you use this parameter, <code>DescribeInstances</code> returns descriptions of the instances associated with the specified layer.</p>
133    pub fn set_layer_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
134        self.inner = self.inner.set_layer_id(input);
135        self
136    }
137    /// <p>A layer ID. If you use this parameter, <code>DescribeInstances</code> returns descriptions of the instances associated with the specified layer.</p>
138    pub fn get_layer_id(&self) -> &::std::option::Option<::std::string::String> {
139        self.inner.get_layer_id()
140    }
141    ///
142    /// Appends an item to `InstanceIds`.
143    ///
144    /// To override the contents of this collection use [`set_instance_ids`](Self::set_instance_ids).
145    ///
146    /// <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>
147    pub fn instance_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
148        self.inner = self.inner.instance_ids(input.into());
149        self
150    }
151    /// <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>
152    pub fn set_instance_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
153        self.inner = self.inner.set_instance_ids(input);
154        self
155    }
156    /// <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>
157    pub fn get_instance_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
158        self.inner.get_instance_ids()
159    }
160}
161
162/// Successful return type for the `instance_online` waiter.
163pub type InstanceOnlineFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
164    crate::operation::describe_instances::DescribeInstancesOutput,
165    ::aws_smithy_runtime_api::client::result::SdkError<
166        crate::operation::describe_instances::DescribeInstancesError,
167        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
168    >,
169>;
170
171/// Error type for the `instance_online` waiter.
172pub type WaitUntilInstanceOnlineError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
173    crate::operation::describe_instances::DescribeInstancesOutput,
174    crate::operation::describe_instances::DescribeInstancesError,
175>;