/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.polly; import org.w3c.dom.*; import java.net.*; import java.util.*; import javax.annotation.Generated; import org.apache.commons.logging.*; import com.amazonaws.*; import com.amazonaws.annotation.SdkInternalApi; import com.amazonaws.auth.*; import com.amazonaws.auth.presign.PresignerParams; import com.amazonaws.handlers.*; import com.amazonaws.http.*; import com.amazonaws.internal.*; import com.amazonaws.internal.auth.*; import com.amazonaws.metrics.*; import com.amazonaws.regions.*; import com.amazonaws.transform.*; import com.amazonaws.util.*; import com.amazonaws.protocol.json.*; import com.amazonaws.util.AWSRequestMetrics.Field; import com.amazonaws.annotation.ThreadSafe; import com.amazonaws.client.AwsSyncClientParams; import com.amazonaws.client.builder.AdvancedConfig; import com.amazonaws.services.polly.AmazonPollyClientBuilder; import com.amazonaws.AmazonServiceException; import com.amazonaws.services.polly.model.*; import com.amazonaws.services.polly.model.transform.*; /** * Client for accessing Amazon Polly. All service calls made using this client are blocking, and will not return until * the service call completes. *
*
* 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. *
*/ @ThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AmazonPollyClient extends AmazonWebServiceClient implements AmazonPolly { /** Provider for AWS credentials. */ private final AWSCredentialsProvider awsCredentialsProvider; private static final Log log = LogFactory.getLog(AmazonPolly.class); /** Default signing name for the service. */ private static final String DEFAULT_SIGNING_NAME = "polly"; /** Client configuration factory providing ClientConfigurations tailored to this client */ protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory(); private final AdvancedConfig advancedConfig; private static final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory = new com.amazonaws.protocol.json.SdkJsonProtocolFactory( new JsonClientMetadata() .withProtocolVersion("1.1") .withSupportsCbor(false) .withSupportsIon(false) .withContentTypeOverride("application/json") .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InvalidS3BucketException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.InvalidS3BucketExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InvalidSampleRateException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.InvalidSampleRateExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("SynthesisTaskNotFoundException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.SynthesisTaskNotFoundExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("MaxLexiconsNumberExceededException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.MaxLexiconsNumberExceededExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("MaxLexemeLengthExceededException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.MaxLexemeLengthExceededExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("UnsupportedPlsAlphabetException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.UnsupportedPlsAlphabetExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("LanguageNotSupportedException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.LanguageNotSupportedExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("TextLengthExceededException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.TextLengthExceededExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InvalidLexiconException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.InvalidLexiconExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("SsmlMarksNotSupportedForTextTypeException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.SsmlMarksNotSupportedForTextTypeExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InvalidS3KeyException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.InvalidS3KeyExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InvalidSnsTopicArnException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.InvalidSnsTopicArnExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("MarksNotSupportedForFormatException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.MarksNotSupportedForFormatExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InvalidTaskIdException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.InvalidTaskIdExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("UnsupportedPlsLanguageException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.UnsupportedPlsLanguageExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("LexiconNotFoundException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.LexiconNotFoundExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("LexiconSizeExceededException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.LexiconSizeExceededExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InvalidSsmlException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.InvalidSsmlExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InvalidNextTokenException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.InvalidNextTokenExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("EngineNotSupportedException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.EngineNotSupportedExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ServiceFailureException").withExceptionUnmarshaller( com.amazonaws.services.polly.model.transform.ServiceFailureExceptionUnmarshaller.getInstance())) .withBaseServiceExceptionClass(com.amazonaws.services.polly.model.AmazonPollyException.class)); /** * Constructs a new client to invoke service methods on Amazon Polly. A credentials provider chain will be used that * searches for credentials in this order: ** All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @see DefaultAWSCredentialsProviderChain * @deprecated use {@link AmazonPollyClientBuilder#defaultClient()} */ @Deprecated public AmazonPollyClient() { this(DefaultAWSCredentialsProviderChain.getInstance(), configFactory.getConfig()); } /** * Constructs a new client to invoke service methods on Amazon Polly. A credentials provider chain will be used that * searches for credentials in this order: *
* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param clientConfiguration * The client configuration options controlling how this client connects to Amazon Polly (ex: proxy settings, * retry counts, etc.). * * @see DefaultAWSCredentialsProviderChain * @deprecated use {@link AmazonPollyClientBuilder#withClientConfiguration(ClientConfiguration)} */ @Deprecated public AmazonPollyClient(ClientConfiguration clientConfiguration) { this(DefaultAWSCredentialsProviderChain.getInstance(), clientConfiguration); } /** * Constructs a new client to invoke service methods on Amazon Polly using the specified AWS account credentials. * *
* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param awsCredentials * The AWS credentials (access key ID and secret key) to use when authenticating with AWS services. * @deprecated use {@link AmazonPollyClientBuilder#withCredentials(AWSCredentialsProvider)} for example: * {@code AmazonPollyClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(awsCredentials)).build();} */ @Deprecated public AmazonPollyClient(AWSCredentials awsCredentials) { this(awsCredentials, configFactory.getConfig()); } /** * Constructs a new client to invoke service methods on Amazon Polly using the specified AWS account credentials and * client configuration options. * *
* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param awsCredentials * The AWS credentials (access key ID and secret key) to use when authenticating with AWS services. * @param clientConfiguration * The client configuration options controlling how this client connects to Amazon Polly (ex: proxy settings, * retry counts, etc.). * @deprecated use {@link AmazonPollyClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonPollyClientBuilder#withClientConfiguration(ClientConfiguration)} */ @Deprecated public AmazonPollyClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration) { super(clientConfiguration); this.awsCredentialsProvider = new StaticCredentialsProvider(awsCredentials); this.advancedConfig = AdvancedConfig.EMPTY; init(); } /** * Constructs a new client to invoke service methods on Amazon Polly using the specified AWS account credentials * provider. * *
* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param awsCredentialsProvider * The AWS credentials provider which will provide credentials to authenticate requests with AWS services. * @deprecated use {@link AmazonPollyClientBuilder#withCredentials(AWSCredentialsProvider)} */ @Deprecated public AmazonPollyClient(AWSCredentialsProvider awsCredentialsProvider) { this(awsCredentialsProvider, configFactory.getConfig()); } /** * Constructs a new client to invoke service methods on Amazon Polly using the specified AWS account credentials * provider and client configuration options. * *
* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param awsCredentialsProvider * The AWS credentials provider which will provide credentials to authenticate requests with AWS services. * @param clientConfiguration * The client configuration options controlling how this client connects to Amazon Polly (ex: proxy settings, * retry counts, etc.). * @deprecated use {@link AmazonPollyClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonPollyClientBuilder#withClientConfiguration(ClientConfiguration)} */ @Deprecated public AmazonPollyClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) { this(awsCredentialsProvider, clientConfiguration, null); } /** * Constructs a new client to invoke service methods on Amazon Polly using the specified AWS account credentials * provider, client configuration options, and request metric collector. * *
* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param awsCredentialsProvider * The AWS credentials provider which will provide credentials to authenticate requests with AWS services. * @param clientConfiguration * The client configuration options controlling how this client connects to Amazon Polly (ex: proxy settings, * retry counts, etc.). * @param requestMetricCollector * optional request metric collector * @deprecated use {@link AmazonPollyClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonPollyClientBuilder#withClientConfiguration(ClientConfiguration)} and * {@link AmazonPollyClientBuilder#withMetricsCollector(RequestMetricCollector)} */ @Deprecated public AmazonPollyClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, RequestMetricCollector requestMetricCollector) { super(clientConfiguration, requestMetricCollector); this.awsCredentialsProvider = awsCredentialsProvider; this.advancedConfig = AdvancedConfig.EMPTY; init(); } public static AmazonPollyClientBuilder builder() { return AmazonPollyClientBuilder.standard(); } /** * Constructs a new client to invoke service methods on Amazon Polly using the specified parameters. * *
* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param clientParams * Object providing client parameters. */ AmazonPollyClient(AwsSyncClientParams clientParams) { this(clientParams, false); } /** * Constructs a new client to invoke service methods on Amazon Polly using the specified parameters. * *
* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param clientParams * Object providing client parameters. */ AmazonPollyClient(AwsSyncClientParams clientParams, boolean endpointDiscoveryEnabled) { super(clientParams); this.awsCredentialsProvider = clientParams.getCredentialsProvider(); this.advancedConfig = clientParams.getAdvancedConfig(); init(); } private void init() { setServiceNameIntern(DEFAULT_SIGNING_NAME); setEndpointPrefix(ENDPOINT_PREFIX); // calling this.setEndPoint(...) will also modify the signer accordingly setEndpoint("polly.us-east-1.amazonaws.com"); HandlerChainFactory chainFactory = new HandlerChainFactory(); requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/polly/request.handlers")); requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/polly/request.handler2s")); requestHandler2s.addAll(chainFactory.getGlobalHandlers()); } /** *
* 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. *
* * @param deleteLexiconRequest * @return Result of the DeleteLexicon operation returned by the service. * @throws 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.
* @throws ServiceFailureException
* An unknown condition has caused a service failure.
* @sample AmazonPolly.DeleteLexicon
* @see AWS API
* Documentation
*/
@Override
public DeleteLexiconResult deleteLexicon(DeleteLexiconRequest request) {
request = beforeClientExecution(request);
return executeDeleteLexicon(request);
}
@SdkInternalApi
final DeleteLexiconResult executeDeleteLexicon(DeleteLexiconRequest deleteLexiconRequest) {
ExecutionContext executionContext = createExecutionContext(deleteLexiconRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request
* Returns the list of voices that are available for use when requesting speech synthesis. Each voice speaks a
* specified language, is either male or female, and is identified by an ID, which is the ASCII version of the voice
* name.
*
* When synthesizing speech (
* For example, you want your news reader application to read news in a specific language, but giving a user the
* option to choose the voice. Using the
* You can optionally specify a language code to filter the available voices. For example, if you specify
*
* This operation requires permissions to perform the
* Returns the content of the specified pronunciation lexicon stored in an Amazon Web Services Region. For more
* information, see Managing
* Lexicons.
* SynthesizeSpeech
), you provide the voice ID for the voice you want from
* the list of voices returned by DescribeVoices
.
* DescribeVoices
operation you can provide the user with a list
* of available voices to select from.
* en-US
, the operation returns a list of all available US English voices.
* polly:DescribeVoices
action.
*
* Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name
* is spelled correctly. Then try again.
* @throws ServiceFailureException
* An unknown condition has caused a service failure.
* @sample AmazonPolly.GetLexicon
* @see AWS API
* Documentation
*/
@Override
public GetLexiconResult getLexicon(GetLexiconRequest request) {
request = beforeClientExecution(request);
return executeGetLexicon(request);
}
@SdkInternalApi
final GetLexiconResult executeGetLexicon(GetLexiconRequest getLexiconRequest) {
ExecutionContext executionContext = createExecutionContext(getLexiconRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request
* 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.
*
* Returns a list of pronunciation lexicons stored in an Amazon Web Services Region. For more information, see Managing Lexicons.
*
* 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.
*
* 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.
*
* For more information, see Managing
* Lexicons.
*
* Allows the creation of an asynchronous synthesis task, by starting a new x-sampa
* and ipa
.
* @throws UnsupportedPlsLanguageException
* The language specified in the lexicon is unsupported. For a list of supported languages, see Lexicon Attributes.
* @throws LexiconSizeExceededException
* The maximum size of the specified lexicon would be exceeded by this operation.
* @throws MaxLexemeLengthExceededException
* The maximum size of the lexeme would be exceeded by this operation.
* @throws MaxLexiconsNumberExceededException
* The maximum number of lexicons would be exceeded by this operation.
* @throws ServiceFailureException
* An unknown condition has caused a service failure.
* @sample AmazonPolly.PutLexicon
* @see AWS API
* Documentation
*/
@Override
public PutLexiconResult putLexicon(PutLexiconRequest request) {
request = beforeClientExecution(request);
return executePutLexicon(request);
}
@SdkInternalApi
final PutLexiconResult executePutLexicon(PutLexiconRequest putLexiconRequest) {
ExecutionContext executionContext = createExecutionContext(putLexiconRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
RequestSpeechSynthesisTask
. 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
). Once the synthesis task is created, this operation
* will return a SpeechSynthesisTask
object, which will include an identifier of this task as well as
* the current status. The SpeechSynthesisTask
object is available for 72 hours after starting the
* asynchronous synthesis task.
* 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.
* @throws InvalidS3BucketException
* The provided Amazon S3 bucket name is invalid. Please check your input with S3 bucket naming requirements
* and try again.
* @throws InvalidS3KeyException
* The provided Amazon S3 key prefix is invalid. Please provide a valid S3 object key name.
* @throws InvalidSampleRateException
* The specified sample rate is not valid.
* @throws InvalidSnsTopicArnException
* The provided SNS topic ARN is invalid. Please provide a valid SNS topic ARN and try again.
* @throws InvalidSsmlException
* The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try
* again.
* @throws 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.
* @throws 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.
* @throws ServiceFailureException
* An unknown condition has caused a service failure.
* @throws MarksNotSupportedForFormatException
* Speech marks are not supported for the
* 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.
* OutputFormat
selected. Speech marks are only
* available for content in json
format.
* @throws SsmlMarksNotSupportedForTextTypeException
* SSML speech marks are not supported for plain text-type input.
* @throws LanguageNotSupportedException
* The language specified is not currently supported by Amazon Polly in this capacity.
* @sample AmazonPolly.StartSpeechSynthesisTask
* @see AWS
* API Documentation
*/
@Override
public StartSpeechSynthesisTaskResult startSpeechSynthesisTask(StartSpeechSynthesisTaskRequest request) {
request = beforeClientExecution(request);
return executeStartSpeechSynthesisTask(request);
}
@SdkInternalApi
final StartSpeechSynthesisTaskResult executeStartSpeechSynthesisTask(StartSpeechSynthesisTaskRequest startSpeechSynthesisTaskRequest) {
ExecutionContext executionContext = createExecutionContext(startSpeechSynthesisTaskRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
RequestSynthesizeSpeech
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.
* @throws InvalidSampleRateException
* The specified sample rate is not valid.
* @throws InvalidSsmlException
* The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try
* again.
* @throws 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.
* @throws ServiceFailureException
* An unknown condition has caused a service failure.
* @throws MarksNotSupportedForFormatException
* Speech marks are not supported for the
* Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic
* information for an executed request, you should use this method to retrieve it as soon as possible after
* executing the request.
*
* @param request
* The originally executed request
*
* @return The response metadata for the specified request, or null if none is available.
*/
public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) {
return client.getResponseMetadataForRequest(request);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private OutputFormat
selected. Speech marks are only
* available for content in json
format.
* @throws SsmlMarksNotSupportedForTextTypeException
* SSML speech marks are not supported for plain text-type input.
* @throws LanguageNotSupportedException
* The language specified is not currently supported by Amazon Polly in this capacity.
* @throws 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.
* @sample AmazonPolly.SynthesizeSpeech
* @see AWS API
* Documentation
*/
@Override
public SynthesizeSpeechResult synthesizeSpeech(SynthesizeSpeechRequest request) {
request = beforeClientExecution(request);
return executeSynthesizeSpeech(request);
}
@SdkInternalApi
final SynthesizeSpeechResult executeSynthesizeSpeech(SynthesizeSpeechRequest synthesizeSpeechRequest) {
ExecutionContext executionContext = createExecutionContext(synthesizeSpeechRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request