155 155 | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError,
|
156 156 | > {
|
157 157 | #[allow(unused_mut)]
|
158 158 | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
159 159 | .map_err(crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::unhandled)?;
|
160 160 | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
|
161 161 | let generic = generic_builder.build();
|
162 162 | let error_code = match generic.code() {
|
163 163 | Some(code) => code,
|
164 164 | None => {
|
165 165 | return Err(crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::unhandled(generic))
|
166 166 | }
|
167 167 | };
|
168 168 |
|
169 169 | let _error_message = generic.message().map(|msg| msg.to_owned());
|
170 170 | Err(match error_code {
|
171 171 | "ServiceUnavailableException" => {
|
172 172 | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::ServiceUnavailableException({
|
173 173 | #[allow(unused_mut)]
|
174 174 | let mut tmp = {
|
175 175 | #[allow(unused_mut)]
|
176 176 | let mut output = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
|
177 177 | output =
|
178 178 | crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(_response_body, output)
|
179 179 | .map_err(
|
180 180 | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::unhandled,
|
181 181 | )?;
|
182 182 | let output = output.meta(generic);
|
183 183 | output.build()
|
184 184 | };
|
185 - | if tmp.message.is_none() {
|
186 - | tmp.message = _error_message;
|
187 - | }
|
188 185 | tmp
|
189 186 | })
|
190 187 | }
|
191 188 | "BadRequestException" => {
|
192 189 | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::BadRequestException({
|
193 190 | #[allow(unused_mut)]
|
194 191 | let mut tmp = {
|
195 192 | #[allow(unused_mut)]
|
196 193 | let mut output = crate::types::error::builders::BadRequestExceptionBuilder::default();
|
197 194 | output = crate::protocol_serde::shape_bad_request_exception::de_bad_request_exception_json_err(_response_body, output).map_err(
|
198 195 | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::unhandled,
|
199 196 | )?;
|
200 197 | let output = output.meta(generic);
|
201 198 | output.build()
|
202 199 | };
|
203 - | if tmp.message.is_none() {
|
204 - | tmp.message = _error_message;
|
205 - | }
|
206 200 | tmp
|
207 201 | })
|
208 202 | }
|
209 203 | "InternalFailureException" => {
|
210 204 | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::InternalFailureException({
|
211 205 | #[allow(unused_mut)]
|
212 206 | let mut tmp = {
|
213 207 | #[allow(unused_mut)]
|
214 208 | let mut output = crate::types::error::builders::InternalFailureExceptionBuilder::default();
|
215 209 | output = crate::protocol_serde::shape_internal_failure_exception::de_internal_failure_exception_json_err(_response_body, output)
|
216 210 | .map_err(
|
217 211 | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::unhandled,
|
218 212 | )?;
|
219 213 | let output = output.meta(generic);
|
220 214 | output.build()
|
221 215 | };
|
222 - | if tmp.message.is_none() {
|
223 - | tmp.message = _error_message;
|
224 - | }
|
225 216 | tmp
|
226 217 | })
|
227 218 | }
|
228 219 | "ConflictException" => {
|
229 220 | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::ConflictException({
|
230 221 | #[allow(unused_mut)]
|
231 222 | let mut tmp = {
|
232 223 | #[allow(unused_mut)]
|
233 224 | let mut output = crate::types::error::builders::ConflictExceptionBuilder::default();
|
234 225 | output = crate::protocol_serde::shape_conflict_exception::de_conflict_exception_json_err(_response_body, output).map_err(
|
235 226 | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::unhandled,
|
236 227 | )?;
|
237 228 | let output = output.meta(generic);
|
238 229 | output.build()
|
239 230 | };
|
240 - | if tmp.message.is_none() {
|
241 - | tmp.message = _error_message;
|
242 - | }
|
243 231 | tmp
|
244 232 | })
|
245 233 | }
|
246 234 | "LimitExceededException" => {
|
247 235 | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::LimitExceededException({
|
248 236 | #[allow(unused_mut)]
|
249 237 | let mut tmp = {
|
250 238 | #[allow(unused_mut)]
|
251 239 | let mut output = crate::types::error::builders::LimitExceededExceptionBuilder::default();
|
252 240 | output = crate::protocol_serde::shape_limit_exceeded_exception::de_limit_exceeded_exception_json_err(_response_body, output)
|
253 241 | .map_err(
|
254 242 | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::unhandled,
|
255 243 | )?;
|
256 244 | let output = output.meta(generic);
|
257 245 | output.build()
|
258 246 | };
|
259 - | if tmp.message.is_none() {
|
260 - | tmp.message = _error_message;
|
261 - | }
|
262 247 | tmp
|
263 248 | })
|
264 249 | }
|
265 250 | _ => crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::generic(generic),
|
266 251 | })
|
267 252 | }
|
268 253 |
|
269 254 | pub fn ser_start_call_analytics_stream_transcription_headers(
|
270 255 | input: &crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionInput,
|
271 256 | mut builder: ::http::request::Builder,
|
272 257 | ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
273 258 | if let ::std::option::Option::Some(inner_1) = &input.language_code {
|
274 259 | let formatted_2 = inner_1.as_str();
|
275 260 | let header_value = formatted_2;
|
276 261 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
277 262 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
278 263 | "language_code",
|
279 264 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
280 265 | )
|
281 266 | })?;
|
282 267 | builder = builder.header("x-amzn-transcribe-language-code", header_value);
|
283 268 | }
|
284 269 | if let ::std::option::Option::Some(inner_3) = &input.media_sample_rate_hertz {
|
285 270 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_3);
|
286 271 | let formatted_4 = encoder.encode();
|
287 272 | let header_value = formatted_4;
|
288 273 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
289 274 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
290 275 | "media_sample_rate_hertz",
|
291 276 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|