Skip to content

delete_user async

delete_user(
    collection_id: CollectionId,
    user_id: UserId,
    *,
    config_overrides: Optional[AsyncRekognitionClientConfig] = None,
    client_request_token: Optional[ClientRequestToken] = None,
) -> DeleteUserResponse

Deletes the specified UserID within the collection. Faces that are associated with the UserID are disassociated from the UserID before deleting the specified UserID. If the specified Collection or UserID is already deleted or not found, a ResourceNotFoundException will be thrown. If the action is successful with a 200 response, an empty HTTP body is returned.

Parameters:

  • collection_id (CollectionId) –

    The ID of an existing collection from which the UserID needs to be deleted.

  • user_id (UserId) –

    ID for the UserID to be deleted.

  • client_request_token (Optional[ClientRequestToken], default: None ) –

    Idempotent token used to identify the request to DeleteUser. If you use the same token with multiple DeleteUser requests, the same response is returned. Use ClientRequestToken to prevent the same request from being processed more than once.

Raises:

  • AccessDeniedException –

    You are not authorized to perform the action.

  • ConflictException –

    A User with the same Id already exists within the collection, or the update or deletion of the User caused an inconsistent state. **

  • IdempotentParameterMismatchException –

    A ClientRequestToken input parameter was reused with an operation, but at least one of the other input parameters is different from the previous call to the operation.

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

  • ProvisionedThroughputExceededException –

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

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

DeleteUser Deletes the specified UserID within the collection.

>>> await client.delete_user(collection_id='MyCollection', user_id='DemoUser', client_request_token='550e8400-e29b-41d4-a716-446655440001')
Source code in docs_src/capo_rekognition/_services/async_rekognition.py
async def delete_user(
    self,
    collection_id: "capo_rekognition.types.collection_id.CollectionId",
    user_id: "capo_rekognition.types.user_id.UserId",
    *,
    config_overrides: Optional[AsyncRekognitionClientConfig] = None,
    client_request_token: Optional[
        "capo_rekognition.types.client_request_token.ClientRequestToken"
    ] = None,
) -> "capo_rekognition.types.delete_user_response.DeleteUserResponse":
    """<p>Deletes the specified UserID within the collection. Faces that are associated with the UserID are disassociated from the UserID before deleting the specified UserID. If the specified <code>Collection</code> or <code>UserID</code> is already deleted or not found, a <code>ResourceNotFoundException</code> will be thrown. If the action is successful with a 200 response, an empty HTTP body is returned. </p>

    Args:
        collection_id: <p>The ID of an existing collection from which the UserID needs to be deleted. </p>
        user_id: <p>ID for the UserID to be deleted. </p>
        client_request_token: <p>Idempotent token used to identify the request to <code>DeleteUser</code>. If you use the same token with multiple <code>DeleteUser </code>requests, the same response is returned. Use ClientRequestToken to prevent the same request from being processed more than once.</p>

    Raises:
        capo_rekognition.errors.access_denied_exception.AccessDeniedException: <p>You are not authorized to perform the action.</p>
        capo_rekognition.errors.conflict_exception.ConflictException: <p> A User with the same Id already exists within the collection, or the update or deletion of the User caused an inconsistent state. ** </p>
        capo_rekognition.errors.idempotent_parameter_mismatch_exception.IdempotentParameterMismatchException: <p>A <code>ClientRequestToken</code> input parameter was reused with an operation, but at least one of the other input parameters is different from the previous call to the operation.</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:
        DeleteUser
        Deletes the specified UserID within the collection.

        >>> await client.delete_user(collection_id='MyCollection', user_id='DemoUser', client_request_token='550e8400-e29b-41d4-a716-446655440001')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rekognition.types.delete_user_request.DeleteUserRequest]",
    ) -> AsyncOperationResponse[
        "capo_rekognition.types.delete_user_response.DeleteUserResponse"
    ]:
        import capo_rekognition._operations.rekognition_service.delete_user

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteUser")
    )
    input_: capo_rekognition.types.delete_user_request.DeleteUserRequest = {
        "collection_id": collection_id,
        "user_id": user_id,
    }
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token

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