14 14 | let mut output = crate::operation::converse_stream::builders::ConverseStreamOutputBuilder::default();
|
15 15 | output = output.set_stream(Some(crate::protocol_serde::shape_converse_stream_output::de_stream_payload(
|
16 16 | _response_body,
|
17 17 | )?));
|
18 18 | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
19 19 | output
|
20 20 | .build()
|
21 21 | .map_err(crate::operation::converse_stream::ConverseStreamError::unhandled)?
|
22 22 | })
|
23 23 | }
|
24 - |
|
25 - | #[allow(clippy::unnecessary_wraps)]
|
26 - | pub fn de_converse_stream_http_error(
|
27 - | _response_status: u16,
|
28 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
29 - | _response_body: &[u8],
|
30 - | ) -> std::result::Result<crate::operation::converse_stream::ConverseStreamOutput, crate::operation::converse_stream::ConverseStreamError> {
|
31 - | #[allow(unused_mut)]
|
32 - | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
33 - | .map_err(crate::operation::converse_stream::ConverseStreamError::unhandled)?;
|
34 - | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
|
35 - | let generic = generic_builder.build();
|
36 - | let error_code = match generic.code() {
|
37 - | Some(code) => code,
|
38 - | None => return Err(crate::operation::converse_stream::ConverseStreamError::unhandled(generic)),
|
39 - | };
|
40 - |
|
41 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
42 - | Err(match error_code {
|
43 - | "AccessDeniedException" => crate::operation::converse_stream::ConverseStreamError::AccessDeniedException({
|
44 - | #[allow(unused_mut)]
|
45 - | let mut tmp = {
|
46 - | #[allow(unused_mut)]
|
47 - | let mut output = crate::types::error::builders::AccessDeniedExceptionBuilder::default();
|
48 - | output = crate::protocol_serde::shape_access_denied_exception::de_access_denied_exception_json_err(_response_body, output)
|
49 - | .map_err(crate::operation::converse_stream::ConverseStreamError::unhandled)?;
|
50 - | let output = output.meta(generic);
|
51 - | output.build()
|
52 - | };
|
53 - | if tmp.message.is_none() {
|
54 - | tmp.message = _error_message;
|
55 - | }
|
56 - | tmp
|
57 - | }),
|
58 - | "InternalServerException" => crate::operation::converse_stream::ConverseStreamError::InternalServerException({
|
59 - | #[allow(unused_mut)]
|
60 - | let mut tmp = {
|
61 - | #[allow(unused_mut)]
|
62 - | let mut output = crate::types::error::builders::InternalServerExceptionBuilder::default();
|
63 - | output = crate::protocol_serde::shape_internal_server_exception::de_internal_server_exception_json_err(_response_body, output)
|
64 - | .map_err(crate::operation::converse_stream::ConverseStreamError::unhandled)?;
|
65 - | let output = output.meta(generic);
|
66 - | output.build()
|
67 - | };
|
68 - | if tmp.message.is_none() {
|
69 - | tmp.message = _error_message;
|
70 - | }
|
71 - | tmp
|
72 - | }),
|
73 - | "ModelErrorException" => crate::operation::converse_stream::ConverseStreamError::ModelErrorException({
|
74 - | #[allow(unused_mut)]
|
75 - | let mut tmp = {
|
76 - | #[allow(unused_mut)]
|
77 - | let mut output = crate::types::error::builders::ModelErrorExceptionBuilder::default();
|
78 - | output = crate::protocol_serde::shape_model_error_exception::de_model_error_exception_json_err(_response_body, output)
|
79 - | .map_err(crate::operation::converse_stream::ConverseStreamError::unhandled)?;
|
80 - | let output = output.meta(generic);
|
81 - | output.build()
|
82 - | };
|
83 - | if tmp.message.is_none() {
|
84 - | tmp.message = _error_message;
|
85 - | }
|
86 - | tmp
|
87 - | }),
|
88 - | "ModelNotReadyException" => crate::operation::converse_stream::ConverseStreamError::ModelNotReadyException({
|
89 - | #[allow(unused_mut)]
|
90 - | let mut tmp = {
|
91 - | #[allow(unused_mut)]
|
92 - | let mut output = crate::types::error::builders::ModelNotReadyExceptionBuilder::default();
|
93 - | output = crate::protocol_serde::shape_model_not_ready_exception::de_model_not_ready_exception_json_err(_response_body, output)
|
94 - | .map_err(crate::operation::converse_stream::ConverseStreamError::unhandled)?;
|
95 - | let output = output.meta(generic);
|
96 - | output.build()
|
97 - | };
|
98 - | if tmp.message.is_none() {
|
99 - | tmp.message = _error_message;
|
100 - | }
|
101 - | tmp
|
102 - | }),
|
103 - | "ModelTimeoutException" => crate::operation::converse_stream::ConverseStreamError::ModelTimeoutException({
|
104 - | #[allow(unused_mut)]
|
105 - | let mut tmp = {
|
106 - | #[allow(unused_mut)]
|
107 - | let mut output = crate::types::error::builders::ModelTimeoutExceptionBuilder::default();
|
108 - | output = crate::protocol_serde::shape_model_timeout_exception::de_model_timeout_exception_json_err(_response_body, output)
|
109 - | .map_err(crate::operation::converse_stream::ConverseStreamError::unhandled)?;
|
110 - | let output = output.meta(generic);
|
111 - | output.build()
|
112 - | };
|
113 - | if tmp.message.is_none() {
|
114 - | tmp.message = _error_message;
|
115 - | }
|
116 - | tmp
|
117 - | }),
|
118 - | "ResourceNotFoundException" => crate::operation::converse_stream::ConverseStreamError::ResourceNotFoundException({
|
119 - | #[allow(unused_mut)]
|
120 - | let mut tmp = {
|
121 - | #[allow(unused_mut)]
|
122 - | let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
|
123 - | output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
|
124 - | .map_err(crate::operation::converse_stream::ConverseStreamError::unhandled)?;
|
125 - | let output = output.meta(generic);
|
126 - | output.build()
|
127 - | };
|
128 - | if tmp.message.is_none() {
|
129 - | tmp.message = _error_message;
|
130 - | }
|
131 - | tmp
|
132 - | }),
|
133 - | "ServiceUnavailableException" => crate::operation::converse_stream::ConverseStreamError::ServiceUnavailableException({
|
134 - | #[allow(unused_mut)]
|
135 - | let mut tmp = {
|
136 - | #[allow(unused_mut)]
|
137 - | let mut output = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
|
138 - | output =
|
139 - | crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(_response_body, output)
|
140 - | .map_err(crate::operation::converse_stream::ConverseStreamError::unhandled)?;
|
141 - | let output = output.meta(generic);
|
142 - | output.build()
|
143 - | };
|
144 - | if tmp.message.is_none() {
|
145 - | tmp.message = _error_message;
|
146 - | }
|
147 - | tmp
|
148 - | }),
|
149 - | "ThrottlingException" => crate::operation::converse_stream::ConverseStreamError::ThrottlingException({
|
150 - | #[allow(unused_mut)]
|
151 - | let mut tmp = {
|
152 - | #[allow(unused_mut)]
|
153 - | let mut output = crate::types::error::builders::ThrottlingExceptionBuilder::default();
|
154 - | output = crate::protocol_serde::shape_throttling_exception::de_throttling_exception_json_err(_response_body, output)
|
155 - | .map_err(crate::operation::converse_stream::ConverseStreamError::unhandled)?;
|
156 - | let output = output.meta(generic);
|
157 - | output.build()
|
158 - | };
|
159 - | if tmp.message.is_none() {
|
160 - | tmp.message = _error_message;
|
161 - | }
|
162 - | tmp
|
163 - | }),
|
164 - | "ValidationException" => crate::operation::converse_stream::ConverseStreamError::ValidationException({
|
165 - | #[allow(unused_mut)]
|
166 - | let mut tmp = {
|
167 - | #[allow(unused_mut)]
|
168 - | let mut output = crate::types::error::builders::ValidationExceptionBuilder::default();
|
169 - | output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
|
170 - | .map_err(crate::operation::converse_stream::ConverseStreamError::unhandled)?;
|
171 - | let output = output.meta(generic);
|
172 - | output.build()
|
173 - | };
|
174 - | if tmp.message.is_none() {
|
175 - | tmp.message = _error_message;
|
176 - | }
|
177 - | tmp
|
178 - | }),
|
179 - | "ModelStreamErrorException" => crate::operation::converse_stream::ConverseStreamError::ModelStreamErrorException({
|
180 - | #[allow(unused_mut)]
|
181 - | let mut tmp = {
|
182 - | #[allow(unused_mut)]
|
183 - | let mut output = crate::types::error::builders::ModelStreamErrorExceptionBuilder::default();
|
184 - | output = crate::protocol_serde::shape_model_stream_error_exception::de_model_stream_error_exception_json_err(_response_body, output)
|
185 - | .map_err(crate::operation::converse_stream::ConverseStreamError::unhandled)?;
|
186 - | let output = output.meta(generic);
|
187 - | output.build()
|
188 - | };
|
189 - | if tmp.message.is_none() {
|
190 - | tmp.message = _error_message;
|
191 - | }
|
192 - | tmp
|
193 - | }),
|
194 - | _ => crate::operation::converse_stream::ConverseStreamError::generic(generic),
|
195 - | })
|
196 - | }
|
197 - |
|
198 - | pub fn ser_converse_stream_input(
|
199 - | input: &crate::operation::converse_stream::ConverseStreamInput,
|
200 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
201 - | let mut out = String::new();
|
202 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
203 - | crate::protocol_serde::shape_converse_stream_input::ser_converse_stream_input_input(&mut object, input)?;
|
204 - | object.finish();
|
205 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
206 - | }
|