sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ IdentityCenter/ GetUserId.ts

import type * as identitystore from "@distilled.cloud/aws/identitystore";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";
import type { Instance } from "./Instance.ts";

/**
 * Runtime binding for the `GetUserId` operation (IAM action
 * `identitystore:GetUserId`), scoped to one {@link Instance}.
 *
 * 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
 * `IdentityStoreId` is injected from the binding. Provide the implementation with
 * `Effect.provide(AWS.IdentityCenter.GetUserIdHttp)`.
 * ### Looking Up Users
 * **Example:** Resolve a UserId From a User Name
 * ```typescript
 * // init — bind the operation to the Identity Center instance
 * const getUserId = yield* AWS.IdentityCenter.GetUserId(instance);
 *
 * // runtime
 * const { UserId } = yield* getUserId({
 *   AlternateIdentifier: {
 *     UniqueAttribute: {
 *       AttributePath: "userName",
 *       AttributeValue: "jdoe",
 *     },
 *   },
 * });
 * ```
 *
 * @binding
 */
export interface GetUserId extends Binding.Service<
  GetUserId,
  "AWS.IdentityCenter.GetUserId",
  (
    instance: Instance,
  ) => Effect.Effect<
    (
      request: Omit<identitystore.GetUserIdRequest, "IdentityStoreId">,
    ) => Effect.Effect<identitystore.GetUserIdResponse, identitystore.GetUserIdError>
  >
> {}
export const GetUserId = Binding.Service<GetUserId>("AWS.IdentityCenter.GetUserId");