| 1 | import type * as batch from "@distilled.cloud/aws/batch"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { JobQueue } from "./JobQueue.ts"; |
| 5 | |
| 6 | /** |
| 7 | * The queue is injected by the binding; filter by `jobStatus` (default |
| 8 | * `RUNNING`), `filters`, or paginate with `nextToken`/`maxResults`. |
| 9 | */ |
| 10 | export interface ListJobsRequest extends Omit< |
| 11 | batch.ListJobsRequest, |
| 12 | "jobQueue" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * List AWS Batch jobs in the bound job queue from runtime code. |
| 17 | * `batch:ListJobs` has no resource-level IAM, so the policy is |
| 18 | * service-scoped; the queue anchors the binding and is injected as the |
| 19 | * `jobQueue` selector. |
| 20 | * |
| 21 | * ### Listing Jobs |
| 22 | * **Example:** List runnable jobs in the queue |
| 23 | * ```typescript |
| 24 | * const listJobs = yield* Batch.ListJobs(queue); |
| 25 | * const { jobSummaryList } = yield* listJobs({ jobStatus: "RUNNABLE" }); |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface ListJobs extends Binding.Service< |
| 31 | ListJobs, |
| 32 | "AWS.Batch.ListJobs", |
| 33 | ( |
| 34 | queue: JobQueue, |
| 35 | ) => Effect.Effect< |
| 36 | ( |
| 37 | request?: ListJobsRequest, |
| 38 | ) => Effect.Effect<batch.ListJobsResponse, batch.ListJobsError> |
| 39 | > |
| 40 | > {} |
| 41 | export const ListJobs = Binding.Service<ListJobs>("AWS.Batch.ListJobs"); |