181 181 | )
|
182 182 | },
|
183 183 | )?,
|
184 184 | );
|
185 185 | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
186 186 | output
|
187 187 | .build()
|
188 188 | .map_err(crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::unhandled)?
|
189 189 | })
|
190 190 | }
|
191 - |
|
192 - | #[allow(clippy::unnecessary_wraps)]
|
193 - | pub fn de_start_call_analytics_stream_transcription_http_error(
|
194 - | _response_status: u16,
|
195 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
196 - | _response_body: &[u8],
|
197 - | ) -> std::result::Result<
|
198 - | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionOutput,
|
199 - | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError,
|
200 - | > {
|
201 - | #[allow(unused_mut)]
|
202 - | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
203 - | .map_err(crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::unhandled)?;
|
204 - | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
|
205 - | let generic = generic_builder.build();
|
206 - | let error_code = match generic.code() {
|
207 - | Some(code) => code,
|
208 - | None => {
|
209 - | return Err(crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::unhandled(generic))
|
210 - | }
|
211 - | };
|
212 - |
|
213 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
214 - | Err(match error_code {
|
215 - | "BadRequestException" => {
|
216 - | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::BadRequestException({
|
217 - | #[allow(unused_mut)]
|
218 - | let mut tmp = {
|
219 - | #[allow(unused_mut)]
|
220 - | let mut output = crate::types::error::builders::BadRequestExceptionBuilder::default();
|
221 - | output = crate::protocol_serde::shape_bad_request_exception::de_bad_request_exception_json_err(_response_body, output).map_err(
|
222 - | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::unhandled,
|
223 - | )?;
|
224 - | let output = output.meta(generic);
|
225 - | output.build()
|
226 - | };
|
227 - | if tmp.message.is_none() {
|
228 - | tmp.message = _error_message;
|
229 - | }
|
230 - | tmp
|
231 - | })
|
232 - | }
|
233 - | "ConflictException" => {
|
234 - | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::ConflictException({
|
235 - | #[allow(unused_mut)]
|
236 - | let mut tmp = {
|
237 - | #[allow(unused_mut)]
|
238 - | let mut output = crate::types::error::builders::ConflictExceptionBuilder::default();
|
239 - | output = crate::protocol_serde::shape_conflict_exception::de_conflict_exception_json_err(_response_body, output).map_err(
|
240 - | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::unhandled,
|
241 - | )?;
|
242 - | let output = output.meta(generic);
|
243 - | output.build()
|
244 - | };
|
245 - | if tmp.message.is_none() {
|
246 - | tmp.message = _error_message;
|
247 - | }
|
248 - | tmp
|
249 - | })
|
250 - | }
|
251 - | "InternalFailureException" => {
|
252 - | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::InternalFailureException({
|
253 - | #[allow(unused_mut)]
|
254 - | let mut tmp = {
|
255 - | #[allow(unused_mut)]
|
256 - | let mut output = crate::types::error::builders::InternalFailureExceptionBuilder::default();
|
257 - | output = crate::protocol_serde::shape_internal_failure_exception::de_internal_failure_exception_json_err(_response_body, output)
|
258 - | .map_err(
|
259 - | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::unhandled,
|
260 - | )?;
|
261 - | let output = output.meta(generic);
|
262 - | output.build()
|
263 - | };
|
264 - | if tmp.message.is_none() {
|
265 - | tmp.message = _error_message;
|
266 - | }
|
267 - | tmp
|
268 - | })
|
269 - | }
|
270 - | "LimitExceededException" => {
|
271 - | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::LimitExceededException({
|
272 - | #[allow(unused_mut)]
|
273 - | let mut tmp = {
|
274 - | #[allow(unused_mut)]
|
275 - | let mut output = crate::types::error::builders::LimitExceededExceptionBuilder::default();
|
276 - | output = crate::protocol_serde::shape_limit_exceeded_exception::de_limit_exceeded_exception_json_err(_response_body, output)
|
277 - | .map_err(
|
278 - | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::unhandled,
|
279 - | )?;
|
280 - | let output = output.meta(generic);
|
281 - | output.build()
|
282 - | };
|
283 - | if tmp.message.is_none() {
|
284 - | tmp.message = _error_message;
|
285 - | }
|
286 - | tmp
|
287 - | })
|
288 - | }
|
289 - | "ServiceUnavailableException" => {
|
290 - | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::ServiceUnavailableException({
|
291 - | #[allow(unused_mut)]
|
292 - | let mut tmp = {
|
293 - | #[allow(unused_mut)]
|
294 - | let mut output = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
|
295 - | output =
|
296 - | crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(_response_body, output)
|
297 - | .map_err(
|
298 - | crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::unhandled,
|
299 - | )?;
|
300 - | let output = output.meta(generic);
|
301 - | output.build()
|
302 - | };
|
303 - | if tmp.message.is_none() {
|
304 - | tmp.message = _error_message;
|
305 - | }
|
306 - | tmp
|
307 - | })
|
308 - | }
|
309 - | _ => crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::generic(generic),
|
310 - | })
|
311 - | }
|
312 - |
|
313 - | pub fn ser_start_call_analytics_stream_transcription_headers(
|
314 - | input: &crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionInput,
|
315 - | mut builder: ::http_1x::request::Builder,
|
316 - | ) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
317 - | if let ::std::option::Option::Some(inner_1) = &input.language_code {
|
318 - | let formatted_2 = inner_1.as_str();
|
319 - | let header_value = formatted_2;
|
320 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
321 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
322 - | "language_code",
|
323 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
324 - | )
|
325 - | })?;
|
326 - | builder = builder.header("x-amzn-transcribe-language-code", header_value);
|
327 - | }
|
328 - | if let ::std::option::Option::Some(inner_3) = &input.media_sample_rate_hertz {
|
329 - | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_3);
|
330 - | let formatted_4 = encoder.encode();
|
331 - | let header_value = formatted_4;
|
332 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
333 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
334 - | "media_sample_rate_hertz",
|
335 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
336 - | )
|
337 - | })?;
|
338 - | builder = builder.header("x-amzn-transcribe-sample-rate", header_value);
|
339 - | }
|
340 - | if let ::std::option::Option::Some(inner_5) = &input.media_encoding {
|
341 - | let formatted_6 = inner_5.as_str();
|
342 - | let header_value = formatted_6;
|
343 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
344 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
345 - | "media_encoding",
|
346 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
347 - | )
|
348 - | })?;
|
349 - | builder = builder.header("x-amzn-transcribe-media-encoding", header_value);
|
350 - | }
|
351 - | if let ::std::option::Option::Some(inner_7) = &input.vocabulary_name {
|
352 - | let formatted_8 = inner_7.as_str();
|
353 - | let header_value = formatted_8;
|
354 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
355 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
356 - | "vocabulary_name",
|
357 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
358 - | )
|
359 - | })?;
|
360 - | builder = builder.header("x-amzn-transcribe-vocabulary-name", header_value);
|
361 - | }
|
362 - | if let ::std::option::Option::Some(inner_9) = &input.session_id {
|
363 - | let formatted_10 = inner_9.as_str();
|
364 - | let header_value = formatted_10;
|
365 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
366 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
367 - | "session_id",
|
368 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
369 - | )
|
370 - | })?;
|
371 - | builder = builder.header("x-amzn-transcribe-session-id", header_value);
|
372 - | }
|
373 - | if let ::std::option::Option::Some(inner_11) = &input.vocabulary_filter_name {
|
374 - | let formatted_12 = inner_11.as_str();
|
375 - | let header_value = formatted_12;
|
376 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
377 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
378 - | "vocabulary_filter_name",
|
379 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
380 - | )
|
381 - | })?;
|
382 - | builder = builder.header("x-amzn-transcribe-vocabulary-filter-name", header_value);
|
383 - | }
|
384 - | if let ::std::option::Option::Some(inner_13) = &input.vocabulary_filter_method {
|
385 - | let formatted_14 = inner_13.as_str();
|
386 - | let header_value = formatted_14;
|
387 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
388 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
389 - | "vocabulary_filter_method",
|
390 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
391 - | )
|
392 - | })?;
|
393 - | builder = builder.header("x-amzn-transcribe-vocabulary-filter-method", header_value);
|
394 - | }
|
395 - | if let ::std::option::Option::Some(inner_15) = &input.language_model_name {
|
396 - | let formatted_16 = inner_15.as_str();
|
397 - | let header_value = formatted_16;
|
398 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
399 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
400 - | "language_model_name",
|
401 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
402 - | )
|
403 - | })?;
|
404 - | builder = builder.header("x-amzn-transcribe-language-model-name", header_value);
|
405 - | }
|
406 - | if let ::std::option::Option::Some(inner_17) = &input.identify_language {
|
407 - | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_17);
|
408 - | let formatted_18 = encoder.encode();
|
409 - | let header_value = formatted_18;
|
410 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
411 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
412 - | "identify_language",
|
413 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
414 - | )
|
415 - | })?;
|
416 - | builder = builder.header("x-amzn-transcribe-identify-language", header_value);
|
417 - | }
|
418 - | if let ::std::option::Option::Some(inner_19) = &input.language_options {
|
419 - | let formatted_20 = inner_19.as_str();
|
420 - | let header_value = formatted_20;
|
421 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
422 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
423 - | "language_options",
|
424 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
425 - | )
|
426 - | })?;
|
427 - | builder = builder.header("x-amzn-transcribe-language-options", header_value);
|
428 - | }
|
429 - | if let ::std::option::Option::Some(inner_21) = &input.preferred_language {
|
430 - | let formatted_22 = inner_21.as_str();
|
431 - | let header_value = formatted_22;
|
432 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
433 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
434 - | "preferred_language",
|
435 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
436 - | )
|
437 - | })?;
|
438 - | builder = builder.header("x-amzn-transcribe-preferred-language", header_value);
|
439 - | }
|
440 - | if let ::std::option::Option::Some(inner_23) = &input.vocabulary_names {
|
441 - | let formatted_24 = inner_23.as_str();
|
442 - | let header_value = formatted_24;
|
443 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
444 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
445 - | "vocabulary_names",
|
446 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
447 - | )
|
448 - | })?;
|
449 - | builder = builder.header("x-amzn-transcribe-vocabulary-names", header_value);
|
450 - | }
|
451 - | if let ::std::option::Option::Some(inner_25) = &input.vocabulary_filter_names {
|
452 - | let formatted_26 = inner_25.as_str();
|
453 - | let header_value = formatted_26;
|
454 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
455 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
456 - | "vocabulary_filter_names",
|
457 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
458 - | )
|
459 - | })?;
|
460 - | builder = builder.header("x-amzn-transcribe-vocabulary-filter-names", header_value);
|
461 - | }
|
462 - | if let ::std::option::Option::Some(inner_27) = &input.enable_partial_results_stabilization {
|
463 - | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_27);
|
464 - | let formatted_28 = encoder.encode();
|
465 - | let header_value = formatted_28;
|
466 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
467 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
468 - | "enable_partial_results_stabilization",
|
469 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
470 - | )
|
471 - | })?;
|
472 - | builder = builder.header("x-amzn-transcribe-enable-partial-results-stabilization", header_value);
|
473 - | }
|
474 - | if let ::std::option::Option::Some(inner_29) = &input.partial_results_stability {
|
475 - | let formatted_30 = inner_29.as_str();
|
476 - | let header_value = formatted_30;
|
477 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
478 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
479 - | "partial_results_stability",
|
480 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
481 - | )
|
482 - | })?;
|
483 - | builder = builder.header("x-amzn-transcribe-partial-results-stability", header_value);
|
484 - | }
|
485 - | if let ::std::option::Option::Some(inner_31) = &input.content_identification_type {
|
486 - | let formatted_32 = inner_31.as_str();
|
487 - | let header_value = formatted_32;
|
488 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
489 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
490 - | "content_identification_type",
|
491 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
492 - | )
|
493 - | })?;
|
494 - | builder = builder.header("x-amzn-transcribe-content-identification-type", header_value);
|
495 - | }
|
496 - | if let ::std::option::Option::Some(inner_33) = &input.content_redaction_type {
|
497 - | let formatted_34 = inner_33.as_str();
|
498 - | let header_value = formatted_34;
|
499 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
500 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
501 - | "content_redaction_type",
|
502 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
503 - | )
|
504 - | })?;
|
505 - | builder = builder.header("x-amzn-transcribe-content-redaction-type", header_value);
|
506 - | }
|
507 - | if let ::std::option::Option::Some(inner_35) = &input.pii_entity_types {
|
508 - | let formatted_36 = inner_35.as_str();
|
509 - | let header_value = formatted_36;
|
510 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
511 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
512 - | "pii_entity_types",
|
513 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
514 - | )
|
515 - | })?;
|
516 - | builder = builder.header("x-amzn-transcribe-pii-entity-types", header_value);
|
517 - | }
|
518 - | Ok(builder)
|
519 - | }
|