| 1 | import type * as transcoder from "@distilled.cloud/gcp/transcoder_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 { JobTemplate } from "./JobTemplate.ts"; |
| 6 | |
| 7 | export interface CreateJobRequest extends Omit< |
| 8 | transcoder.CreateProjectsLocationsJobsRequest, |
| 9 | "parent" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for Transcoder `jobs.create`. |
| 14 | * |
| 15 | * Starts a transcoding job in the template's location. When `body.config` |
| 16 | * is omitted, `templateId` is filled from the bound {@link JobTemplate}. |
| 17 | * Provide {@link CreateJobHttp}. |
| 18 | * |
| 19 | * Grants `roles/transcoder.editor` on the project because Transcoder has |
| 20 | * no resource-level IAM and no narrower predefined role carries |
| 21 | * `transcoder.jobs.create` (`roles/transcoder.viewer` is read-only). |
| 22 | * |
| 23 | * ### Creating a Job |
| 24 | * **Example:** Transcode with the bound template |
| 25 | * ```typescript |
| 26 | * const createJob = yield* GCP.Transcoder.CreateJob(template); |
| 27 | * const job = yield* createJob({ |
| 28 | * body: { |
| 29 | * inputUri: "gs://bucket/inputs/file.mp4", |
| 30 | * outputUri: "gs://bucket/outputs/", |
| 31 | * }, |
| 32 | * }); |
| 33 | * ``` |
| 34 | * |
| 35 | * @binding |
| 36 | * @category Transcoder |
| 37 | */ |
| 38 | export interface CreateJob extends Binding.Service< |
| 39 | CreateJob, |
| 40 | "GCP.Transcoder.CreateJob", |
| 41 | ( |
| 42 | template: JobTemplate, |
| 43 | ) => Effect.Effect< |
| 44 | ( |
| 45 | request?: CreateJobRequest, |
| 46 | ) => Effect.Effect< |
| 47 | transcoder.Job, |
| 48 | transcoder.CreateProjectsLocationsJobsError, |
| 49 | RuntimeContext |
| 50 | > |
| 51 | > |
| 52 | > {} |
| 53 | |
| 54 | export const CreateJob = Binding.Service<CreateJob>("GCP.Transcoder.CreateJob"); |