297 297 | _ => crate::operation::start_stream_transcription::StartStreamTranscriptionError::generic(generic),
|
298 298 | })
|
299 299 | }
|
300 300 |
|
301 301 | pub fn ser_start_stream_transcription_headers(
|
302 302 | input: &crate::operation::start_stream_transcription::StartStreamTranscriptionInput,
|
303 303 | mut builder: ::http::request::Builder,
|
304 304 | ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
305 305 | if let ::std::option::Option::Some(inner_1) = &input.language_code {
|
306 306 | let formatted_2 = inner_1.as_str();
|
307 + | if !formatted_2.is_empty() {
|
307 308 | let header_value = formatted_2;
|
308 309 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
309 310 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
310 311 | "language_code",
|
311 312 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
312 313 | )
|
313 314 | })?;
|
314 315 | builder = builder.header("x-amzn-transcribe-language-code", header_value);
|
315 316 | }
|
317 + | }
|
316 318 | if let ::std::option::Option::Some(inner_3) = &input.media_sample_rate_hertz {
|
317 319 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_3);
|
318 320 | let formatted_4 = encoder.encode();
|
321 + | if !formatted_4.is_empty() {
|
319 322 | let header_value = formatted_4;
|
320 323 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
321 324 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
322 325 | "media_sample_rate_hertz",
|
323 326 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
324 327 | )
|
325 328 | })?;
|
326 329 | builder = builder.header("x-amzn-transcribe-sample-rate", header_value);
|
327 330 | }
|
331 + | }
|
328 332 | if let ::std::option::Option::Some(inner_5) = &input.media_encoding {
|
329 333 | let formatted_6 = inner_5.as_str();
|
334 + | if !formatted_6.is_empty() {
|
330 335 | let header_value = formatted_6;
|
331 336 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
332 337 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
333 338 | "media_encoding",
|
334 339 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
335 340 | )
|
336 341 | })?;
|
337 342 | builder = builder.header("x-amzn-transcribe-media-encoding", header_value);
|
338 343 | }
|
344 + | }
|
339 345 | if let ::std::option::Option::Some(inner_7) = &input.vocabulary_name {
|
340 346 | let formatted_8 = inner_7.as_str();
|
347 + | if !formatted_8.is_empty() {
|
341 348 | let header_value = formatted_8;
|
342 349 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
343 350 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
344 351 | "vocabulary_name",
|
345 352 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
346 353 | )
|
347 354 | })?;
|
348 355 | builder = builder.header("x-amzn-transcribe-vocabulary-name", header_value);
|
349 356 | }
|
357 + | }
|
350 358 | if let ::std::option::Option::Some(inner_9) = &input.session_id {
|
351 359 | let formatted_10 = inner_9.as_str();
|
360 + | if !formatted_10.is_empty() {
|
352 361 | let header_value = formatted_10;
|
353 362 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
354 363 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
355 364 | "session_id",
|
356 365 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
357 366 | )
|
358 367 | })?;
|
359 368 | builder = builder.header("x-amzn-transcribe-session-id", header_value);
|
360 369 | }
|
370 + | }
|
361 371 | if let ::std::option::Option::Some(inner_11) = &input.vocabulary_filter_name {
|
362 372 | let formatted_12 = inner_11.as_str();
|
373 + | if !formatted_12.is_empty() {
|
363 374 | let header_value = formatted_12;
|
364 375 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
365 376 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
366 377 | "vocabulary_filter_name",
|
367 378 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
368 379 | )
|
369 380 | })?;
|
370 381 | builder = builder.header("x-amzn-transcribe-vocabulary-filter-name", header_value);
|
371 382 | }
|
383 + | }
|
372 384 | if let ::std::option::Option::Some(inner_13) = &input.vocabulary_filter_method {
|
373 385 | let formatted_14 = inner_13.as_str();
|
386 + | if !formatted_14.is_empty() {
|
374 387 | let header_value = formatted_14;
|
375 388 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
376 389 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
377 390 | "vocabulary_filter_method",
|
378 391 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
379 392 | )
|
380 393 | })?;
|
381 394 | builder = builder.header("x-amzn-transcribe-vocabulary-filter-method", header_value);
|
382 395 | }
|
396 + | }
|
383 397 | if let ::std::option::Option::Some(inner_15) = &input.show_speaker_label {
|
384 398 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_15);
|
385 399 | let formatted_16 = encoder.encode();
|
400 + | if !formatted_16.is_empty() {
|
386 401 | let header_value = formatted_16;
|
387 402 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
388 403 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
389 404 | "show_speaker_label",
|
390 405 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
391 406 | )
|
392 407 | })?;
|
393 408 | builder = builder.header("x-amzn-transcribe-show-speaker-label", header_value);
|
394 409 | }
|
410 + | }
|
395 411 | if let ::std::option::Option::Some(inner_17) = &input.enable_channel_identification {
|
396 412 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_17);
|
397 413 | let formatted_18 = encoder.encode();
|
414 + | if !formatted_18.is_empty() {
|
398 415 | let header_value = formatted_18;
|
399 416 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
400 417 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
401 418 | "enable_channel_identification",
|
402 419 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
403 420 | )
|
404 421 | })?;
|
405 422 | builder = builder.header("x-amzn-transcribe-enable-channel-identification", header_value);
|
406 423 | }
|
424 + | }
|
407 425 | if let ::std::option::Option::Some(inner_19) = &input.number_of_channels {
|
408 426 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_19);
|
409 427 | let formatted_20 = encoder.encode();
|
428 + | if !formatted_20.is_empty() {
|
410 429 | let header_value = formatted_20;
|
411 430 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
412 431 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
413 432 | "number_of_channels",
|
414 433 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
415 434 | )
|
416 435 | })?;
|
417 436 | builder = builder.header("x-amzn-transcribe-number-of-channels", header_value);
|
418 437 | }
|
438 + | }
|
419 439 | if let ::std::option::Option::Some(inner_21) = &input.enable_partial_results_stabilization {
|
420 440 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_21);
|
421 441 | let formatted_22 = encoder.encode();
|
442 + | if !formatted_22.is_empty() {
|
422 443 | let header_value = formatted_22;
|
423 444 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
424 445 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
425 446 | "enable_partial_results_stabilization",
|
426 447 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
427 448 | )
|
428 449 | })?;
|
429 450 | builder = builder.header("x-amzn-transcribe-enable-partial-results-stabilization", header_value);
|
430 451 | }
|
452 + | }
|
431 453 | if let ::std::option::Option::Some(inner_23) = &input.partial_results_stability {
|
432 454 | let formatted_24 = inner_23.as_str();
|
455 + | if !formatted_24.is_empty() {
|
433 456 | let header_value = formatted_24;
|
434 457 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
435 458 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
436 459 | "partial_results_stability",
|
437 460 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
438 461 | )
|
439 462 | })?;
|
440 463 | builder = builder.header("x-amzn-transcribe-partial-results-stability", header_value);
|
441 464 | }
|
465 + | }
|
442 466 | if let ::std::option::Option::Some(inner_25) = &input.content_identification_type {
|
443 467 | let formatted_26 = inner_25.as_str();
|
468 + | if !formatted_26.is_empty() {
|
444 469 | let header_value = formatted_26;
|
445 470 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
446 471 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
447 472 | "content_identification_type",
|
448 473 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
449 474 | )
|
450 475 | })?;
|
451 476 | builder = builder.header("x-amzn-transcribe-content-identification-type", header_value);
|
452 477 | }
|
478 + | }
|
453 479 | if let ::std::option::Option::Some(inner_27) = &input.content_redaction_type {
|
454 480 | let formatted_28 = inner_27.as_str();
|
481 + | if !formatted_28.is_empty() {
|
455 482 | let header_value = formatted_28;
|
456 483 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
457 484 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
458 485 | "content_redaction_type",
|
459 486 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
460 487 | )
|
461 488 | })?;
|
462 489 | builder = builder.header("x-amzn-transcribe-content-redaction-type", header_value);
|
463 490 | }
|
491 + | }
|
464 492 | if let ::std::option::Option::Some(inner_29) = &input.pii_entity_types {
|
465 493 | let formatted_30 = inner_29.as_str();
|
494 + | if !formatted_30.is_empty() {
|
466 495 | let header_value = formatted_30;
|
467 496 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
468 497 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
469 498 | "pii_entity_types",
|
470 499 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
471 500 | )
|
472 501 | })?;
|
473 502 | builder = builder.header("x-amzn-transcribe-pii-entity-types", header_value);
|
474 503 | }
|
504 + | }
|
475 505 | if let ::std::option::Option::Some(inner_31) = &input.language_model_name {
|
476 506 | let formatted_32 = inner_31.as_str();
|
507 + | if !formatted_32.is_empty() {
|
477 508 | let header_value = formatted_32;
|
478 509 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
479 510 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
480 511 | "language_model_name",
|
481 512 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
482 513 | )
|
483 514 | })?;
|
484 515 | builder = builder.header("x-amzn-transcribe-language-model-name", header_value);
|
485 516 | }
|
517 + | }
|
486 518 | if let ::std::option::Option::Some(inner_33) = &input.identify_language {
|
487 519 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_33);
|
488 520 | let formatted_34 = encoder.encode();
|
521 + | if !formatted_34.is_empty() {
|
489 522 | let header_value = formatted_34;
|
490 523 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
491 524 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
492 525 | "identify_language",
|
493 526 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
494 527 | )
|
495 528 | })?;
|
496 529 | builder = builder.header("x-amzn-transcribe-identify-language", header_value);
|
497 530 | }
|
531 + | }
|
498 532 | if let ::std::option::Option::Some(inner_35) = &input.language_options {
|
499 533 | let formatted_36 = inner_35.as_str();
|
534 + | if !formatted_36.is_empty() {
|
500 535 | let header_value = formatted_36;
|
501 536 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
502 537 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
503 538 | "language_options",
|
504 539 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
505 540 | )
|
506 541 | })?;
|
507 542 | builder = builder.header("x-amzn-transcribe-language-options", header_value);
|
508 543 | }
|
544 + | }
|
509 545 | if let ::std::option::Option::Some(inner_37) = &input.preferred_language {
|
510 546 | let formatted_38 = inner_37.as_str();
|
547 + | if !formatted_38.is_empty() {
|
511 548 | let header_value = formatted_38;
|
512 549 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
513 550 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
514 551 | "preferred_language",
|
515 552 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
516 553 | )
|
517 554 | })?;
|
518 555 | builder = builder.header("x-amzn-transcribe-preferred-language", header_value);
|
519 556 | }
|
557 + | }
|
520 558 | if let ::std::option::Option::Some(inner_39) = &input.identify_multiple_languages {
|
521 559 | let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_39);
|
522 560 | let formatted_40 = encoder.encode();
|
561 + | if !formatted_40.is_empty() {
|
523 562 | let header_value = formatted_40;
|
524 563 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
525 564 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
526 565 | "identify_multiple_languages",
|
527 566 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
528 567 | )
|
529 568 | })?;
|
530 569 | builder = builder.header("x-amzn-transcribe-identify-multiple-languages", header_value);
|
531 570 | }
|
571 + | }
|
532 572 | if let ::std::option::Option::Some(inner_41) = &input.vocabulary_names {
|
533 573 | let formatted_42 = inner_41.as_str();
|
574 + | if !formatted_42.is_empty() {
|
534 575 | let header_value = formatted_42;
|
535 576 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
536 577 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
537 578 | "vocabulary_names",
|
538 579 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
539 580 | )
|
540 581 | })?;
|
541 582 | builder = builder.header("x-amzn-transcribe-vocabulary-names", header_value);
|
542 583 | }
|
584 + | }
|
543 585 | if let ::std::option::Option::Some(inner_43) = &input.vocabulary_filter_names {
|
544 586 | let formatted_44 = inner_43.as_str();
|
587 + | if !formatted_44.is_empty() {
|
545 588 | let header_value = formatted_44;
|
546 589 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
547 590 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
548 591 | "vocabulary_filter_names",
|
549 592 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
550 593 | )
|
551 594 | })?;
|
552 595 | builder = builder.header("x-amzn-transcribe-vocabulary-filter-names", header_value);
|
553 596 | }
|
597 + | }
|
554 598 | Ok(builder)
|
555 599 | }
|