Interface PollyAsyncClient
- All Superinterfaces:
AutoCloseable,AwsClient,SdkAutoCloseable,SdkClient
builder()
method.The asynchronous client performs non-blocking I/O when configured with any SdkAsyncHttpClient
supported in the SDK. However, full non-blocking is not guaranteed as the async client may perform blocking calls in
some cases such as credentials retrieval and endpoint discovery as part of the async API call.
Amazon Polly is a web service that makes it easy to synthesize speech from text.
The Amazon Polly service provides API operations for synthesizing high-quality speech from plain text and Speech Synthesis Markup Language (SSML), along with managing pronunciations lexicons that enable you to get the best results for your application domain.
Authenticated API calls must be signed using the Signature Version 4 Signing Process. For more information, see Signing Amazon Web Services API Requests in the IAM User Guide.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringValue for looking up the service's metadata from theServiceMetadataProvider.static final String -
Method Summary
Modifier and TypeMethodDescriptionstatic PollyAsyncClientBuilderbuilder()Create a builder that can be used to configure and create aPollyAsyncClient.static PollyAsyncClientcreate()Create aPollyAsyncClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider.default CompletableFuture<CreateVoiceResponse> createVoice(Consumer<CreateVoiceRequest.Builder> createVoiceRequest) Creates a custom voice from recordings of a speaker and returns it inpendingstatus.default CompletableFuture<CreateVoiceResponse> createVoice(CreateVoiceRequest createVoiceRequest) Creates a custom voice from recordings of a speaker and returns it inpendingstatus.default CompletableFuture<DeleteLexiconResponse> deleteLexicon(Consumer<DeleteLexiconRequest.Builder> deleteLexiconRequest) Deletes the specified pronunciation lexicon stored in an Amazon Web Services Region.default CompletableFuture<DeleteLexiconResponse> deleteLexicon(DeleteLexiconRequest deleteLexiconRequest) Deletes the specified pronunciation lexicon stored in an Amazon Web Services Region.default CompletableFuture<DeleteVoiceResponse> deleteVoice(Consumer<DeleteVoiceRequest.Builder> deleteVoiceRequest) Deletes a custom voice.default CompletableFuture<DeleteVoiceResponse> deleteVoice(DeleteVoiceRequest deleteVoiceRequest) Deletes a custom voice.default CompletableFuture<DescribeVoicesResponse> Returns the list of voices: the voices that Amazon Polly provides and the custom voices in your account.default CompletableFuture<DescribeVoicesResponse> describeVoices(Consumer<DescribeVoicesRequest.Builder> describeVoicesRequest) Returns the list of voices: the voices that Amazon Polly provides and the custom voices in your account.default CompletableFuture<DescribeVoicesResponse> describeVoices(DescribeVoicesRequest describeVoicesRequest) Returns the list of voices: the voices that Amazon Polly provides and the custom voices in your account.default CompletableFuture<GetLexiconResponse> getLexicon(Consumer<GetLexiconRequest.Builder> getLexiconRequest) Returns the content of the specified pronunciation lexicon stored in an Amazon Web Services Region.default CompletableFuture<GetLexiconResponse> getLexicon(GetLexiconRequest getLexiconRequest) Returns the content of the specified pronunciation lexicon stored in an Amazon Web Services Region.getSpeechSynthesisTask(Consumer<GetSpeechSynthesisTaskRequest.Builder> getSpeechSynthesisTaskRequest) Retrieves a specific SpeechSynthesisTask object based on its TaskID.getSpeechSynthesisTask(GetSpeechSynthesisTaskRequest getSpeechSynthesisTaskRequest) Retrieves a specific SpeechSynthesisTask object based on its TaskID.default CompletableFuture<GetVoiceResponse> getVoice(Consumer<GetVoiceRequest.Builder> getVoiceRequest) Returns the status and properties of a custom voice.default CompletableFuture<GetVoiceResponse> getVoice(GetVoiceRequest getVoiceRequest) Returns the status and properties of a custom voice.default CompletableFuture<ListLexiconsResponse> Returns a list of pronunciation lexicons stored in an Amazon Web Services Region.default CompletableFuture<ListLexiconsResponse> listLexicons(Consumer<ListLexiconsRequest.Builder> listLexiconsRequest) Returns a list of pronunciation lexicons stored in an Amazon Web Services Region.default CompletableFuture<ListLexiconsResponse> listLexicons(ListLexiconsRequest listLexiconsRequest) Returns a list of pronunciation lexicons stored in an Amazon Web Services Region.Returns a list of SpeechSynthesisTask objects ordered by their creation date.listSpeechSynthesisTasks(Consumer<ListSpeechSynthesisTasksRequest.Builder> listSpeechSynthesisTasksRequest) Returns a list of SpeechSynthesisTask objects ordered by their creation date.listSpeechSynthesisTasks(ListSpeechSynthesisTasksRequest listSpeechSynthesisTasksRequest) Returns a list of SpeechSynthesisTask objects ordered by their creation date.This is a variant oflistSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest)operation.listSpeechSynthesisTasksPaginator(Consumer<ListSpeechSynthesisTasksRequest.Builder> listSpeechSynthesisTasksRequest) This is a variant oflistSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest)operation.listSpeechSynthesisTasksPaginator(ListSpeechSynthesisTasksRequest listSpeechSynthesisTasksRequest) This is a variant oflistSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest)operation.listTagsForResource(Consumer<ListTagsForResourceRequest.Builder> listTagsForResourceRequest) Lists the tags for an Amazon Polly resource.listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) Lists the tags for an Amazon Polly resource.default CompletableFuture<PutLexiconResponse> putLexicon(Consumer<PutLexiconRequest.Builder> putLexiconRequest) Stores a pronunciation lexicon in an Amazon Web Services Region.default CompletableFuture<PutLexiconResponse> putLexicon(PutLexiconRequest putLexiconRequest) Stores a pronunciation lexicon in an Amazon Web Services Region.default PollyServiceClientConfigurationThe SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfigurationdefault CompletableFuture<Void> startSpeechSynthesisStream(Consumer<StartSpeechSynthesisStreamRequest.Builder> startSpeechSynthesisStreamRequest, org.reactivestreams.Publisher<StartSpeechSynthesisStreamActionStream> requestStream, StartSpeechSynthesisStreamResponseHandler asyncResponseHandler) Synthesizes UTF-8 input, plain text, or SSML over a bidirectional streaming connection.default CompletableFuture<Void> startSpeechSynthesisStream(StartSpeechSynthesisStreamRequest startSpeechSynthesisStreamRequest, org.reactivestreams.Publisher<StartSpeechSynthesisStreamActionStream> requestStream, StartSpeechSynthesisStreamResponseHandler asyncResponseHandler) Synthesizes UTF-8 input, plain text, or SSML over a bidirectional streaming connection.startSpeechSynthesisTask(Consumer<StartSpeechSynthesisTaskRequest.Builder> startSpeechSynthesisTaskRequest) Starts an asynchronous synthesis task by creating a newSpeechSynthesisTask.startSpeechSynthesisTask(StartSpeechSynthesisTaskRequest startSpeechSynthesisTaskRequest) Starts an asynchronous synthesis task by creating a newSpeechSynthesisTask.synthesizeSpeech(Consumer<SynthesizeSpeechRequest.Builder> synthesizeSpeechRequest, Path destinationPath) Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes.default <ReturnT> CompletableFuture<ReturnT> synthesizeSpeech(Consumer<SynthesizeSpeechRequest.Builder> synthesizeSpeechRequest, AsyncResponseTransformer<SynthesizeSpeechResponse, ReturnT> asyncResponseTransformer) Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes.synthesizeSpeech(SynthesizeSpeechRequest synthesizeSpeechRequest, Path destinationPath) Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes.default <ReturnT> CompletableFuture<ReturnT> synthesizeSpeech(SynthesizeSpeechRequest synthesizeSpeechRequest, AsyncResponseTransformer<SynthesizeSpeechResponse, ReturnT> asyncResponseTransformer) Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes.default CompletableFuture<TagResourceResponse> tagResource(Consumer<TagResourceRequest.Builder> tagResourceRequest) Adds specified tags to a resource with the specified ARN.default CompletableFuture<TagResourceResponse> tagResource(TagResourceRequest tagResourceRequest) Adds specified tags to a resource with the specified ARN.default CompletableFuture<UntagResourceResponse> untagResource(Consumer<UntagResourceRequest.Builder> untagResourceRequest) Deletes specified tags from a resource.default CompletableFuture<UntagResourceResponse> untagResource(UntagResourceRequest untagResourceRequest) Deletes specified tags from a resource.default PollyAsyncWaiterwaiter()Create an instance ofPollyAsyncWaiterusing this client.Methods inherited from interface software.amazon.awssdk.utils.SdkAutoCloseable
closeMethods inherited from interface software.amazon.awssdk.core.SdkClient
serviceName
-
Field Details
-
SERVICE_NAME
- See Also:
-
SERVICE_METADATA_ID
Value for looking up the service's metadata from theServiceMetadataProvider.- See Also:
-
-
Method Details
-
createVoice
Creates a custom voice from recordings of a speaker and returns it in
pendingstatus. UseGetVoiceto check the status. When the status isactive, you can use the voice ID inSynthesizeSpeech,StartSpeechSynthesisTask, andStartSpeechSynthesisStream.The
custom-voice-max-countservice quota limits the number of custom voices in your account in each Region. If you reach the quota, the request fails withServiceQuotaExceededException.This operation requires permissions to perform the
polly:CreateVoiceaction. You also needs3:GetObjectpermission on each recording that you specify byS3Url. If you specify a customer managed key, you also needkms:DescribeKey,kms:GenerateDataKey, andkms:Decryptpermissions on the key. If you specifyTags, you also need thepolly:TagResourcepermission.- Parameters:
createVoiceRequest-- Returns:
- A Java Future containing the result of the CreateVoice operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ValidationException The input fails to satisfy the constraints specified by the service.
- ServiceFailureException An unknown condition has caused a service failure.
- ServiceQuotaExceededException The request would cause a service quota to be exceeded.
- AccessDeniedException You don't have sufficient permissions to perform this action. For a custom voice that uses a customer managed key, Amazon Polly also returns this exception if you don't have the required Amazon Web Services KMS permissions on the key.
- TooManyTagsException The list of tags on the resource is over the limit. The maximum number of tags that can be applied to a resource is 50. Remove unused tags or reduce the number of tags in the request, and then try again.
- InvalidTagParameterException The resource ARN or a tag in the request isn't valid. Specify the ARN of a supported resource in the Amazon Web Services account and Region of the request. Tag keys can have a maximum length of 128 characters, and tag values can have a maximum length of 256 characters. Correct the ARN or the tags, and then try again.
- ThrottlingException The request was denied because of request throttling.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
createVoice
default CompletableFuture<CreateVoiceResponse> createVoice(Consumer<CreateVoiceRequest.Builder> createVoiceRequest) Creates a custom voice from recordings of a speaker and returns it in
pendingstatus. UseGetVoiceto check the status. When the status isactive, you can use the voice ID inSynthesizeSpeech,StartSpeechSynthesisTask, andStartSpeechSynthesisStream.The
custom-voice-max-countservice quota limits the number of custom voices in your account in each Region. If you reach the quota, the request fails withServiceQuotaExceededException.This operation requires permissions to perform the
polly:CreateVoiceaction. You also needs3:GetObjectpermission on each recording that you specify byS3Url. If you specify a customer managed key, you also needkms:DescribeKey,kms:GenerateDataKey, andkms:Decryptpermissions on the key. If you specifyTags, you also need thepolly:TagResourcepermission.
This is a convenience which creates an instance of the
CreateVoiceRequest.Builderavoiding the need to create one manually viaCreateVoiceRequest.builder()- Parameters:
createVoiceRequest- AConsumerthat will call methods onCreateVoiceRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the CreateVoice operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ValidationException The input fails to satisfy the constraints specified by the service.
- ServiceFailureException An unknown condition has caused a service failure.
- ServiceQuotaExceededException The request would cause a service quota to be exceeded.
- AccessDeniedException You don't have sufficient permissions to perform this action. For a custom voice that uses a customer managed key, Amazon Polly also returns this exception if you don't have the required Amazon Web Services KMS permissions on the key.
- TooManyTagsException The list of tags on the resource is over the limit. The maximum number of tags that can be applied to a resource is 50. Remove unused tags or reduce the number of tags in the request, and then try again.
- InvalidTagParameterException The resource ARN or a tag in the request isn't valid. Specify the ARN of a supported resource in the Amazon Web Services account and Region of the request. Tag keys can have a maximum length of 128 characters, and tag values can have a maximum length of 256 characters. Correct the ARN or the tags, and then try again.
- ThrottlingException The request was denied because of request throttling.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
deleteLexicon
default CompletableFuture<DeleteLexiconResponse> deleteLexicon(DeleteLexiconRequest deleteLexiconRequest) 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
GetLexiconorListLexiconAPIs.For more information, see Managing Lexicons.
- Parameters:
deleteLexiconRequest-- Returns:
- A Java Future containing the result of the DeleteLexicon operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a
lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different
region.
Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a
lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different
region.
- See Also:
-
deleteLexicon
default CompletableFuture<DeleteLexiconResponse> deleteLexicon(Consumer<DeleteLexiconRequest.Builder> deleteLexiconRequest) 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
GetLexiconorListLexiconAPIs.For more information, see Managing Lexicons.
This is a convenience which creates an instance of the
DeleteLexiconRequest.Builderavoiding the need to create one manually viaDeleteLexiconRequest.builder()- Parameters:
deleteLexiconRequest- AConsumerthat will call methods onDeleteLexiconRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the DeleteLexicon operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a
lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different
region.
Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a
lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different
region.
- See Also:
-
deleteVoice
Deletes a custom voice.
DescribeVoicesandGetVoicestop returning the voice immediately. You can't restore a deleted voice.You can delete a voice in
activeorfailedstatus. If the voice is inpendingstatus, the request fails withConflictException. If no custom voice with the specified ID exists in your account and Region, the request fails withResourceNotFoundException. You can delete the voice even if you disabled its Amazon Web Services KMS key or scheduled it for deletion.This operation requires permissions to perform the
polly:DeleteVoiceaction.- Parameters:
deleteVoiceRequest-- Returns:
- A Java Future containing the result of the DeleteVoice operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ResourceNotFoundException Amazon Polly can't find the specified resource. Verify that the resource exists in the Amazon Web Services account and Region of the request and that its ARN or ID is spelled correctly, and then try again.
- ConflictException The request conflicts with the current state of the resource. For a custom voice,
the voice isn't in the status that the operation requires. Check the status with
GetVoice, and then try again. - ValidationException The input fails to satisfy the constraints specified by the service.
- ServiceFailureException An unknown condition has caused a service failure.
- ThrottlingException The request was denied because of request throttling.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
deleteVoice
default CompletableFuture<DeleteVoiceResponse> deleteVoice(Consumer<DeleteVoiceRequest.Builder> deleteVoiceRequest) Deletes a custom voice.
DescribeVoicesandGetVoicestop returning the voice immediately. You can't restore a deleted voice.You can delete a voice in
activeorfailedstatus. If the voice is inpendingstatus, the request fails withConflictException. If no custom voice with the specified ID exists in your account and Region, the request fails withResourceNotFoundException. You can delete the voice even if you disabled its Amazon Web Services KMS key or scheduled it for deletion.This operation requires permissions to perform the
polly:DeleteVoiceaction.
This is a convenience which creates an instance of the
DeleteVoiceRequest.Builderavoiding the need to create one manually viaDeleteVoiceRequest.builder()- Parameters:
deleteVoiceRequest- AConsumerthat will call methods onDeleteVoiceRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the DeleteVoice operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ResourceNotFoundException Amazon Polly can't find the specified resource. Verify that the resource exists in the Amazon Web Services account and Region of the request and that its ARN or ID is spelled correctly, and then try again.
- ConflictException The request conflicts with the current state of the resource. For a custom voice,
the voice isn't in the status that the operation requires. Check the status with
GetVoice, and then try again. - ValidationException The input fails to satisfy the constraints specified by the service.
- ServiceFailureException An unknown condition has caused a service failure.
- ThrottlingException The request was denied because of request throttling.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
describeVoices
default CompletableFuture<DescribeVoicesResponse> describeVoices(DescribeVoicesRequest describeVoicesRequest) Returns the list of voices: the voices that Amazon Polly provides and the custom voices in your account. Each voice speaks a specified language and is identified by an ID. A voice that Amazon Polly provides is either male or female, and its ID is the ASCII version of the voice name.
When synthesizing speech (
SynthesizeSpeech), you provide the voice ID for the voice you want from the list of voices returned byDescribeVoices.For example, your news reader application reads news in a specific language, and you want to give users the option to choose the voice. With the
DescribeVoicesoperation, you can provide a list of available voices for users to choose from.You can optionally specify a language code to filter the available voices. For example, if you specify
en-US, the operation returns a list of all available US English voices.The list includes custom voices in every status. For each voice,
Originindicates whether Amazon Polly provides the voice or you created it. You can use a custom voice for synthesis only when its status isactive. A voice infailedstatus stays in the list until you delete it.For a custom voice,
DescribeVoicesreturnsOrigin,Id,Name,Status,LanguageCode,LanguageName,SupportedEngines, andCreationTime. To getArn,StatusReason,VoiceCreationData, andCustomerManagedEncryption, useGetVoice.The
LanguageCodeandEnginefilters apply to custom voices in the same way as to voices that Amazon Polly provides.This operation requires permissions to perform the
polly:DescribeVoicesaction.- Parameters:
describeVoicesRequest-- Returns:
- A Java Future containing the result of the DescribeVoices operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
describeVoices
default CompletableFuture<DescribeVoicesResponse> describeVoices(Consumer<DescribeVoicesRequest.Builder> describeVoicesRequest) Returns the list of voices: the voices that Amazon Polly provides and the custom voices in your account. Each voice speaks a specified language and is identified by an ID. A voice that Amazon Polly provides is either male or female, and its ID is the ASCII version of the voice name.
When synthesizing speech (
SynthesizeSpeech), you provide the voice ID for the voice you want from the list of voices returned byDescribeVoices.For example, your news reader application reads news in a specific language, and you want to give users the option to choose the voice. With the
DescribeVoicesoperation, you can provide a list of available voices for users to choose from.You can optionally specify a language code to filter the available voices. For example, if you specify
en-US, the operation returns a list of all available US English voices.The list includes custom voices in every status. For each voice,
Originindicates whether Amazon Polly provides the voice or you created it. You can use a custom voice for synthesis only when its status isactive. A voice infailedstatus stays in the list until you delete it.For a custom voice,
DescribeVoicesreturnsOrigin,Id,Name,Status,LanguageCode,LanguageName,SupportedEngines, andCreationTime. To getArn,StatusReason,VoiceCreationData, andCustomerManagedEncryption, useGetVoice.The
LanguageCodeandEnginefilters apply to custom voices in the same way as to voices that Amazon Polly provides.This operation requires permissions to perform the
polly:DescribeVoicesaction.
This is a convenience which creates an instance of the
DescribeVoicesRequest.Builderavoiding the need to create one manually viaDescribeVoicesRequest.builder()- Parameters:
describeVoicesRequest- AConsumerthat will call methods onDescribeVoicesRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the DescribeVoices operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
describeVoices
Returns the list of voices: the voices that Amazon Polly provides and the custom voices in your account. Each voice speaks a specified language and is identified by an ID. A voice that Amazon Polly provides is either male or female, and its ID is the ASCII version of the voice name.
When synthesizing speech (
SynthesizeSpeech), you provide the voice ID for the voice you want from the list of voices returned byDescribeVoices.For example, your news reader application reads news in a specific language, and you want to give users the option to choose the voice. With the
DescribeVoicesoperation, you can provide a list of available voices for users to choose from.You can optionally specify a language code to filter the available voices. For example, if you specify
en-US, the operation returns a list of all available US English voices.The list includes custom voices in every status. For each voice,
Originindicates whether Amazon Polly provides the voice or you created it. You can use a custom voice for synthesis only when its status isactive. A voice infailedstatus stays in the list until you delete it.For a custom voice,
DescribeVoicesreturnsOrigin,Id,Name,Status,LanguageCode,LanguageName,SupportedEngines, andCreationTime. To getArn,StatusReason,VoiceCreationData, andCustomerManagedEncryption, useGetVoice.The
LanguageCodeandEnginefilters apply to custom voices in the same way as to voices that Amazon Polly provides.This operation requires permissions to perform the
polly:DescribeVoicesaction.- Returns:
- A Java Future containing the result of the DescribeVoices operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
getLexicon
Returns the content of the specified pronunciation lexicon stored in an Amazon Web Services Region. For more information, see Managing Lexicons.
- Parameters:
getLexiconRequest-- Returns:
- A Java Future containing the result of the GetLexicon operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a
lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different
region.
Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a
lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different
region.
- See Also:
-
getLexicon
default CompletableFuture<GetLexiconResponse> getLexicon(Consumer<GetLexiconRequest.Builder> getLexiconRequest) Returns the content of the specified pronunciation lexicon stored in an Amazon Web Services Region. For more information, see Managing Lexicons.
This is a convenience which creates an instance of the
GetLexiconRequest.Builderavoiding the need to create one manually viaGetLexiconRequest.builder()- Parameters:
getLexiconRequest- AConsumerthat will call methods onGetLexiconRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the GetLexicon operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a
lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different
region.
Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a
lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different
region.
- See Also:
-
getSpeechSynthesisTask
default CompletableFuture<GetSpeechSynthesisTaskResponse> getSpeechSynthesisTask(GetSpeechSynthesisTaskRequest getSpeechSynthesisTaskRequest) 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.
- Parameters:
getSpeechSynthesisTaskRequest-- Returns:
- A Java Future containing the result of the GetSpeechSynthesisTask operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- InvalidTaskIdException The provided Task ID is not valid. Please provide a valid Task ID and try again.
- ServiceFailureException An unknown condition has caused a service failure.
- SynthesisTaskNotFoundException The Speech Synthesis task with requested Task ID cannot be found.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
getSpeechSynthesisTask
default CompletableFuture<GetSpeechSynthesisTaskResponse> getSpeechSynthesisTask(Consumer<GetSpeechSynthesisTaskRequest.Builder> getSpeechSynthesisTaskRequest) 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.
This is a convenience which creates an instance of the
GetSpeechSynthesisTaskRequest.Builderavoiding the need to create one manually viaGetSpeechSynthesisTaskRequest.builder()- Parameters:
getSpeechSynthesisTaskRequest- AConsumerthat will call methods onGetSpeechSynthesisTaskRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the GetSpeechSynthesisTask operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- InvalidTaskIdException The provided Task ID is not valid. Please provide a valid Task ID and try again.
- ServiceFailureException An unknown condition has caused a service failure.
- SynthesisTaskNotFoundException The Speech Synthesis task with requested Task ID cannot be found.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
getVoice
Returns the status and properties of a custom voice. Use this operation after
CreateVoiceto check whether the status of the voice isactiveorfailed. UnlikeDescribeVoices,GetVoicealso returnsArn,VoiceCreationData,CustomerManagedEncryption, andStatusReason. If no custom voice with the specified ID exists in your account and Region, the request fails withResourceNotFoundException.This operation requires permissions to perform the
polly:GetVoiceaction.- Parameters:
getVoiceRequest-- Returns:
- A Java Future containing the result of the GetVoice operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ResourceNotFoundException Amazon Polly can't find the specified resource. Verify that the resource exists in the Amazon Web Services account and Region of the request and that its ARN or ID is spelled correctly, and then try again.
- ValidationException The input fails to satisfy the constraints specified by the service.
- ServiceFailureException An unknown condition has caused a service failure.
- ThrottlingException The request was denied because of request throttling.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
getVoice
default CompletableFuture<GetVoiceResponse> getVoice(Consumer<GetVoiceRequest.Builder> getVoiceRequest) Returns the status and properties of a custom voice. Use this operation after
CreateVoiceto check whether the status of the voice isactiveorfailed. UnlikeDescribeVoices,GetVoicealso returnsArn,VoiceCreationData,CustomerManagedEncryption, andStatusReason. If no custom voice with the specified ID exists in your account and Region, the request fails withResourceNotFoundException.This operation requires permissions to perform the
polly:GetVoiceaction.
This is a convenience which creates an instance of the
GetVoiceRequest.Builderavoiding the need to create one manually viaGetVoiceRequest.builder()- Parameters:
getVoiceRequest- AConsumerthat will call methods onGetVoiceRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the GetVoice operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ResourceNotFoundException Amazon Polly can't find the specified resource. Verify that the resource exists in the Amazon Web Services account and Region of the request and that its ARN or ID is spelled correctly, and then try again.
- ValidationException The input fails to satisfy the constraints specified by the service.
- ServiceFailureException An unknown condition has caused a service failure.
- ThrottlingException The request was denied because of request throttling.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
listLexicons
default CompletableFuture<ListLexiconsResponse> listLexicons(ListLexiconsRequest listLexiconsRequest) Returns a list of pronunciation lexicons stored in an Amazon Web Services Region. For more information, see Managing Lexicons.
- Parameters:
listLexiconsRequest-- Returns:
- A Java Future containing the result of the ListLexicons operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
listLexicons
default CompletableFuture<ListLexiconsResponse> listLexicons(Consumer<ListLexiconsRequest.Builder> listLexiconsRequest) Returns a list of pronunciation lexicons stored in an Amazon Web Services Region. For more information, see Managing Lexicons.
This is a convenience which creates an instance of the
ListLexiconsRequest.Builderavoiding the need to create one manually viaListLexiconsRequest.builder()- Parameters:
listLexiconsRequest- AConsumerthat will call methods onListLexiconsRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the ListLexicons operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
listLexicons
Returns a list of pronunciation lexicons stored in an Amazon Web Services Region. For more information, see Managing Lexicons.
- Returns:
- A Java Future containing the result of the ListLexicons operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
listSpeechSynthesisTasks
default CompletableFuture<ListSpeechSynthesisTasksResponse> listSpeechSynthesisTasks(ListSpeechSynthesisTasksRequest listSpeechSynthesisTasksRequest) 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.
- Parameters:
listSpeechSynthesisTasksRequest-- Returns:
- A Java Future containing the result of the ListSpeechSynthesisTasks operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
listSpeechSynthesisTasks
default CompletableFuture<ListSpeechSynthesisTasksResponse> listSpeechSynthesisTasks(Consumer<ListSpeechSynthesisTasksRequest.Builder> listSpeechSynthesisTasksRequest) 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.
This is a convenience which creates an instance of the
ListSpeechSynthesisTasksRequest.Builderavoiding the need to create one manually viaListSpeechSynthesisTasksRequest.builder()- Parameters:
listSpeechSynthesisTasksRequest- AConsumerthat will call methods onListSpeechSynthesisTasksRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the ListSpeechSynthesisTasks operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
listSpeechSynthesisTasks
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.
- Returns:
- A Java Future containing the result of the ListSpeechSynthesisTasks operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
listSpeechSynthesisTasksPaginator
This is a variant of
listSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest)operation. The return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will internally handle making service calls for you.When the operation is called, an instance of this class is returned. At this point, no service calls are made yet and so there is no guarantee that the request is valid. If there are errors in your request, you will see the failures only after you start streaming the data. The subscribe method should be called as a request to start streaming data. For more info, see
Publisher.subscribe(org.reactivestreams.Subscriber). Each call to the subscribe method will result in a newSubscriptioni.e., a new contract to stream data from the starting request.The following are few ways to use the response class:
1) Using the subscribe helper method
2) Using a custom subscribersoftware.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request); CompletableFuture<Void> future = publisher.subscribe(res -> { // Do something with the response }); future.get();
As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request); publisher.subscribe(new Subscriber<software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksResponse>() { public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... }; public void onNext(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksResponse response) { //... }; });Please notice that the configuration of MaxResults won't limit the number of results you get with the paginator. It only limits the number of results in each page.
Note: If you prefer to have control on service calls, use the
listSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest)operation.- Returns:
- A custom publisher that can be subscribed to request a stream of response pages.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
listSpeechSynthesisTasksPaginator
default ListSpeechSynthesisTasksPublisher listSpeechSynthesisTasksPaginator(ListSpeechSynthesisTasksRequest listSpeechSynthesisTasksRequest) This is a variant of
listSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest)operation. The return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will internally handle making service calls for you.When the operation is called, an instance of this class is returned. At this point, no service calls are made yet and so there is no guarantee that the request is valid. If there are errors in your request, you will see the failures only after you start streaming the data. The subscribe method should be called as a request to start streaming data. For more info, see
Publisher.subscribe(org.reactivestreams.Subscriber). Each call to the subscribe method will result in a newSubscriptioni.e., a new contract to stream data from the starting request.The following are few ways to use the response class:
1) Using the subscribe helper method
2) Using a custom subscribersoftware.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request); CompletableFuture<Void> future = publisher.subscribe(res -> { // Do something with the response }); future.get();
As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request); publisher.subscribe(new Subscriber<software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksResponse>() { public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... }; public void onNext(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksResponse response) { //... }; });Please notice that the configuration of MaxResults won't limit the number of results you get with the paginator. It only limits the number of results in each page.
Note: If you prefer to have control on service calls, use the
listSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest)operation.- Parameters:
listSpeechSynthesisTasksRequest-- Returns:
- A custom publisher that can be subscribed to request a stream of response pages.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
listSpeechSynthesisTasksPaginator
default ListSpeechSynthesisTasksPublisher listSpeechSynthesisTasksPaginator(Consumer<ListSpeechSynthesisTasksRequest.Builder> listSpeechSynthesisTasksRequest) This is a variant of
listSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest)operation. The return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will internally handle making service calls for you.When the operation is called, an instance of this class is returned. At this point, no service calls are made yet and so there is no guarantee that the request is valid. If there are errors in your request, you will see the failures only after you start streaming the data. The subscribe method should be called as a request to start streaming data. For more info, see
Publisher.subscribe(org.reactivestreams.Subscriber). Each call to the subscribe method will result in a newSubscriptioni.e., a new contract to stream data from the starting request.The following are few ways to use the response class:
1) Using the subscribe helper method
2) Using a custom subscribersoftware.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request); CompletableFuture<Void> future = publisher.subscribe(res -> { // Do something with the response }); future.get();
As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request); publisher.subscribe(new Subscriber<software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksResponse>() { public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... }; public void onNext(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksResponse response) { //... }; });Please notice that the configuration of MaxResults won't limit the number of results you get with the paginator. It only limits the number of results in each page.
Note: If you prefer to have control on service calls, use the
listSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest)operation.
This is a convenience which creates an instance of the
ListSpeechSynthesisTasksRequest.Builderavoiding the need to create one manually viaListSpeechSynthesisTasksRequest.builder()- Parameters:
listSpeechSynthesisTasksRequest- AConsumerthat will call methods onListSpeechSynthesisTasksRequest.Builderto create a request.- Returns:
- A custom publisher that can be subscribed to request a stream of response pages.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
listTagsForResource
default CompletableFuture<ListTagsForResourceResponse> listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) Lists the tags for an Amazon Polly resource.
- Parameters:
listTagsForResourceRequest-- Returns:
- A Java Future containing the result of the ListTagsForResource operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ResourceNotFoundException Amazon Polly can't find the specified resource. Verify that the resource exists in the Amazon Web Services account and Region of the request and that its ARN or ID is spelled correctly, and then try again.
- ValidationException The input fails to satisfy the constraints specified by the service.
- InvalidTagParameterException The resource ARN or a tag in the request isn't valid. Specify the ARN of a supported resource in the Amazon Web Services account and Region of the request. Tag keys can have a maximum length of 128 characters, and tag values can have a maximum length of 256 characters. Correct the ARN or the tags, and then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- ThrottlingException The request was denied because of request throttling.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
listTagsForResource
default CompletableFuture<ListTagsForResourceResponse> listTagsForResource(Consumer<ListTagsForResourceRequest.Builder> listTagsForResourceRequest) Lists the tags for an Amazon Polly resource.
This is a convenience which creates an instance of the
ListTagsForResourceRequest.Builderavoiding the need to create one manually viaListTagsForResourceRequest.builder()- Parameters:
listTagsForResourceRequest- AConsumerthat will call methods onListTagsForResourceRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the ListTagsForResource operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ResourceNotFoundException Amazon Polly can't find the specified resource. Verify that the resource exists in the Amazon Web Services account and Region of the request and that its ARN or ID is spelled correctly, and then try again.
- ValidationException The input fails to satisfy the constraints specified by the service.
- InvalidTagParameterException The resource ARN or a tag in the request isn't valid. Specify the ARN of a supported resource in the Amazon Web Services account and Region of the request. Tag keys can have a maximum length of 128 characters, and tag values can have a maximum length of 256 characters. Correct the ARN or the tags, and then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- ThrottlingException The request was denied because of request throttling.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
putLexicon
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.
Overwriting a lexicon keeps its existing tags. You can specify tags only when you create a lexicon. If you specify tags for a lexicon that already exists, the request fails with a
ValidationException. To change the tags of an existing lexicon, useTagResourceandUntagResource.For more information, see Managing Lexicons.
- Parameters:
putLexiconRequest-- Returns:
- A Java Future containing the result of the PutLexicon operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- InvalidLexiconException Amazon Polly can't find the specified lexicon. Verify that the lexicon's name is spelled correctly, and then try again.
- UnsupportedPlsAlphabetException The alphabet specified by the lexicon is not a supported alphabet.
Valid values are
ipa,x-sampa,x-amazon-pinyin,x-amazon-jyutping,x-amazon-pron-kana, andx-amazon-yomigana. Replace the unsupported alphabet with one of the valid values and resubmit your request. - UnsupportedPlsLanguageException The language specified in the lexicon is unsupported. For a list of supported languages, see Lexicon Attributes.
- LexiconSizeExceededException The maximum size of the specified lexicon would be exceeded by this operation.
- MaxLexemeLengthExceededException The maximum size of the lexeme would be exceeded by this operation.
- MaxLexiconsNumberExceededException The maximum number of lexicons would be exceeded by this operation.
- ValidationException The input fails to satisfy the constraints specified by the service.
- TooManyTagsException The list of tags on the resource is over the limit. The maximum number of tags that can be applied to a resource is 50. Remove unused tags or reduce the number of tags in the request, and then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- InvalidTagParameterException The resource ARN or a tag in the request isn't valid. Specify the ARN of a supported resource in the Amazon Web Services account and Region of the request. Tag keys can have a maximum length of 128 characters, and tag values can have a maximum length of 256 characters. Correct the ARN or the tags, and then try again.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
putLexicon
default CompletableFuture<PutLexiconResponse> putLexicon(Consumer<PutLexiconRequest.Builder> putLexiconRequest) 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.
Overwriting a lexicon keeps its existing tags. You can specify tags only when you create a lexicon. If you specify tags for a lexicon that already exists, the request fails with a
ValidationException. To change the tags of an existing lexicon, useTagResourceandUntagResource.For more information, see Managing Lexicons.
This is a convenience which creates an instance of the
PutLexiconRequest.Builderavoiding the need to create one manually viaPutLexiconRequest.builder()- Parameters:
putLexiconRequest- AConsumerthat will call methods onPutLexiconRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the PutLexicon operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- InvalidLexiconException Amazon Polly can't find the specified lexicon. Verify that the lexicon's name is spelled correctly, and then try again.
- UnsupportedPlsAlphabetException The alphabet specified by the lexicon is not a supported alphabet.
Valid values are
ipa,x-sampa,x-amazon-pinyin,x-amazon-jyutping,x-amazon-pron-kana, andx-amazon-yomigana. Replace the unsupported alphabet with one of the valid values and resubmit your request. - UnsupportedPlsLanguageException The language specified in the lexicon is unsupported. For a list of supported languages, see Lexicon Attributes.
- LexiconSizeExceededException The maximum size of the specified lexicon would be exceeded by this operation.
- MaxLexemeLengthExceededException The maximum size of the lexeme would be exceeded by this operation.
- MaxLexiconsNumberExceededException The maximum number of lexicons would be exceeded by this operation.
- ValidationException The input fails to satisfy the constraints specified by the service.
- TooManyTagsException The list of tags on the resource is over the limit. The maximum number of tags that can be applied to a resource is 50. Remove unused tags or reduce the number of tags in the request, and then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- InvalidTagParameterException The resource ARN or a tag in the request isn't valid. Specify the ARN of a supported resource in the Amazon Web Services account and Region of the request. Tag keys can have a maximum length of 128 characters, and tag values can have a maximum length of 256 characters. Correct the ARN or the tags, and then try again.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
startSpeechSynthesisStream
default CompletableFuture<Void> startSpeechSynthesisStream(StartSpeechSynthesisStreamRequest startSpeechSynthesisStreamRequest, org.reactivestreams.Publisher<StartSpeechSynthesisStreamActionStream> requestStream, StartSpeechSynthesisStreamResponseHandler asyncResponseHandler) Synthesizes UTF-8 input, plain text, or SSML over a bidirectional streaming connection. Specify synthesis parameters in HTTP/2 headers, send text incrementally as events on the input stream, and receive synthesized audio as it becomes available.
This operation serves as a bidirectional counterpart to
SynthesizeSpeech:To use a custom voice, specify its ID in
VoiceId. The voice must be inactivestatus. If the voice is inpendingorfailedstatus, the request fails withConflictException. If no custom voice with the specified ID exists in your account and Region, the request fails withResourceNotFoundException. If the custom voice uses a customer managed key, you needkms:Decryptpermission on the key. If you disabled the key or scheduled it for deletion, the request fails withValidationException. If you don't have permission to use the key, the request fails withAccessDeniedException. If Amazon Web Services KMS throttles Amazon Polly's request to use the key, the request fails withThrottlingException.- Parameters:
startSpeechSynthesisStreamRequest-- Returns:
- A Java Future containing the result of the StartSpeechSynthesisStream operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ValidationException The input fails to satisfy the constraints specified by the service.
- ServiceQuotaExceededException The request would cause a service quota to be exceeded.
- ServiceFailureException An unknown condition has caused a service failure.
- ThrottlingException The request was denied because of request throttling.
- ResourceNotFoundException Amazon Polly can't find the specified resource. Verify that the resource exists in the Amazon Web Services account and Region of the request and that its ARN or ID is spelled correctly, and then try again.
- ConflictException The request conflicts with the current state of the resource. For a custom voice,
the voice isn't in the status that the operation requires. Check the status with
GetVoice, and then try again. - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
startSpeechSynthesisStream
default CompletableFuture<Void> startSpeechSynthesisStream(Consumer<StartSpeechSynthesisStreamRequest.Builder> startSpeechSynthesisStreamRequest, org.reactivestreams.Publisher<StartSpeechSynthesisStreamActionStream> requestStream, StartSpeechSynthesisStreamResponseHandler asyncResponseHandler) Synthesizes UTF-8 input, plain text, or SSML over a bidirectional streaming connection. Specify synthesis parameters in HTTP/2 headers, send text incrementally as events on the input stream, and receive synthesized audio as it becomes available.
This operation serves as a bidirectional counterpart to
SynthesizeSpeech:To use a custom voice, specify its ID in
VoiceId. The voice must be inactivestatus. If the voice is inpendingorfailedstatus, the request fails withConflictException. If no custom voice with the specified ID exists in your account and Region, the request fails withResourceNotFoundException. If the custom voice uses a customer managed key, you needkms:Decryptpermission on the key. If you disabled the key or scheduled it for deletion, the request fails withValidationException. If you don't have permission to use the key, the request fails withAccessDeniedException. If Amazon Web Services KMS throttles Amazon Polly's request to use the key, the request fails withThrottlingException.
This is a convenience which creates an instance of the
StartSpeechSynthesisStreamRequest.Builderavoiding the need to create one manually viaStartSpeechSynthesisStreamRequest.builder()- Parameters:
startSpeechSynthesisStreamRequest- AConsumerthat will call methods onStartSpeechSynthesisStreamRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the StartSpeechSynthesisStream operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ValidationException The input fails to satisfy the constraints specified by the service.
- ServiceQuotaExceededException The request would cause a service quota to be exceeded.
- ServiceFailureException An unknown condition has caused a service failure.
- ThrottlingException The request was denied because of request throttling.
- ResourceNotFoundException Amazon Polly can't find the specified resource. Verify that the resource exists in the Amazon Web Services account and Region of the request and that its ARN or ID is spelled correctly, and then try again.
- ConflictException The request conflicts with the current state of the resource. For a custom voice,
the voice isn't in the status that the operation requires. Check the status with
GetVoice, and then try again. - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
startSpeechSynthesisTask
default CompletableFuture<StartSpeechSynthesisTaskResponse> startSpeechSynthesisTask(StartSpeechSynthesisTaskRequest startSpeechSynthesisTaskRequest) Starts an asynchronous synthesis task by creating a new
SpeechSynthesisTask. 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 (OutputS3KeyPrefixandSnsTopicArn). After Amazon Polly creates the synthesis task, the operation returns aSpeechSynthesisTaskobject that includes an identifier for the task and its current status. TheSpeechSynthesisTaskobject is available for 72 hours after you start the asynchronous synthesis task.To use a custom voice, specify its ID in
VoiceId. The voice must be inactivestatus. If the voice is inpendingorfailedstatus, the request fails withConflictException. If no custom voice with the specified ID exists in your account and Region, the request fails withResourceNotFoundException. If the custom voice uses a customer managed key, you needkms:Decryptpermission on the key. If you disable the key or schedule it for deletion before the task runs, the task fails andTaskStatusReasondescribes the cause.- Parameters:
startSpeechSynthesisTaskRequest-- Returns:
- A Java Future containing the result of the StartSpeechSynthesisTask operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For
the
SynthesizeSpeechAPI, the limit for input text is a maximum of 6000 characters total, of which no more than 3000 can be billed characters. For theStartSpeechSynthesisTaskAPI, the maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not counted as billed characters. - InvalidS3BucketException The provided Amazon S3 bucket name is invalid. Please check your input with S3 bucket naming requirements and try again.
- InvalidS3KeyException The provided Amazon S3 key prefix is invalid. Please provide a valid S3 object key name.
- InvalidSampleRateException The specified sample rate is not valid.
- InvalidSnsTopicArnException The provided SNS topic ARN is invalid. Please provide a valid SNS topic ARN and try again.
- InvalidSsmlException The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try again.
- EngineNotSupportedException This engine is not compatible with the voice that you have designated. Choose a new voice that is compatible with the engine or change the engine and restart the operation.
- LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a
lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different
region.
Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- MarksNotSupportedForFormatException Speech marks are not supported for the
OutputFormatselected. Speech marks are only available for content injsonformat. - SsmlMarksNotSupportedForTextTypeException SSML speech marks are not supported for plain text-type input.
- LanguageNotSupportedException The language specified is not currently supported by Amazon Polly in this capacity.
- ResourceNotFoundException Amazon Polly can't find the specified resource. Verify that the resource exists in the Amazon Web Services account and Region of the request and that its ARN or ID is spelled correctly, and then try again.
- ConflictException The request conflicts with the current state of the resource. For a custom voice,
the voice isn't in the status that the operation requires. Check the status with
GetVoice, and then try again. - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For
the
- See Also:
-
startSpeechSynthesisTask
default CompletableFuture<StartSpeechSynthesisTaskResponse> startSpeechSynthesisTask(Consumer<StartSpeechSynthesisTaskRequest.Builder> startSpeechSynthesisTaskRequest) Starts an asynchronous synthesis task by creating a new
SpeechSynthesisTask. 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 (OutputS3KeyPrefixandSnsTopicArn). After Amazon Polly creates the synthesis task, the operation returns aSpeechSynthesisTaskobject that includes an identifier for the task and its current status. TheSpeechSynthesisTaskobject is available for 72 hours after you start the asynchronous synthesis task.To use a custom voice, specify its ID in
VoiceId. The voice must be inactivestatus. If the voice is inpendingorfailedstatus, the request fails withConflictException. If no custom voice with the specified ID exists in your account and Region, the request fails withResourceNotFoundException. If the custom voice uses a customer managed key, you needkms:Decryptpermission on the key. If you disable the key or schedule it for deletion before the task runs, the task fails andTaskStatusReasondescribes the cause.
This is a convenience which creates an instance of the
StartSpeechSynthesisTaskRequest.Builderavoiding the need to create one manually viaStartSpeechSynthesisTaskRequest.builder()- Parameters:
startSpeechSynthesisTaskRequest- AConsumerthat will call methods onStartSpeechSynthesisTaskRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the StartSpeechSynthesisTask operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For
the
SynthesizeSpeechAPI, the limit for input text is a maximum of 6000 characters total, of which no more than 3000 can be billed characters. For theStartSpeechSynthesisTaskAPI, the maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not counted as billed characters. - InvalidS3BucketException The provided Amazon S3 bucket name is invalid. Please check your input with S3 bucket naming requirements and try again.
- InvalidS3KeyException The provided Amazon S3 key prefix is invalid. Please provide a valid S3 object key name.
- InvalidSampleRateException The specified sample rate is not valid.
- InvalidSnsTopicArnException The provided SNS topic ARN is invalid. Please provide a valid SNS topic ARN and try again.
- InvalidSsmlException The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try again.
- EngineNotSupportedException This engine is not compatible with the voice that you have designated. Choose a new voice that is compatible with the engine or change the engine and restart the operation.
- LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a
lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different
region.
Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- MarksNotSupportedForFormatException Speech marks are not supported for the
OutputFormatselected. Speech marks are only available for content injsonformat. - SsmlMarksNotSupportedForTextTypeException SSML speech marks are not supported for plain text-type input.
- LanguageNotSupportedException The language specified is not currently supported by Amazon Polly in this capacity.
- ResourceNotFoundException Amazon Polly can't find the specified resource. Verify that the resource exists in the Amazon Web Services account and Region of the request and that its ARN or ID is spelled correctly, and then try again.
- ConflictException The request conflicts with the current state of the resource. For a custom voice,
the voice isn't in the status that the operation requires. Check the status with
GetVoice, and then try again. - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For
the
- See Also:
-
synthesizeSpeech
default <ReturnT> CompletableFuture<ReturnT> synthesizeSpeech(SynthesizeSpeechRequest synthesizeSpeechRequest, AsyncResponseTransformer<SynthesizeSpeechResponse, ReturnT> asyncResponseTransformer) 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 How it Works.
To use a custom voice, specify its ID in
VoiceId. The voice must be inactivestatus. If the voice is inpendingorfailedstatus, the request fails withConflictException. If no custom voice with the specified ID exists in your account and Region, the request fails withResourceNotFoundException.If the custom voice uses a customer managed key, you need
kms:Decryptpermission on the key. If you disabled the key or scheduled it for deletion, the request fails withValidationException. If you don't have permission to use the key, the request fails withAccessDeniedException. If Amazon Web Services KMS throttles Amazon Polly's request to use the key, the request fails withThrottlingException.- Parameters:
synthesizeSpeechRequest-asyncResponseTransformer- The response transformer for processing the streaming response in a non-blocking manner. SeeAsyncResponseTransformerfor details on how this callback should be implemented and for links to precanned implementations for common scenarios like downloading to a file. The service documentation for the response content is as follows 'Stream containing the synthesized speech.
'.- Returns:
- A future to the transformed result of the AsyncResponseTransformer.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For
the
SynthesizeSpeechAPI, the limit for input text is a maximum of 6000 characters total, of which no more than 3000 can be billed characters. For theStartSpeechSynthesisTaskAPI, the maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not counted as billed characters. - InvalidSampleRateException The specified sample rate is not valid.
- InvalidSsmlException The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try again.
- LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a
lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different
region.
Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- MarksNotSupportedForFormatException Speech marks are not supported for the
OutputFormatselected. Speech marks are only available for content injsonformat. - SsmlMarksNotSupportedForTextTypeException SSML speech marks are not supported for plain text-type input.
- LanguageNotSupportedException The language specified is not currently supported by Amazon Polly in this capacity.
- EngineNotSupportedException This engine is not compatible with the voice that you have designated. Choose a new voice that is compatible with the engine or change the engine and restart the operation.
- ResourceNotFoundException Amazon Polly can't find the specified resource. Verify that the resource exists in the Amazon Web Services account and Region of the request and that its ARN or ID is spelled correctly, and then try again.
- ConflictException The request conflicts with the current state of the resource. For a custom voice,
the voice isn't in the status that the operation requires. Check the status with
GetVoice, and then try again. - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For
the
- See Also:
-
synthesizeSpeech
default <ReturnT> CompletableFuture<ReturnT> synthesizeSpeech(Consumer<SynthesizeSpeechRequest.Builder> synthesizeSpeechRequest, AsyncResponseTransformer<SynthesizeSpeechResponse, ReturnT> asyncResponseTransformer) 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 How it Works.
To use a custom voice, specify its ID in
VoiceId. The voice must be inactivestatus. If the voice is inpendingorfailedstatus, the request fails withConflictException. If no custom voice with the specified ID exists in your account and Region, the request fails withResourceNotFoundException.If the custom voice uses a customer managed key, you need
kms:Decryptpermission on the key. If you disabled the key or scheduled it for deletion, the request fails withValidationException. If you don't have permission to use the key, the request fails withAccessDeniedException. If Amazon Web Services KMS throttles Amazon Polly's request to use the key, the request fails withThrottlingException.
This is a convenience which creates an instance of the
SynthesizeSpeechRequest.Builderavoiding the need to create one manually viaSynthesizeSpeechRequest.builder()- Parameters:
synthesizeSpeechRequest- AConsumerthat will call methods onSynthesizeSpeechRequest.Builderto create a request.asyncResponseTransformer- The response transformer for processing the streaming response in a non-blocking manner. SeeAsyncResponseTransformerfor details on how this callback should be implemented and for links to precanned implementations for common scenarios like downloading to a file. The service documentation for the response content is as follows 'Stream containing the synthesized speech.
'.- Returns:
- A future to the transformed result of the AsyncResponseTransformer.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For
the
SynthesizeSpeechAPI, the limit for input text is a maximum of 6000 characters total, of which no more than 3000 can be billed characters. For theStartSpeechSynthesisTaskAPI, the maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not counted as billed characters. - InvalidSampleRateException The specified sample rate is not valid.
- InvalidSsmlException The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try again.
- LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a
lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different
region.
Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- MarksNotSupportedForFormatException Speech marks are not supported for the
OutputFormatselected. Speech marks are only available for content injsonformat. - SsmlMarksNotSupportedForTextTypeException SSML speech marks are not supported for plain text-type input.
- LanguageNotSupportedException The language specified is not currently supported by Amazon Polly in this capacity.
- EngineNotSupportedException This engine is not compatible with the voice that you have designated. Choose a new voice that is compatible with the engine or change the engine and restart the operation.
- ResourceNotFoundException Amazon Polly can't find the specified resource. Verify that the resource exists in the Amazon Web Services account and Region of the request and that its ARN or ID is spelled correctly, and then try again.
- ConflictException The request conflicts with the current state of the resource. For a custom voice,
the voice isn't in the status that the operation requires. Check the status with
GetVoice, and then try again. - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For
the
- See Also:
-
synthesizeSpeech
default CompletableFuture<SynthesizeSpeechResponse> synthesizeSpeech(SynthesizeSpeechRequest synthesizeSpeechRequest, Path destinationPath) 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 How it Works.
To use a custom voice, specify its ID in
VoiceId. The voice must be inactivestatus. If the voice is inpendingorfailedstatus, the request fails withConflictException. If no custom voice with the specified ID exists in your account and Region, the request fails withResourceNotFoundException.If the custom voice uses a customer managed key, you need
kms:Decryptpermission on the key. If you disabled the key or scheduled it for deletion, the request fails withValidationException. If you don't have permission to use the key, the request fails withAccessDeniedException. If Amazon Web Services KMS throttles Amazon Polly's request to use the key, the request fails withThrottlingException.- Parameters:
synthesizeSpeechRequest-destinationPath-Pathto file that response contents will be written to. The file must not exist or this method will throw an exception. If the file is not writable by the current user then an exception will be thrown. The service documentation for the response content is as follows 'Stream containing the synthesized speech.
'.- Returns:
- A future to the transformed result of the AsyncResponseTransformer.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For
the
SynthesizeSpeechAPI, the limit for input text is a maximum of 6000 characters total, of which no more than 3000 can be billed characters. For theStartSpeechSynthesisTaskAPI, the maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not counted as billed characters. - InvalidSampleRateException The specified sample rate is not valid.
- InvalidSsmlException The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try again.
- LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a
lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different
region.
Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- MarksNotSupportedForFormatException Speech marks are not supported for the
OutputFormatselected. Speech marks are only available for content injsonformat. - SsmlMarksNotSupportedForTextTypeException SSML speech marks are not supported for plain text-type input.
- LanguageNotSupportedException The language specified is not currently supported by Amazon Polly in this capacity.
- EngineNotSupportedException This engine is not compatible with the voice that you have designated. Choose a new voice that is compatible with the engine or change the engine and restart the operation.
- ResourceNotFoundException Amazon Polly can't find the specified resource. Verify that the resource exists in the Amazon Web Services account and Region of the request and that its ARN or ID is spelled correctly, and then try again.
- ConflictException The request conflicts with the current state of the resource. For a custom voice,
the voice isn't in the status that the operation requires. Check the status with
GetVoice, and then try again. - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For
the
- See Also:
-
synthesizeSpeech
default CompletableFuture<SynthesizeSpeechResponse> synthesizeSpeech(Consumer<SynthesizeSpeechRequest.Builder> synthesizeSpeechRequest, Path destinationPath) 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 How it Works.
To use a custom voice, specify its ID in
VoiceId. The voice must be inactivestatus. If the voice is inpendingorfailedstatus, the request fails withConflictException. If no custom voice with the specified ID exists in your account and Region, the request fails withResourceNotFoundException.If the custom voice uses a customer managed key, you need
kms:Decryptpermission on the key. If you disabled the key or scheduled it for deletion, the request fails withValidationException. If you don't have permission to use the key, the request fails withAccessDeniedException. If Amazon Web Services KMS throttles Amazon Polly's request to use the key, the request fails withThrottlingException.
This is a convenience which creates an instance of the
SynthesizeSpeechRequest.Builderavoiding the need to create one manually viaSynthesizeSpeechRequest.builder()- Parameters:
synthesizeSpeechRequest- AConsumerthat will call methods onSynthesizeSpeechRequest.Builderto create a request.destinationPath-Pathto file that response contents will be written to. The file must not exist or this method will throw an exception. If the file is not writable by the current user then an exception will be thrown. The service documentation for the response content is as follows 'Stream containing the synthesized speech.
'.- Returns:
- A future to the transformed result of the AsyncResponseTransformer.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For
the
SynthesizeSpeechAPI, the limit for input text is a maximum of 6000 characters total, of which no more than 3000 can be billed characters. For theStartSpeechSynthesisTaskAPI, the maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not counted as billed characters. - InvalidSampleRateException The specified sample rate is not valid.
- InvalidSsmlException The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try again.
- LexiconNotFoundException Amazon Polly can't find the specified lexicon. This could be caused by a
lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different
region.
Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- MarksNotSupportedForFormatException Speech marks are not supported for the
OutputFormatselected. Speech marks are only available for content injsonformat. - SsmlMarksNotSupportedForTextTypeException SSML speech marks are not supported for plain text-type input.
- LanguageNotSupportedException The language specified is not currently supported by Amazon Polly in this capacity.
- EngineNotSupportedException This engine is not compatible with the voice that you have designated. Choose a new voice that is compatible with the engine or change the engine and restart the operation.
- ResourceNotFoundException Amazon Polly can't find the specified resource. Verify that the resource exists in the Amazon Web Services account and Region of the request and that its ARN or ID is spelled correctly, and then try again.
- ConflictException The request conflicts with the current state of the resource. For a custom voice,
the voice isn't in the status that the operation requires. Check the status with
GetVoice, and then try again. - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For
the
- See Also:
-
tagResource
Adds specified tags to a resource with the specified ARN. Existing tags on a resource are not changed if they are not specified in the request parameters. If you specify a tag key that already exists on the resource, the value in the request replaces the existing value.
- Parameters:
tagResourceRequest-- Returns:
- A Java Future containing the result of the TagResource operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ResourceNotFoundException Amazon Polly can't find the specified resource. Verify that the resource exists in the Amazon Web Services account and Region of the request and that its ARN or ID is spelled correctly, and then try again.
- TooManyTagsException The list of tags on the resource is over the limit. The maximum number of tags that can be applied to a resource is 50. Remove unused tags or reduce the number of tags in the request, and then try again.
- ValidationException The input fails to satisfy the constraints specified by the service.
- InvalidTagParameterException The resource ARN or a tag in the request isn't valid. Specify the ARN of a supported resource in the Amazon Web Services account and Region of the request. Tag keys can have a maximum length of 128 characters, and tag values can have a maximum length of 256 characters. Correct the ARN or the tags, and then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- ThrottlingException The request was denied because of request throttling.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
tagResource
default CompletableFuture<TagResourceResponse> tagResource(Consumer<TagResourceRequest.Builder> tagResourceRequest) Adds specified tags to a resource with the specified ARN. Existing tags on a resource are not changed if they are not specified in the request parameters. If you specify a tag key that already exists on the resource, the value in the request replaces the existing value.
This is a convenience which creates an instance of the
TagResourceRequest.Builderavoiding the need to create one manually viaTagResourceRequest.builder()- Parameters:
tagResourceRequest- AConsumerthat will call methods onTagResourceRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the TagResource operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ResourceNotFoundException Amazon Polly can't find the specified resource. Verify that the resource exists in the Amazon Web Services account and Region of the request and that its ARN or ID is spelled correctly, and then try again.
- TooManyTagsException The list of tags on the resource is over the limit. The maximum number of tags that can be applied to a resource is 50. Remove unused tags or reduce the number of tags in the request, and then try again.
- ValidationException The input fails to satisfy the constraints specified by the service.
- InvalidTagParameterException The resource ARN or a tag in the request isn't valid. Specify the ARN of a supported resource in the Amazon Web Services account and Region of the request. Tag keys can have a maximum length of 128 characters, and tag values can have a maximum length of 256 characters. Correct the ARN or the tags, and then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- ThrottlingException The request was denied because of request throttling.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
untagResource
default CompletableFuture<UntagResourceResponse> untagResource(UntagResourceRequest untagResourceRequest) Deletes specified tags from a resource.
- Parameters:
untagResourceRequest-- Returns:
- A Java Future containing the result of the UntagResource operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ResourceNotFoundException Amazon Polly can't find the specified resource. Verify that the resource exists in the Amazon Web Services account and Region of the request and that its ARN or ID is spelled correctly, and then try again.
- ValidationException The input fails to satisfy the constraints specified by the service.
- InvalidTagParameterException The resource ARN or a tag in the request isn't valid. Specify the ARN of a supported resource in the Amazon Web Services account and Region of the request. Tag keys can have a maximum length of 128 characters, and tag values can have a maximum length of 256 characters. Correct the ARN or the tags, and then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- ThrottlingException The request was denied because of request throttling.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
untagResource
default CompletableFuture<UntagResourceResponse> untagResource(Consumer<UntagResourceRequest.Builder> untagResourceRequest) Deletes specified tags from a resource.
This is a convenience which creates an instance of the
UntagResourceRequest.Builderavoiding the need to create one manually viaUntagResourceRequest.builder()- Parameters:
untagResourceRequest- AConsumerthat will call methods onUntagResourceRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the UntagResource operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ResourceNotFoundException Amazon Polly can't find the specified resource. Verify that the resource exists in the Amazon Web Services account and Region of the request and that its ARN or ID is spelled correctly, and then try again.
- ValidationException The input fails to satisfy the constraints specified by the service.
- InvalidTagParameterException The resource ARN or a tag in the request isn't valid. Specify the ARN of a supported resource in the Amazon Web Services account and Region of the request. Tag keys can have a maximum length of 128 characters, and tag values can have a maximum length of 256 characters. Correct the ARN or the tags, and then try again.
- ServiceFailureException An unknown condition has caused a service failure.
- ThrottlingException The request was denied because of request throttling.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
-
waiter
Create an instance ofPollyAsyncWaiterusing this client.Waiters created via this method are managed by the SDK and resources will be released when the service client is closed.
- Returns:
- an instance of
PollyAsyncWaiter
-
serviceClientConfiguration
Description copied from interface:SdkClientThe SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfiguration- Specified by:
serviceClientConfigurationin interfaceAwsClient- Specified by:
serviceClientConfigurationin interfaceSdkClient- Returns:
- SdkServiceClientConfiguration
-
create
Create aPollyAsyncClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider. -
builder
Create a builder that can be used to configure and create aPollyAsyncClient.
-