aws_sdk_qconnect/operation/retrieve/
_retrieve_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 RetrieveOutput {
6    /// <p>The results of the content retrieval operation.</p>
7    pub results: ::std::vec::Vec<crate::types::RetrieveResult>,
8    _request_id: Option<String>,
9}
10impl RetrieveOutput {
11    /// <p>The results of the content retrieval operation.</p>
12    pub fn results(&self) -> &[crate::types::RetrieveResult] {
13        use std::ops::Deref;
14        self.results.deref()
15    }
16}
17impl ::aws_types::request_id::RequestId for RetrieveOutput {
18    fn request_id(&self) -> Option<&str> {
19        self._request_id.as_deref()
20    }
21}
22impl RetrieveOutput {
23    /// Creates a new builder-style object to manufacture [`RetrieveOutput`](crate::operation::retrieve::RetrieveOutput).
24    pub fn builder() -> crate::operation::retrieve::builders::RetrieveOutputBuilder {
25        crate::operation::retrieve::builders::RetrieveOutputBuilder::default()
26    }
27}
28
29/// A builder for [`RetrieveOutput`](crate::operation::retrieve::RetrieveOutput).
30#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
31#[non_exhaustive]
32pub struct RetrieveOutputBuilder {
33    pub(crate) results: ::std::option::Option<::std::vec::Vec<crate::types::RetrieveResult>>,
34    _request_id: Option<String>,
35}
36impl RetrieveOutputBuilder {
37    /// Appends an item to `results`.
38    ///
39    /// To override the contents of this collection use [`set_results`](Self::set_results).
40    ///
41    /// <p>The results of the content retrieval operation.</p>
42    pub fn results(mut self, input: crate::types::RetrieveResult) -> Self {
43        let mut v = self.results.unwrap_or_default();
44        v.push(input);
45        self.results = ::std::option::Option::Some(v);
46        self
47    }
48    /// <p>The results of the content retrieval operation.</p>
49    pub fn set_results(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RetrieveResult>>) -> Self {
50        self.results = input;
51        self
52    }
53    /// <p>The results of the content retrieval operation.</p>
54    pub fn get_results(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RetrieveResult>> {
55        &self.results
56    }
57    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
58        self._request_id = Some(request_id.into());
59        self
60    }
61
62    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
63        self._request_id = request_id;
64        self
65    }
66    /// Consumes the builder and constructs a [`RetrieveOutput`](crate::operation::retrieve::RetrieveOutput).
67    /// This method will fail if any of the following fields are not set:
68    /// - [`results`](crate::operation::retrieve::builders::RetrieveOutputBuilder::results)
69    pub fn build(self) -> ::std::result::Result<crate::operation::retrieve::RetrieveOutput, ::aws_smithy_types::error::operation::BuildError> {
70        ::std::result::Result::Ok(crate::operation::retrieve::RetrieveOutput {
71            results: self.results.ok_or_else(|| {
72                ::aws_smithy_types::error::operation::BuildError::missing_field(
73                    "results",
74                    "results was not specified but it is required when building RetrieveOutput",
75                )
76            })?,
77            _request_id: self._request_id,
78        })
79    }
80}