aws_sdk_deadline/operation/search_jobs/
_search_jobs_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 SearchJobsOutput {
6    /// <p>The jobs in the search.</p>
7    pub jobs: ::std::vec::Vec<crate::types::JobSearchSummary>,
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 SearchJobsOutput {
15    /// <p>The jobs in the search.</p>
16    pub fn jobs(&self) -> &[crate::types::JobSearchSummary] {
17        use std::ops::Deref;
18        self.jobs.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 SearchJobsOutput {
30    fn request_id(&self) -> Option<&str> {
31        self._request_id.as_deref()
32    }
33}
34impl SearchJobsOutput {
35    /// Creates a new builder-style object to manufacture [`SearchJobsOutput`](crate::operation::search_jobs::SearchJobsOutput).
36    pub fn builder() -> crate::operation::search_jobs::builders::SearchJobsOutputBuilder {
37        crate::operation::search_jobs::builders::SearchJobsOutputBuilder::default()
38    }
39}
40
41/// A builder for [`SearchJobsOutput`](crate::operation::search_jobs::SearchJobsOutput).
42#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
43#[non_exhaustive]
44pub struct SearchJobsOutputBuilder {
45    pub(crate) jobs: ::std::option::Option<::std::vec::Vec<crate::types::JobSearchSummary>>,
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 SearchJobsOutputBuilder {
51    /// Appends an item to `jobs`.
52    ///
53    /// To override the contents of this collection use [`set_jobs`](Self::set_jobs).
54    ///
55    /// <p>The jobs in the search.</p>
56    pub fn jobs(mut self, input: crate::types::JobSearchSummary) -> Self {
57        let mut v = self.jobs.unwrap_or_default();
58        v.push(input);
59        self.jobs = ::std::option::Option::Some(v);
60        self
61    }
62    /// <p>The jobs in the search.</p>
63    pub fn set_jobs(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::JobSearchSummary>>) -> Self {
64        self.jobs = input;
65        self
66    }
67    /// <p>The jobs in the search.</p>
68    pub fn get_jobs(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::JobSearchSummary>> {
69        &self.jobs
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 [`SearchJobsOutput`](crate::operation::search_jobs::SearchJobsOutput).
110    /// This method will fail if any of the following fields are not set:
111    /// - [`jobs`](crate::operation::search_jobs::builders::SearchJobsOutputBuilder::jobs)
112    /// - [`total_results`](crate::operation::search_jobs::builders::SearchJobsOutputBuilder::total_results)
113    pub fn build(self) -> ::std::result::Result<crate::operation::search_jobs::SearchJobsOutput, ::aws_smithy_types::error::operation::BuildError> {
114        ::std::result::Result::Ok(crate::operation::search_jobs::SearchJobsOutput {
115            jobs: self.jobs.ok_or_else(|| {
116                ::aws_smithy_types::error::operation::BuildError::missing_field(
117                    "jobs",
118                    "jobs was not specified but it is required when building SearchJobsOutput",
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 SearchJobsOutput",
126                )
127            })?,
128            _request_id: self._request_id,
129        })
130    }
131}