| 1 | import type * as b2bi from "@distilled.cloud/aws/b2bi"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Transformer } from "./Transformer.ts"; |
| 5 | |
| 6 | export interface GetTransformerJobRequest extends Omit< |
| 7 | b2bi.GetTransformerJobRequest, |
| 8 | "transformerId" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `b2bi:GetTransformerJob`. |
| 13 | * |
| 14 | * Polls the status of an asynchronous transformer job started with |
| 15 | * {@link StartTransformerJob} — `status` progresses from `running` to |
| 16 | * `succeeded` (with `outputFiles`) or `failed` (with `message`). Provide the |
| 17 | * implementation with `Effect.provide(AWS.B2BI.GetTransformerJobHttp)`. |
| 18 | * ### Running Transformer Jobs |
| 19 | * **Example:** Poll a Transformer Job Until It Finishes |
| 20 | * ```typescript |
| 21 | * // init — grants b2bi:GetTransformerJob on the transformer |
| 22 | * const getTransformerJob = yield* AWS.B2BI.GetTransformerJob(transformer); |
| 23 | * |
| 24 | * // runtime |
| 25 | * const job = yield* getTransformerJob({ transformerJobId }).pipe( |
| 26 | * Effect.repeat({ |
| 27 | * schedule: Schedule.spaced("2 seconds"), |
| 28 | * until: (job) => job.status !== "running", |
| 29 | * times: 30, |
| 30 | * }), |
| 31 | * ); |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface GetTransformerJob extends Binding.Service< |
| 37 | GetTransformerJob, |
| 38 | "AWS.B2BI.GetTransformerJob", |
| 39 | ( |
| 40 | transformer: Transformer, |
| 41 | ) => Effect.Effect< |
| 42 | ( |
| 43 | request: GetTransformerJobRequest, |
| 44 | ) => Effect.Effect< |
| 45 | b2bi.GetTransformerJobResponse, |
| 46 | b2bi.GetTransformerJobError |
| 47 | > |
| 48 | > |
| 49 | > {} |
| 50 | export const GetTransformerJob = Binding.Service<GetTransformerJob>( |
| 51 | "AWS.B2BI.GetTransformerJob", |
| 52 | ); |