aws_sdk_iot/operation/search_index/
_search_index_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 SearchIndexOutput {
6    /// <p>The token used to get the next set of results, or <code>null</code> if there are no additional results.</p>
7    pub next_token: ::std::option::Option<::std::string::String>,
8    /// <p>The things that match the search query.</p>
9    pub things: ::std::option::Option<::std::vec::Vec<crate::types::ThingDocument>>,
10    /// <p>The thing groups that match the search query.</p>
11    pub thing_groups: ::std::option::Option<::std::vec::Vec<crate::types::ThingGroupDocument>>,
12    _request_id: Option<String>,
13}
14impl SearchIndexOutput {
15    /// <p>The token used to get the next set of results, or <code>null</code> if there are no additional results.</p>
16    pub fn next_token(&self) -> ::std::option::Option<&str> {
17        self.next_token.as_deref()
18    }
19    /// <p>The things that match the search query.</p>
20    ///
21    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.things.is_none()`.
22    pub fn things(&self) -> &[crate::types::ThingDocument] {
23        self.things.as_deref().unwrap_or_default()
24    }
25    /// <p>The thing groups that match the search query.</p>
26    ///
27    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.thing_groups.is_none()`.
28    pub fn thing_groups(&self) -> &[crate::types::ThingGroupDocument] {
29        self.thing_groups.as_deref().unwrap_or_default()
30    }
31}
32impl ::aws_types::request_id::RequestId for SearchIndexOutput {
33    fn request_id(&self) -> Option<&str> {
34        self._request_id.as_deref()
35    }
36}
37impl SearchIndexOutput {
38    /// Creates a new builder-style object to manufacture [`SearchIndexOutput`](crate::operation::search_index::SearchIndexOutput).
39    pub fn builder() -> crate::operation::search_index::builders::SearchIndexOutputBuilder {
40        crate::operation::search_index::builders::SearchIndexOutputBuilder::default()
41    }
42}
43
44/// A builder for [`SearchIndexOutput`](crate::operation::search_index::SearchIndexOutput).
45#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
46#[non_exhaustive]
47pub struct SearchIndexOutputBuilder {
48    pub(crate) next_token: ::std::option::Option<::std::string::String>,
49    pub(crate) things: ::std::option::Option<::std::vec::Vec<crate::types::ThingDocument>>,
50    pub(crate) thing_groups: ::std::option::Option<::std::vec::Vec<crate::types::ThingGroupDocument>>,
51    _request_id: Option<String>,
52}
53impl SearchIndexOutputBuilder {
54    /// <p>The token used to get the next set of results, or <code>null</code> if there are no additional results.</p>
55    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
56        self.next_token = ::std::option::Option::Some(input.into());
57        self
58    }
59    /// <p>The token used to get the next set of results, or <code>null</code> if there are no additional results.</p>
60    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
61        self.next_token = input;
62        self
63    }
64    /// <p>The token used to get the next set of results, or <code>null</code> if there are no additional results.</p>
65    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
66        &self.next_token
67    }
68    /// Appends an item to `things`.
69    ///
70    /// To override the contents of this collection use [`set_things`](Self::set_things).
71    ///
72    /// <p>The things that match the search query.</p>
73    pub fn things(mut self, input: crate::types::ThingDocument) -> Self {
74        let mut v = self.things.unwrap_or_default();
75        v.push(input);
76        self.things = ::std::option::Option::Some(v);
77        self
78    }
79    /// <p>The things that match the search query.</p>
80    pub fn set_things(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ThingDocument>>) -> Self {
81        self.things = input;
82        self
83    }
84    /// <p>The things that match the search query.</p>
85    pub fn get_things(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ThingDocument>> {
86        &self.things
87    }
88    /// Appends an item to `thing_groups`.
89    ///
90    /// To override the contents of this collection use [`set_thing_groups`](Self::set_thing_groups).
91    ///
92    /// <p>The thing groups that match the search query.</p>
93    pub fn thing_groups(mut self, input: crate::types::ThingGroupDocument) -> Self {
94        let mut v = self.thing_groups.unwrap_or_default();
95        v.push(input);
96        self.thing_groups = ::std::option::Option::Some(v);
97        self
98    }
99    /// <p>The thing groups that match the search query.</p>
100    pub fn set_thing_groups(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ThingGroupDocument>>) -> Self {
101        self.thing_groups = input;
102        self
103    }
104    /// <p>The thing groups that match the search query.</p>
105    pub fn get_thing_groups(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ThingGroupDocument>> {
106        &self.thing_groups
107    }
108    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
109        self._request_id = Some(request_id.into());
110        self
111    }
112
113    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
114        self._request_id = request_id;
115        self
116    }
117    /// Consumes the builder and constructs a [`SearchIndexOutput`](crate::operation::search_index::SearchIndexOutput).
118    pub fn build(self) -> crate::operation::search_index::SearchIndexOutput {
119        crate::operation::search_index::SearchIndexOutput {
120            next_token: self.next_token,
121            things: self.things,
122            thing_groups: self.thing_groups,
123            _request_id: self._request_id,
124        }
125    }
126}