Skip to content

delete_collection async

delete_collection(
    collection_id: CollectionId,
    *,
    config_overrides: Optional[AsyncRekognitionClientConfig] = None,
) -> DeleteCollectionResponse

Deletes the specified collection. Note that this operation removes all faces in the collection. For an example, see Deleting a collection.

This operation requires permissions to perform the rekognition:DeleteCollection action.

Parameters:

  • collection_id (CollectionId) –

    ID of the collection to delete.

Raises:

Examples:

To delete a collection This operation deletes a Rekognition collection.

>>> await client.delete_collection(collection_id='myphotos')
Source code in docs_src/capo_rekognition/_services/async_rekognition.py
async def delete_collection(
    self,
    collection_id: "capo_rekognition.types.collection_id.CollectionId",
    *,
    config_overrides: Optional[AsyncRekognitionClientConfig] = None,
) -> "capo_rekognition.types.delete_collection_response.DeleteCollectionResponse":
    """<p>Deletes the specified collection. Note that this operation removes all faces in the collection. For an example, see <a href="https://docs.aws.amazon.com/rekognition/latest/dg/delete-collection-procedure.html">Deleting a collection</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:DeleteCollection</code> action.</p>

    Args:
        collection_id: <p>ID of the collection to delete.</p>

    Raises:
        capo_rekognition.errors.access_denied_exception.AccessDeniedException: <p>You are not authorized to perform the action.</p>
        capo_rekognition.errors.internal_server_error.InternalServerError: <p>Amazon Rekognition experienced a service issue. Try your call again.</p>
        capo_rekognition.errors.invalid_parameter_exception.InvalidParameterException: <p>Input parameter violated a constraint. Validate your parameter before calling the API operation again.</p>
        capo_rekognition.errors.provisioned_throughput_exceeded_exception.ProvisionedThroughputExceededException: <p>The number of requests exceeded your throughput limit. If you want to increase this limit, contact Amazon Rekognition.</p>
        capo_rekognition.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request cannot be found.</p>
        capo_rekognition.errors.throttling_exception.ThrottlingException: <p>Amazon Rekognition is temporarily unable to process the request. Try your call again.</p>
        capo_rekognition.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To delete a collection
        This operation deletes a Rekognition collection.

        >>> await client.delete_collection(collection_id='myphotos')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rekognition.types.delete_collection_request.DeleteCollectionRequest]",
    ) -> AsyncOperationResponse[
        "capo_rekognition.types.delete_collection_response.DeleteCollectionResponse"
    ]:
        import capo_rekognition._operations.rekognition_service.delete_collection

        (
            output,
            http_response,
        ) = await capo_rekognition._operations.rekognition_service.delete_collection.async_delete_collection(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteCollection")
    )
    input_: capo_rekognition.types.delete_collection_request.DeleteCollectionRequest = {
        "collection_id": collection_id
    }

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