| 1 | import type * as mediaconvert from "@distilled.cloud/aws/mediaconvert"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | /** |
| 6 | * Runtime binding for `mediaconvert:CreateJob` — submit a transcode job from |
| 7 | * runtime code, the classic "S3 upload event → Lambda → transcode" workflow. |
| 8 | * Also grants `iam:PassRole` (conditioned to `mediaconvert.amazonaws.com`) |
| 9 | * for the S3-access role the job passes to the service. |
| 10 | * |
| 11 | * Job ids are server-assigned at runtime, so the binding takes no arguments |
| 12 | * and grants `mediaconvert:CreateJob` on `*`. Provide the implementation |
| 13 | * with `Effect.provide(AWS.MediaConvert.CreateJobHttp)`. |
| 14 | * |
| 15 | * ### Submitting Jobs |
| 16 | * **Example:** Transcode an Uploaded File |
| 17 | * ```typescript |
| 18 | * // init |
| 19 | * const createJob = yield* AWS.MediaConvert.CreateJob(); |
| 20 | * |
| 21 | * // runtime |
| 22 | * const { Job } = yield* createJob({ |
| 23 | * Role: roleArn, |
| 24 | * JobTemplate: template.jobTemplateName, |
| 25 | * Settings: { Inputs: [{ FileInput: `s3://${bucket}/${key}` }] }, |
| 26 | * }); |
| 27 | * ``` |
| 28 | * |
| 29 | * @binding |
| 30 | */ |
| 31 | export interface CreateJob extends Binding.Service< |
| 32 | CreateJob, |
| 33 | "AWS.MediaConvert.CreateJob", |
| 34 | () => Effect.Effect< |
| 35 | ( |
| 36 | request: mediaconvert.CreateJobRequest, |
| 37 | ) => Effect.Effect< |
| 38 | mediaconvert.CreateJobResponse, |
| 39 | mediaconvert.CreateJobError |
| 40 | > |
| 41 | > |
| 42 | > {} |
| 43 | export const CreateJob = Binding.Service<CreateJob>( |
| 44 | "AWS.MediaConvert.CreateJob", |
| 45 | ); |