1import type * as glue from "@distilled.cloud/aws/glue";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Job } from "./Job.ts";
5
6export interface GetJobRunRequest extends Omit<
7 glue.GetJobRunRequest,
8 "JobName"
9> {}
10
11/**
12 * Runtime binding for `glue:GetJobRun`.
13 *
14 * Reads the metadata of a single run of the bound {@link Job} — its
15 * `JobRunState` (`RUNNING`, `SUCCEEDED`, `FAILED`, `TIMEOUT`, …), timings,
16 * and error message — so a function can poll a run it started to a terminal
17 * state. The job name is injected from the binding. Provide the
18 * implementation with `Effect.provide(AWS.Glue.GetJobRunHttp)`.
19 * ### Running Jobs
20 * **Example:** Poll a Run to a Terminal State
21 * ```typescript
22 * // init
23 * const getJobRun = yield* AWS.Glue.GetJobRun(job);
24 *
25 * // runtime
26 * const { JobRun } = yield* getJobRun({ RunId: runId });
27 * if (JobRun?.JobRunState === "FAILED") {
28 * yield* Effect.logError(JobRun.ErrorMessage ?? "run failed");
29 * }
30 * ```
31 *
32 * @binding
33 */
34export interface GetJobRun extends Binding.Service<
35 GetJobRun,
36 "AWS.Glue.GetJobRun",
37 (
38 job: Job,
39 ) => Effect.Effect<
40 (
41 request: GetJobRunRequest,
42 ) => Effect.Effect<glue.GetJobRunResponse, glue.GetJobRunError>
43 >
44> {}
45
46export const GetJobRun = Binding.Service<GetJobRun>("AWS.Glue.GetJobRun");