The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import type * as identitystore from "@distilled.cloud/aws/identitystore"; |
| 2 | import * as Binding from "alchemy/Binding"; |
| 3 | import type * as Effect from "effect/Effect"; |
| 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<identitystore.IsMemberInGroupsResponse, identitystore.IsMemberInGroupsError> |
| 38 | > |
| 39 | > {} |
| 40 | export const IsMemberInGroups = Binding.Service<IsMemberInGroups>( |
| 41 | "AWS.IdentityCenter.IsMemberInGroups", |
| 42 | ); |