1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[derive(Debug)]
pub(crate) struct Handle {
pub(crate) client: aws_smithy_client::Client<
aws_smithy_client::erase::DynConnector,
aws_smithy_client::erase::DynMiddleware<aws_smithy_client::erase::DynConnector>,
>,
pub(crate) conf: crate::Config,
}
/// Client for Amazon Polly
///
/// Client for invoking operations on Amazon Polly. Each operation on Amazon Polly is a method on this
/// this struct. `.send()` MUST be invoked on the generated operations to dispatch the request to the service.
///
/// # Examples
/// **Constructing a client and invoking an operation**
/// ```rust,no_run
/// # async fn docs() {
/// // create a shared configuration. This can be used & shared between multiple service clients.
/// let shared_config = aws_config::load_from_env().await;
/// let client = aws_sdk_polly::Client::new(&shared_config);
/// // invoke an operation
/// /* let rsp = client
/// .<operation_name>().
/// .<param>("some value")
/// .send().await; */
/// # }
/// ```
/// **Constructing a client with custom configuration**
/// ```rust,no_run
/// use aws_config::RetryConfig;
/// # async fn docs() {
/// let shared_config = aws_config::load_from_env().await;
/// let config = aws_sdk_polly::config::Builder::from(&shared_config)
/// .retry_config(RetryConfig::disabled())
/// .build();
/// let client = aws_sdk_polly::Client::from_conf(config);
/// # }
#[derive(std::fmt::Debug)]
pub struct Client {
handle: std::sync::Arc<Handle>,
}
impl std::clone::Clone for Client {
fn clone(&self) -> Self {
Self {
handle: self.handle.clone(),
}
}
}
#[doc(inline)]
pub use aws_smithy_client::Builder;
impl
From<
aws_smithy_client::Client<
aws_smithy_client::erase::DynConnector,
aws_smithy_client::erase::DynMiddleware<aws_smithy_client::erase::DynConnector>,
>,
> for Client
{
fn from(
client: aws_smithy_client::Client<
aws_smithy_client::erase::DynConnector,
aws_smithy_client::erase::DynMiddleware<aws_smithy_client::erase::DynConnector>,
>,
) -> Self {
Self::with_config(client, crate::Config::builder().build())
}
}
impl Client {
/// Creates a client with the given service configuration.
pub fn with_config(
client: aws_smithy_client::Client<
aws_smithy_client::erase::DynConnector,
aws_smithy_client::erase::DynMiddleware<aws_smithy_client::erase::DynConnector>,
>,
conf: crate::Config,
) -> Self {
Self {
handle: std::sync::Arc::new(Handle { client, conf }),
}
}
/// Returns the client's configuration.
pub fn conf(&self) -> &crate::Config {
&self.handle.conf
}
}
impl Client {
/// Constructs a fluent builder for the [`DeleteLexicon`](crate::client::fluent_builders::DeleteLexicon) operation.
///
/// - The fluent builder is configurable:
/// - [`name(impl Into<String>)`](crate::client::fluent_builders::DeleteLexicon::name) / [`set_name(Option<String>)`](crate::client::fluent_builders::DeleteLexicon::set_name): <p>The name of the lexicon to delete. Must be an existing lexicon in the region.</p>
/// - On success, responds with [`DeleteLexiconOutput`](crate::output::DeleteLexiconOutput)
/// - On failure, responds with [`SdkError<DeleteLexiconError>`](crate::error::DeleteLexiconError)
pub fn delete_lexicon(&self) -> fluent_builders::DeleteLexicon {
fluent_builders::DeleteLexicon::new(self.handle.clone())
}
/// Constructs a fluent builder for the [`DescribeVoices`](crate::client::fluent_builders::DescribeVoices) operation.
///
/// - The fluent builder is configurable:
/// - [`engine(Engine)`](crate::client::fluent_builders::DescribeVoices::engine) / [`set_engine(Option<Engine>)`](crate::client::fluent_builders::DescribeVoices::set_engine): <p>Specifies the engine (<code>standard</code> or <code>neural</code>) used by Amazon Polly when processing input text for speech synthesis. </p>
/// - [`language_code(LanguageCode)`](crate::client::fluent_builders::DescribeVoices::language_code) / [`set_language_code(Option<LanguageCode>)`](crate::client::fluent_builders::DescribeVoices::set_language_code): <p> The language identification tag (ISO 639 code for the language name-ISO 3166 country code) for filtering the list of voices returned. If you don't specify this optional parameter, all available voices are returned. </p>
/// - [`include_additional_language_codes(bool)`](crate::client::fluent_builders::DescribeVoices::include_additional_language_codes) / [`set_include_additional_language_codes(bool)`](crate::client::fluent_builders::DescribeVoices::set_include_additional_language_codes): <p>Boolean value indicating whether to return any bilingual voices that use the specified language as an additional language. For instance, if you request all languages that use US English (es-US), and there is an Italian voice that speaks both Italian (it-IT) and US English, that voice will be included if you specify <code>yes</code> but not if you specify <code>no</code>.</p>
/// - [`next_token(impl Into<String>)`](crate::client::fluent_builders::DescribeVoices::next_token) / [`set_next_token(Option<String>)`](crate::client::fluent_builders::DescribeVoices::set_next_token): <p>An opaque pagination token returned from the previous <code>DescribeVoices</code> operation. If present, this indicates where to continue the listing.</p>
/// - On success, responds with [`DescribeVoicesOutput`](crate::output::DescribeVoicesOutput) with field(s):
/// - [`voices(Option<Vec<Voice>>)`](crate::output::DescribeVoicesOutput::voices): <p>A list of voices with their properties.</p>
/// - [`next_token(Option<String>)`](crate::output::DescribeVoicesOutput::next_token): <p>The pagination token to use in the next request to continue the listing of voices. <code>NextToken</code> is returned only if the response is truncated.</p>
/// - On failure, responds with [`SdkError<DescribeVoicesError>`](crate::error::DescribeVoicesError)
pub fn describe_voices(&self) -> fluent_builders::DescribeVoices {
fluent_builders::DescribeVoices::new(self.handle.clone())
}
/// Constructs a fluent builder for the [`GetLexicon`](crate::client::fluent_builders::GetLexicon) operation.
///
/// - The fluent builder is configurable:
/// - [`name(impl Into<String>)`](crate::client::fluent_builders::GetLexicon::name) / [`set_name(Option<String>)`](crate::client::fluent_builders::GetLexicon::set_name): <p>Name of the lexicon.</p>
/// - On success, responds with [`GetLexiconOutput`](crate::output::GetLexiconOutput) with field(s):
/// - [`lexicon(Option<Lexicon>)`](crate::output::GetLexiconOutput::lexicon): <p>Lexicon object that provides name and the string content of the lexicon. </p>
/// - [`lexicon_attributes(Option<LexiconAttributes>)`](crate::output::GetLexiconOutput::lexicon_attributes): <p>Metadata of the lexicon, including phonetic alphabetic used, language code, lexicon ARN, number of lexemes defined in the lexicon, and size of lexicon in bytes.</p>
/// - On failure, responds with [`SdkError<GetLexiconError>`](crate::error::GetLexiconError)
pub fn get_lexicon(&self) -> fluent_builders::GetLexicon {
fluent_builders::GetLexicon::new(self.handle.clone())
}
/// Constructs a fluent builder for the [`GetSpeechSynthesisTask`](crate::client::fluent_builders::GetSpeechSynthesisTask) operation.
///
/// - The fluent builder is configurable:
/// - [`task_id(impl Into<String>)`](crate::client::fluent_builders::GetSpeechSynthesisTask::task_id) / [`set_task_id(Option<String>)`](crate::client::fluent_builders::GetSpeechSynthesisTask::set_task_id): <p>The Amazon Polly generated identifier for a speech synthesis task.</p>
/// - On success, responds with [`GetSpeechSynthesisTaskOutput`](crate::output::GetSpeechSynthesisTaskOutput) with field(s):
/// - [`synthesis_task(Option<SynthesisTask>)`](crate::output::GetSpeechSynthesisTaskOutput::synthesis_task): <p>SynthesisTask object that provides information from the requested task, including output format, creation time, task status, and so on.</p>
/// - On failure, responds with [`SdkError<GetSpeechSynthesisTaskError>`](crate::error::GetSpeechSynthesisTaskError)
pub fn get_speech_synthesis_task(&self) -> fluent_builders::GetSpeechSynthesisTask {
fluent_builders::GetSpeechSynthesisTask::new(self.handle.clone())
}
/// Constructs a fluent builder for the [`ListLexicons`](crate::client::fluent_builders::ListLexicons) operation.
///
/// - The fluent builder is configurable:
/// - [`next_token(impl Into<String>)`](crate::client::fluent_builders::ListLexicons::next_token) / [`set_next_token(Option<String>)`](crate::client::fluent_builders::ListLexicons::set_next_token): <p>An opaque pagination token returned from previous <code>ListLexicons</code> operation. If present, indicates where to continue the list of lexicons.</p>
/// - On success, responds with [`ListLexiconsOutput`](crate::output::ListLexiconsOutput) with field(s):
/// - [`lexicons(Option<Vec<LexiconDescription>>)`](crate::output::ListLexiconsOutput::lexicons): <p>A list of lexicon names and attributes.</p>
/// - [`next_token(Option<String>)`](crate::output::ListLexiconsOutput::next_token): <p>The pagination token to use in the next request to continue the listing of lexicons. <code>NextToken</code> is returned only if the response is truncated.</p>
/// - On failure, responds with [`SdkError<ListLexiconsError>`](crate::error::ListLexiconsError)
pub fn list_lexicons(&self) -> fluent_builders::ListLexicons {
fluent_builders::ListLexicons::new(self.handle.clone())
}
/// Constructs a fluent builder for the [`ListSpeechSynthesisTasks`](crate::client::fluent_builders::ListSpeechSynthesisTasks) operation.
/// This operation supports pagination; See [`into_paginator()`](crate::client::fluent_builders::ListSpeechSynthesisTasks::into_paginator).
///
/// - The fluent builder is configurable:
/// - [`max_results(i32)`](crate::client::fluent_builders::ListSpeechSynthesisTasks::max_results) / [`set_max_results(Option<i32>)`](crate::client::fluent_builders::ListSpeechSynthesisTasks::set_max_results): <p>Maximum number of speech synthesis tasks returned in a List operation.</p>
/// - [`next_token(impl Into<String>)`](crate::client::fluent_builders::ListSpeechSynthesisTasks::next_token) / [`set_next_token(Option<String>)`](crate::client::fluent_builders::ListSpeechSynthesisTasks::set_next_token): <p>The pagination token to use in the next request to continue the listing of speech synthesis tasks. </p>
/// - [`status(TaskStatus)`](crate::client::fluent_builders::ListSpeechSynthesisTasks::status) / [`set_status(Option<TaskStatus>)`](crate::client::fluent_builders::ListSpeechSynthesisTasks::set_status): <p>Status of the speech synthesis tasks returned in a List operation</p>
/// - On success, responds with [`ListSpeechSynthesisTasksOutput`](crate::output::ListSpeechSynthesisTasksOutput) with field(s):
/// - [`next_token(Option<String>)`](crate::output::ListSpeechSynthesisTasksOutput::next_token): <p>An opaque pagination token returned from the previous List operation in this request. If present, this indicates where to continue the listing.</p>
/// - [`synthesis_tasks(Option<Vec<SynthesisTask>>)`](crate::output::ListSpeechSynthesisTasksOutput::synthesis_tasks): <p>List of SynthesisTask objects that provides information from the specified task in the list request, including output format, creation time, task status, and so on.</p>
/// - On failure, responds with [`SdkError<ListSpeechSynthesisTasksError>`](crate::error::ListSpeechSynthesisTasksError)
pub fn list_speech_synthesis_tasks(&self) -> fluent_builders::ListSpeechSynthesisTasks {
fluent_builders::ListSpeechSynthesisTasks::new(self.handle.clone())
}
/// Constructs a fluent builder for the [`PutLexicon`](crate::client::fluent_builders::PutLexicon) operation.
///
/// - The fluent builder is configurable:
/// - [`name(impl Into<String>)`](crate::client::fluent_builders::PutLexicon::name) / [`set_name(Option<String>)`](crate::client::fluent_builders::PutLexicon::set_name): <p>Name of the lexicon. The name must follow the regular express format [0-9A-Za-z]{1,20}. That is, the name is a case-sensitive alphanumeric string up to 20 characters long. </p>
/// - [`content(impl Into<String>)`](crate::client::fluent_builders::PutLexicon::content) / [`set_content(Option<String>)`](crate::client::fluent_builders::PutLexicon::set_content): <p>Content of the PLS lexicon as string data.</p>
/// - On success, responds with [`PutLexiconOutput`](crate::output::PutLexiconOutput)
/// - On failure, responds with [`SdkError<PutLexiconError>`](crate::error::PutLexiconError)
pub fn put_lexicon(&self) -> fluent_builders::PutLexicon {
fluent_builders::PutLexicon::new(self.handle.clone())
}
/// Constructs a fluent builder for the [`StartSpeechSynthesisTask`](crate::client::fluent_builders::StartSpeechSynthesisTask) operation.
///
/// - The fluent builder is configurable:
/// - [`engine(Engine)`](crate::client::fluent_builders::StartSpeechSynthesisTask::engine) / [`set_engine(Option<Engine>)`](crate::client::fluent_builders::StartSpeechSynthesisTask::set_engine): <p>Specifies the engine (<code>standard</code> or <code>neural</code>) for Amazon Polly to use when processing input text for speech synthesis. Using a voice that is not supported for the engine selected will result in an error.</p>
/// - [`language_code(LanguageCode)`](crate::client::fluent_builders::StartSpeechSynthesisTask::language_code) / [`set_language_code(Option<LanguageCode>)`](crate::client::fluent_builders::StartSpeechSynthesisTask::set_language_code): <p>Optional language code for the Speech Synthesis request. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN). </p> <p>If a bilingual voice is used and no language code is specified, Amazon Polly uses the default language of the bilingual voice. The default language for any voice is the one returned by the <a href="https://docs.aws.amazon.com/polly/latest/dg/API_DescribeVoices.html">DescribeVoices</a> operation for the <code>LanguageCode</code> parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.</p>
/// - [`lexicon_names(Vec<String>)`](crate::client::fluent_builders::StartSpeechSynthesisTask::lexicon_names) / [`set_lexicon_names(Option<Vec<String>>)`](crate::client::fluent_builders::StartSpeechSynthesisTask::set_lexicon_names): <p>List of one or more pronunciation lexicon names you want the service to apply during synthesis. Lexicons are applied only if the language of the lexicon is the same as the language of the voice. </p>
/// - [`output_format(OutputFormat)`](crate::client::fluent_builders::StartSpeechSynthesisTask::output_format) / [`set_output_format(Option<OutputFormat>)`](crate::client::fluent_builders::StartSpeechSynthesisTask::set_output_format): <p>The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, or pcm. For speech marks, this will be json. </p>
/// - [`output_s3_bucket_name(impl Into<String>)`](crate::client::fluent_builders::StartSpeechSynthesisTask::output_s3_bucket_name) / [`set_output_s3_bucket_name(Option<String>)`](crate::client::fluent_builders::StartSpeechSynthesisTask::set_output_s3_bucket_name): <p>Amazon S3 bucket name to which the output file will be saved.</p>
/// - [`output_s3_key_prefix(impl Into<String>)`](crate::client::fluent_builders::StartSpeechSynthesisTask::output_s3_key_prefix) / [`set_output_s3_key_prefix(Option<String>)`](crate::client::fluent_builders::StartSpeechSynthesisTask::set_output_s3_key_prefix): <p>The Amazon S3 key prefix for the output speech file.</p>
/// - [`sample_rate(impl Into<String>)`](crate::client::fluent_builders::StartSpeechSynthesisTask::sample_rate) / [`set_sample_rate(Option<String>)`](crate::client::fluent_builders::StartSpeechSynthesisTask::set_sample_rate): <p>The audio frequency specified in Hz.</p> <p>The valid values for mp3 and ogg_vorbis are "8000", "16000", "22050", and "24000". The default value for standard voices is "22050". The default value for neural voices is "24000".</p> <p>Valid values for pcm are "8000" and "16000" The default value is "16000". </p>
/// - [`sns_topic_arn(impl Into<String>)`](crate::client::fluent_builders::StartSpeechSynthesisTask::sns_topic_arn) / [`set_sns_topic_arn(Option<String>)`](crate::client::fluent_builders::StartSpeechSynthesisTask::set_sns_topic_arn): <p>ARN for the SNS topic optionally used for providing status notification for a speech synthesis task.</p>
/// - [`speech_mark_types(Vec<SpeechMarkType>)`](crate::client::fluent_builders::StartSpeechSynthesisTask::speech_mark_types) / [`set_speech_mark_types(Option<Vec<SpeechMarkType>>)`](crate::client::fluent_builders::StartSpeechSynthesisTask::set_speech_mark_types): <p>The type of speech marks returned for the input text.</p>
/// - [`text(impl Into<String>)`](crate::client::fluent_builders::StartSpeechSynthesisTask::text) / [`set_text(Option<String>)`](crate::client::fluent_builders::StartSpeechSynthesisTask::set_text): <p>The input text to synthesize. If you specify ssml as the TextType, follow the SSML format for the input text. </p>
/// - [`text_type(TextType)`](crate::client::fluent_builders::StartSpeechSynthesisTask::text_type) / [`set_text_type(Option<TextType>)`](crate::client::fluent_builders::StartSpeechSynthesisTask::set_text_type): <p>Specifies whether the input text is plain text or SSML. The default value is plain text. </p>
/// - [`voice_id(VoiceId)`](crate::client::fluent_builders::StartSpeechSynthesisTask::voice_id) / [`set_voice_id(Option<VoiceId>)`](crate::client::fluent_builders::StartSpeechSynthesisTask::set_voice_id): <p>Voice ID to use for the synthesis. </p>
/// - On success, responds with [`StartSpeechSynthesisTaskOutput`](crate::output::StartSpeechSynthesisTaskOutput) with field(s):
/// - [`synthesis_task(Option<SynthesisTask>)`](crate::output::StartSpeechSynthesisTaskOutput::synthesis_task): <p>SynthesisTask object that provides information and attributes about a newly submitted speech synthesis task.</p>
/// - On failure, responds with [`SdkError<StartSpeechSynthesisTaskError>`](crate::error::StartSpeechSynthesisTaskError)
pub fn start_speech_synthesis_task(&self) -> fluent_builders::StartSpeechSynthesisTask {
fluent_builders::StartSpeechSynthesisTask::new(self.handle.clone())
}
/// Constructs a fluent builder for the [`SynthesizeSpeech`](crate::client::fluent_builders::SynthesizeSpeech) operation.
///
/// - The fluent builder is configurable:
/// - [`engine(Engine)`](crate::client::fluent_builders::SynthesizeSpeech::engine) / [`set_engine(Option<Engine>)`](crate::client::fluent_builders::SynthesizeSpeech::set_engine): <p>Specifies the engine (<code>standard</code> or <code>neural</code>) for Amazon Polly to use when processing input text for speech synthesis. For information on Amazon Polly voices and which voices are available in standard-only, NTTS-only, and both standard and NTTS formats, see <a href="https://docs.aws.amazon.com/polly/latest/dg/voicelist.html">Available Voices</a>.</p> <p> <b>NTTS-only voices</b> </p> <p>When using NTTS-only voices such as Kevin (en-US), this parameter is required and must be set to <code>neural</code>. If the engine is not specified, or is set to <code>standard</code>, this will result in an error. </p> <p>Type: String</p> <p>Valid Values: <code>standard</code> | <code>neural</code> </p> <p>Required: Yes</p> <p> <b>Standard voices</b> </p> <p>For standard voices, this is not required; the engine parameter defaults to <code>standard</code>. If the engine is not specified, or is set to <code>standard</code> and an NTTS-only voice is selected, this will result in an error. </p>
/// - [`language_code(LanguageCode)`](crate::client::fluent_builders::SynthesizeSpeech::language_code) / [`set_language_code(Option<LanguageCode>)`](crate::client::fluent_builders::SynthesizeSpeech::set_language_code): <p>Optional language code for the Synthesize Speech request. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN). </p> <p>If a bilingual voice is used and no language code is specified, Amazon Polly uses the default language of the bilingual voice. The default language for any voice is the one returned by the <a href="https://docs.aws.amazon.com/polly/latest/dg/API_DescribeVoices.html">DescribeVoices</a> operation for the <code>LanguageCode</code> parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.</p>
/// - [`lexicon_names(Vec<String>)`](crate::client::fluent_builders::SynthesizeSpeech::lexicon_names) / [`set_lexicon_names(Option<Vec<String>>)`](crate::client::fluent_builders::SynthesizeSpeech::set_lexicon_names): <p>List of one or more pronunciation lexicon names you want the service to apply during synthesis. Lexicons are applied only if the language of the lexicon is the same as the language of the voice. For information about storing lexicons, see <a href="https://docs.aws.amazon.com/polly/latest/dg/API_PutLexicon.html">PutLexicon</a>.</p>
/// - [`output_format(OutputFormat)`](crate::client::fluent_builders::SynthesizeSpeech::output_format) / [`set_output_format(Option<OutputFormat>)`](crate::client::fluent_builders::SynthesizeSpeech::set_output_format): <p> The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, or pcm. For speech marks, this will be json. </p> <p>When pcm is used, the content returned is audio/pcm in a signed 16-bit, 1 channel (mono), little-endian format. </p>
/// - [`sample_rate(impl Into<String>)`](crate::client::fluent_builders::SynthesizeSpeech::sample_rate) / [`set_sample_rate(Option<String>)`](crate::client::fluent_builders::SynthesizeSpeech::set_sample_rate): <p>The audio frequency specified in Hz.</p> <p>The valid values for mp3 and ogg_vorbis are "8000", "16000", "22050", and "24000". The default value for standard voices is "22050". The default value for neural voices is "24000".</p> <p>Valid values for pcm are "8000" and "16000" The default value is "16000". </p>
/// - [`speech_mark_types(Vec<SpeechMarkType>)`](crate::client::fluent_builders::SynthesizeSpeech::speech_mark_types) / [`set_speech_mark_types(Option<Vec<SpeechMarkType>>)`](crate::client::fluent_builders::SynthesizeSpeech::set_speech_mark_types): <p>The type of speech marks returned for the input text.</p>
/// - [`text(impl Into<String>)`](crate::client::fluent_builders::SynthesizeSpeech::text) / [`set_text(Option<String>)`](crate::client::fluent_builders::SynthesizeSpeech::set_text): <p> Input text to synthesize. If you specify <code>ssml</code> as the <code>TextType</code>, follow the SSML format for the input text. </p>
/// - [`text_type(TextType)`](crate::client::fluent_builders::SynthesizeSpeech::text_type) / [`set_text_type(Option<TextType>)`](crate::client::fluent_builders::SynthesizeSpeech::set_text_type): <p> Specifies whether the input text is plain text or SSML. The default value is plain text. For more information, see <a href="https://docs.aws.amazon.com/polly/latest/dg/ssml.html">Using SSML</a>.</p>
/// - [`voice_id(VoiceId)`](crate::client::fluent_builders::SynthesizeSpeech::voice_id) / [`set_voice_id(Option<VoiceId>)`](crate::client::fluent_builders::SynthesizeSpeech::set_voice_id): <p> Voice ID to use for the synthesis. You can get a list of available voice IDs by calling the <a href="https://docs.aws.amazon.com/polly/latest/dg/API_DescribeVoices.html">DescribeVoices</a> operation. </p>
/// - On success, responds with [`SynthesizeSpeechOutput`](crate::output::SynthesizeSpeechOutput) with field(s):
/// - [`audio_stream(byte_stream::ByteStream)`](crate::output::SynthesizeSpeechOutput::audio_stream): <p> Stream containing the synthesized speech. </p>
/// - [`content_type(Option<String>)`](crate::output::SynthesizeSpeechOutput::content_type): <p> Specifies the type audio stream. This should reflect the <code>OutputFormat</code> parameter in your request. </p> <ul> <li> <p> If you request <code>mp3</code> as the <code>OutputFormat</code>, the <code>ContentType</code> returned is audio/mpeg. </p> </li> <li> <p> If you request <code>ogg_vorbis</code> as the <code>OutputFormat</code>, the <code>ContentType</code> returned is audio/ogg. </p> </li> <li> <p> If you request <code>pcm</code> as the <code>OutputFormat</code>, the <code>ContentType</code> returned is audio/pcm in a signed 16-bit, 1 channel (mono), little-endian format. </p> </li> <li> <p>If you request <code>json</code> as the <code>OutputFormat</code>, the <code>ContentType</code> returned is application/x-json-stream.</p> </li> </ul> <p> </p>
/// - [`request_characters(i32)`](crate::output::SynthesizeSpeechOutput::request_characters): <p>Number of characters synthesized.</p>
/// - On failure, responds with [`SdkError<SynthesizeSpeechError>`](crate::error::SynthesizeSpeechError)
pub fn synthesize_speech(&self) -> fluent_builders::SynthesizeSpeech {
fluent_builders::SynthesizeSpeech::new(self.handle.clone())
}
}
pub mod fluent_builders {
//!
//! Utilities to ergonomically construct a request to the service.
//!
//! Fluent builders are created through the [`Client`](crate::client::Client) by calling
//! one if its operation methods. After parameters are set using the builder methods,
//! the `send` method can be called to initiate the request.
//!
/// Fluent builder constructing a request to `DeleteLexicon`.
///
/// <p>Deletes the specified pronunciation lexicon stored in an Amazon Web Services Region. A lexicon which has been deleted is not available for speech synthesis, nor is it possible to retrieve it using either the <code>GetLexicon</code> or <code>ListLexicon</code> APIs.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/polly/latest/dg/managing-lexicons.html">Managing Lexicons</a>.</p>
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct DeleteLexicon {
handle: std::sync::Arc<super::Handle>,
inner: crate::input::delete_lexicon_input::Builder,
}
impl DeleteLexicon {
/// Creates a new `DeleteLexicon`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::DeleteLexiconOutput,
aws_smithy_http::result::SdkError<crate::error::DeleteLexiconError>,
> {
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
/// <p>The name of the lexicon to delete. Must be an existing lexicon in the region.</p>
pub fn name(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.name(input.into());
self
}
/// <p>The name of the lexicon to delete. Must be an existing lexicon in the region.</p>
pub fn set_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_name(input);
self
}
}
/// Fluent builder constructing a request to `DescribeVoices`.
///
/// <p>Returns the list of voices that are available for use when requesting speech synthesis. Each voice speaks a specified language, is either male or female, and is identified by an ID, which is the ASCII version of the voice name. </p>
/// <p>When synthesizing speech ( <code>SynthesizeSpeech</code> ), you provide the voice ID for the voice you want from the list of voices returned by <code>DescribeVoices</code>.</p>
/// <p>For example, you want your news reader application to read news in a specific language, but giving a user the option to choose the voice. Using the <code>DescribeVoices</code> operation you can provide the user with a list of available voices to select from.</p>
/// <p> You can optionally specify a language code to filter the available voices. For example, if you specify <code>en-US</code>, the operation returns a list of all available US English voices. </p>
/// <p>This operation requires permissions to perform the <code>polly:DescribeVoices</code> action.</p>
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct DescribeVoices {
handle: std::sync::Arc<super::Handle>,
inner: crate::input::describe_voices_input::Builder,
}
impl DescribeVoices {
/// Creates a new `DescribeVoices`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::DescribeVoicesOutput,
aws_smithy_http::result::SdkError<crate::error::DescribeVoicesError>,
> {
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
/// <p>Specifies the engine (<code>standard</code> or <code>neural</code>) used by Amazon Polly when processing input text for speech synthesis. </p>
pub fn engine(mut self, input: crate::model::Engine) -> Self {
self.inner = self.inner.engine(input);
self
}
/// <p>Specifies the engine (<code>standard</code> or <code>neural</code>) used by Amazon Polly when processing input text for speech synthesis. </p>
pub fn set_engine(mut self, input: std::option::Option<crate::model::Engine>) -> Self {
self.inner = self.inner.set_engine(input);
self
}
/// <p> The language identification tag (ISO 639 code for the language name-ISO 3166 country code) for filtering the list of voices returned. If you don't specify this optional parameter, all available voices are returned. </p>
pub fn language_code(mut self, input: crate::model::LanguageCode) -> Self {
self.inner = self.inner.language_code(input);
self
}
/// <p> The language identification tag (ISO 639 code for the language name-ISO 3166 country code) for filtering the list of voices returned. If you don't specify this optional parameter, all available voices are returned. </p>
pub fn set_language_code(
mut self,
input: std::option::Option<crate::model::LanguageCode>,
) -> Self {
self.inner = self.inner.set_language_code(input);
self
}
/// <p>Boolean value indicating whether to return any bilingual voices that use the specified language as an additional language. For instance, if you request all languages that use US English (es-US), and there is an Italian voice that speaks both Italian (it-IT) and US English, that voice will be included if you specify <code>yes</code> but not if you specify <code>no</code>.</p>
pub fn include_additional_language_codes(mut self, input: bool) -> Self {
self.inner = self.inner.include_additional_language_codes(input);
self
}
/// <p>Boolean value indicating whether to return any bilingual voices that use the specified language as an additional language. For instance, if you request all languages that use US English (es-US), and there is an Italian voice that speaks both Italian (it-IT) and US English, that voice will be included if you specify <code>yes</code> but not if you specify <code>no</code>.</p>
pub fn set_include_additional_language_codes(
mut self,
input: std::option::Option<bool>,
) -> Self {
self.inner = self.inner.set_include_additional_language_codes(input);
self
}
/// <p>An opaque pagination token returned from the previous <code>DescribeVoices</code> operation. If present, this indicates where to continue the listing.</p>
pub fn next_token(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.next_token(input.into());
self
}
/// <p>An opaque pagination token returned from the previous <code>DescribeVoices</code> operation. If present, this indicates where to continue the listing.</p>
pub fn set_next_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_next_token(input);
self
}
}
/// Fluent builder constructing a request to `GetLexicon`.
///
/// <p>Returns the content of the specified pronunciation lexicon stored in an Amazon Web Services Region. For more information, see <a href="https://docs.aws.amazon.com/polly/latest/dg/managing-lexicons.html">Managing Lexicons</a>.</p>
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct GetLexicon {
handle: std::sync::Arc<super::Handle>,
inner: crate::input::get_lexicon_input::Builder,
}
impl GetLexicon {
/// Creates a new `GetLexicon`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::GetLexiconOutput,
aws_smithy_http::result::SdkError<crate::error::GetLexiconError>,
> {
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
/// <p>Name of the lexicon.</p>
pub fn name(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.name(input.into());
self
}
/// <p>Name of the lexicon.</p>
pub fn set_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_name(input);
self
}
}
/// Fluent builder constructing a request to `GetSpeechSynthesisTask`.
///
/// <p>Retrieves a specific SpeechSynthesisTask object based on its TaskID. This object contains information about the given speech synthesis task, including the status of the task, and a link to the S3 bucket containing the output of the task.</p>
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct GetSpeechSynthesisTask {
handle: std::sync::Arc<super::Handle>,
inner: crate::input::get_speech_synthesis_task_input::Builder,
}
impl GetSpeechSynthesisTask {
/// Creates a new `GetSpeechSynthesisTask`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::GetSpeechSynthesisTaskOutput,
aws_smithy_http::result::SdkError<crate::error::GetSpeechSynthesisTaskError>,
> {
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
/// <p>The Amazon Polly generated identifier for a speech synthesis task.</p>
pub fn task_id(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.task_id(input.into());
self
}
/// <p>The Amazon Polly generated identifier for a speech synthesis task.</p>
pub fn set_task_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_task_id(input);
self
}
}
/// Fluent builder constructing a request to `ListLexicons`.
///
/// <p>Returns a list of pronunciation lexicons stored in an Amazon Web Services Region. For more information, see <a href="https://docs.aws.amazon.com/polly/latest/dg/managing-lexicons.html">Managing Lexicons</a>.</p>
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct ListLexicons {
handle: std::sync::Arc<super::Handle>,
inner: crate::input::list_lexicons_input::Builder,
}
impl ListLexicons {
/// Creates a new `ListLexicons`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::ListLexiconsOutput,
aws_smithy_http::result::SdkError<crate::error::ListLexiconsError>,
> {
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
/// <p>An opaque pagination token returned from previous <code>ListLexicons</code> operation. If present, indicates where to continue the list of lexicons.</p>
pub fn next_token(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.next_token(input.into());
self
}
/// <p>An opaque pagination token returned from previous <code>ListLexicons</code> operation. If present, indicates where to continue the list of lexicons.</p>
pub fn set_next_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_next_token(input);
self
}
}
/// Fluent builder constructing a request to `ListSpeechSynthesisTasks`.
///
/// <p>Returns a list of SpeechSynthesisTask objects ordered by their creation date. This operation can filter the tasks by their status, for example, allowing users to list only tasks that are completed.</p>
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct ListSpeechSynthesisTasks {
handle: std::sync::Arc<super::Handle>,
inner: crate::input::list_speech_synthesis_tasks_input::Builder,
}
impl ListSpeechSynthesisTasks {
/// Creates a new `ListSpeechSynthesisTasks`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::ListSpeechSynthesisTasksOutput,
aws_smithy_http::result::SdkError<crate::error::ListSpeechSynthesisTasksError>,
> {
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
/// Create a paginator for this request
///
/// Paginators are used by calling [`send().await`](crate::paginator::ListSpeechSynthesisTasksPaginator::send) which returns a [`Stream`](tokio_stream::Stream).
pub fn into_paginator(self) -> crate::paginator::ListSpeechSynthesisTasksPaginator {
crate::paginator::ListSpeechSynthesisTasksPaginator::new(self.handle, self.inner)
}
/// <p>Maximum number of speech synthesis tasks returned in a List operation.</p>
pub fn max_results(mut self, input: i32) -> Self {
self.inner = self.inner.max_results(input);
self
}
/// <p>Maximum number of speech synthesis tasks returned in a List operation.</p>
pub fn set_max_results(mut self, input: std::option::Option<i32>) -> Self {
self.inner = self.inner.set_max_results(input);
self
}
/// <p>The pagination token to use in the next request to continue the listing of speech synthesis tasks. </p>
pub fn next_token(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.next_token(input.into());
self
}
/// <p>The pagination token to use in the next request to continue the listing of speech synthesis tasks. </p>
pub fn set_next_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_next_token(input);
self
}
/// <p>Status of the speech synthesis tasks returned in a List operation</p>
pub fn status(mut self, input: crate::model::TaskStatus) -> Self {
self.inner = self.inner.status(input);
self
}
/// <p>Status of the speech synthesis tasks returned in a List operation</p>
pub fn set_status(mut self, input: std::option::Option<crate::model::TaskStatus>) -> Self {
self.inner = self.inner.set_status(input);
self
}
}
/// Fluent builder constructing a request to `PutLexicon`.
///
/// <p>Stores a pronunciation lexicon in an Amazon Web Services Region. If a lexicon with the same name already exists in the region, it is overwritten by the new lexicon. Lexicon operations have eventual consistency, therefore, it might take some time before the lexicon is available to the SynthesizeSpeech operation.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/polly/latest/dg/managing-lexicons.html">Managing Lexicons</a>.</p>
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct PutLexicon {
handle: std::sync::Arc<super::Handle>,
inner: crate::input::put_lexicon_input::Builder,
}
impl PutLexicon {
/// Creates a new `PutLexicon`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::PutLexiconOutput,
aws_smithy_http::result::SdkError<crate::error::PutLexiconError>,
> {
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
/// <p>Name of the lexicon. The name must follow the regular express format [0-9A-Za-z]{1,20}. That is, the name is a case-sensitive alphanumeric string up to 20 characters long. </p>
pub fn name(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.name(input.into());
self
}
/// <p>Name of the lexicon. The name must follow the regular express format [0-9A-Za-z]{1,20}. That is, the name is a case-sensitive alphanumeric string up to 20 characters long. </p>
pub fn set_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_name(input);
self
}
/// <p>Content of the PLS lexicon as string data.</p>
pub fn content(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.content(input.into());
self
}
/// <p>Content of the PLS lexicon as string data.</p>
pub fn set_content(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_content(input);
self
}
}
/// Fluent builder constructing a request to `StartSpeechSynthesisTask`.
///
/// <p>Allows the creation of an asynchronous synthesis task, by starting a new <code>SpeechSynthesisTask</code>. This operation requires all the standard information needed for speech synthesis, plus the name of an Amazon S3 bucket for the service to store the output of the synthesis task and two optional parameters (<code>OutputS3KeyPrefix</code> and <code>SnsTopicArn</code>). Once the synthesis task is created, this operation will return a <code>SpeechSynthesisTask</code> object, which will include an identifier of this task as well as the current status. The <code>SpeechSynthesisTask</code> object is available for 72 hours after starting the asynchronous synthesis task.</p>
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct StartSpeechSynthesisTask {
handle: std::sync::Arc<super::Handle>,
inner: crate::input::start_speech_synthesis_task_input::Builder,
}
impl StartSpeechSynthesisTask {
/// Creates a new `StartSpeechSynthesisTask`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::StartSpeechSynthesisTaskOutput,
aws_smithy_http::result::SdkError<crate::error::StartSpeechSynthesisTaskError>,
> {
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
/// <p>Specifies the engine (<code>standard</code> or <code>neural</code>) for Amazon Polly to use when processing input text for speech synthesis. Using a voice that is not supported for the engine selected will result in an error.</p>
pub fn engine(mut self, input: crate::model::Engine) -> Self {
self.inner = self.inner.engine(input);
self
}
/// <p>Specifies the engine (<code>standard</code> or <code>neural</code>) for Amazon Polly to use when processing input text for speech synthesis. Using a voice that is not supported for the engine selected will result in an error.</p>
pub fn set_engine(mut self, input: std::option::Option<crate::model::Engine>) -> Self {
self.inner = self.inner.set_engine(input);
self
}
/// <p>Optional language code for the Speech Synthesis request. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN). </p>
/// <p>If a bilingual voice is used and no language code is specified, Amazon Polly uses the default language of the bilingual voice. The default language for any voice is the one returned by the <a href="https://docs.aws.amazon.com/polly/latest/dg/API_DescribeVoices.html">DescribeVoices</a> operation for the <code>LanguageCode</code> parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.</p>
pub fn language_code(mut self, input: crate::model::LanguageCode) -> Self {
self.inner = self.inner.language_code(input);
self
}
/// <p>Optional language code for the Speech Synthesis request. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN). </p>
/// <p>If a bilingual voice is used and no language code is specified, Amazon Polly uses the default language of the bilingual voice. The default language for any voice is the one returned by the <a href="https://docs.aws.amazon.com/polly/latest/dg/API_DescribeVoices.html">DescribeVoices</a> operation for the <code>LanguageCode</code> parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.</p>
pub fn set_language_code(
mut self,
input: std::option::Option<crate::model::LanguageCode>,
) -> Self {
self.inner = self.inner.set_language_code(input);
self
}
/// Appends an item to `LexiconNames`.
///
/// To override the contents of this collection use [`set_lexicon_names`](Self::set_lexicon_names).
///
/// <p>List of one or more pronunciation lexicon names you want the service to apply during synthesis. Lexicons are applied only if the language of the lexicon is the same as the language of the voice. </p>
pub fn lexicon_names(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.lexicon_names(input.into());
self
}
/// <p>List of one or more pronunciation lexicon names you want the service to apply during synthesis. Lexicons are applied only if the language of the lexicon is the same as the language of the voice. </p>
pub fn set_lexicon_names(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.inner = self.inner.set_lexicon_names(input);
self
}
/// <p>The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, or pcm. For speech marks, this will be json. </p>
pub fn output_format(mut self, input: crate::model::OutputFormat) -> Self {
self.inner = self.inner.output_format(input);
self
}
/// <p>The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, or pcm. For speech marks, this will be json. </p>
pub fn set_output_format(
mut self,
input: std::option::Option<crate::model::OutputFormat>,
) -> Self {
self.inner = self.inner.set_output_format(input);
self
}
/// <p>Amazon S3 bucket name to which the output file will be saved.</p>
pub fn output_s3_bucket_name(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.output_s3_bucket_name(input.into());
self
}
/// <p>Amazon S3 bucket name to which the output file will be saved.</p>
pub fn set_output_s3_bucket_name(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.inner = self.inner.set_output_s3_bucket_name(input);
self
}
/// <p>The Amazon S3 key prefix for the output speech file.</p>
pub fn output_s3_key_prefix(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.output_s3_key_prefix(input.into());
self
}
/// <p>The Amazon S3 key prefix for the output speech file.</p>
pub fn set_output_s3_key_prefix(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.inner = self.inner.set_output_s3_key_prefix(input);
self
}
/// <p>The audio frequency specified in Hz.</p>
/// <p>The valid values for mp3 and ogg_vorbis are "8000", "16000", "22050", and "24000". The default value for standard voices is "22050". The default value for neural voices is "24000".</p>
/// <p>Valid values for pcm are "8000" and "16000" The default value is "16000". </p>
pub fn sample_rate(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.sample_rate(input.into());
self
}
/// <p>The audio frequency specified in Hz.</p>
/// <p>The valid values for mp3 and ogg_vorbis are "8000", "16000", "22050", and "24000". The default value for standard voices is "22050". The default value for neural voices is "24000".</p>
/// <p>Valid values for pcm are "8000" and "16000" The default value is "16000". </p>
pub fn set_sample_rate(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_sample_rate(input);
self
}
/// <p>ARN for the SNS topic optionally used for providing status notification for a speech synthesis task.</p>
pub fn sns_topic_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.sns_topic_arn(input.into());
self
}
/// <p>ARN for the SNS topic optionally used for providing status notification for a speech synthesis task.</p>
pub fn set_sns_topic_arn(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.inner = self.inner.set_sns_topic_arn(input);
self
}
/// Appends an item to `SpeechMarkTypes`.
///
/// To override the contents of this collection use [`set_speech_mark_types`](Self::set_speech_mark_types).
///
/// <p>The type of speech marks returned for the input text.</p>
pub fn speech_mark_types(mut self, input: crate::model::SpeechMarkType) -> Self {
self.inner = self.inner.speech_mark_types(input);
self
}
/// <p>The type of speech marks returned for the input text.</p>
pub fn set_speech_mark_types(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::SpeechMarkType>>,
) -> Self {
self.inner = self.inner.set_speech_mark_types(input);
self
}
/// <p>The input text to synthesize. If you specify ssml as the TextType, follow the SSML format for the input text. </p>
pub fn text(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.text(input.into());
self
}
/// <p>The input text to synthesize. If you specify ssml as the TextType, follow the SSML format for the input text. </p>
pub fn set_text(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_text(input);
self
}
/// <p>Specifies whether the input text is plain text or SSML. The default value is plain text. </p>
pub fn text_type(mut self, input: crate::model::TextType) -> Self {
self.inner = self.inner.text_type(input);
self
}
/// <p>Specifies whether the input text is plain text or SSML. The default value is plain text. </p>
pub fn set_text_type(mut self, input: std::option::Option<crate::model::TextType>) -> Self {
self.inner = self.inner.set_text_type(input);
self
}
/// <p>Voice ID to use for the synthesis. </p>
pub fn voice_id(mut self, input: crate::model::VoiceId) -> Self {
self.inner = self.inner.voice_id(input);
self
}
/// <p>Voice ID to use for the synthesis. </p>
pub fn set_voice_id(mut self, input: std::option::Option<crate::model::VoiceId>) -> Self {
self.inner = self.inner.set_voice_id(input);
self
}
}
/// Fluent builder constructing a request to `SynthesizeSpeech`.
///
/// <p>Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by English voices) unless phoneme mapping is used. For more information, see <a href="https://docs.aws.amazon.com/polly/latest/dg/how-text-to-speech-works.html">How it Works</a>.</p>
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct SynthesizeSpeech {
handle: std::sync::Arc<super::Handle>,
inner: crate::input::synthesize_speech_input::Builder,
}
impl SynthesizeSpeech {
/// Creates a new `SynthesizeSpeech`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::SynthesizeSpeechOutput,
aws_smithy_http::result::SdkError<crate::error::SynthesizeSpeechError>,
> {
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
///
/// Creates a presigned request for this operation.
///
/// The `presigning_config` provides additional presigning-specific config values, such as the
/// amount of time the request should be valid for after creation.
///
/// Presigned requests can be given to other users or applications to access a resource or perform
/// an operation without having access to the AWS security credentials.
///
pub async fn presigned(
self,
presigning_config: crate::presigning::config::PresigningConfig,
) -> Result<
crate::presigning::request::PresignedRequest,
aws_smithy_http::result::SdkError<crate::error::SynthesizeSpeechError>,
> {
let input = self.inner.build().map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
input.presigned(&self.handle.conf, presigning_config).await
}
/// <p>Specifies the engine (<code>standard</code> or <code>neural</code>) for Amazon Polly to use when processing input text for speech synthesis. For information on Amazon Polly voices and which voices are available in standard-only, NTTS-only, and both standard and NTTS formats, see <a href="https://docs.aws.amazon.com/polly/latest/dg/voicelist.html">Available Voices</a>.</p>
/// <p> <b>NTTS-only voices</b> </p>
/// <p>When using NTTS-only voices such as Kevin (en-US), this parameter is required and must be set to <code>neural</code>. If the engine is not specified, or is set to <code>standard</code>, this will result in an error. </p>
/// <p>Type: String</p>
/// <p>Valid Values: <code>standard</code> | <code>neural</code> </p>
/// <p>Required: Yes</p>
/// <p> <b>Standard voices</b> </p>
/// <p>For standard voices, this is not required; the engine parameter defaults to <code>standard</code>. If the engine is not specified, or is set to <code>standard</code> and an NTTS-only voice is selected, this will result in an error. </p>
pub fn engine(mut self, input: crate::model::Engine) -> Self {
self.inner = self.inner.engine(input);
self
}
/// <p>Specifies the engine (<code>standard</code> or <code>neural</code>) for Amazon Polly to use when processing input text for speech synthesis. For information on Amazon Polly voices and which voices are available in standard-only, NTTS-only, and both standard and NTTS formats, see <a href="https://docs.aws.amazon.com/polly/latest/dg/voicelist.html">Available Voices</a>.</p>
/// <p> <b>NTTS-only voices</b> </p>
/// <p>When using NTTS-only voices such as Kevin (en-US), this parameter is required and must be set to <code>neural</code>. If the engine is not specified, or is set to <code>standard</code>, this will result in an error. </p>
/// <p>Type: String</p>
/// <p>Valid Values: <code>standard</code> | <code>neural</code> </p>
/// <p>Required: Yes</p>
/// <p> <b>Standard voices</b> </p>
/// <p>For standard voices, this is not required; the engine parameter defaults to <code>standard</code>. If the engine is not specified, or is set to <code>standard</code> and an NTTS-only voice is selected, this will result in an error. </p>
pub fn set_engine(mut self, input: std::option::Option<crate::model::Engine>) -> Self {
self.inner = self.inner.set_engine(input);
self
}
/// <p>Optional language code for the Synthesize Speech request. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN). </p>
/// <p>If a bilingual voice is used and no language code is specified, Amazon Polly uses the default language of the bilingual voice. The default language for any voice is the one returned by the <a href="https://docs.aws.amazon.com/polly/latest/dg/API_DescribeVoices.html">DescribeVoices</a> operation for the <code>LanguageCode</code> parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.</p>
pub fn language_code(mut self, input: crate::model::LanguageCode) -> Self {
self.inner = self.inner.language_code(input);
self
}
/// <p>Optional language code for the Synthesize Speech request. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN). </p>
/// <p>If a bilingual voice is used and no language code is specified, Amazon Polly uses the default language of the bilingual voice. The default language for any voice is the one returned by the <a href="https://docs.aws.amazon.com/polly/latest/dg/API_DescribeVoices.html">DescribeVoices</a> operation for the <code>LanguageCode</code> parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.</p>
pub fn set_language_code(
mut self,
input: std::option::Option<crate::model::LanguageCode>,
) -> Self {
self.inner = self.inner.set_language_code(input);
self
}
/// Appends an item to `LexiconNames`.
///
/// To override the contents of this collection use [`set_lexicon_names`](Self::set_lexicon_names).
///
/// <p>List of one or more pronunciation lexicon names you want the service to apply during synthesis. Lexicons are applied only if the language of the lexicon is the same as the language of the voice. For information about storing lexicons, see <a href="https://docs.aws.amazon.com/polly/latest/dg/API_PutLexicon.html">PutLexicon</a>.</p>
pub fn lexicon_names(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.lexicon_names(input.into());
self
}
/// <p>List of one or more pronunciation lexicon names you want the service to apply during synthesis. Lexicons are applied only if the language of the lexicon is the same as the language of the voice. For information about storing lexicons, see <a href="https://docs.aws.amazon.com/polly/latest/dg/API_PutLexicon.html">PutLexicon</a>.</p>
pub fn set_lexicon_names(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.inner = self.inner.set_lexicon_names(input);
self
}
/// <p> The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, or pcm. For speech marks, this will be json. </p>
/// <p>When pcm is used, the content returned is audio/pcm in a signed 16-bit, 1 channel (mono), little-endian format. </p>
pub fn output_format(mut self, input: crate::model::OutputFormat) -> Self {
self.inner = self.inner.output_format(input);
self
}
/// <p> The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, or pcm. For speech marks, this will be json. </p>
/// <p>When pcm is used, the content returned is audio/pcm in a signed 16-bit, 1 channel (mono), little-endian format. </p>
pub fn set_output_format(
mut self,
input: std::option::Option<crate::model::OutputFormat>,
) -> Self {
self.inner = self.inner.set_output_format(input);
self
}
/// <p>The audio frequency specified in Hz.</p>
/// <p>The valid values for mp3 and ogg_vorbis are "8000", "16000", "22050", and "24000". The default value for standard voices is "22050". The default value for neural voices is "24000".</p>
/// <p>Valid values for pcm are "8000" and "16000" The default value is "16000". </p>
pub fn sample_rate(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.sample_rate(input.into());
self
}
/// <p>The audio frequency specified in Hz.</p>
/// <p>The valid values for mp3 and ogg_vorbis are "8000", "16000", "22050", and "24000". The default value for standard voices is "22050". The default value for neural voices is "24000".</p>
/// <p>Valid values for pcm are "8000" and "16000" The default value is "16000". </p>
pub fn set_sample_rate(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_sample_rate(input);
self
}
/// Appends an item to `SpeechMarkTypes`.
///
/// To override the contents of this collection use [`set_speech_mark_types`](Self::set_speech_mark_types).
///
/// <p>The type of speech marks returned for the input text.</p>
pub fn speech_mark_types(mut self, input: crate::model::SpeechMarkType) -> Self {
self.inner = self.inner.speech_mark_types(input);
self
}
/// <p>The type of speech marks returned for the input text.</p>
pub fn set_speech_mark_types(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::SpeechMarkType>>,
) -> Self {
self.inner = self.inner.set_speech_mark_types(input);
self
}
/// <p> Input text to synthesize. If you specify <code>ssml</code> as the <code>TextType</code>, follow the SSML format for the input text. </p>
pub fn text(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.text(input.into());
self
}
/// <p> Input text to synthesize. If you specify <code>ssml</code> as the <code>TextType</code>, follow the SSML format for the input text. </p>
pub fn set_text(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_text(input);
self
}
/// <p> Specifies whether the input text is plain text or SSML. The default value is plain text. For more information, see <a href="https://docs.aws.amazon.com/polly/latest/dg/ssml.html">Using SSML</a>.</p>
pub fn text_type(mut self, input: crate::model::TextType) -> Self {
self.inner = self.inner.text_type(input);
self
}
/// <p> Specifies whether the input text is plain text or SSML. The default value is plain text. For more information, see <a href="https://docs.aws.amazon.com/polly/latest/dg/ssml.html">Using SSML</a>.</p>
pub fn set_text_type(mut self, input: std::option::Option<crate::model::TextType>) -> Self {
self.inner = self.inner.set_text_type(input);
self
}
/// <p> Voice ID to use for the synthesis. You can get a list of available voice IDs by calling the <a href="https://docs.aws.amazon.com/polly/latest/dg/API_DescribeVoices.html">DescribeVoices</a> operation. </p>
pub fn voice_id(mut self, input: crate::model::VoiceId) -> Self {
self.inner = self.inner.voice_id(input);
self
}
/// <p> Voice ID to use for the synthesis. You can get a list of available voice IDs by calling the <a href="https://docs.aws.amazon.com/polly/latest/dg/API_DescribeVoices.html">DescribeVoices</a> operation. </p>
pub fn set_voice_id(mut self, input: std::option::Option<crate::model::VoiceId>) -> Self {
self.inner = self.inner.set_voice_id(input);
self
}
}
}
impl Client {
/// Creates a client with the given service config and connector override.
pub fn from_conf_conn<C, E>(conf: crate::Config, conn: C) -> Self
where
C: aws_smithy_client::bounds::SmithyConnector<Error = E> + Send + 'static,
E: Into<aws_smithy_http::result::ConnectorError>,
{
let retry_config = conf.retry_config.as_ref().cloned().unwrap_or_default();
let timeout_config = conf.timeout_config.as_ref().cloned().unwrap_or_default();
let sleep_impl = conf.sleep_impl.clone();
let mut builder = aws_smithy_client::Builder::new()
.connector(aws_smithy_client::erase::DynConnector::new(conn))
.middleware(aws_smithy_client::erase::DynMiddleware::new(
crate::middleware::DefaultMiddleware::new(),
));
builder.set_retry_config(retry_config.into());
builder.set_timeout_config(timeout_config);
if let Some(sleep_impl) = sleep_impl {
builder.set_sleep_impl(Some(sleep_impl));
}
let client = builder.build();
Self {
handle: std::sync::Arc::new(Handle { client, conf }),
}
}
/// Creates a new client from a shared config.
#[cfg(any(feature = "rustls", feature = "native-tls"))]
pub fn new(sdk_config: &aws_types::sdk_config::SdkConfig) -> Self {
Self::from_conf(sdk_config.into())
}
/// Creates a new client from the service [`Config`](crate::Config).
#[cfg(any(feature = "rustls", feature = "native-tls"))]
pub fn from_conf(conf: crate::Config) -> Self {
let retry_config = conf.retry_config.as_ref().cloned().unwrap_or_default();
let timeout_config = conf.timeout_config.as_ref().cloned().unwrap_or_default();
let sleep_impl = conf.sleep_impl.clone();
let mut builder = aws_smithy_client::Builder::dyn_https().middleware(
aws_smithy_client::erase::DynMiddleware::new(
crate::middleware::DefaultMiddleware::new(),
),
);
builder.set_retry_config(retry_config.into());
builder.set_timeout_config(timeout_config);
// the builder maintains a try-state. To avoid suppressing the warning when sleep is unset,
// only set it if we actually have a sleep impl.
if let Some(sleep_impl) = sleep_impl {
builder.set_sleep_impl(Some(sleep_impl));
}
let client = builder.build();
Self {
handle: std::sync::Arc::new(Handle { client, conf }),
}
}
}