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