sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ EMRServerless/ GetJobRun.ts

import type * as emr from "@distilled.cloud/aws/emr-serverless";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";
import type { Application } from "./Application.ts";

/**
 * Request accepted by the {@link GetJobRun} runtime callable. The
 * `applicationId` is injected from the bound {@link Application}.
 */
export type GetJobRunInput = Omit<emr.GetJobRunRequest, "applicationId">;

/**
 * Runtime binding for `emr-serverless:GetJobRun`.
 *
 * Reads a job run's full detail on the bound {@link Application} — state,
 * driver, resource utilization, timeout — so a function can poll a submitted
 * job to completion or inspect why it failed. Provide the implementation
 * with `Effect.provide(AWS.EMRServerless.GetJobRunHttp)`.
 * ### Running Jobs
 * **Example:** Poll A Job Run
 * ```typescript
 * // init
 * const getJobRun = yield* AWS.EMRServerless.GetJobRun(app);
 *
 * // runtime
 * const { jobRun } = yield* getJobRun({ jobRunId });
 * yield* Effect.log(`${jobRun.jobRunId} is ${jobRun.state}`);
 * ```
 *
 * @binding
 */
export interface GetJobRun extends Binding.Service<
  GetJobRun,
  "AWS.EMRServerless.GetJobRun",
  (
    application: Application,
  ) => Effect.Effect<
    (request: GetJobRunInput) => Effect.Effect<emr.GetJobRunResponse, emr.GetJobRunError>
  >
> {}
export const GetJobRun = Binding.Service<GetJobRun>("AWS.EMRServerless.GetJobRun");