aws_sdk_bedrockruntime/operation/converse_stream/
_converse_stream_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::fmt::Debug)]
5pub struct ConverseStreamOutput {
6    /// <p>The output stream that the model generated.</p>
7    pub stream: crate::event_receiver::EventReceiver<crate::types::ConverseStreamOutput, crate::types::error::ConverseStreamOutputError>,
8    _request_id: Option<String>,
9}
10impl ConverseStreamOutput {
11    /// <p>The output stream that the model generated.</p>
12    pub fn stream(
13        &self,
14    ) -> &crate::event_receiver::EventReceiver<crate::types::ConverseStreamOutput, crate::types::error::ConverseStreamOutputError> {
15        &self.stream
16    }
17}
18impl ::aws_types::request_id::RequestId for ConverseStreamOutput {
19    fn request_id(&self) -> Option<&str> {
20        self._request_id.as_deref()
21    }
22}
23impl ConverseStreamOutput {
24    /// Creates a new builder-style object to manufacture [`ConverseStreamOutput`](crate::operation::converse_stream::ConverseStreamOutput).
25    pub fn builder() -> crate::operation::converse_stream::builders::ConverseStreamOutputBuilder {
26        crate::operation::converse_stream::builders::ConverseStreamOutputBuilder::default()
27    }
28}
29
30/// A builder for [`ConverseStreamOutput`](crate::operation::converse_stream::ConverseStreamOutput).
31#[derive(::std::default::Default, ::std::fmt::Debug)]
32#[non_exhaustive]
33pub struct ConverseStreamOutputBuilder {
34    pub(crate) stream: ::std::option::Option<
35        crate::event_receiver::EventReceiver<crate::types::ConverseStreamOutput, crate::types::error::ConverseStreamOutputError>,
36    >,
37    _request_id: Option<String>,
38}
39impl ConverseStreamOutputBuilder {
40    /// <p>The output stream that the model generated.</p>
41    pub fn stream(
42        mut self,
43        input: crate::event_receiver::EventReceiver<crate::types::ConverseStreamOutput, crate::types::error::ConverseStreamOutputError>,
44    ) -> Self {
45        self.stream = ::std::option::Option::Some(input);
46        self
47    }
48    /// <p>The output stream that the model generated.</p>
49    pub fn set_stream(
50        mut self,
51        input: ::std::option::Option<
52            crate::event_receiver::EventReceiver<crate::types::ConverseStreamOutput, crate::types::error::ConverseStreamOutputError>,
53        >,
54    ) -> Self {
55        self.stream = input;
56        self
57    }
58    /// <p>The output stream that the model generated.</p>
59    pub fn get_stream(
60        &self,
61    ) -> &::std::option::Option<
62        crate::event_receiver::EventReceiver<crate::types::ConverseStreamOutput, crate::types::error::ConverseStreamOutputError>,
63    > {
64        &self.stream
65    }
66    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
67        self._request_id = Some(request_id.into());
68        self
69    }
70
71    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
72        self._request_id = request_id;
73        self
74    }
75    /// Consumes the builder and constructs a [`ConverseStreamOutput`](crate::operation::converse_stream::ConverseStreamOutput).
76    /// This method will fail if any of the following fields are not set:
77    /// - [`stream`](crate::operation::converse_stream::builders::ConverseStreamOutputBuilder::stream)
78    pub fn build(
79        self,
80    ) -> ::std::result::Result<crate::operation::converse_stream::ConverseStreamOutput, ::aws_smithy_types::error::operation::BuildError> {
81        ::std::result::Result::Ok(crate::operation::converse_stream::ConverseStreamOutput {
82            stream: self.stream.ok_or_else(|| {
83                ::aws_smithy_types::error::operation::BuildError::missing_field(
84                    "stream",
85                    "stream was not specified but it is required when building ConverseStreamOutput",
86                )
87            })?,
88            _request_id: self._request_id,
89        })
90    }
91}