The best way to control Claude Code, Codex and more from any computer or phone

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