| 1 | import type * as emr from "@distilled.cloud/aws/emr-serverless"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Application } from "./Application.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Request accepted by the {@link GetJobRun} runtime callable. The |
| 8 | * `applicationId` is injected from the bound {@link Application}. |
| 9 | */ |
| 10 | export type GetJobRunInput = Omit<emr.GetJobRunRequest, "applicationId">; |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for `emr-serverless:GetJobRun`. |
| 14 | * |
| 15 | * Reads a job run's full detail on the bound {@link Application} — state, |
| 16 | * driver, resource utilization, timeout — so a function can poll a submitted |
| 17 | * job to completion or inspect why it failed. Provide the implementation |
| 18 | * with `Effect.provide(AWS.EMRServerless.GetJobRunHttp)`. |
| 19 | * ### Running Jobs |
| 20 | * **Example:** Poll A Job Run |
| 21 | * ```typescript |
| 22 | * // init |
| 23 | * const getJobRun = yield* AWS.EMRServerless.GetJobRun(app); |
| 24 | * |
| 25 | * // runtime |
| 26 | * const { jobRun } = yield* getJobRun({ jobRunId }); |
| 27 | * yield* Effect.log(`${jobRun.jobRunId} is ${jobRun.state}`); |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | */ |
| 32 | export interface GetJobRun extends Binding.Service< |
| 33 | GetJobRun, |
| 34 | "AWS.EMRServerless.GetJobRun", |
| 35 | ( |
| 36 | application: Application, |
| 37 | ) => Effect.Effect< |
| 38 | ( |
| 39 | request: GetJobRunInput, |
| 40 | ) => Effect.Effect<emr.GetJobRunResponse, emr.GetJobRunError> |
| 41 | > |
| 42 | > {} |
| 43 | export const GetJobRun = Binding.Service<GetJobRun>( |
| 44 | "AWS.EMRServerless.GetJobRun", |
| 45 | ); |