sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ Transfer/ DescribeUser.ts

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

/**
 * Runtime binding for `transfer:DescribeUser`.
 *
 * Reads the bound {@link User}'s live configuration — home directory, role,
 * POSIX profile, and the SSH public keys currently registered (including
 * their `SshPublicKeyId`s, which {@link DeleteSshPublicKey} needs). The
 * `ServerId` and `UserName` are injected from the binding. Provide the
 * implementation with `Effect.provide(AWS.Transfer.DescribeUserHttp)`.
 * ### Managing Users at Runtime
 * **Example:** Read the User's SSH Keys
 * ```typescript
 * // init — bind the operation to the user
 * const describeUser = yield* AWS.Transfer.DescribeUser(user);
 *
 * // runtime
 * const { User } = yield* describeUser();
 * const keyIds = (User.SshPublicKeys ?? []).map((k) => k.SshPublicKeyId);
 * ```
 *
 * @binding
 */
export interface DescribeUser extends Binding.Service<
  DescribeUser,
  "AWS.Transfer.DescribeUser",
  (
    user: User,
  ) => Effect.Effect<
    (
      request?: Omit<transfer.DescribeUserRequest, "ServerId" | "UserName">,
    ) => Effect.Effect<transfer.DescribeUserResponse, transfer.DescribeUserError>
  >
> {}
export const DescribeUser = Binding.Service<DescribeUser>("AWS.Transfer.DescribeUser");