import type * as batch from "@distilled.cloud/aws/batch";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";
import type { JobQueue } from "./JobQueue.ts";
export interface CancelJobRequest extends batch.CancelJobRequest {}
/**
* Cancel a queued AWS Batch job from runtime code. Jobs in `SUBMITTED`,
* `PENDING`, or `RUNNABLE` state are cancelled; jobs that already progressed
* to `STARTING`/`RUNNING` are NOT cancelled (use `TerminateJob` for those) —
* the request still succeeds.
*
* ### Cancelling Jobs
* **Example:** Cancel a queued job
* ```typescript
* const cancelJob = yield* Batch.CancelJob(queue);
* yield* cancelJob({ jobId, reason: "superseded" });
* ```
*
* @binding
*/
export interface CancelJob extends Binding.Service<
CancelJob,
"AWS.Batch.CancelJob",
(
queue: JobQueue,
) => Effect.Effect<
(request: CancelJobRequest) => Effect.Effect<batch.CancelJobResponse, batch.CancelJobError>
>
> {}
export const CancelJob = Binding.Service<CancelJob>("AWS.Batch.CancelJob");