checkDocumentAccess method

Future<CheckDocumentAccessResponse> checkDocumentAccess({
  1. required String applicationId,
  2. required String documentId,
  3. required String indexId,
  4. required String userId,
  5. String? dataSourceId,
})

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.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

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

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

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

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

Parameter dataSourceId : 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.

Implementation

Future<CheckDocumentAccessResponse> checkDocumentAccess({
  required String applicationId,
  required String documentId,
  required String indexId,
  required String userId,
  String? dataSourceId,
}) async {
  final $query = <String, List<String>>{
    if (dataSourceId != null) 'dataSourceId': [dataSourceId],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri:
        '/applications/${Uri.encodeComponent(applicationId)}/index/${Uri.encodeComponent(indexId)}/users/${Uri.encodeComponent(userId)}/documents/${Uri.encodeComponent(documentId)}/check-document-access',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return CheckDocumentAccessResponse.fromJson(response);
}