Interface PollyAsyncClient

All Superinterfaces:
AutoCloseable, AwsClient, SdkAutoCloseable, SdkClient

@Generated("software.amazon.awssdk:codegen") @SdkPublicApi @ThreadSafe public interface PollyAsyncClient extends AwsClient
Service client for accessing Amazon Polly asynchronously. This can be created using the static 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 Details

  • Method Details

    • createVoice

      default CompletableFuture<CreateVoiceResponse> createVoice(CreateVoiceRequest createVoiceRequest)

      Creates a custom voice from recordings of a speaker and returns it in pending status. Use GetVoice to check the status. When the status is active, you can use the voice ID in SynthesizeSpeech, StartSpeechSynthesisTask, and StartSpeechSynthesisStream .

      The custom-voice-max-count service quota limits the number of custom voices in your account in each Region. If you reach the quota, the request fails with ServiceQuotaExceededException.

      This operation requires permissions to perform the polly:CreateVoice action. You also need s3:GetObject permission on each recording that you specify by S3Url. If you specify a customer managed key, you also need kms:DescribeKey, kms:GenerateDataKey, and kms:Decrypt permissions on the key. If you specify Tags, you also need the polly:TagResource permission.

      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 invoke Throwable.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 pending status. Use GetVoice to check the status. When the status is active, you can use the voice ID in SynthesizeSpeech, StartSpeechSynthesisTask, and StartSpeechSynthesisStream .

      The custom-voice-max-count service quota limits the number of custom voices in your account in each Region. If you reach the quota, the request fails with ServiceQuotaExceededException.

      This operation requires permissions to perform the polly:CreateVoice action. You also need s3:GetObject permission on each recording that you specify by S3Url. If you specify a customer managed key, you also need kms:DescribeKey, kms:GenerateDataKey, and kms:Decrypt permissions on the key. If you specify Tags, you also need the polly:TagResource permission.


      This is a convenience which creates an instance of the CreateVoiceRequest.Builder avoiding the need to create one manually via CreateVoiceRequest.builder()

      Parameters:
      createVoiceRequest - A Consumer that will call methods on CreateVoiceRequest.Builder to 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 invoke Throwable.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 GetLexicon or ListLexicon APIs.

      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 invoke Throwable.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.
      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 GetLexicon or ListLexicon APIs.

      For more information, see Managing Lexicons.


      This is a convenience which creates an instance of the DeleteLexiconRequest.Builder avoiding the need to create one manually via DeleteLexiconRequest.builder()

      Parameters:
      deleteLexiconRequest - A Consumer that will call methods on DeleteLexiconRequest.Builder to 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 invoke Throwable.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.
      See Also:
    • deleteVoice

      default CompletableFuture<DeleteVoiceResponse> deleteVoice(DeleteVoiceRequest deleteVoiceRequest)

      Deletes a custom voice. DescribeVoices and GetVoice stop returning the voice immediately. You can't restore a deleted voice.

      You can delete a voice in active or failed status. If the voice is in pending status, the request fails with ConflictException. If no custom voice with the specified ID exists in your account and Region, the request fails with ResourceNotFoundException. 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:DeleteVoice action.

      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 invoke Throwable.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. DescribeVoices and GetVoice stop returning the voice immediately. You can't restore a deleted voice.

      You can delete a voice in active or failed status. If the voice is in pending status, the request fails with ConflictException. If no custom voice with the specified ID exists in your account and Region, the request fails with ResourceNotFoundException. 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:DeleteVoice action.


      This is a convenience which creates an instance of the DeleteVoiceRequest.Builder avoiding the need to create one manually via DeleteVoiceRequest.builder()

      Parameters:
      deleteVoiceRequest - A Consumer that will call methods on DeleteVoiceRequest.Builder to 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 invoke Throwable.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 by DescribeVoices.

      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 DescribeVoices operation, 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, Origin indicates whether Amazon Polly provides the voice or you created it. You can use a custom voice for synthesis only when its status is active. A voice in failed status stays in the list until you delete it.

      For a custom voice, DescribeVoices returns Origin, Id, Name, Status, LanguageCode, LanguageName, SupportedEngines, and CreationTime. To get Arn, StatusReason, VoiceCreationData, and CustomerManagedEncryption, use GetVoice.

      The LanguageCode and Engine filters apply to custom voices in the same way as to voices that Amazon Polly provides.

      This operation requires permissions to perform the polly:DescribeVoices action.

      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 invoke Throwable.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 by DescribeVoices.

      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 DescribeVoices operation, 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, Origin indicates whether Amazon Polly provides the voice or you created it. You can use a custom voice for synthesis only when its status is active. A voice in failed status stays in the list until you delete it.

      For a custom voice, DescribeVoices returns Origin, Id, Name, Status, LanguageCode, LanguageName, SupportedEngines, and CreationTime. To get Arn, StatusReason, VoiceCreationData, and CustomerManagedEncryption, use GetVoice.

      The LanguageCode and Engine filters apply to custom voices in the same way as to voices that Amazon Polly provides.

      This operation requires permissions to perform the polly:DescribeVoices action.


      This is a convenience which creates an instance of the DescribeVoicesRequest.Builder avoiding the need to create one manually via DescribeVoicesRequest.builder()

      Parameters:
      describeVoicesRequest - A Consumer that will call methods on DescribeVoicesRequest.Builder to 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 invoke Throwable.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()

      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 by DescribeVoices.

      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 DescribeVoices operation, 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, Origin indicates whether Amazon Polly provides the voice or you created it. You can use a custom voice for synthesis only when its status is active. A voice in failed status stays in the list until you delete it.

      For a custom voice, DescribeVoices returns Origin, Id, Name, Status, LanguageCode, LanguageName, SupportedEngines, and CreationTime. To get Arn, StatusReason, VoiceCreationData, and CustomerManagedEncryption, use GetVoice.

      The LanguageCode and Engine filters apply to custom voices in the same way as to voices that Amazon Polly provides.

      This operation requires permissions to perform the polly:DescribeVoices action.

      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 invoke Throwable.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

      default CompletableFuture<GetLexiconResponse> getLexicon(GetLexiconRequest getLexiconRequest)

      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 invoke Throwable.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.
      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.Builder avoiding the need to create one manually via GetLexiconRequest.builder()

      Parameters:
      getLexiconRequest - A Consumer that will call methods on GetLexiconRequest.Builder to 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 invoke Throwable.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.
      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 invoke Throwable.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.Builder avoiding the need to create one manually via GetSpeechSynthesisTaskRequest.builder()

      Parameters:
      getSpeechSynthesisTaskRequest - A Consumer that will call methods on GetSpeechSynthesisTaskRequest.Builder to 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 invoke Throwable.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

      default CompletableFuture<GetVoiceResponse> getVoice(GetVoiceRequest getVoiceRequest)

      Returns the status and properties of a custom voice. Use this operation after CreateVoice to check whether the status of the voice is active or failed. Unlike DescribeVoices, GetVoice also returns Arn, VoiceCreationData, CustomerManagedEncryption, and StatusReason. If no custom voice with the specified ID exists in your account and Region, the request fails with ResourceNotFoundException.

      This operation requires permissions to perform the polly:GetVoice action.

      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 invoke Throwable.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

      Returns the status and properties of a custom voice. Use this operation after CreateVoice to check whether the status of the voice is active or failed. Unlike DescribeVoices, GetVoice also returns Arn, VoiceCreationData, CustomerManagedEncryption, and StatusReason. If no custom voice with the specified ID exists in your account and Region, the request fails with ResourceNotFoundException.

      This operation requires permissions to perform the polly:GetVoice action.


      This is a convenience which creates an instance of the GetVoiceRequest.Builder avoiding the need to create one manually via GetVoiceRequest.builder()

      Parameters:
      getVoiceRequest - A Consumer that will call methods on GetVoiceRequest.Builder to 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 invoke Throwable.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 invoke Throwable.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.Builder avoiding the need to create one manually via ListLexiconsRequest.builder()

      Parameters:
      listLexiconsRequest - A Consumer that will call methods on ListLexiconsRequest.Builder to 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 invoke Throwable.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()

      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 invoke Throwable.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 invoke Throwable.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.Builder avoiding the need to create one manually via ListSpeechSynthesisTasksRequest.builder()

      Parameters:
      listSpeechSynthesisTasksRequest - A Consumer that will call methods on ListSpeechSynthesisTasksRequest.Builder to 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 invoke Throwable.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()

      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 invoke Throwable.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()

      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 new Subscription i.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
       
       software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request);
       CompletableFuture<Void> future = publisher.subscribe(res -> { // Do something with the response });
       future.get();
       
       
      2) Using a custom subscriber
       
       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) { //... };
       });
       
      As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.

      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 invoke Throwable.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 new Subscription i.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
       
       software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request);
       CompletableFuture<Void> future = publisher.subscribe(res -> { // Do something with the response });
       future.get();
       
       
      2) Using a custom subscriber
       
       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) { //... };
       });
       
      As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.

      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 invoke Throwable.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 new Subscription i.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
       
       software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request);
       CompletableFuture<Void> future = publisher.subscribe(res -> { // Do something with the response });
       future.get();
       
       
      2) Using a custom subscriber
       
       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) { //... };
       });
       
      As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.

      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.Builder avoiding the need to create one manually via ListSpeechSynthesisTasksRequest.builder()

      Parameters:
      listSpeechSynthesisTasksRequest - A Consumer that will call methods on ListSpeechSynthesisTasksRequest.Builder to 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 invoke Throwable.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 invoke Throwable.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.Builder avoiding the need to create one manually via ListTagsForResourceRequest.builder()

      Parameters:
      listTagsForResourceRequest - A Consumer that will call methods on ListTagsForResourceRequest.Builder to 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 invoke Throwable.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

      default CompletableFuture<PutLexiconResponse> putLexicon(PutLexiconRequest 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, use TagResource and UntagResource.

      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 invoke Throwable.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, and x-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, use TagResource and UntagResource.

      For more information, see Managing Lexicons.


      This is a convenience which creates an instance of the PutLexiconRequest.Builder avoiding the need to create one manually via PutLexiconRequest.builder()

      Parameters:
      putLexiconRequest - A Consumer that will call methods on PutLexiconRequest.Builder to 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 invoke Throwable.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, and x-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 in active status. If the voice is in pending or failed status, the request fails with ConflictException. If no custom voice with the specified ID exists in your account and Region, the request fails with ResourceNotFoundException. If the custom voice uses a customer managed key, you need kms:Decrypt permission on the key. If you disabled the key or scheduled it for deletion, the request fails with ValidationException. If you don't have permission to use the key, the request fails with AccessDeniedException. If Amazon Web Services KMS throttles Amazon Polly's request to use the key, the request fails with ThrottlingException.

      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 invoke Throwable.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 in active status. If the voice is in pending or failed status, the request fails with ConflictException. If no custom voice with the specified ID exists in your account and Region, the request fails with ResourceNotFoundException. If the custom voice uses a customer managed key, you need kms:Decrypt permission on the key. If you disabled the key or scheduled it for deletion, the request fails with ValidationException. If you don't have permission to use the key, the request fails with AccessDeniedException. If Amazon Web Services KMS throttles Amazon Polly's request to use the key, the request fails with ThrottlingException.


      This is a convenience which creates an instance of the StartSpeechSynthesisStreamRequest.Builder avoiding the need to create one manually via StartSpeechSynthesisStreamRequest.builder()

      Parameters:
      startSpeechSynthesisStreamRequest - A Consumer that will call methods on StartSpeechSynthesisStreamRequest.Builder to 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 invoke Throwable.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 (OutputS3KeyPrefix and SnsTopicArn). After Amazon Polly creates the synthesis task, the operation returns a SpeechSynthesisTask object that includes an identifier for the task and its current status. The SpeechSynthesisTask object 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 in active status. If the voice is in pending or failed status, the request fails with ConflictException. If no custom voice with the specified ID exists in your account and Region, the request fails with ResourceNotFoundException. If the custom voice uses a customer managed key, you need kms:Decrypt permission on the key. If you disable the key or schedule it for deletion before the task runs, the task fails and TaskStatusReason describes 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 invoke Throwable.getCause() to retrieve the underlying exception.
      • TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For the SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, 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 OutputFormat selected. Speech marks are only available for content in json format.
      • 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.
      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 (OutputS3KeyPrefix and SnsTopicArn). After Amazon Polly creates the synthesis task, the operation returns a SpeechSynthesisTask object that includes an identifier for the task and its current status. The SpeechSynthesisTask object 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 in active status. If the voice is in pending or failed status, the request fails with ConflictException. If no custom voice with the specified ID exists in your account and Region, the request fails with ResourceNotFoundException. If the custom voice uses a customer managed key, you need kms:Decrypt permission on the key. If you disable the key or schedule it for deletion before the task runs, the task fails and TaskStatusReason describes the cause.


      This is a convenience which creates an instance of the StartSpeechSynthesisTaskRequest.Builder avoiding the need to create one manually via StartSpeechSynthesisTaskRequest.builder()

      Parameters:
      startSpeechSynthesisTaskRequest - A Consumer that will call methods on StartSpeechSynthesisTaskRequest.Builder to 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 invoke Throwable.getCause() to retrieve the underlying exception.
      • TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For the SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, 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 OutputFormat selected. Speech marks are only available for content in json format.
      • 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.
      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 in active status. If the voice is in pending or failed status, the request fails with ConflictException. If no custom voice with the specified ID exists in your account and Region, the request fails with ResourceNotFoundException.

      If the custom voice uses a customer managed key, you need kms:Decrypt permission on the key. If you disabled the key or scheduled it for deletion, the request fails with ValidationException. If you don't have permission to use the key, the request fails with AccessDeniedException. If Amazon Web Services KMS throttles Amazon Polly's request to use the key, the request fails with ThrottlingException.

      Parameters:
      synthesizeSpeechRequest -
      asyncResponseTransformer - The response transformer for processing the streaming response in a non-blocking manner. See AsyncResponseTransformer for 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 invoke Throwable.getCause() to retrieve the underlying exception.
      • TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For the SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, 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 OutputFormat selected. Speech marks are only available for content in json format.
      • 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.
      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 in active status. If the voice is in pending or failed status, the request fails with ConflictException. If no custom voice with the specified ID exists in your account and Region, the request fails with ResourceNotFoundException.

      If the custom voice uses a customer managed key, you need kms:Decrypt permission on the key. If you disabled the key or scheduled it for deletion, the request fails with ValidationException. If you don't have permission to use the key, the request fails with AccessDeniedException. If Amazon Web Services KMS throttles Amazon Polly's request to use the key, the request fails with ThrottlingException.


      This is a convenience which creates an instance of the SynthesizeSpeechRequest.Builder avoiding the need to create one manually via SynthesizeSpeechRequest.builder()

      Parameters:
      synthesizeSpeechRequest - A Consumer that will call methods on SynthesizeSpeechRequest.Builder to create a request.
      asyncResponseTransformer - The response transformer for processing the streaming response in a non-blocking manner. See AsyncResponseTransformer for 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 invoke Throwable.getCause() to retrieve the underlying exception.
      • TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For the SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, 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 OutputFormat selected. Speech marks are only available for content in json format.
      • 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.
      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 in active status. If the voice is in pending or failed status, the request fails with ConflictException. If no custom voice with the specified ID exists in your account and Region, the request fails with ResourceNotFoundException.

      If the custom voice uses a customer managed key, you need kms:Decrypt permission on the key. If you disabled the key or scheduled it for deletion, the request fails with ValidationException. If you don't have permission to use the key, the request fails with AccessDeniedException. If Amazon Web Services KMS throttles Amazon Polly's request to use the key, the request fails with ThrottlingException.

      Parameters:
      synthesizeSpeechRequest -
      destinationPath - Path to 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 invoke Throwable.getCause() to retrieve the underlying exception.
      • TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For the SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, 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 OutputFormat selected. Speech marks are only available for content in json format.
      • 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.
      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 in active status. If the voice is in pending or failed status, the request fails with ConflictException. If no custom voice with the specified ID exists in your account and Region, the request fails with ResourceNotFoundException.

      If the custom voice uses a customer managed key, you need kms:Decrypt permission on the key. If you disabled the key or scheduled it for deletion, the request fails with ValidationException. If you don't have permission to use the key, the request fails with AccessDeniedException. If Amazon Web Services KMS throttles Amazon Polly's request to use the key, the request fails with ThrottlingException.


      This is a convenience which creates an instance of the SynthesizeSpeechRequest.Builder avoiding the need to create one manually via SynthesizeSpeechRequest.builder()

      Parameters:
      synthesizeSpeechRequest - A Consumer that will call methods on SynthesizeSpeechRequest.Builder to create a request.
      destinationPath - Path to 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 invoke Throwable.getCause() to retrieve the underlying exception.
      • TextLengthExceededException The value of the "Text" parameter is longer than the accepted limits. For the SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, 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 OutputFormat selected. Speech marks are only available for content in json format.
      • 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.
      See Also:
    • tagResource

      default CompletableFuture<TagResourceResponse> tagResource(TagResourceRequest 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.

      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 invoke Throwable.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.Builder avoiding the need to create one manually via TagResourceRequest.builder()

      Parameters:
      tagResourceRequest - A Consumer that will call methods on TagResourceRequest.Builder to 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 invoke Throwable.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 invoke Throwable.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.Builder avoiding the need to create one manually via UntagResourceRequest.builder()

      Parameters:
      untagResourceRequest - A Consumer that will call methods on UntagResourceRequest.Builder to 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 invoke Throwable.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

      default PollyAsyncWaiter waiter()
      Create an instance of PollyAsyncWaiter using 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

      default PollyServiceClientConfiguration serviceClientConfiguration()
      Description copied from interface: SdkClient
      The SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfiguration
      Specified by:
      serviceClientConfiguration in interface AwsClient
      Specified by:
      serviceClientConfiguration in interface SdkClient
      Returns:
      SdkServiceClientConfiguration
    • create

      static PollyAsyncClient create()
      Create a PollyAsyncClient with the region loaded from the DefaultAwsRegionProviderChain and credentials loaded from the DefaultCredentialsProvider.
    • builder

      static PollyAsyncClientBuilder builder()
      Create a builder that can be used to configure and create a PollyAsyncClient.