1import type * as qbusiness from "@distilled.cloud/aws/qbusiness";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Index } from "./SearchIndex.ts";
5
6/**
7 * `CheckDocumentAccess` request with `applicationId` + `indexId` injected from the bound index.
8 */
9export interface CheckDocumentAccessRequest extends Omit<
10 qbusiness.CheckDocumentAccessRequest,
11 "applicationId" | "indexId"
12> {}
13
14/**
15 * Runtime binding for the `CheckDocumentAccess` operation (IAM action
16 * `qbusiness:CheckDocumentAccess`), scoped to one {@link Index}.
17 *
18 * Checks whether a specific user can access a document, returning
19 * the user's groups/aliases and the document's ACL evaluation.
20 * Provide the implementation with
21 * `Effect.provide(AWS.QBusiness.CheckDocumentAccessHttp)`.
22 *
23 * ### Document Ingestion
24 * **Example:** Check a User's Document Access
25 * ```typescript
26 * const checkAccess = yield* AWS.QBusiness.CheckDocumentAccess(index);
27 *
28 * const { hasAccess } = yield* checkAccess({
29 * userId: "user@example.com",
30 * documentId: "welcome",
31 * });
32 * ```
33 *
34 * @binding
35 */
36export interface CheckDocumentAccess extends Binding.Service<
37 CheckDocumentAccess,
38 "AWS.QBusiness.CheckDocumentAccess",
39 (
40 index: Index,
41 ) => Effect.Effect<
42 (
43 request: CheckDocumentAccessRequest,
44 ) => Effect.Effect<
45 qbusiness.CheckDocumentAccessResponse,
46 qbusiness.CheckDocumentAccessError
47 >
48 >
49> {}
50export const CheckDocumentAccess = Binding.Service<CheckDocumentAccess>(
51 "AWS.QBusiness.CheckDocumentAccess",
52);