aws_sdk_bedrockagentruntime/operation/retrieve/
_retrieve_output.rs1#[allow(missing_docs)] #[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
5pub struct RetrieveOutput {
6 pub retrieval_results: ::std::vec::Vec<crate::types::KnowledgeBaseRetrievalResult>,
8 pub guardrail_action: ::std::option::Option<crate::types::GuadrailAction>,
10 pub next_token: ::std::option::Option<::std::string::String>,
12 _request_id: Option<String>,
13}
14impl RetrieveOutput {
15 pub fn retrieval_results(&self) -> &[crate::types::KnowledgeBaseRetrievalResult] {
17 use std::ops::Deref;
18 self.retrieval_results.deref()
19 }
20 pub fn guardrail_action(&self) -> ::std::option::Option<&crate::types::GuadrailAction> {
22 self.guardrail_action.as_ref()
23 }
24 pub fn next_token(&self) -> ::std::option::Option<&str> {
26 self.next_token.as_deref()
27 }
28}
29impl ::std::fmt::Debug for RetrieveOutput {
30 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
31 let mut formatter = f.debug_struct("RetrieveOutput");
32 formatter.field("retrieval_results", &"*** Sensitive Data Redacted ***");
33 formatter.field("guardrail_action", &self.guardrail_action);
34 formatter.field("next_token", &self.next_token);
35 formatter.field("_request_id", &self._request_id);
36 formatter.finish()
37 }
38}
39impl ::aws_types::request_id::RequestId for RetrieveOutput {
40 fn request_id(&self) -> Option<&str> {
41 self._request_id.as_deref()
42 }
43}
44impl RetrieveOutput {
45 pub fn builder() -> crate::operation::retrieve::builders::RetrieveOutputBuilder {
47 crate::operation::retrieve::builders::RetrieveOutputBuilder::default()
48 }
49}
50
51#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
53#[non_exhaustive]
54pub struct RetrieveOutputBuilder {
55 pub(crate) retrieval_results: ::std::option::Option<::std::vec::Vec<crate::types::KnowledgeBaseRetrievalResult>>,
56 pub(crate) guardrail_action: ::std::option::Option<crate::types::GuadrailAction>,
57 pub(crate) next_token: ::std::option::Option<::std::string::String>,
58 _request_id: Option<String>,
59}
60impl RetrieveOutputBuilder {
61 pub fn retrieval_results(mut self, input: crate::types::KnowledgeBaseRetrievalResult) -> Self {
67 let mut v = self.retrieval_results.unwrap_or_default();
68 v.push(input);
69 self.retrieval_results = ::std::option::Option::Some(v);
70 self
71 }
72 pub fn set_retrieval_results(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::KnowledgeBaseRetrievalResult>>) -> Self {
74 self.retrieval_results = input;
75 self
76 }
77 pub fn get_retrieval_results(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::KnowledgeBaseRetrievalResult>> {
79 &self.retrieval_results
80 }
81 pub fn guardrail_action(mut self, input: crate::types::GuadrailAction) -> Self {
83 self.guardrail_action = ::std::option::Option::Some(input);
84 self
85 }
86 pub fn set_guardrail_action(mut self, input: ::std::option::Option<crate::types::GuadrailAction>) -> Self {
88 self.guardrail_action = input;
89 self
90 }
91 pub fn get_guardrail_action(&self) -> &::std::option::Option<crate::types::GuadrailAction> {
93 &self.guardrail_action
94 }
95 pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
97 self.next_token = ::std::option::Option::Some(input.into());
98 self
99 }
100 pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
102 self.next_token = input;
103 self
104 }
105 pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
107 &self.next_token
108 }
109 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
110 self._request_id = Some(request_id.into());
111 self
112 }
113
114 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
115 self._request_id = request_id;
116 self
117 }
118 pub fn build(self) -> ::std::result::Result<crate::operation::retrieve::RetrieveOutput, ::aws_smithy_types::error::operation::BuildError> {
122 ::std::result::Result::Ok(crate::operation::retrieve::RetrieveOutput {
123 retrieval_results: self.retrieval_results.ok_or_else(|| {
124 ::aws_smithy_types::error::operation::BuildError::missing_field(
125 "retrieval_results",
126 "retrieval_results was not specified but it is required when building RetrieveOutput",
127 )
128 })?,
129 guardrail_action: self.guardrail_action,
130 next_token: self.next_token,
131 _request_id: self._request_id,
132 })
133 }
134}
135impl ::std::fmt::Debug for RetrieveOutputBuilder {
136 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
137 let mut formatter = f.debug_struct("RetrieveOutputBuilder");
138 formatter.field("retrieval_results", &"*** Sensitive Data Redacted ***");
139 formatter.field("guardrail_action", &self.guardrail_action);
140 formatter.field("next_token", &self.next_token);
141 formatter.field("_request_id", &self._request_id);
142 formatter.finish()
143 }
144}