sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ DirectoryService/ CreateComputer.ts

import type * as ds from "@distilled.cloud/aws/directory-service";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";
import type { Directory } from "./Directory.ts";

/**
 * Runtime binding for the `CreateComputer` operation (IAM action
 * `ds:CreateComputer`), scoped to one {@link Directory}.
 *
 * Creates a computer account in the bound directory — the programmatic half
 * of joining a machine to the domain (e.g. from an instance-provisioning
 * workflow). `Password` is the one-time machine password and is sensitive;
 * pass a `Redacted` value. The directory id is injected from the binding.
 * Provide the implementation with
 * `Effect.provide(AWS.DirectoryService.CreateComputerHttp)`.
 * ### Managing Computers
 * **Example:** Create a Computer Account
 * ```typescript
 * // init — bind the operation to the directory
 * const createComputer = yield* AWS.DirectoryService.CreateComputer(directory);
 *
 * // runtime
 * const { Computer } = yield* createComputer({
 *   ComputerName: "BUILD-AGENT-01",
 *   Password: Redacted.make("0ne-Time-Secret!"),
 * });
 * ```
 *
 * @binding
 */
export interface CreateComputer extends Binding.Service<
  CreateComputer,
  "AWS.DirectoryService.CreateComputer",
  (
    directory: Directory,
  ) => Effect.Effect<
    (
      request: Omit<ds.CreateComputerRequest, "DirectoryId">,
    ) => Effect.Effect<ds.CreateComputerResult, ds.CreateComputerError>
  >
> {}
export const CreateComputer = Binding.Service<CreateComputer>(
  "AWS.DirectoryService.CreateComputer",
);