sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ Batch/ ListJobs.ts

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

/**
 * The queue is injected by the binding; filter by `jobStatus` (default
 * `RUNNING`), `filters`, or paginate with `nextToken`/`maxResults`.
 */
export interface ListJobsRequest extends Omit<batch.ListJobsRequest, "jobQueue"> {}

/**
 * List AWS Batch jobs in the bound job queue from runtime code.
 * `batch:ListJobs` has no resource-level IAM, so the policy is
 * service-scoped; the queue anchors the binding and is injected as the
 * `jobQueue` selector.
 *
 * ### Listing Jobs
 * **Example:** List runnable jobs in the queue
 * ```typescript
 * const listJobs = yield* Batch.ListJobs(queue);
 * const { jobSummaryList } = yield* listJobs({ jobStatus: "RUNNABLE" });
 * ```
 *
 * @binding
 */
export interface ListJobs extends Binding.Service<
  ListJobs,
  "AWS.Batch.ListJobs",
  (
    queue: JobQueue,
  ) => Effect.Effect<
    (request?: ListJobsRequest) => Effect.Effect<batch.ListJobsResponse, batch.ListJobsError>
  >
> {}
export const ListJobs = Binding.Service<ListJobs>("AWS.Batch.ListJobs");