| 1 | import type * as dataexchange from "@distilled.cloud/aws/dataexchange"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | /** |
| 6 | * Runtime binding for `dataexchange:GetJob`. |
| 7 | * |
| 8 | * Reads a job's state (`WAITING`, `IN_PROGRESS`, `COMPLETED`, `ERROR`, |
| 9 | * …) and typed error details — the polling half of every import/export |
| 10 | * flow. |
| 11 | * Provide the implementation with |
| 12 | * `Effect.provide(AWS.DataExchange.GetJobHttp)`. |
| 13 | * ### Import & Export Jobs |
| 14 | * **Example:** Poll A Job Until It Completes |
| 15 | * ```typescript |
| 16 | * const getJob = yield* AWS.DataExchange.GetJob(); |
| 17 | * |
| 18 | * // runtime |
| 19 | * const done = yield* getJob({ JobId: job.Id! }).pipe( |
| 20 | * Effect.repeat({ |
| 21 | * schedule: Schedule.spaced("2 seconds"), |
| 22 | * until: (j) => j.State === "COMPLETED" || j.State === "ERROR", |
| 23 | * times: 30, |
| 24 | * }), |
| 25 | * ); |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface GetJob extends Binding.Service< |
| 31 | GetJob, |
| 32 | "AWS.DataExchange.GetJob", |
| 33 | () => Effect.Effect< |
| 34 | ( |
| 35 | request: dataexchange.GetJobRequest, |
| 36 | ) => Effect.Effect<dataexchange.GetJobResponse, dataexchange.GetJobError> |
| 37 | > |
| 38 | > {} |
| 39 | export const GetJob = Binding.Service<GetJob>("AWS.DataExchange.GetJob"); |