| 1 | import type * as cloudrun from "@distilled.cloud/gcp/run_v2"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { RuntimeContext } from "../../RuntimeContext.ts"; |
| 5 | import type { Job } from "./Job.ts"; |
| 6 | |
| 7 | export interface RunJobRequest extends Omit< |
| 8 | cloudrun.RunProjectsLocationsJobsRequest, |
| 9 | "name" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for Cloud Run `jobs.run`. |
| 14 | * |
| 15 | * Triggers a new execution of the bound {@link Job}. Provide |
| 16 | * {@link RunJobHttp}. |
| 17 | * |
| 18 | * ### Running Jobs |
| 19 | * **Example:** Trigger an execution |
| 20 | * ```typescript |
| 21 | * const runJob = yield* GCP.Run.RunJob(job); |
| 22 | * yield* runJob(); |
| 23 | * ``` |
| 24 | * |
| 25 | * **Example:** Override task count |
| 26 | * ```typescript |
| 27 | * const runJob = yield* GCP.Run.RunJob(job); |
| 28 | * yield* runJob({ |
| 29 | * body: { overrides: { taskCount: 1 } }, |
| 30 | * }); |
| 31 | * ``` |
| 32 | * |
| 33 | * @binding |
| 34 | * @category Run |
| 35 | */ |
| 36 | export interface RunJob extends Binding.Service< |
| 37 | RunJob, |
| 38 | "GCP.Run.RunJob", |
| 39 | ( |
| 40 | job: Job, |
| 41 | ) => Effect.Effect< |
| 42 | ( |
| 43 | request?: RunJobRequest, |
| 44 | ) => Effect.Effect< |
| 45 | cloudrun.GoogleLongrunningOperation, |
| 46 | cloudrun.RunProjectsLocationsJobsError, |
| 47 | RuntimeContext |
| 48 | > |
| 49 | > |
| 50 | > {} |
| 51 | |
| 52 | export const RunJob = Binding.Service<RunJob>("GCP.Run.RunJob"); |