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:
-
voice_id
(CustomVoiceId)
–
The ID of the custom voice that CreateVoice returned, for example, vc-9a8fa85dd3. You can't specify the ARN of the voice.
Raises:
-
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.
-
ServiceFailureException
–
An unknown condition has caused a service failure.
-
ThrottlingException
–
The request was denied because of request throttling.
-
ValidationException
–
The input fails to satisfy the constraints specified by the service.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_polly/_services/polly.py
| def get_voice(
self,
voice_id: "capo_polly.types.custom_voice_id.CustomVoiceId",
*,
config_overrides: Optional[PollyClientConfig] = None,
) -> "capo_polly.types.get_voice_output.GetVoiceOutput":
"""<p>Returns the status and properties of a custom voice. Use this operation after <code>CreateVoice</code> to check whether the status of the voice is <code>active</code> or <code>failed</code>. Unlike <code>DescribeVoices</code>, <code>GetVoice</code> also returns <code>Arn</code>, <code>VoiceCreationData</code>, <code>CustomerManagedEncryption</code>, and <code>StatusReason</code>. If no custom voice with the specified ID exists in your account and Region, the request fails with <code>ResourceNotFoundException</code>.</p> <p>This operation requires permissions to perform the <code>polly:GetVoice</code> action.</p>
Args:
voice_id: <p>The ID of the custom voice that <code>CreateVoice</code> returned, for example, <code>vc-9a8fa85dd3</code>. You can't specify the ARN of the voice.</p>
Raises:
capo_polly.errors.resource_not_found_exception.ResourceNotFoundException: <p>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.</p>
capo_polly.errors.service_failure_exception.ServiceFailureException: <p>An unknown condition has caused a service failure.</p>
capo_polly.errors.throttling_exception.ThrottlingException: <p>The request was denied because of request throttling.</p>
capo_polly.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the service.</p>
capo_polly.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_polly.types.get_voice_input.GetVoiceInput]",
) -> OperationResponse["capo_polly.types.get_voice_output.GetVoiceOutput"]:
import capo_polly._operations.parrot_v1.get_voice
output, http_response = (
capo_polly._operations.parrot_v1.get_voice.get_voice(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_output(
output: "capo_polly.types.get_voice_output.GetVoiceOutput",
) -> dict[str, Any]:
import capo_polly.types.get_voice_output
return capo_polly.types.get_voice_output.redact_sensitive(output)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("GetVoice", redact_output=_redact_output)
)
input_: capo_polly.types.get_voice_input.GetVoiceInput = {"voice_id": voice_id}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|