| 1 | import type * as deadline from "@distilled.cloud/aws/deadline"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Queue } from "./Queue.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `deadline:UpdateStep`. |
| 8 | * |
| 9 | * Retargets every task of a step in the bound {@link Queue} — requeue |
| 10 | * (`READY`), cancel (`CANCELED`), suspend (`SUSPENDED`), or force-fail/ |
| 11 | * succeed the step's tasks in one call. The queue's `farmId`/`queueId` are |
| 12 | * injected from the binding. Provide the implementation with |
| 13 | * `Effect.provide(AWS.Deadline.UpdateStepHttp)`. |
| 14 | * ### Managing Steps |
| 15 | * **Example:** Requeue A Step's Tasks |
| 16 | * ```typescript |
| 17 | * // init — bind the operation to the queue |
| 18 | * const updateStep = yield* AWS.Deadline.UpdateStep(queue); |
| 19 | * |
| 20 | * // runtime |
| 21 | * yield* updateStep({ jobId, stepId, targetTaskRunStatus: "READY" }); |
| 22 | * ``` |
| 23 | * |
| 24 | * @binding |
| 25 | */ |
| 26 | export interface UpdateStep extends Binding.Service< |
| 27 | UpdateStep, |
| 28 | "AWS.Deadline.UpdateStep", |
| 29 | ( |
| 30 | queue: Queue, |
| 31 | ) => Effect.Effect< |
| 32 | ( |
| 33 | request: Omit<deadline.UpdateStepRequest, "farmId" | "queueId">, |
| 34 | ) => Effect.Effect<deadline.UpdateStepResponse, deadline.UpdateStepError> |
| 35 | > |
| 36 | > {} |
| 37 | export const UpdateStep = Binding.Service<UpdateStep>( |
| 38 | "AWS.Deadline.UpdateStep", |
| 39 | ); |