Skip to content

check_document_access

check_document_access(
    application_id: ApplicationId,
    index_id: IndexId,
    user_id: String,
    document_id: DocumentId,
    *,
    config_overrides: Optional[QBusinessClientConfig] = None,
    data_source_id: Optional[DataSourceId] = None,
) -> CheckDocumentAccessResponse

Verifies if a user has access permissions for a specified document and returns the actual ACL attached to the document. Resolves user access on the document via user aliases and groups when verifying user access.

Parameters:

  • application_id (ApplicationId) –

    The unique identifier of the application. This is required to identify the specific Amazon Q Business application context for the document access check.

  • index_id (IndexId) –

    The unique identifier of the index. Used to locate the correct index within the application where the document is stored.

  • user_id (String) –

    The unique identifier of the user. Used to check the access permissions for this specific user against the document's ACL.

  • document_id (DocumentId) –

    The unique identifier of the document. Specifies which document's access permissions are being checked.

  • data_source_id (Optional[DataSourceId], default: None ) –

    The unique identifier of the data source. Identifies the specific data source from which the document originates. Should not be used when a document is uploaded directly with BatchPutDocument, as no dataSourceId is available or necessary.

Raises:

  • AccessDeniedException –

    You don't have access to perform this action. Make sure you have the required permission policies and user accounts and try again.

  • InternalServerException –

    An issue occurred with the internal server used for your Amazon Q Business service. Wait some minutes and try again, or contact Support for help.

  • ResourceNotFoundException –

    The application or plugin resource you want to use doesn’t exist. Make sure you have provided the correct resource and try again.

  • ThrottlingException –

    The request was denied due to throttling. Reduce the number of requests and try again.

  • ValidationException –

    The input doesn't meet the constraints set by the Amazon Q Business service. Provide the correct input and try again.

  • UnknownServiceError –

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

Source code in docs_src/capo_qbusiness/_services/q_business.py
def check_document_access(
    self,
    application_id: "capo_qbusiness.types.application_id.ApplicationId",
    index_id: "capo_qbusiness.types.index_id.IndexId",
    user_id: "capo_qbusiness.types.string.String",
    document_id: "capo_qbusiness.types.document_id.DocumentId",
    *,
    config_overrides: Optional[QBusinessClientConfig] = None,
    data_source_id: Optional[
        "capo_qbusiness.types.data_source_id.DataSourceId"
    ] = None,
) -> "capo_qbusiness.types.check_document_access_response.CheckDocumentAccessResponse":
    """<p>Verifies if a user has access permissions for a specified document and returns the actual ACL attached to the document. Resolves user access on the document via user aliases and groups when verifying user access.</p>

    Args:
        application_id: <p>The unique identifier of the application. This is required to identify the specific Amazon Q Business application context for the document access check.</p>
        index_id: <p>The unique identifier of the index. Used to locate the correct index within the application where the document is stored.</p>
        user_id: <p>The unique identifier of the user. Used to check the access permissions for this specific user against the document's ACL.</p>
        document_id: <p>The unique identifier of the document. Specifies which document's access permissions are being checked.</p>
        data_source_id: <p>The unique identifier of the data source. Identifies the specific data source from which the document originates. Should not be used when a document is uploaded directly with BatchPutDocument, as no dataSourceId is available or necessary. </p>

    Raises:
        capo_qbusiness.errors.access_denied_exception.AccessDeniedException: <p> You don't have access to perform this action. Make sure you have the required permission policies and user accounts and try again.</p>
        capo_qbusiness.errors.internal_server_exception.InternalServerException: <p>An issue occurred with the internal server used for your Amazon Q Business service. Wait some minutes and try again, or contact <a href="http://aws.amazon.com/contact-us/">Support</a> for help.</p>
        capo_qbusiness.errors.resource_not_found_exception.ResourceNotFoundException: <p>The application or plugin resource you want to use doesn’t exist. Make sure you have provided the correct resource and try again.</p>
        capo_qbusiness.errors.throttling_exception.ThrottlingException: <p>The request was denied due to throttling. Reduce the number of requests and try again.</p>
        capo_qbusiness.errors.validation_exception.ValidationException: <p>The input doesn't meet the constraints set by the Amazon Q Business service. Provide the correct input and try again.</p>
        capo_qbusiness.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_qbusiness.types.check_document_access_request.CheckDocumentAccessRequest]",
    ) -> OperationResponse[
        "capo_qbusiness.types.check_document_access_response.CheckDocumentAccessResponse"
    ]:
        import capo_qbusiness._operations.expert_q.check_document_access

        output, http_response = (
            capo_qbusiness._operations.expert_q.check_document_access.check_document_access(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CheckDocumentAccess")
    )
    input_: capo_qbusiness.types.check_document_access_request.CheckDocumentAccessRequest = {
        "application_id": application_id,
        "index_id": index_id,
        "user_id": user_id,
        "document_id": document_id,
    }
    if data_source_id is not None:
        input_["data_source_id"] = data_source_id

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output