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

main
ts 60 lines 2.08 KB
Raw
1 import type * as emr from "@distilled.cloud/aws/emr-serverless";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { Application } from "./Application.ts";
5
6 /**
7 * Request accepted by the {@link StartJobRun} runtime callable. The
8 * `applicationId` is injected from the bound {@link Application}; the
9 * idempotency `clientToken` is auto-generated when omitted.
10 */
11 export type StartJobRunInput = Omit<emr.StartJobRunRequest, "applicationId" | "clientToken"> & {
12 /**
13 * Idempotency token deduplicating retried submissions.
14 * @default a generated UUID per call
15 */
16 clientToken?: string;
17 };
18
19 /**
20 * Runtime binding for `emr-serverless:StartJobRun`.
21 *
22 * Submits a Spark or Hive job to the bound {@link Application} — the
23 * serverless equivalent of `spark-submit`. The application id is injected
24 * from the binding; the caller supplies the job driver, the execution role
25 * the job assumes, and optional configuration overrides. Grants
26 * `iam:PassRole` (conditioned to `emr-serverless.amazonaws.com`) so the
27 * function can hand the service the execution role. Provide the
28 * implementation with `Effect.provide(AWS.EMRServerless.StartJobRunHttp)`.
29 * ### Running Jobs
30 * **Example:** Submit A Spark Job
31 * ```typescript
32 * // init — bind the operation to the application
33 * const startJobRun = yield* AWS.EMRServerless.StartJobRun(app);
34 *
35 * // runtime
36 * const run = yield* startJobRun({
37 * executionRoleArn: jobRoleArn,
38 * jobDriver: {
39 * sparkSubmit: {
40 * entryPoint: "s3://my-scripts/etl.py",
41 * entryPointArguments: ["--date", "2026-07-14"],
42 * },
43 * },
44 * executionTimeoutMinutes: 60,
45 * });
46 * yield* Effect.log(`started ${run.jobRunId}`);
47 * ```
48 *
49 * @binding
50 */
51 export interface StartJobRun extends Binding.Service<
52 StartJobRun,
53 "AWS.EMRServerless.StartJobRun",
54 (
55 application: Application,
56 ) => Effect.Effect<
57 (request: StartJobRunInput) => Effect.Effect<emr.StartJobRunResponse, emr.StartJobRunError>
58 >
59 > {}
60 export const StartJobRun = Binding.Service<StartJobRun>("AWS.EMRServerless.StartJobRun");