| 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 `GetUserId` operation (IAM action |
| 8 | * `identitystore:GetUserId`), scoped to one {@link Instance}. |
| 9 | * |
| 10 | * Resolves a user's `UserId` from a unique attribute (e.g. the user name) — the canonical login-to-id lookup for apps federated through Identity Center. The instance's |
| 11 | * `IdentityStoreId` is injected from the binding. Provide the implementation with |
| 12 | * `Effect.provide(AWS.IdentityCenter.GetUserIdHttp)`. |
| 13 | * ### Looking Up Users |
| 14 | * **Example:** Resolve a UserId From a User Name |
| 15 | * ```typescript |
| 16 | * // init — bind the operation to the Identity Center instance |
| 17 | * const getUserId = yield* AWS.IdentityCenter.GetUserId(instance); |
| 18 | * |
| 19 | * // runtime |
| 20 | * const { UserId } = yield* getUserId({ |
| 21 | * AlternateIdentifier: { |
| 22 | * UniqueAttribute: { |
| 23 | * AttributePath: "userName", |
| 24 | * AttributeValue: "jdoe", |
| 25 | * }, |
| 26 | * }, |
| 27 | * }); |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | */ |
| 32 | export interface GetUserId extends Binding.Service< |
| 33 | GetUserId, |
| 34 | "AWS.IdentityCenter.GetUserId", |
| 35 | ( |
| 36 | instance: Instance, |
| 37 | ) => Effect.Effect< |
| 38 | ( |
| 39 | request: Omit<identitystore.GetUserIdRequest, "IdentityStoreId">, |
| 40 | ) => Effect.Effect< |
| 41 | identitystore.GetUserIdResponse, |
| 42 | identitystore.GetUserIdError |
| 43 | > |
| 44 | > |
| 45 | > {} |
| 46 | export const GetUserId = Binding.Service<GetUserId>( |
| 47 | "AWS.IdentityCenter.GetUserId", |
| 48 | ); |