1import * as scheduler from "@distilled.cloud/gcp/cloudscheduler_v1";
2import { Credentials } from "@distilled.cloud/gcp/Credentials";
3import * as Layer from "effect/Layer";
4import * as HttpClient from "effect/http/HttpClient";
5import { makeJobHttpBinding } from "./BindingHttp.ts";
6import { PauseJob } from "./PauseJob.ts";
7
8/**
9 * HTTP implementation of {@link PauseJob}.
10 *
11 * Grants `roles/cloudscheduler.admin` on the project because it is the
12 * only predefined role with `cloudscheduler.jobs.pause`, and Cloud Scheduler
13 * supports neither per-job IAM policies nor IAM Conditions on
14 * `resource.name`.
15 *
16 * @layer
17 * @provides GCP.CloudScheduler.PauseJob
18 */
19export const PauseJobHttp: Layer.Layer<
20 PauseJob,
21 never,
22 Credentials | HttpClient.HttpClient
23> = Layer.effect(
24 PauseJob,
25 makeJobHttpBinding<
26 scheduler.PauseProjectsLocationsJobsRequest,
27 scheduler.Job,
28 scheduler.PauseProjectsLocationsJobsError
29 >({
30 tag: "GCP.CloudScheduler.PauseJob",
31 iam: { role: "roles/cloudscheduler.admin" },
32 operation: scheduler.pauseProjectsLocationsJobs,
33 }),
34);