aws_sdk_deadline/operation/search_tasks/
_search_tasks_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct SearchTasksOutput {
6    /// <p>Tasks in the search.</p>
7    pub tasks: ::std::vec::Vec<crate::types::TaskSearchSummary>,
8    /// <p>The next incremental starting point after the defined <code>itemOffset</code>.</p>
9    pub next_item_offset: ::std::option::Option<i32>,
10    /// <p>The total number of results in the search.</p>
11    pub total_results: i32,
12    _request_id: Option<String>,
13}
14impl SearchTasksOutput {
15    /// <p>Tasks in the search.</p>
16    pub fn tasks(&self) -> &[crate::types::TaskSearchSummary] {
17        use std::ops::Deref;
18        self.tasks.deref()
19    }
20    /// <p>The next incremental starting point after the defined <code>itemOffset</code>.</p>
21    pub fn next_item_offset(&self) -> ::std::option::Option<i32> {
22        self.next_item_offset
23    }
24    /// <p>The total number of results in the search.</p>
25    pub fn total_results(&self) -> i32 {
26        self.total_results
27    }
28}
29impl ::aws_types::request_id::RequestId for SearchTasksOutput {
30    fn request_id(&self) -> Option<&str> {
31        self._request_id.as_deref()
32    }
33}
34impl SearchTasksOutput {
35    /// Creates a new builder-style object to manufacture [`SearchTasksOutput`](crate::operation::search_tasks::SearchTasksOutput).
36    pub fn builder() -> crate::operation::search_tasks::builders::SearchTasksOutputBuilder {
37        crate::operation::search_tasks::builders::SearchTasksOutputBuilder::default()
38    }
39}
40
41/// A builder for [`SearchTasksOutput`](crate::operation::search_tasks::SearchTasksOutput).
42#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
43#[non_exhaustive]
44pub struct SearchTasksOutputBuilder {
45    pub(crate) tasks: ::std::option::Option<::std::vec::Vec<crate::types::TaskSearchSummary>>,
46    pub(crate) next_item_offset: ::std::option::Option<i32>,
47    pub(crate) total_results: ::std::option::Option<i32>,
48    _request_id: Option<String>,
49}
50impl SearchTasksOutputBuilder {
51    /// Appends an item to `tasks`.
52    ///
53    /// To override the contents of this collection use [`set_tasks`](Self::set_tasks).
54    ///
55    /// <p>Tasks in the search.</p>
56    pub fn tasks(mut self, input: crate::types::TaskSearchSummary) -> Self {
57        let mut v = self.tasks.unwrap_or_default();
58        v.push(input);
59        self.tasks = ::std::option::Option::Some(v);
60        self
61    }
62    /// <p>Tasks in the search.</p>
63    pub fn set_tasks(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TaskSearchSummary>>) -> Self {
64        self.tasks = input;
65        self
66    }
67    /// <p>Tasks in the search.</p>
68    pub fn get_tasks(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TaskSearchSummary>> {
69        &self.tasks
70    }
71    /// <p>The next incremental starting point after the defined <code>itemOffset</code>.</p>
72    pub fn next_item_offset(mut self, input: i32) -> Self {
73        self.next_item_offset = ::std::option::Option::Some(input);
74        self
75    }
76    /// <p>The next incremental starting point after the defined <code>itemOffset</code>.</p>
77    pub fn set_next_item_offset(mut self, input: ::std::option::Option<i32>) -> Self {
78        self.next_item_offset = input;
79        self
80    }
81    /// <p>The next incremental starting point after the defined <code>itemOffset</code>.</p>
82    pub fn get_next_item_offset(&self) -> &::std::option::Option<i32> {
83        &self.next_item_offset
84    }
85    /// <p>The total number of results in the search.</p>
86    /// This field is required.
87    pub fn total_results(mut self, input: i32) -> Self {
88        self.total_results = ::std::option::Option::Some(input);
89        self
90    }
91    /// <p>The total number of results in the search.</p>
92    pub fn set_total_results(mut self, input: ::std::option::Option<i32>) -> Self {
93        self.total_results = input;
94        self
95    }
96    /// <p>The total number of results in the search.</p>
97    pub fn get_total_results(&self) -> &::std::option::Option<i32> {
98        &self.total_results
99    }
100    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
101        self._request_id = Some(request_id.into());
102        self
103    }
104
105    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
106        self._request_id = request_id;
107        self
108    }
109    /// Consumes the builder and constructs a [`SearchTasksOutput`](crate::operation::search_tasks::SearchTasksOutput).
110    /// This method will fail if any of the following fields are not set:
111    /// - [`tasks`](crate::operation::search_tasks::builders::SearchTasksOutputBuilder::tasks)
112    /// - [`total_results`](crate::operation::search_tasks::builders::SearchTasksOutputBuilder::total_results)
113    pub fn build(self) -> ::std::result::Result<crate::operation::search_tasks::SearchTasksOutput, ::aws_smithy_types::error::operation::BuildError> {
114        ::std::result::Result::Ok(crate::operation::search_tasks::SearchTasksOutput {
115            tasks: self.tasks.ok_or_else(|| {
116                ::aws_smithy_types::error::operation::BuildError::missing_field(
117                    "tasks",
118                    "tasks was not specified but it is required when building SearchTasksOutput",
119                )
120            })?,
121            next_item_offset: self.next_item_offset,
122            total_results: self.total_results.ok_or_else(|| {
123                ::aws_smithy_types::error::operation::BuildError::missing_field(
124                    "total_results",
125                    "total_results was not specified but it is required when building SearchTasksOutput",
126                )
127            })?,
128            _request_id: self._request_id,
129        })
130    }
131}