aws_sdk_ecs/operation/list_tasks/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::list_tasks::_list_tasks_output::ListTasksOutputBuilder;
3
4pub use crate::operation::list_tasks::_list_tasks_input::ListTasksInputBuilder;
5
6impl crate::operation::list_tasks::builders::ListTasksInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::list_tasks::ListTasksOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::list_tasks::ListTasksError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.list_tasks();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ListTasks`.
24///
25/// <p>Returns a list of tasks. You can filter the results by cluster, task definition family, container instance, launch type, what IAM principal started the task, or by the desired status of the task.</p>
26/// <p>Recently stopped tasks might appear in the returned results.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct ListTasksFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::list_tasks::builders::ListTasksInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl crate::client::customize::internal::CustomizableSend<crate::operation::list_tasks::ListTasksOutput, crate::operation::list_tasks::ListTasksError>
34    for ListTasksFluentBuilder
35{
36    fn send(
37        self,
38        config_override: crate::config::Builder,
39    ) -> crate::client::customize::internal::BoxFuture<
40        crate::client::customize::internal::SendResult<crate::operation::list_tasks::ListTasksOutput, crate::operation::list_tasks::ListTasksError>,
41    > {
42        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
43    }
44}
45impl ListTasksFluentBuilder {
46    /// Creates a new `ListTasksFluentBuilder`.
47    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
48        Self {
49            handle,
50            inner: ::std::default::Default::default(),
51            config_override: ::std::option::Option::None,
52        }
53    }
54    /// Access the ListTasks as a reference.
55    pub fn as_input(&self) -> &crate::operation::list_tasks::builders::ListTasksInputBuilder {
56        &self.inner
57    }
58    /// Sends the request and returns the response.
59    ///
60    /// If an error occurs, an `SdkError` will be returned with additional details that
61    /// can be matched against.
62    ///
63    /// By default, any retryable failures will be retried twice. Retry behavior
64    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
65    /// set when configuring the client.
66    pub async fn send(
67        self,
68    ) -> ::std::result::Result<
69        crate::operation::list_tasks::ListTasksOutput,
70        ::aws_smithy_runtime_api::client::result::SdkError<
71            crate::operation::list_tasks::ListTasksError,
72            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
73        >,
74    > {
75        let input = self
76            .inner
77            .build()
78            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
79        let runtime_plugins = crate::operation::list_tasks::ListTasks::operation_runtime_plugins(
80            self.handle.runtime_plugins.clone(),
81            &self.handle.conf,
82            self.config_override,
83        );
84        crate::operation::list_tasks::ListTasks::orchestrate(&runtime_plugins, input).await
85    }
86
87    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
88    pub fn customize(
89        self,
90    ) -> crate::client::customize::CustomizableOperation<
91        crate::operation::list_tasks::ListTasksOutput,
92        crate::operation::list_tasks::ListTasksError,
93        Self,
94    > {
95        crate::client::customize::CustomizableOperation::new(self)
96    }
97    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
98        self.set_config_override(::std::option::Option::Some(config_override.into()));
99        self
100    }
101
102    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
103        self.config_override = config_override;
104        self
105    }
106    /// Create a paginator for this request
107    ///
108    /// Paginators are used by calling [`send().await`](crate::operation::list_tasks::paginator::ListTasksPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
109    pub fn into_paginator(self) -> crate::operation::list_tasks::paginator::ListTasksPaginator {
110        crate::operation::list_tasks::paginator::ListTasksPaginator::new(self.handle, self.inner)
111    }
112    /// <p>The short name or full Amazon Resource Name (ARN) of the cluster to use when filtering the <code>ListTasks</code> results. If you do not specify a cluster, the default cluster is assumed.</p>
113    pub fn cluster(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.inner = self.inner.cluster(input.into());
115        self
116    }
117    /// <p>The short name or full Amazon Resource Name (ARN) of the cluster to use when filtering the <code>ListTasks</code> results. If you do not specify a cluster, the default cluster is assumed.</p>
118    pub fn set_cluster(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119        self.inner = self.inner.set_cluster(input);
120        self
121    }
122    /// <p>The short name or full Amazon Resource Name (ARN) of the cluster to use when filtering the <code>ListTasks</code> results. If you do not specify a cluster, the default cluster is assumed.</p>
123    pub fn get_cluster(&self) -> &::std::option::Option<::std::string::String> {
124        self.inner.get_cluster()
125    }
126    /// <p>The container instance ID or full ARN of the container instance to use when filtering the <code>ListTasks</code> results. Specifying a <code>containerInstance</code> limits the results to tasks that belong to that container instance.</p>
127    pub fn container_instance(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.inner = self.inner.container_instance(input.into());
129        self
130    }
131    /// <p>The container instance ID or full ARN of the container instance to use when filtering the <code>ListTasks</code> results. Specifying a <code>containerInstance</code> limits the results to tasks that belong to that container instance.</p>
132    pub fn set_container_instance(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
133        self.inner = self.inner.set_container_instance(input);
134        self
135    }
136    /// <p>The container instance ID or full ARN of the container instance to use when filtering the <code>ListTasks</code> results. Specifying a <code>containerInstance</code> limits the results to tasks that belong to that container instance.</p>
137    pub fn get_container_instance(&self) -> &::std::option::Option<::std::string::String> {
138        self.inner.get_container_instance()
139    }
140    /// <p>The name of the task definition family to use when filtering the <code>ListTasks</code> results. Specifying a <code>family</code> limits the results to tasks that belong to that family.</p>
141    pub fn family(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
142        self.inner = self.inner.family(input.into());
143        self
144    }
145    /// <p>The name of the task definition family to use when filtering the <code>ListTasks</code> results. Specifying a <code>family</code> limits the results to tasks that belong to that family.</p>
146    pub fn set_family(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
147        self.inner = self.inner.set_family(input);
148        self
149    }
150    /// <p>The name of the task definition family to use when filtering the <code>ListTasks</code> results. Specifying a <code>family</code> limits the results to tasks that belong to that family.</p>
151    pub fn get_family(&self) -> &::std::option::Option<::std::string::String> {
152        self.inner.get_family()
153    }
154    /// <p>The <code>nextToken</code> value returned from a <code>ListTasks</code> request indicating that more results are available to fulfill the request and further calls will be needed. If <code>maxResults</code> was provided, it's possible the number of results to be fewer than <code>maxResults</code>.</p><note>
155    /// <p>This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.</p>
156    /// </note>
157    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
158        self.inner = self.inner.next_token(input.into());
159        self
160    }
161    /// <p>The <code>nextToken</code> value returned from a <code>ListTasks</code> request indicating that more results are available to fulfill the request and further calls will be needed. If <code>maxResults</code> was provided, it's possible the number of results to be fewer than <code>maxResults</code>.</p><note>
162    /// <p>This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.</p>
163    /// </note>
164    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
165        self.inner = self.inner.set_next_token(input);
166        self
167    }
168    /// <p>The <code>nextToken</code> value returned from a <code>ListTasks</code> request indicating that more results are available to fulfill the request and further calls will be needed. If <code>maxResults</code> was provided, it's possible the number of results to be fewer than <code>maxResults</code>.</p><note>
169    /// <p>This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.</p>
170    /// </note>
171    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
172        self.inner.get_next_token()
173    }
174    /// <p>The maximum number of task results that <code>ListTasks</code> returned in paginated output. When this parameter is used, <code>ListTasks</code> only returns <code>maxResults</code> results in a single page along with a <code>nextToken</code> response element. The remaining results of the initial request can be seen by sending another <code>ListTasks</code> request with the returned <code>nextToken</code> value. This value can be between 1 and 100. If this parameter isn't used, then <code>ListTasks</code> returns up to 100 results and a <code>nextToken</code> value if applicable.</p>
175    pub fn max_results(mut self, input: i32) -> Self {
176        self.inner = self.inner.max_results(input);
177        self
178    }
179    /// <p>The maximum number of task results that <code>ListTasks</code> returned in paginated output. When this parameter is used, <code>ListTasks</code> only returns <code>maxResults</code> results in a single page along with a <code>nextToken</code> response element. The remaining results of the initial request can be seen by sending another <code>ListTasks</code> request with the returned <code>nextToken</code> value. This value can be between 1 and 100. If this parameter isn't used, then <code>ListTasks</code> returns up to 100 results and a <code>nextToken</code> value if applicable.</p>
180    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
181        self.inner = self.inner.set_max_results(input);
182        self
183    }
184    /// <p>The maximum number of task results that <code>ListTasks</code> returned in paginated output. When this parameter is used, <code>ListTasks</code> only returns <code>maxResults</code> results in a single page along with a <code>nextToken</code> response element. The remaining results of the initial request can be seen by sending another <code>ListTasks</code> request with the returned <code>nextToken</code> value. This value can be between 1 and 100. If this parameter isn't used, then <code>ListTasks</code> returns up to 100 results and a <code>nextToken</code> value if applicable.</p>
185    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
186        self.inner.get_max_results()
187    }
188    /// <p>The <code>startedBy</code> value to filter the task results with. Specifying a <code>startedBy</code> value limits the results to tasks that were started with that value.</p>
189    /// <p>When you specify <code>startedBy</code> as the filter, it must be the only filter that you use.</p>
190    pub fn started_by(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
191        self.inner = self.inner.started_by(input.into());
192        self
193    }
194    /// <p>The <code>startedBy</code> value to filter the task results with. Specifying a <code>startedBy</code> value limits the results to tasks that were started with that value.</p>
195    /// <p>When you specify <code>startedBy</code> as the filter, it must be the only filter that you use.</p>
196    pub fn set_started_by(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
197        self.inner = self.inner.set_started_by(input);
198        self
199    }
200    /// <p>The <code>startedBy</code> value to filter the task results with. Specifying a <code>startedBy</code> value limits the results to tasks that were started with that value.</p>
201    /// <p>When you specify <code>startedBy</code> as the filter, it must be the only filter that you use.</p>
202    pub fn get_started_by(&self) -> &::std::option::Option<::std::string::String> {
203        self.inner.get_started_by()
204    }
205    /// <p>The name of the service to use when filtering the <code>ListTasks</code> results. Specifying a <code>serviceName</code> limits the results to tasks that belong to that service.</p>
206    pub fn service_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
207        self.inner = self.inner.service_name(input.into());
208        self
209    }
210    /// <p>The name of the service to use when filtering the <code>ListTasks</code> results. Specifying a <code>serviceName</code> limits the results to tasks that belong to that service.</p>
211    pub fn set_service_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
212        self.inner = self.inner.set_service_name(input);
213        self
214    }
215    /// <p>The name of the service to use when filtering the <code>ListTasks</code> results. Specifying a <code>serviceName</code> limits the results to tasks that belong to that service.</p>
216    pub fn get_service_name(&self) -> &::std::option::Option<::std::string::String> {
217        self.inner.get_service_name()
218    }
219    /// <p>The task desired status to use when filtering the <code>ListTasks</code> results. Specifying a <code>desiredStatus</code> of <code>STOPPED</code> limits the results to tasks that Amazon ECS has set the desired status to <code>STOPPED</code>. This can be useful for debugging tasks that aren't starting properly or have died or finished. The default status filter is <code>RUNNING</code>, which shows tasks that Amazon ECS has set the desired status to <code>RUNNING</code>.</p><note>
220    /// <p>Although you can filter results based on a desired status of <code>PENDING</code>, this doesn't return any results. Amazon ECS never sets the desired status of a task to that value (only a task's <code>lastStatus</code> may have a value of <code>PENDING</code>).</p>
221    /// </note>
222    pub fn desired_status(mut self, input: crate::types::DesiredStatus) -> Self {
223        self.inner = self.inner.desired_status(input);
224        self
225    }
226    /// <p>The task desired status to use when filtering the <code>ListTasks</code> results. Specifying a <code>desiredStatus</code> of <code>STOPPED</code> limits the results to tasks that Amazon ECS has set the desired status to <code>STOPPED</code>. This can be useful for debugging tasks that aren't starting properly or have died or finished. The default status filter is <code>RUNNING</code>, which shows tasks that Amazon ECS has set the desired status to <code>RUNNING</code>.</p><note>
227    /// <p>Although you can filter results based on a desired status of <code>PENDING</code>, this doesn't return any results. Amazon ECS never sets the desired status of a task to that value (only a task's <code>lastStatus</code> may have a value of <code>PENDING</code>).</p>
228    /// </note>
229    pub fn set_desired_status(mut self, input: ::std::option::Option<crate::types::DesiredStatus>) -> Self {
230        self.inner = self.inner.set_desired_status(input);
231        self
232    }
233    /// <p>The task desired status to use when filtering the <code>ListTasks</code> results. Specifying a <code>desiredStatus</code> of <code>STOPPED</code> limits the results to tasks that Amazon ECS has set the desired status to <code>STOPPED</code>. This can be useful for debugging tasks that aren't starting properly or have died or finished. The default status filter is <code>RUNNING</code>, which shows tasks that Amazon ECS has set the desired status to <code>RUNNING</code>.</p><note>
234    /// <p>Although you can filter results based on a desired status of <code>PENDING</code>, this doesn't return any results. Amazon ECS never sets the desired status of a task to that value (only a task's <code>lastStatus</code> may have a value of <code>PENDING</code>).</p>
235    /// </note>
236    pub fn get_desired_status(&self) -> &::std::option::Option<crate::types::DesiredStatus> {
237        self.inner.get_desired_status()
238    }
239    /// <p>The launch type to use when filtering the <code>ListTasks</code> results.</p>
240    pub fn launch_type(mut self, input: crate::types::LaunchType) -> Self {
241        self.inner = self.inner.launch_type(input);
242        self
243    }
244    /// <p>The launch type to use when filtering the <code>ListTasks</code> results.</p>
245    pub fn set_launch_type(mut self, input: ::std::option::Option<crate::types::LaunchType>) -> Self {
246        self.inner = self.inner.set_launch_type(input);
247        self
248    }
249    /// <p>The launch type to use when filtering the <code>ListTasks</code> results.</p>
250    pub fn get_launch_type(&self) -> &::std::option::Option<crate::types::LaunchType> {
251        self.inner.get_launch_type()
252    }
253}