sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ VpcLattice/ RegisterTargets.ts

import type * as vpclattice from "@distilled.cloud/aws/vpc-lattice";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";
import type { TargetGroup } from "./TargetGroup.ts";

/**
 * `RegisterTargets` request with `targetGroupIdentifier` injected from the
 * bound {@link TargetGroup}.
 */
export interface RegisterTargetsRequest extends Omit<
  vpclattice.RegisterTargetsRequest,
  "targetGroupIdentifier"
> {}

/**
 * Runtime binding for the `RegisterTargets` operation (IAM action
 * `vpc-lattice:RegisterTargets` on the target group ARN).
 *
 * Registers targets with the bound {@link TargetGroup} at runtime — the
 * self-registration data plane for workloads that join a lattice service
 * dynamically. Provide the implementation with
 * `Effect.provide(AWS.VpcLattice.RegisterTargetsHttp)`.
 * ### Managing Targets at Runtime
 * **Example:** Register a target
 * ```typescript
 * const registerTargets = yield* AWS.VpcLattice.RegisterTargets(targetGroup);
 *
 * const { successful, unsuccessful } = yield* registerTargets({
 *   targets: [{ id: "10.0.1.10", port: 80 }],
 * });
 * ```
 *
 * @binding
 */
export interface RegisterTargets extends Binding.Service<
  RegisterTargets,
  "AWS.VpcLattice.RegisterTargets",
  (
    targetGroup: TargetGroup,
  ) => Effect.Effect<
    (
      request: RegisterTargetsRequest,
    ) => Effect.Effect<vpclattice.RegisterTargetsResponse, vpclattice.RegisterTargetsError>
  >
> {}
export const RegisterTargets = Binding.Service<RegisterTargets>("AWS.VpcLattice.RegisterTargets");