| 1 | import type * as batch from "@distilled.cloud/aws/batch"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { JobQueue } from "./JobQueue.ts"; |
| 5 | |
| 6 | export interface CancelJobRequest extends batch.CancelJobRequest {} |
| 7 | |
| 8 | /** |
| 9 | * Cancel a queued AWS Batch job from runtime code. Jobs in `SUBMITTED`, |
| 10 | * `PENDING`, or `RUNNABLE` state are cancelled; jobs that already progressed |
| 11 | * to `STARTING`/`RUNNING` are NOT cancelled (use `TerminateJob` for those) — |
| 12 | * the request still succeeds. |
| 13 | * |
| 14 | * ### Cancelling Jobs |
| 15 | * **Example:** Cancel a queued job |
| 16 | * ```typescript |
| 17 | * const cancelJob = yield* Batch.CancelJob(queue); |
| 18 | * yield* cancelJob({ jobId, reason: "superseded" }); |
| 19 | * ``` |
| 20 | * |
| 21 | * @binding |
| 22 | */ |
| 23 | export interface CancelJob extends Binding.Service< |
| 24 | CancelJob, |
| 25 | "AWS.Batch.CancelJob", |
| 26 | ( |
| 27 | queue: JobQueue, |
| 28 | ) => Effect.Effect< |
| 29 | ( |
| 30 | request: CancelJobRequest, |
| 31 | ) => Effect.Effect<batch.CancelJobResponse, batch.CancelJobError> |
| 32 | > |
| 33 | > {} |
| 34 | export const CancelJob = Binding.Service<CancelJob>("AWS.Batch.CancelJob"); |