aws_sdk_bedrockagent/operation/list_knowledge_bases/
_list_knowledge_bases_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 ListKnowledgeBasesOutput {
6    /// <p>A list of knowledge bases with information about each knowledge base.</p>
7    pub knowledge_base_summaries: ::std::vec::Vec<crate::types::KnowledgeBaseSummary>,
8    /// <p>If the total number of results is greater than the <code>maxResults</code> value provided in the request, use this token when making another request in the <code>nextToken</code> field to return the next batch of results.</p>
9    pub next_token: ::std::option::Option<::std::string::String>,
10    _request_id: Option<String>,
11}
12impl ListKnowledgeBasesOutput {
13    /// <p>A list of knowledge bases with information about each knowledge base.</p>
14    pub fn knowledge_base_summaries(&self) -> &[crate::types::KnowledgeBaseSummary] {
15        use std::ops::Deref;
16        self.knowledge_base_summaries.deref()
17    }
18    /// <p>If the total number of results is greater than the <code>maxResults</code> value provided in the request, use this token when making another request in the <code>nextToken</code> field to return the next batch of results.</p>
19    pub fn next_token(&self) -> ::std::option::Option<&str> {
20        self.next_token.as_deref()
21    }
22}
23impl ::aws_types::request_id::RequestId for ListKnowledgeBasesOutput {
24    fn request_id(&self) -> Option<&str> {
25        self._request_id.as_deref()
26    }
27}
28impl ListKnowledgeBasesOutput {
29    /// Creates a new builder-style object to manufacture [`ListKnowledgeBasesOutput`](crate::operation::list_knowledge_bases::ListKnowledgeBasesOutput).
30    pub fn builder() -> crate::operation::list_knowledge_bases::builders::ListKnowledgeBasesOutputBuilder {
31        crate::operation::list_knowledge_bases::builders::ListKnowledgeBasesOutputBuilder::default()
32    }
33}
34
35/// A builder for [`ListKnowledgeBasesOutput`](crate::operation::list_knowledge_bases::ListKnowledgeBasesOutput).
36#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
37#[non_exhaustive]
38pub struct ListKnowledgeBasesOutputBuilder {
39    pub(crate) knowledge_base_summaries: ::std::option::Option<::std::vec::Vec<crate::types::KnowledgeBaseSummary>>,
40    pub(crate) next_token: ::std::option::Option<::std::string::String>,
41    _request_id: Option<String>,
42}
43impl ListKnowledgeBasesOutputBuilder {
44    /// Appends an item to `knowledge_base_summaries`.
45    ///
46    /// To override the contents of this collection use [`set_knowledge_base_summaries`](Self::set_knowledge_base_summaries).
47    ///
48    /// <p>A list of knowledge bases with information about each knowledge base.</p>
49    pub fn knowledge_base_summaries(mut self, input: crate::types::KnowledgeBaseSummary) -> Self {
50        let mut v = self.knowledge_base_summaries.unwrap_or_default();
51        v.push(input);
52        self.knowledge_base_summaries = ::std::option::Option::Some(v);
53        self
54    }
55    /// <p>A list of knowledge bases with information about each knowledge base.</p>
56    pub fn set_knowledge_base_summaries(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::KnowledgeBaseSummary>>) -> Self {
57        self.knowledge_base_summaries = input;
58        self
59    }
60    /// <p>A list of knowledge bases with information about each knowledge base.</p>
61    pub fn get_knowledge_base_summaries(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::KnowledgeBaseSummary>> {
62        &self.knowledge_base_summaries
63    }
64    /// <p>If the total number of results is greater than the <code>maxResults</code> value provided in the request, use this token when making another request in the <code>nextToken</code> field to return the next batch of results.</p>
65    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
66        self.next_token = ::std::option::Option::Some(input.into());
67        self
68    }
69    /// <p>If the total number of results is greater than the <code>maxResults</code> value provided in the request, use this token when making another request in the <code>nextToken</code> field to return the next batch of results.</p>
70    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
71        self.next_token = input;
72        self
73    }
74    /// <p>If the total number of results is greater than the <code>maxResults</code> value provided in the request, use this token when making another request in the <code>nextToken</code> field to return the next batch of results.</p>
75    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
76        &self.next_token
77    }
78    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
79        self._request_id = Some(request_id.into());
80        self
81    }
82
83    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
84        self._request_id = request_id;
85        self
86    }
87    /// Consumes the builder and constructs a [`ListKnowledgeBasesOutput`](crate::operation::list_knowledge_bases::ListKnowledgeBasesOutput).
88    /// This method will fail if any of the following fields are not set:
89    /// - [`knowledge_base_summaries`](crate::operation::list_knowledge_bases::builders::ListKnowledgeBasesOutputBuilder::knowledge_base_summaries)
90    pub fn build(
91        self,
92    ) -> ::std::result::Result<crate::operation::list_knowledge_bases::ListKnowledgeBasesOutput, ::aws_smithy_types::error::operation::BuildError>
93    {
94        ::std::result::Result::Ok(crate::operation::list_knowledge_bases::ListKnowledgeBasesOutput {
95            knowledge_base_summaries: self.knowledge_base_summaries.ok_or_else(|| {
96                ::aws_smithy_types::error::operation::BuildError::missing_field(
97                    "knowledge_base_summaries",
98                    "knowledge_base_summaries was not specified but it is required when building ListKnowledgeBasesOutput",
99                )
100            })?,
101            next_token: self.next_token,
102            _request_id: self._request_id,
103        })
104    }
105}