1import type * as kendra from "@distilled.cloud/aws/kendra";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Index } from "./SearchIndex.ts";
5
6/**
7 * `PutPrincipalMapping` request with `IndexId` injected from the bound index.
8 */
9export interface PutPrincipalMappingRequest extends Omit<
10 kendra.PutPrincipalMappingRequest,
11 "IndexId"
12> {}
13
14/**
15 * Runtime binding for the `PutPrincipalMapping` operation (IAM action
16 * `kendra:PutPrincipalMapping`), scoped to one {@link Index}.
17 *
18 * Maps users to groups (optionally per data source) so queries filtered
19 * on the user's context only return documents that user's groups may
20 * access.
21 * Provide the implementation with
22 * `Effect.provide(AWS.Kendra.PutPrincipalMappingHttp)`.
23 *
24 * ### Principal Mapping
25 * **Example:** Map Users to a Group
26 * ```typescript
27 * const putPrincipalMapping = yield* AWS.Kendra.PutPrincipalMapping(index);
28 *
29 * yield* putPrincipalMapping({
30 * GroupId: "engineering",
31 * GroupMembers: {
32 * MemberUsers: [{ UserId: "user@example.com" }],
33 * },
34 * });
35 * ```
36 *
37 * @binding
38 */
39export interface PutPrincipalMapping extends Binding.Service<
40 PutPrincipalMapping,
41 "AWS.Kendra.PutPrincipalMapping",
42 (
43 index: Index,
44 ) => Effect.Effect<
45 (
46 request: PutPrincipalMappingRequest,
47 ) => Effect.Effect<
48 kendra.PutPrincipalMappingResponse,
49 kendra.PutPrincipalMappingError
50 >
51 >
52> {}
53export const PutPrincipalMapping = Binding.Service<PutPrincipalMapping>(
54 "AWS.Kendra.PutPrincipalMapping",
55);