| 1 | import type * as glue from "@distilled.cloud/aws/glue"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Job } from "./Job.ts"; |
| 5 | |
| 6 | export interface GetJobBookmarkRequest extends Omit< |
| 7 | glue.GetJobBookmarkRequest, |
| 8 | "JobName" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `glue:GetJobBookmark`. |
| 13 | * |
| 14 | * Reads the bound {@link Job}'s bookmark entry — the incremental-processing |
| 15 | * checkpoint Glue keeps when a job runs with `--job-bookmark-option |
| 16 | * job-bookmark-enable`. Fails with the typed `EntityNotFoundException` when |
| 17 | * the job has never recorded a bookmark. The job name is injected from the |
| 18 | * binding. Provide the implementation with |
| 19 | * `Effect.provide(AWS.Glue.GetJobBookmarkHttp)`. |
| 20 | * ### Job Bookmarks |
| 21 | * **Example:** Read the Bookmark |
| 22 | * ```typescript |
| 23 | * // init |
| 24 | * const getJobBookmark = yield* AWS.Glue.GetJobBookmark(job); |
| 25 | * |
| 26 | * // runtime |
| 27 | * const entry = yield* getJobBookmark().pipe( |
| 28 | * Effect.map((r) => r.JobBookmarkEntry), |
| 29 | * Effect.catchTag("EntityNotFoundException", () => |
| 30 | * Effect.succeed(undefined), |
| 31 | * ), |
| 32 | * ); |
| 33 | * ``` |
| 34 | * |
| 35 | * @binding |
| 36 | */ |
| 37 | export interface GetJobBookmark extends Binding.Service< |
| 38 | GetJobBookmark, |
| 39 | "AWS.Glue.GetJobBookmark", |
| 40 | ( |
| 41 | job: Job, |
| 42 | ) => Effect.Effect< |
| 43 | ( |
| 44 | request?: GetJobBookmarkRequest, |
| 45 | ) => Effect.Effect<glue.GetJobBookmarkResponse, glue.GetJobBookmarkError> |
| 46 | > |
| 47 | > {} |
| 48 | |
| 49 | export const GetJobBookmark = Binding.Service<GetJobBookmark>( |
| 50 | "AWS.Glue.GetJobBookmark", |
| 51 | ); |