Struct aws_sdk_polly::Client
source · [−]pub struct Client { /* private fields */ }Expand description
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
// 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
use aws_config::RetryConfig;
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);Implementations
sourceimpl Client
impl Client
sourcepub fn with_config(
client: Client<DynConnector, DynMiddleware<DynConnector>>,
conf: Config
) -> Self
pub fn with_config(
client: Client<DynConnector, DynMiddleware<DynConnector>>,
conf: Config
) -> Self
Creates a client with the given service configuration.
sourceimpl Client
impl Client
sourcepub fn delete_lexicon(&self) -> DeleteLexicon
pub fn delete_lexicon(&self) -> DeleteLexicon
Constructs a fluent builder for the DeleteLexicon operation.
- The fluent builder is configurable:
name(impl Into<String>)/set_name(Option<String>):The name of the lexicon to delete. Must be an existing lexicon in the region.
- On success, responds with
DeleteLexiconOutput - On failure, responds with
SdkError<DeleteLexiconError>
sourcepub fn describe_voices(&self) -> DescribeVoices
pub fn describe_voices(&self) -> DescribeVoices
Constructs a fluent builder for the DescribeVoices operation.
- The fluent builder is configurable:
engine(Engine)/set_engine(Option<Engine>):Specifies the engine (
standardorneural) used by Amazon Polly when processing input text for speech synthesis.language_code(LanguageCode)/set_language_code(Option<LanguageCode>):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.
include_additional_language_codes(bool)/set_include_additional_language_codes(bool):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
yesbut not if you specifyno.next_token(impl Into<String>)/set_next_token(Option<String>):An opaque pagination token returned from the previous
DescribeVoicesoperation. If present, this indicates where to continue the listing.
- On success, responds with
DescribeVoicesOutputwith field(s):voices(Option<Vec<Voice>>):A list of voices with their properties.
next_token(Option<String>):The pagination token to use in the next request to continue the listing of voices.
NextTokenis returned only if the response is truncated.
- On failure, responds with
SdkError<DescribeVoicesError>
sourcepub fn get_lexicon(&self) -> GetLexicon
pub fn get_lexicon(&self) -> GetLexicon
Constructs a fluent builder for the GetLexicon operation.
- The fluent builder is configurable:
name(impl Into<String>)/set_name(Option<String>):Name of the lexicon.
- On success, responds with
GetLexiconOutputwith field(s):lexicon(Option<Lexicon>):Lexicon object that provides name and the string content of the lexicon.
lexicon_attributes(Option<LexiconAttributes>):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.
- On failure, responds with
SdkError<GetLexiconError>
sourcepub fn get_speech_synthesis_task(&self) -> GetSpeechSynthesisTask
pub fn get_speech_synthesis_task(&self) -> GetSpeechSynthesisTask
Constructs a fluent builder for the GetSpeechSynthesisTask operation.
- The fluent builder is configurable:
task_id(impl Into<String>)/set_task_id(Option<String>):The Amazon Polly generated identifier for a speech synthesis task.
- On success, responds with
GetSpeechSynthesisTaskOutputwith field(s):synthesis_task(Option<SynthesisTask>):SynthesisTask object that provides information from the requested task, including output format, creation time, task status, and so on.
- On failure, responds with
SdkError<GetSpeechSynthesisTaskError>
sourcepub fn list_lexicons(&self) -> ListLexicons
pub fn list_lexicons(&self) -> ListLexicons
Constructs a fluent builder for the ListLexicons operation.
- The fluent builder is configurable:
next_token(impl Into<String>)/set_next_token(Option<String>):An opaque pagination token returned from previous
ListLexiconsoperation. If present, indicates where to continue the list of lexicons.
- On success, responds with
ListLexiconsOutputwith field(s):lexicons(Option<Vec<LexiconDescription>>):A list of lexicon names and attributes.
next_token(Option<String>):The pagination token to use in the next request to continue the listing of lexicons.
NextTokenis returned only if the response is truncated.
- On failure, responds with
SdkError<ListLexiconsError>
sourcepub fn list_speech_synthesis_tasks(&self) -> ListSpeechSynthesisTasks
pub fn list_speech_synthesis_tasks(&self) -> ListSpeechSynthesisTasks
Constructs a fluent builder for the ListSpeechSynthesisTasks operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
max_results(i32)/set_max_results(Option<i32>):Maximum number of speech synthesis tasks returned in a List operation.
next_token(impl Into<String>)/set_next_token(Option<String>):The pagination token to use in the next request to continue the listing of speech synthesis tasks.
status(TaskStatus)/set_status(Option<TaskStatus>):Status of the speech synthesis tasks returned in a List operation
- On success, responds with
ListSpeechSynthesisTasksOutputwith field(s):next_token(Option<String>):An opaque pagination token returned from the previous List operation in this request. If present, this indicates where to continue the listing.
synthesis_tasks(Option<Vec<SynthesisTask>>):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.
- On failure, responds with
SdkError<ListSpeechSynthesisTasksError>
sourcepub fn put_lexicon(&self) -> PutLexicon
pub fn put_lexicon(&self) -> PutLexicon
Constructs a fluent builder for the PutLexicon operation.
- The fluent builder is configurable:
name(impl Into<String>)/set_name(Option<String>):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.
content(impl Into<String>)/set_content(Option<String>):Content of the PLS lexicon as string data.
- On success, responds with
PutLexiconOutput - On failure, responds with
SdkError<PutLexiconError>
sourcepub fn start_speech_synthesis_task(&self) -> StartSpeechSynthesisTask
pub fn start_speech_synthesis_task(&self) -> StartSpeechSynthesisTask
Constructs a fluent builder for the StartSpeechSynthesisTask operation.
- The fluent builder is configurable:
engine(Engine)/set_engine(Option<Engine>):Specifies the engine (
standardorneural) 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.language_code(LanguageCode)/set_language_code(Option<LanguageCode>):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).
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 DescribeVoices operation for the
LanguageCodeparameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.lexicon_names(Vec<String>)/set_lexicon_names(Option<Vec<String>>):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.
output_format(OutputFormat)/set_output_format(Option<OutputFormat>):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.
output_s3_bucket_name(impl Into<String>)/set_output_s3_bucket_name(Option<String>):Amazon S3 bucket name to which the output file will be saved.
output_s3_key_prefix(impl Into<String>)/set_output_s3_key_prefix(Option<String>):The Amazon S3 key prefix for the output speech file.
sample_rate(impl Into<String>)/set_sample_rate(Option<String>):The audio frequency specified in Hz.
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”.
Valid values for pcm are “8000” and “16000” The default value is “16000”.
sns_topic_arn(impl Into<String>)/set_sns_topic_arn(Option<String>):ARN for the SNS topic optionally used for providing status notification for a speech synthesis task.
speech_mark_types(Vec<SpeechMarkType>)/set_speech_mark_types(Option<Vec<SpeechMarkType>>):The type of speech marks returned for the input text.
text(impl Into<String>)/set_text(Option<String>):The input text to synthesize. If you specify ssml as the TextType, follow the SSML format for the input text.
text_type(TextType)/set_text_type(Option<TextType>):Specifies whether the input text is plain text or SSML. The default value is plain text.
voice_id(VoiceId)/set_voice_id(Option<VoiceId>):Voice ID to use for the synthesis.
- On success, responds with
StartSpeechSynthesisTaskOutputwith field(s):synthesis_task(Option<SynthesisTask>):SynthesisTask object that provides information and attributes about a newly submitted speech synthesis task.
- On failure, responds with
SdkError<StartSpeechSynthesisTaskError>
sourcepub fn synthesize_speech(&self) -> SynthesizeSpeech
pub fn synthesize_speech(&self) -> SynthesizeSpeech
Constructs a fluent builder for the SynthesizeSpeech operation.
- The fluent builder is configurable:
engine(Engine)/set_engine(Option<Engine>):Specifies the engine (
standardorneural) 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 Available Voices.NTTS-only voices
When using NTTS-only voices such as Kevin (en-US), this parameter is required and must be set to
neural. If the engine is not specified, or is set tostandard, this will result in an error.Type: String
Valid Values:
standard|neuralRequired: Yes
Standard voices
For standard voices, this is not required; the engine parameter defaults to
standard. If the engine is not specified, or is set tostandardand an NTTS-only voice is selected, this will result in an error.language_code(LanguageCode)/set_language_code(Option<LanguageCode>):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).
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 DescribeVoices operation for the
LanguageCodeparameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.lexicon_names(Vec<String>)/set_lexicon_names(Option<Vec<String>>):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 PutLexicon.
output_format(OutputFormat)/set_output_format(Option<OutputFormat>):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.
When pcm is used, the content returned is audio/pcm in a signed 16-bit, 1 channel (mono), little-endian format.
sample_rate(impl Into<String>)/set_sample_rate(Option<String>):The audio frequency specified in Hz.
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”.
Valid values for pcm are “8000” and “16000” The default value is “16000”.
speech_mark_types(Vec<SpeechMarkType>)/set_speech_mark_types(Option<Vec<SpeechMarkType>>):The type of speech marks returned for the input text.
text(impl Into<String>)/set_text(Option<String>):Input text to synthesize. If you specify
ssmlas theTextType, follow the SSML format for the input text.text_type(TextType)/set_text_type(Option<TextType>):Specifies whether the input text is plain text or SSML. The default value is plain text. For more information, see Using SSML.
voice_id(VoiceId)/set_voice_id(Option<VoiceId>):Voice ID to use for the synthesis. You can get a list of available voice IDs by calling the DescribeVoices operation.
- On success, responds with
SynthesizeSpeechOutputwith field(s):audio_stream(byte_stream::ByteStream):Stream containing the synthesized speech.
content_type(Option<String>):Specifies the type audio stream. This should reflect the
OutputFormatparameter in your request.-
If you request
mp3as theOutputFormat, theContentTypereturned is audio/mpeg. -
If you request
ogg_vorbisas theOutputFormat, theContentTypereturned is audio/ogg. -
If you request
pcmas theOutputFormat, theContentTypereturned is audio/pcm in a signed 16-bit, 1 channel (mono), little-endian format. -
If you request
jsonas theOutputFormat, theContentTypereturned is application/x-json-stream.
-
request_characters(i32):Number of characters synthesized.
- On failure, responds with
SdkError<SynthesizeSpeechError>
sourceimpl Client
impl Client
sourcepub fn from_conf_conn<C, E>(conf: Config, conn: C) -> Self where
C: SmithyConnector<Error = E> + Send + 'static,
E: Into<ConnectorError>,
pub fn from_conf_conn<C, E>(conf: Config, conn: C) -> Self where
C: SmithyConnector<Error = E> + Send + 'static,
E: Into<ConnectorError>,
Creates a client with the given service config and connector override.
Trait Implementations
sourceimpl From<Client<DynConnector, DynMiddleware<DynConnector>, Standard>> for Client
impl From<Client<DynConnector, DynMiddleware<DynConnector>, Standard>> for Client
sourcefn from(client: Client<DynConnector, DynMiddleware<DynConnector>>) -> Self
fn from(client: Client<DynConnector, DynMiddleware<DynConnector>>) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more