Skip to content

delete_lexicon async

delete_lexicon(
    name: LexiconName, *, config_overrides: Optional[AsyncPollyClientConfig] = None
) -> DeleteLexiconOutput

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:

  • name (LexiconName) –

    The name of the lexicon to delete. Must be an existing lexicon in the region.

Raises:

  • 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.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

To delete a lexicon Deletes a specified pronunciation lexicon stored in an AWS Region.

>>> await client.delete_lexicon(name='example')
Source code in docs_src/capo_polly/_services/async_polly.py
async def delete_lexicon(
    self,
    name: "capo_polly.types.lexicon_name.LexiconName",
    *,
    config_overrides: Optional[AsyncPollyClientConfig] = None,
) -> "capo_polly.types.delete_lexicon_output.DeleteLexiconOutput":
    """<p>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 <code>GetLexicon</code> or <code>ListLexicon</code> APIs.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/polly/latest/dg/managing-lexicons.html">Managing Lexicons</a>.</p>

    Args:
        name: <p>The name of the lexicon to delete. Must be an existing lexicon in the region.</p>

    Raises:
        capo_polly.errors.lexicon_not_found_exception.LexiconNotFoundException: <p>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.</p> <p>Verify that the lexicon exists, is in the region (see <a>ListLexicons</a>) and that you spelled its name is spelled correctly. Then try again.</p>
        capo_polly.errors.service_failure_exception.ServiceFailureException: <p>An unknown condition has caused a service failure.</p>
        capo_polly.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To delete a lexicon
        Deletes a specified pronunciation lexicon stored in an AWS Region.

        >>> await client.delete_lexicon(name='example')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_polly.types.delete_lexicon_input.DeleteLexiconInput]",
    ) -> AsyncOperationResponse[
        "capo_polly.types.delete_lexicon_output.DeleteLexiconOutput"
    ]:
        import capo_polly._operations.parrot_v1.delete_lexicon

        (
            output,
            http_response,
        ) = await capo_polly._operations.parrot_v1.delete_lexicon.async_delete_lexicon(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteLexicon")
    )
    input_: capo_polly.types.delete_lexicon_input.DeleteLexiconInput = {
        "name": name
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output