| 1 | import type * as identitystore from "@distilled.cloud/aws/identitystore"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Instance } from "./Instance.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for the `IsMemberInGroups` operation (IAM action |
| 8 | * `identitystore:IsMemberInGroups`), scoped to one {@link Instance}. |
| 9 | * |
| 10 | * Checks whether a user belongs to any of up to 100 groups in one call — the fast authorization primitive for group-gated routes. The instance's |
| 11 | * `IdentityStoreId` is injected from the binding. Provide the implementation with |
| 12 | * `Effect.provide(AWS.IdentityCenter.IsMemberInGroupsHttp)`. |
| 13 | * ### Querying Group Memberships |
| 14 | * **Example:** Gate a Route on Group Membership |
| 15 | * ```typescript |
| 16 | * // init — bind the operation to the Identity Center instance |
| 17 | * const isMemberInGroups = yield* AWS.IdentityCenter.IsMemberInGroups(instance); |
| 18 | * |
| 19 | * // runtime |
| 20 | * const { Results } = yield* isMemberInGroups({ |
| 21 | * MemberId: { UserId: userId }, |
| 22 | * GroupIds: [adminGroupId], |
| 23 | * }); |
| 24 | * const isAdmin = Results?.[0]?.MembershipExists === true; |
| 25 | * ``` |
| 26 | * |
| 27 | * @binding |
| 28 | */ |
| 29 | export interface IsMemberInGroups extends Binding.Service< |
| 30 | IsMemberInGroups, |
| 31 | "AWS.IdentityCenter.IsMemberInGroups", |
| 32 | ( |
| 33 | instance: Instance, |
| 34 | ) => Effect.Effect< |
| 35 | ( |
| 36 | request: Omit<identitystore.IsMemberInGroupsRequest, "IdentityStoreId">, |
| 37 | ) => Effect.Effect< |
| 38 | identitystore.IsMemberInGroupsResponse, |
| 39 | identitystore.IsMemberInGroupsError |
| 40 | > |
| 41 | > |
| 42 | > {} |
| 43 | export const IsMemberInGroups = Binding.Service<IsMemberInGroups>( |
| 44 | "AWS.IdentityCenter.IsMemberInGroups", |
| 45 | ); |