aws_sdk_ecs/waiters/
services_stable.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3///
4/// Fluent builder for the `services_stable` 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 ServicesStableFluentBuilder {
16    handle: ::std::sync::Arc<crate::client::Handle>,
17    inner: crate::operation::describe_services::builders::DescribeServicesInputBuilder,
18}
19impl ServicesStableFluentBuilder {
20    /// Creates a new `ServicesStableFluentBuilder`.
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 DescribeServices as a reference.
28    pub fn as_input(&self) -> &crate::operation::describe_services::builders::DescribeServicesInputBuilder {
29        &self.inner
30    }
31    /// Wait for `services_stable`
32    pub async fn wait(
33        self,
34        max_wait: ::std::time::Duration,
35    ) -> ::std::result::Result<crate::waiters::services_stable::ServicesStableFinalPoll, crate::waiters::services_stable::WaitUntilServicesStableError>
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_services::DescribeServices::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_services::DescribeServicesOutput,
57            &crate::operation::describe_services::DescribeServicesError,
58        >| {
59            // Matches: {"output":{"path":"failures[].reason","expected":"MISSING","comparator":"anyStringEquals"}}
60            if crate::waiters::matchers::match_describe_services_499ce94a3ac316e04(result) {
61                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
62            }
63            // Matches: {"output":{"path":"services[].status","expected":"DRAINING","comparator":"anyStringEquals"}}
64            if crate::waiters::matchers::match_describe_services_3aec8b75baa95f8d0(result) {
65                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
66            }
67            // Matches: {"output":{"path":"services[].status","expected":"INACTIVE","comparator":"anyStringEquals"}}
68            if crate::waiters::matchers::match_describe_services_8f2b7a2837e52f740(result) {
69                return ::aws_smithy_runtime::client::waiters::AcceptorState::Failure;
70            }
71            // Matches: {"output":{"path":"length(services[?!(length(deployments) == `1` && runningCount == desiredCount)]) == `0`","expected":"true","comparator":"booleanEquals"}}
72            if crate::waiters::matchers::match_describe_services_714c843e63d34632d(result) {
73                return ::aws_smithy_runtime::client::waiters::AcceptorState::Success;
74            }
75            ::aws_smithy_runtime::client::waiters::AcceptorState::NoAcceptorsMatched
76        };
77        let operation = move || {
78            let input = input.clone();
79            let runtime_plugins = runtime_plugins.clone();
80            async move { crate::operation::describe_services::DescribeServices::orchestrate(&runtime_plugins, input).await }
81        };
82        let orchestrator = ::aws_smithy_runtime::client::waiters::WaiterOrchestrator::builder()
83            .min_delay(::std::time::Duration::from_secs(15))
84            .max_delay(::std::time::Duration::from_secs(120))
85            .max_wait(max_wait)
86            .time_source(time_source)
87            .sleep_impl(sleep_impl)
88            .acceptor(acceptor)
89            .operation(operation)
90            .build();
91        ::aws_smithy_runtime::client::waiters::attach_waiter_tracing_span(orchestrator.orchestrate()).await
92    }
93    /// <p>The short name or full Amazon Resource Name (ARN)the cluster that hosts the service to describe. If you do not specify a cluster, the default cluster is assumed. This parameter is required if the service or services you are describing were launched in any cluster other than the default cluster.</p>
94    pub fn cluster(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
95        self.inner = self.inner.cluster(input.into());
96        self
97    }
98    /// <p>The short name or full Amazon Resource Name (ARN)the cluster that hosts the service to describe. If you do not specify a cluster, the default cluster is assumed. This parameter is required if the service or services you are describing were launched in any cluster other than the default cluster.</p>
99    pub fn set_cluster(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
100        self.inner = self.inner.set_cluster(input);
101        self
102    }
103    /// <p>The short name or full Amazon Resource Name (ARN)the cluster that hosts the service to describe. If you do not specify a cluster, the default cluster is assumed. This parameter is required if the service or services you are describing were launched in any cluster other than the default cluster.</p>
104    pub fn get_cluster(&self) -> &::std::option::Option<::std::string::String> {
105        self.inner.get_cluster()
106    }
107    ///
108    /// Appends an item to `services`.
109    ///
110    /// To override the contents of this collection use [`set_services`](Self::set_services).
111    ///
112    /// <p>A list of services to describe. You may specify up to 10 services to describe in a single operation.</p>
113    pub fn services(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.inner = self.inner.services(input.into());
115        self
116    }
117    /// <p>A list of services to describe. You may specify up to 10 services to describe in a single operation.</p>
118    pub fn set_services(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
119        self.inner = self.inner.set_services(input);
120        self
121    }
122    /// <p>A list of services to describe. You may specify up to 10 services to describe in a single operation.</p>
123    pub fn get_services(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
124        self.inner.get_services()
125    }
126    ///
127    /// Appends an item to `include`.
128    ///
129    /// To override the contents of this collection use [`set_include`](Self::set_include).
130    ///
131    /// <p>Determines whether you want to see the resource tags for the service. If <code>TAGS</code> is specified, the tags are included in the response. If this field is omitted, tags aren't included in the response.</p>
132    pub fn include(mut self, input: crate::types::ServiceField) -> Self {
133        self.inner = self.inner.include(input);
134        self
135    }
136    /// <p>Determines whether you want to see the resource tags for the service. If <code>TAGS</code> is specified, the tags are included in the response. If this field is omitted, tags aren't included in the response.</p>
137    pub fn set_include(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ServiceField>>) -> Self {
138        self.inner = self.inner.set_include(input);
139        self
140    }
141    /// <p>Determines whether you want to see the resource tags for the service. If <code>TAGS</code> is specified, the tags are included in the response. If this field is omitted, tags aren't included in the response.</p>
142    pub fn get_include(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ServiceField>> {
143        self.inner.get_include()
144    }
145}
146
147/// Successful return type for the `services_stable` waiter.
148pub type ServicesStableFinalPoll = ::aws_smithy_runtime_api::client::waiters::FinalPoll<
149    crate::operation::describe_services::DescribeServicesOutput,
150    ::aws_smithy_runtime_api::client::result::SdkError<
151        crate::operation::describe_services::DescribeServicesError,
152        ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
153    >,
154>;
155
156/// Error type for the `services_stable` waiter.
157pub type WaitUntilServicesStableError = ::aws_smithy_runtime_api::client::waiters::error::WaiterError<
158    crate::operation::describe_services::DescribeServicesOutput,
159    crate::operation::describe_services::DescribeServicesError,
160>;