1import type * as scheduler from "@distilled.cloud/gcp/cloudscheduler_v1";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { RuntimeContext } from "../../RuntimeContext.ts";
5import type { Job } from "./Job.ts";
6
7export interface RunJobRequest extends Omit<
8 scheduler.RunProjectsLocationsJobsRequest,
9 "name"
10> {}
11
12/**
13 * Runtime binding for Cloud Scheduler `jobs.run`.
14 *
15 * Forces an immediate dispatch even if the job is already running. Bind this
16 * operation to a {@link Job} in a Function/Action init phase. Provide
17 * {@link RunJobHttp}.
18 *
19 * ### Running Jobs
20 * **Example:** Run the bound job now
21 * ```typescript
22 * const runJob = yield* GCP.CloudScheduler.RunJob(ping);
23 * yield* runJob();
24 * ```
25 *
26 * @binding
27 * @category CloudScheduler
28 */
29export interface RunJob extends Binding.Service<
30 RunJob,
31 "GCP.CloudScheduler.RunJob",
32 (
33 job: Job,
34 ) => Effect.Effect<
35 (
36 request?: RunJobRequest,
37 ) => Effect.Effect<
38 scheduler.Job,
39 scheduler.RunProjectsLocationsJobsError,
40 RuntimeContext
41 >
42 >
43> {}
44
45export const RunJob = Binding.Service<RunJob>("GCP.CloudScheduler.RunJob");