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