Skip to content

delete_document_version async

delete_document_version(
    document_id: ResourceIdType,
    version_id: DocumentVersionIdType,
    delete_prior_versions: BooleanType,
    *,
    config_overrides: Optional[AsyncWorkDocsClientConfig] = None,
    authentication_token: Optional[AuthenticationHeaderType] = None,
) -> None

Deletes a specific version of a document.

Parameters:

  • authentication_token (Optional[AuthenticationHeaderType], default: None ) –

    Amazon WorkDocs authentication token. Not required when using Amazon Web Services administrator credentials to access the API.

  • document_id (ResourceIdType) –

    The ID of the document associated with the version being deleted.

  • version_id (DocumentVersionIdType) –

    The ID of the version being deleted.

  • delete_prior_versions (BooleanType) –

    Deletes all versions of a document prior to the current version.

Raises:

Source code in docs_src/capo_workdocs/_services/async_work_docs.py
async def delete_document_version(
    self,
    document_id: "capo_workdocs.types.resource_id_type.ResourceIdType",
    version_id: "capo_workdocs.types.document_version_id_type.DocumentVersionIdType",
    delete_prior_versions: "capo_workdocs.types.boolean_type.BooleanType",
    *,
    config_overrides: Optional[AsyncWorkDocsClientConfig] = None,
    authentication_token: Optional[
        "capo_workdocs.types.authentication_header_type.AuthenticationHeaderType"
    ] = None,
) -> None:
    """<p>Deletes a specific version of a document.</p>

    Args:
        authentication_token: <p>Amazon WorkDocs authentication token. Not required when using Amazon Web Services administrator credentials to access the API.</p>
        document_id: <p>The ID of the document associated with the version being deleted.</p>
        version_id: <p>The ID of the version being deleted.</p>
        delete_prior_versions: <p>Deletes all versions of a document prior to the current version.</p>

    Raises:
        capo_workdocs.errors.concurrent_modification_exception.ConcurrentModificationException: <p>The resource hierarchy is changing.</p>
        capo_workdocs.errors.conflicting_operation_exception.ConflictingOperationException: <p>Another operation is in progress on the resource that conflicts with the current operation.</p>
        capo_workdocs.errors.entity_not_exists_exception.EntityNotExistsException: <p>The resource does not exist.</p>
        capo_workdocs.errors.failed_dependency_exception.FailedDependencyException: <p>The Directory Service cannot reach an on-premises instance. Or a dependency under the control of the organization is failing, such as a connected Active Directory.</p>
        capo_workdocs.errors.invalid_operation_exception.InvalidOperationException: <p>The operation is invalid.</p>
        capo_workdocs.errors.prohibited_state_exception.ProhibitedStateException: <p>The specified document version is not in the INITIALIZED state.</p>
        capo_workdocs.errors.unauthorized_operation_exception.UnauthorizedOperationException: <p>The operation is not permitted.</p>
        capo_workdocs.errors.unauthorized_resource_access_exception.UnauthorizedResourceAccessException: <p>The caller does not have access to perform the action on the resource.</p>
        capo_workdocs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_workdocs.types.delete_document_version_request.DeleteDocumentVersionRequest]",
    ) -> AsyncOperationResponse[None]:
        import capo_workdocs._operations.aws_gorilla_boy_service.delete_document_version

        (
            output,
            http_response,
        ) = await capo_workdocs._operations.aws_gorilla_boy_service.delete_document_version.async_delete_document_version(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_workdocs.types.delete_document_version_request.DeleteDocumentVersionRequest",
    ) -> dict[str, Any]:
        import capo_workdocs.types.delete_document_version_request

        return capo_workdocs.types.delete_document_version_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("DeleteDocumentVersion", redact_input=_redact_input),
    )
    input_: capo_workdocs.types.delete_document_version_request.DeleteDocumentVersionRequest = {
        "document_id": document_id,
        "version_id": version_id,
        "delete_prior_versions": delete_prior_versions,
    }
    if authentication_token is not None:
        input_["authentication_token"] = authentication_token

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