Skip to content

delete_ontology async

delete_ontology(
    ontology_id: OntologyIdentifier,
    *,
    config_overrides: Optional[AsyncContextClientConfig] = None,
) -> DeleteOntologyResponse

Deletes an ontology that you own and all of its versions. You can't delete an AWS managed ontology. While an agent context maps the ontology, the request fails with ConflictException. Remove the ontology from the agent context's connection mappings with UpdateAgentContext first. If an agent context mapped the ontology in the last 5 minutes, the request also fails with ConflictException, and you can retry later. A DRAFT ontology that an induction created is deleted together with its induction. Deleting an ontology that is already deleted succeeds. AWS Context never reuses the ID of a deleted ontology.

Parameters:

  • ontology_id (OntologyIdentifier) –

    The ontology to delete, by its ID or ARN. ListOntologies and GetOntology return its ARN.

Raises:

  • AccessDeniedException –

    You don't have sufficient access to perform this operation. Verify that you have permission to perform the operation on the resource.

  • InternalServerException –

    The request failed because of an internal error. Retry the request.

  • ThrottlingException –

    The request was denied because it exceeded a request rate quota. Wait, then retry the request.

  • ValidationException –

    The input fails to satisfy the constraints of the operation. Correct the input before you retry the request.

  • ConflictException –

    The request conflicts with the current state of the resource. Check the resource's current state before you retry the request.

  • ResourceNotFoundException –

    The specified resource was not found. Check that the ID is correct and that the resource exists in your account and Region.

  • UnknownServiceError –

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

Examples:

Delete an ontology The following example deletes an ontology and all of its versions.

>>> await client.delete_ontology(ontology_id='ont-7d3e9a1c5b2f4e8a9c0d1e2f3a4b5c6d')
Delete an ontology that an agent context maps, which fails with ConflictException
The following example fails with ConflictException because an agent context still maps the ontology; remove the ontology from the agent context's connection mappings with UpdateAgentContext, then retry.
>>> await client.delete_ontology(ontology_id='ont-7d3e9a1c5b2f4e8a9c0d1e2f3a4b5c6d')
Source code in docs_src/capo_context/_services/async_context.py
async def delete_ontology(
    self,
    ontology_id: "capo_context.types.ontology_identifier.OntologyIdentifier",
    *,
    config_overrides: Optional[AsyncContextClientConfig] = None,
) -> "capo_context.types.delete_ontology_response.DeleteOntologyResponse":
    """<p>Deletes an ontology that you own and all of its versions. You can't delete an AWS managed ontology. While an agent context maps the ontology, the request fails with <code>ConflictException</code>. Remove the ontology from the agent context's connection mappings with UpdateAgentContext first. If an agent context mapped the ontology in the last 5 minutes, the request also fails with <code>ConflictException</code>, and you can retry later. A <code>DRAFT</code> ontology that an induction created is deleted together with its induction. Deleting an ontology that is already deleted succeeds. AWS Context never reuses the ID of a deleted ontology.</p>

    Args:
        ontology_id: <p>The ontology to delete, by its ID or ARN. ListOntologies and GetOntology return its ARN.</p>

    Raises:
        capo_context.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this operation. Verify that you have permission to perform the operation on the resource.</p>
        capo_context.errors.internal_server_exception.InternalServerException: <p>The request failed because of an internal error. Retry the request.</p>
        capo_context.errors.throttling_exception.ThrottlingException: <p>The request was denied because it exceeded a request rate quota. Wait, then retry the request.</p>
        capo_context.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints of the operation. Correct the input before you retry the request.</p>
        capo_context.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource. Check the resource's current state before you retry the request.</p>
        capo_context.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found. Check that the ID is correct and that the resource exists in your account and Region.</p>
        capo_context.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Delete an ontology
        The following example deletes an ontology and all of its versions.

        >>> await client.delete_ontology(ontology_id='ont-7d3e9a1c5b2f4e8a9c0d1e2f3a4b5c6d')
        Delete an ontology that an agent context maps, which fails with ConflictException
        The following example fails with ConflictException because an agent context still maps the ontology; remove the ontology from the agent context's connection mappings with UpdateAgentContext, then retry.

        >>> await client.delete_ontology(ontology_id='ont-7d3e9a1c5b2f4e8a9c0d1e2f3a4b5c6d')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_context.types.delete_ontology_request.DeleteOntologyRequest]",
    ) -> AsyncOperationResponse[
        "capo_context.types.delete_ontology_response.DeleteOntologyResponse"
    ]:
        import capo_context._operations.context.delete_ontology

        (
            output,
            http_response,
        ) = await capo_context._operations.context.delete_ontology.async_delete_ontology(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteOntology")
    )
    input_: capo_context.types.delete_ontology_request.DeleteOntologyRequest = {
        "ontology_id": ontology_id
    }

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