aws_sdk_bedrockagentruntime/operation/retrieve_and_generate_stream/
builders.rs1pub use crate::operation::retrieve_and_generate_stream::_retrieve_and_generate_stream_output::RetrieveAndGenerateStreamOutputBuilder;
3
4pub use crate::operation::retrieve_and_generate_stream::_retrieve_and_generate_stream_input::RetrieveAndGenerateStreamInputBuilder;
5
6impl crate::operation::retrieve_and_generate_stream::builders::RetrieveAndGenerateStreamInputBuilder {
7 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::retrieve_and_generate_stream::RetrieveAndGenerateStreamOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::retrieve_and_generate_stream::RetrieveAndGenerateStreamError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.retrieve_and_generate_stream();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23#[derive(::std::clone::Clone, ::std::fmt::Debug)]
30pub struct RetrieveAndGenerateStreamFluentBuilder {
31 handle: ::std::sync::Arc<crate::client::Handle>,
32 inner: crate::operation::retrieve_and_generate_stream::builders::RetrieveAndGenerateStreamInputBuilder,
33 config_override: ::std::option::Option<crate::config::Builder>,
34}
35impl
36 crate::client::customize::internal::CustomizableSend<
37 crate::operation::retrieve_and_generate_stream::RetrieveAndGenerateStreamOutput,
38 crate::operation::retrieve_and_generate_stream::RetrieveAndGenerateStreamError,
39 > for RetrieveAndGenerateStreamFluentBuilder
40{
41 fn send(
42 self,
43 config_override: crate::config::Builder,
44 ) -> crate::client::customize::internal::BoxFuture<
45 crate::client::customize::internal::SendResult<
46 crate::operation::retrieve_and_generate_stream::RetrieveAndGenerateStreamOutput,
47 crate::operation::retrieve_and_generate_stream::RetrieveAndGenerateStreamError,
48 >,
49 > {
50 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
51 }
52}
53impl RetrieveAndGenerateStreamFluentBuilder {
54 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
56 Self {
57 handle,
58 inner: ::std::default::Default::default(),
59 config_override: ::std::option::Option::None,
60 }
61 }
62 pub fn as_input(&self) -> &crate::operation::retrieve_and_generate_stream::builders::RetrieveAndGenerateStreamInputBuilder {
64 &self.inner
65 }
66 pub async fn send(
75 self,
76 ) -> ::std::result::Result<
77 crate::operation::retrieve_and_generate_stream::RetrieveAndGenerateStreamOutput,
78 ::aws_smithy_runtime_api::client::result::SdkError<
79 crate::operation::retrieve_and_generate_stream::RetrieveAndGenerateStreamError,
80 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
81 >,
82 > {
83 let input = self
84 .inner
85 .build()
86 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
87 let runtime_plugins = crate::operation::retrieve_and_generate_stream::RetrieveAndGenerateStream::operation_runtime_plugins(
88 self.handle.runtime_plugins.clone(),
89 &self.handle.conf,
90 self.config_override,
91 );
92 let mut output = crate::operation::retrieve_and_generate_stream::RetrieveAndGenerateStream::orchestrate(&runtime_plugins, input).await?;
93
94 fn response_error(
103 err: impl ::std::convert::Into<::aws_smithy_runtime_api::box_error::BoxError>,
104 ) -> ::aws_smithy_runtime_api::client::result::SdkError<
105 crate::operation::retrieve_and_generate_stream::RetrieveAndGenerateStreamError,
106 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
107 > {
108 ::aws_smithy_runtime_api::client::result::SdkError::response_error(
109 err,
110 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse::new(
111 ::aws_smithy_runtime_api::http::StatusCode::try_from(200).expect("valid successful code"),
112 ::aws_smithy_types::body::SdkBody::empty(),
113 ),
114 )
115 }
116
117 let message = output.stream.try_recv_initial_response().await.map_err(response_error)?;
118
119 match message {
120 ::std::option::Option::Some(_message) => ::std::result::Result::Ok(output),
121 ::std::option::Option::None => ::std::result::Result::Ok(output),
122 }
123 }
124
125 pub fn customize(
127 self,
128 ) -> crate::client::customize::CustomizableOperation<
129 crate::operation::retrieve_and_generate_stream::RetrieveAndGenerateStreamOutput,
130 crate::operation::retrieve_and_generate_stream::RetrieveAndGenerateStreamError,
131 Self,
132 > {
133 crate::client::customize::CustomizableOperation::new(self)
134 }
135 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
136 self.set_config_override(::std::option::Option::Some(config_override.into()));
137 self
138 }
139
140 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
141 self.config_override = config_override;
142 self
143 }
144 pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146 self.inner = self.inner.session_id(input.into());
147 self
148 }
149 pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
151 self.inner = self.inner.set_session_id(input);
152 self
153 }
154 pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
156 self.inner.get_session_id()
157 }
158 pub fn input(mut self, input: crate::types::RetrieveAndGenerateInput) -> Self {
160 self.inner = self.inner.input(input);
161 self
162 }
163 pub fn set_input(mut self, input: ::std::option::Option<crate::types::RetrieveAndGenerateInput>) -> Self {
165 self.inner = self.inner.set_input(input);
166 self
167 }
168 pub fn get_input(&self) -> &::std::option::Option<crate::types::RetrieveAndGenerateInput> {
170 self.inner.get_input()
171 }
172 pub fn retrieve_and_generate_configuration(mut self, input: crate::types::RetrieveAndGenerateConfiguration) -> Self {
174 self.inner = self.inner.retrieve_and_generate_configuration(input);
175 self
176 }
177 pub fn set_retrieve_and_generate_configuration(mut self, input: ::std::option::Option<crate::types::RetrieveAndGenerateConfiguration>) -> Self {
179 self.inner = self.inner.set_retrieve_and_generate_configuration(input);
180 self
181 }
182 pub fn get_retrieve_and_generate_configuration(&self) -> &::std::option::Option<crate::types::RetrieveAndGenerateConfiguration> {
184 self.inner.get_retrieve_and_generate_configuration()
185 }
186 pub fn session_configuration(mut self, input: crate::types::RetrieveAndGenerateSessionConfiguration) -> Self {
188 self.inner = self.inner.session_configuration(input);
189 self
190 }
191 pub fn set_session_configuration(mut self, input: ::std::option::Option<crate::types::RetrieveAndGenerateSessionConfiguration>) -> Self {
193 self.inner = self.inner.set_session_configuration(input);
194 self
195 }
196 pub fn get_session_configuration(&self) -> &::std::option::Option<crate::types::RetrieveAndGenerateSessionConfiguration> {
198 self.inner.get_session_configuration()
199 }
200}