Skip to content

delete_dataset async

delete_dataset(
    dataset_arn: DatasetArn,
    *,
    config_overrides: Optional[AsyncRekognitionClientConfig] = None,
) -> DeleteDatasetResponse

This operation applies only to Amazon Rekognition Custom Labels.

Deletes an existing Amazon Rekognition Custom Labels dataset. Deleting a dataset might take while. Use DescribeDataset to check the current status. The dataset is still deleting if the value of Status is DELETE_IN_PROGRESS. If you try to access the dataset after it is deleted, you get a ResourceNotFoundException exception.

You can't delete a dataset while it is creating (Status = CREATE_IN_PROGRESS) or if the dataset is updating (Status = UPDATE_IN_PROGRESS).

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

Parameters:

  • dataset_arn (DatasetArn) –

    The ARN of the Amazon Rekognition Custom Labels dataset that you want to delete.

Raises:

  • AccessDeniedException –

    You are not authorized to perform the action.

  • InternalServerError –

    Amazon Rekognition experienced a service issue. Try your call again.

  • InvalidParameterException –

    Input parameter violated a constraint. Validate your parameter before calling the API operation again.

  • LimitExceededException –

    An Amazon Rekognition service limit was exceeded. For example, if you start too many jobs concurrently, subsequent calls to start operations (ex: StartLabelDetection) will raise a LimitExceededException exception (HTTP status code: 400) until the number of concurrently running jobs is below the Amazon Rekognition service limit.

  • ProvisionedThroughputExceededException –

    The number of requests exceeded your throughput limit. If you want to increase this limit, contact Amazon Rekognition.

  • ResourceInUseException –

    The specified resource is already being used.

  • ResourceNotFoundException –

    The resource specified in the request cannot be found.

  • ThrottlingException –

    Amazon Rekognition is temporarily unable to process the request. Try your call again.

  • UnknownServiceError –

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

Examples:

To delete an Amazon Rekognition Custom Labels dataset Deletes an Amazon Rekognition Custom Labels dataset.

>>> await client.delete_dataset(dataset_arn='arn:aws:rekognition:us-east-1:111122223333:project/my-project/dataset/test/1690556733321')
Source code in docs_src/capo_rekognition/_services/async_rekognition.py
async def delete_dataset(
    self,
    dataset_arn: "capo_rekognition.types.dataset_arn.DatasetArn",
    *,
    config_overrides: Optional[AsyncRekognitionClientConfig] = None,
) -> "capo_rekognition.types.delete_dataset_response.DeleteDatasetResponse":
    """<note> <p>This operation applies only to Amazon Rekognition Custom Labels.</p> </note> <p>Deletes an existing Amazon Rekognition Custom Labels dataset. Deleting a dataset might take while. Use <a>DescribeDataset</a> to check the current status. The dataset is still deleting if the value of <code>Status</code> is <code>DELETE_IN_PROGRESS</code>. If you try to access the dataset after it is deleted, you get a <code>ResourceNotFoundException</code> exception. </p> <p>You can't delete a dataset while it is creating (<code>Status</code> = <code>CREATE_IN_PROGRESS</code>) or if the dataset is updating (<code>Status</code> = <code>UPDATE_IN_PROGRESS</code>).</p> <p>This operation requires permissions to perform the <code>rekognition:DeleteDataset</code> action.</p>

    Args:
        dataset_arn: <p> The ARN of the Amazon Rekognition Custom Labels dataset that you want 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.limit_exceeded_exception.LimitExceededException: <p>An Amazon Rekognition service limit was exceeded. For example, if you start too many jobs concurrently, subsequent calls to start operations (ex: <code>StartLabelDetection</code>) will raise a <code>LimitExceededException</code> exception (HTTP status code: 400) until the number of concurrently running jobs is below the Amazon Rekognition service limit. </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_in_use_exception.ResourceInUseException: <p>The specified resource is already being used.</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 an Amazon Rekognition Custom Labels dataset
        Deletes an Amazon Rekognition Custom Labels dataset.

        >>> await client.delete_dataset(dataset_arn='arn:aws:rekognition:us-east-1:111122223333:project/my-project/dataset/test/1690556733321')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rekognition.types.delete_dataset_request.DeleteDatasetRequest]",
    ) -> AsyncOperationResponse[
        "capo_rekognition.types.delete_dataset_response.DeleteDatasetResponse"
    ]:
        import capo_rekognition._operations.rekognition_service.delete_dataset

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteDataset")
    )
    input_: capo_rekognition.types.delete_dataset_request.DeleteDatasetRequest = {
        "dataset_arn": dataset_arn
    }

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