| 1 | import type * as scheduler from "@distilled.cloud/gcp/cloudscheduler_v1"; |
| 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 ResumeJobRequest extends Omit< |
| 8 | scheduler.ResumeProjectsLocationsJobsRequest, |
| 9 | "name" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for Cloud Scheduler `jobs.resume`. |
| 14 | * |
| 15 | * Bind this operation to a {@link Job} in a Function/Action init phase. |
| 16 | * Provide {@link ResumeJobHttp}. |
| 17 | * |
| 18 | * Grants `roles/cloudscheduler.admin` on the project: it is the only |
| 19 | * predefined role with `cloudscheduler.jobs.enable`, and Cloud Scheduler has |
| 20 | * neither per-job IAM policies nor IAM Conditions on `resource.name`. |
| 21 | * |
| 22 | * ### Resuming Jobs |
| 23 | * **Example:** Resume the bound job |
| 24 | * ```typescript |
| 25 | * const resumeJob = yield* GCP.CloudScheduler.ResumeJob(ping); |
| 26 | * yield* resumeJob(); |
| 27 | * ``` |
| 28 | * |
| 29 | * @binding |
| 30 | * @category CloudScheduler |
| 31 | */ |
| 32 | export interface ResumeJob extends Binding.Service< |
| 33 | ResumeJob, |
| 34 | "GCP.CloudScheduler.ResumeJob", |
| 35 | ( |
| 36 | job: Job, |
| 37 | ) => Effect.Effect< |
| 38 | ( |
| 39 | request?: ResumeJobRequest, |
| 40 | ) => Effect.Effect< |
| 41 | scheduler.Job, |
| 42 | scheduler.ResumeProjectsLocationsJobsError, |
| 43 | RuntimeContext |
| 44 | > |
| 45 | > |
| 46 | > {} |
| 47 | |
| 48 | export const ResumeJob = Binding.Service<ResumeJob>( |
| 49 | "GCP.CloudScheduler.ResumeJob", |
| 50 | ); |