aws_sdk_ec2/waiters/
instance_status_ok.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `instance_status_ok` 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 InstanceStatusOkFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_instance_status::builders::DescribeInstanceStatusInputBuilder,
18}
19impl InstanceStatusOkFluentBuilder {
20    /// Creates a new `InstanceStatusOkFluentBuilder`.
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 DescribeInstanceStatus as a reference.
28    pub fn as_input(&self) -> &crate::operation::describe_instance_status::builders::DescribeInstanceStatusInputBuilder {
29        &self.inner
30    }
31    /// Wait for `instance_status_ok`
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<
36        crate::waiters::instance_status_ok::InstanceStatusOkFinalPoll,
37        crate::waiters::instance_status_ok::WaitUntilInstanceStatusOkError,
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_instance_status::DescribeInstanceStatus::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_instance_status::DescribeInstanceStatusOutput,
59            &crate::operation::describe_instance_status::DescribeInstanceStatusError,
60        >| {
61            // Matches: {"output":{"path":"InstanceStatuses[].InstanceStatus.Status","expected":"ok","comparator":"allStringEquals"}}
62            if crate::waiters::matchers::match_describe_instance_status_18d8df0a3dbc1c894(result) {
63                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
64            }
65            // Matches: {"errorType":"InvalidInstanceID.NotFound"}
66            if crate::waiters::matchers::match_describe_instance_status_c46b5661fd6e97d44(result) {
67                return ::aws_smithy_runtime::client::waiters::AcceptorState::Retry;
68            }
69            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
70        };
71        let operation = move || {
72            let input = input.clone();
73            let runtime_plugins = runtime_plugins.clone();
74            async move { crate::operation::describe_instance_status::DescribeInstanceStatus::orchestrate(&runtime_plugins, input).await }
75        };
76        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
77            .min_delay(::std::time::Duration::from_secs(15))
78            .max_delay(::std::time::Duration::from_secs(120))
79            .max_wait(max_wait)
80            .time_source(time_source)
81            .sleep_impl(sleep_impl)
82            .acceptor(acceptor)
83            .operation(operation)
84            .build();
85        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
86    }
87    ///
88    /// Appends an item to `InstanceIds`.
89    ///
90    /// To override the contents of this collection use [`set_instance_ids`](Self::set_instance_ids).
91    ///
92    /// <p>The instance IDs.</p>
93    /// <p>Default: Describes all your instances.</p>
94    /// <p>Constraints: Maximum 100 explicitly specified instance IDs.</p>
95    pub fn instance_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
96        self.inner = self.inner.instance_ids(input.into());
97        self
98    }
99    /// <p>The instance IDs.</p>
100    /// <p>Default: Describes all your instances.</p>
101    /// <p>Constraints: Maximum 100 explicitly specified instance IDs.</p>
102    pub fn set_instance_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
103        self.inner = self.inner.set_instance_ids(input);
104        self
105    }
106    /// <p>The instance IDs.</p>
107    /// <p>Default: Describes all your instances.</p>
108    /// <p>Constraints: Maximum 100 explicitly specified instance IDs.</p>
109    pub fn get_instance_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
110        self.inner.get_instance_ids()
111    }
112    /// <p>The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
113    /// <p>You cannot specify this parameter and the instance IDs parameter in the same request.</p>
114    pub fn max_results(mut self, input: i32) -> Self {
115        self.inner = self.inner.max_results(input);
116        self
117    }
118    /// <p>The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
119    /// <p>You cannot specify this parameter and the instance IDs parameter in the same request.</p>
120    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
121        self.inner = self.inner.set_max_results(input);
122        self
123    }
124    /// <p>The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
125    /// <p>You cannot specify this parameter and the instance IDs parameter in the same request.</p>
126    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
127        self.inner.get_max_results()
128    }
129    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
130    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.inner = self.inner.next_token(input.into());
132        self
133    }
134    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
135    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.inner = self.inner.set_next_token(input);
137        self
138    }
139    /// <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
140    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
141        self.inner.get_next_token()
142    }
143    /// <p>Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
144    pub fn dry_run(mut self, input: bool) -> Self {
145        self.inner = self.inner.dry_run(input);
146        self
147    }
148    /// <p>Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
149    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
150        self.inner = self.inner.set_dry_run(input);
151        self
152    }
153    /// <p>Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
154    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
155        self.inner.get_dry_run()
156    }
157    ///
158    /// Appends an item to `Filters`.
159    ///
160    /// To override the contents of this collection use [`set_filters`](Self::set_filters).
161    ///
162    /// <p>The filters.</p>
163    /// <ul>
164    /// <li>
165    /// <p><code>availability-zone</code> - The Availability Zone of the instance.</p></li>
166    /// <li>
167    /// <p><code>event.code</code> - The code for the scheduled event (<code>instance-reboot</code> | <code>system-reboot</code> | <code>system-maintenance</code> | <code>instance-retirement</code> | <code>instance-stop</code>).</p></li>
168    /// <li>
169    /// <p><code>event.description</code> - A description of the event.</p></li>
170    /// <li>
171    /// <p><code>event.instance-event-id</code> - The ID of the event whose date and time you are modifying.</p></li>
172    /// <li>
173    /// <p><code>event.not-after</code> - The latest end time for the scheduled event (for example, <code>2014-09-15T17:15:20.000Z</code>).</p></li>
174    /// <li>
175    /// <p><code>event.not-before</code> - The earliest start time for the scheduled event (for example, <code>2014-09-15T17:15:20.000Z</code>).</p></li>
176    /// <li>
177    /// <p><code>event.not-before-deadline</code> - The deadline for starting the event (for example, <code>2014-09-15T17:15:20.000Z</code>).</p></li>
178    /// <li>
179    /// <p><code>instance-state-code</code> - The code for the instance state, as a 16-bit unsigned integer. The high byte is used for internal purposes and should be ignored. The low byte is set based on the state represented. The valid values are 0 (pending), 16 (running), 32 (shutting-down), 48 (terminated), 64 (stopping), and 80 (stopped).</p></li>
180    /// <li>
181    /// <p><code>instance-state-name</code> - The state of the instance (<code>pending</code> | <code>running</code> | <code>shutting-down</code> | <code>terminated</code> | <code>stopping</code> | <code>stopped</code>).</p></li>
182    /// <li>
183    /// <p><code>instance-status.reachability</code> - Filters on instance status where the name is <code>reachability</code> (<code>passed</code> | <code>failed</code> | <code>initializing</code> | <code>insufficient-data</code>).</p></li>
184    /// <li>
185    /// <p><code>instance-status.status</code> - The status of the instance (<code>ok</code> | <code>impaired</code> | <code>initializing</code> | <code>insufficient-data</code> | <code>not-applicable</code>).</p></li>
186    /// <li>
187    /// <p><code>operator.managed</code> - A Boolean that indicates whether this is a managed instance.</p></li>
188    /// <li>
189    /// <p><code>operator.principal</code> - The principal that manages the instance. Only valid for managed instances, where <code>managed</code> is <code>true</code>.</p></li>
190    /// <li>
191    /// <p><code>system-status.reachability</code> - Filters on system status where the name is <code>reachability</code> (<code>passed</code> | <code>failed</code> | <code>initializing</code> | <code>insufficient-data</code>).</p></li>
192    /// <li>
193    /// <p><code>system-status.status</code> - The system status of the instance (<code>ok</code> | <code>impaired</code> | <code>initializing</code> | <code>insufficient-data</code> | <code>not-applicable</code>).</p></li>
194    /// <li>
195    /// <p><code>attached-ebs-status.status</code> - The status of the attached EBS volume for the instance (<code>ok</code> | <code>impaired</code> | <code>initializing</code> | <code>insufficient-data</code> | <code>not-applicable</code>).</p></li>
196    /// </ul>
197    pub fn filters(mut self, input: crate::types::Filter) -> Self {
198        self.inner = self.inner.filters(input);
199        self
200    }
201    /// <p>The filters.</p>
202    /// <ul>
203    /// <li>
204    /// <p><code>availability-zone</code> - The Availability Zone of the instance.</p></li>
205    /// <li>
206    /// <p><code>event.code</code> - The code for the scheduled event (<code>instance-reboot</code> | <code>system-reboot</code> | <code>system-maintenance</code> | <code>instance-retirement</code> | <code>instance-stop</code>).</p></li>
207    /// <li>
208    /// <p><code>event.description</code> - A description of the event.</p></li>
209    /// <li>
210    /// <p><code>event.instance-event-id</code> - The ID of the event whose date and time you are modifying.</p></li>
211    /// <li>
212    /// <p><code>event.not-after</code> - The latest end time for the scheduled event (for example, <code>2014-09-15T17:15:20.000Z</code>).</p></li>
213    /// <li>
214    /// <p><code>event.not-before</code> - The earliest start time for the scheduled event (for example, <code>2014-09-15T17:15:20.000Z</code>).</p></li>
215    /// <li>
216    /// <p><code>event.not-before-deadline</code> - The deadline for starting the event (for example, <code>2014-09-15T17:15:20.000Z</code>).</p></li>
217    /// <li>
218    /// <p><code>instance-state-code</code> - The code for the instance state, as a 16-bit unsigned integer. The high byte is used for internal purposes and should be ignored. The low byte is set based on the state represented. The valid values are 0 (pending), 16 (running), 32 (shutting-down), 48 (terminated), 64 (stopping), and 80 (stopped).</p></li>
219    /// <li>
220    /// <p><code>instance-state-name</code> - The state of the instance (<code>pending</code> | <code>running</code> | <code>shutting-down</code> | <code>terminated</code> | <code>stopping</code> | <code>stopped</code>).</p></li>
221    /// <li>
222    /// <p><code>instance-status.reachability</code> - Filters on instance status where the name is <code>reachability</code> (<code>passed</code> | <code>failed</code> | <code>initializing</code> | <code>insufficient-data</code>).</p></li>
223    /// <li>
224    /// <p><code>instance-status.status</code> - The status of the instance (<code>ok</code> | <code>impaired</code> | <code>initializing</code> | <code>insufficient-data</code> | <code>not-applicable</code>).</p></li>
225    /// <li>
226    /// <p><code>operator.managed</code> - A Boolean that indicates whether this is a managed instance.</p></li>
227    /// <li>
228    /// <p><code>operator.principal</code> - The principal that manages the instance. Only valid for managed instances, where <code>managed</code> is <code>true</code>.</p></li>
229    /// <li>
230    /// <p><code>system-status.reachability</code> - Filters on system status where the name is <code>reachability</code> (<code>passed</code> | <code>failed</code> | <code>initializing</code> | <code>insufficient-data</code>).</p></li>
231    /// <li>
232    /// <p><code>system-status.status</code> - The system status of the instance (<code>ok</code> | <code>impaired</code> | <code>initializing</code> | <code>insufficient-data</code> | <code>not-applicable</code>).</p></li>
233    /// <li>
234    /// <p><code>attached-ebs-status.status</code> - The status of the attached EBS volume for the instance (<code>ok</code> | <code>impaired</code> | <code>initializing</code> | <code>insufficient-data</code> | <code>not-applicable</code>).</p></li>
235    /// </ul>
236    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Filter>>) -> Self {
237        self.inner = self.inner.set_filters(input);
238        self
239    }
240    /// <p>The filters.</p>
241    /// <ul>
242    /// <li>
243    /// <p><code>availability-zone</code> - The Availability Zone of the instance.</p></li>
244    /// <li>
245    /// <p><code>event.code</code> - The code for the scheduled event (<code>instance-reboot</code> | <code>system-reboot</code> | <code>system-maintenance</code> | <code>instance-retirement</code> | <code>instance-stop</code>).</p></li>
246    /// <li>
247    /// <p><code>event.description</code> - A description of the event.</p></li>
248    /// <li>
249    /// <p><code>event.instance-event-id</code> - The ID of the event whose date and time you are modifying.</p></li>
250    /// <li>
251    /// <p><code>event.not-after</code> - The latest end time for the scheduled event (for example, <code>2014-09-15T17:15:20.000Z</code>).</p></li>
252    /// <li>
253    /// <p><code>event.not-before</code> - The earliest start time for the scheduled event (for example, <code>2014-09-15T17:15:20.000Z</code>).</p></li>
254    /// <li>
255    /// <p><code>event.not-before-deadline</code> - The deadline for starting the event (for example, <code>2014-09-15T17:15:20.000Z</code>).</p></li>
256    /// <li>
257    /// <p><code>instance-state-code</code> - The code for the instance state, as a 16-bit unsigned integer. The high byte is used for internal purposes and should be ignored. The low byte is set based on the state represented. The valid values are 0 (pending), 16 (running), 32 (shutting-down), 48 (terminated), 64 (stopping), and 80 (stopped).</p></li>
258    /// <li>
259    /// <p><code>instance-state-name</code> - The state of the instance (<code>pending</code> | <code>running</code> | <code>shutting-down</code> | <code>terminated</code> | <code>stopping</code> | <code>stopped</code>).</p></li>
260    /// <li>
261    /// <p><code>instance-status.reachability</code> - Filters on instance status where the name is <code>reachability</code> (<code>passed</code> | <code>failed</code> | <code>initializing</code> | <code>insufficient-data</code>).</p></li>
262    /// <li>
263    /// <p><code>instance-status.status</code> - The status of the instance (<code>ok</code> | <code>impaired</code> | <code>initializing</code> | <code>insufficient-data</code> | <code>not-applicable</code>).</p></li>
264    /// <li>
265    /// <p><code>operator.managed</code> - A Boolean that indicates whether this is a managed instance.</p></li>
266    /// <li>
267    /// <p><code>operator.principal</code> - The principal that manages the instance. Only valid for managed instances, where <code>managed</code> is <code>true</code>.</p></li>
268    /// <li>
269    /// <p><code>system-status.reachability</code> - Filters on system status where the name is <code>reachability</code> (<code>passed</code> | <code>failed</code> | <code>initializing</code> | <code>insufficient-data</code>).</p></li>
270    /// <li>
271    /// <p><code>system-status.status</code> - The system status of the instance (<code>ok</code> | <code>impaired</code> | <code>initializing</code> | <code>insufficient-data</code> | <code>not-applicable</code>).</p></li>
272    /// <li>
273    /// <p><code>attached-ebs-status.status</code> - The status of the attached EBS volume for the instance (<code>ok</code> | <code>impaired</code> | <code>initializing</code> | <code>insufficient-data</code> | <code>not-applicable</code>).</p></li>
274    /// </ul>
275    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Filter>> {
276        self.inner.get_filters()
277    }
278    /// <p>When <code>true</code>, includes the health status for all instances. When <code>false</code>, includes the health status for running instances only.</p>
279    /// <p>Default: <code>false</code></p>
280    pub fn include_all_instances(mut self, input: bool) -> Self {
281        self.inner = self.inner.include_all_instances(input);
282        self
283    }
284    /// <p>When <code>true</code>, includes the health status for all instances. When <code>false</code>, includes the health status for running instances only.</p>
285    /// <p>Default: <code>false</code></p>
286    pub fn set_include_all_instances(mut self, input: ::std::option::Option<bool>) -> Self {
287        self.inner = self.inner.set_include_all_instances(input);
288        self
289    }
290    /// <p>When <code>true</code>, includes the health status for all instances. When <code>false</code>, includes the health status for running instances only.</p>
291    /// <p>Default: <code>false</code></p>
292    pub fn get_include_all_instances(&self) -> &::std::option::Option<bool> {
293        self.inner.get_include_all_instances()
294    }
295}
296
297/// Successful return type for the `instance_status_ok` waiter.
298pub type InstanceStatusOkFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
299    crate::operation::describe_instance_status::DescribeInstanceStatusOutput,
300    ::aws_smithy_runtime_api::client::result::SdkError<
301        crate::operation::describe_instance_status::DescribeInstanceStatusError,
302        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
303    >,
304>;
305
306/// Error type for the `instance_status_ok` waiter.
307pub type WaitUntilInstanceStatusOkError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
308    crate::operation::describe_instance_status::DescribeInstanceStatusOutput,
309    crate::operation::describe_instance_status::DescribeInstanceStatusError,
310>;