| 1 | import type * as glue from "@distilled.cloud/aws/glue"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Job } from "./Job.ts"; |
| 5 | |
| 6 | export interface GetJobRunsRequest extends Omit< |
| 7 | glue.GetJobRunsRequest, |
| 8 | "JobName" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `glue:GetJobRuns`. |
| 13 | * |
| 14 | * Lists the runs of the bound {@link Job} (newest first, paginated via |
| 15 | * `NextToken`), so a function can report run history or find in-flight runs. |
| 16 | * The job name is injected from the binding. Provide the implementation with |
| 17 | * `Effect.provide(AWS.Glue.GetJobRunsHttp)`. |
| 18 | * ### Running Jobs |
| 19 | * **Example:** List Recent Runs |
| 20 | * ```typescript |
| 21 | * // init |
| 22 | * const getJobRuns = yield* AWS.Glue.GetJobRuns(job); |
| 23 | * |
| 24 | * // runtime |
| 25 | * const { JobRuns } = yield* getJobRuns({ MaxResults: 10 }); |
| 26 | * const running = (JobRuns ?? []).filter( |
| 27 | * (run) => run.JobRunState === "RUNNING", |
| 28 | * ); |
| 29 | * ``` |
| 30 | * |
| 31 | * @binding |
| 32 | */ |
| 33 | export interface GetJobRuns extends Binding.Service< |
| 34 | GetJobRuns, |
| 35 | "AWS.Glue.GetJobRuns", |
| 36 | ( |
| 37 | job: Job, |
| 38 | ) => Effect.Effect< |
| 39 | ( |
| 40 | request?: GetJobRunsRequest, |
| 41 | ) => Effect.Effect<glue.GetJobRunsResponse, glue.GetJobRunsError> |
| 42 | > |
| 43 | > {} |
| 44 | |
| 45 | export const GetJobRuns = Binding.Service<GetJobRuns>("AWS.Glue.GetJobRuns"); |