| 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 { Crawler } from "./Crawler.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `glue:StartCrawler`. |
| 8 | * |
| 9 | * Starts a crawl of the bound {@link Crawler} on demand — the standard way |
| 10 | * to refresh the Data Catalog right after new data lands. Fails with the |
| 11 | * typed `CrawlerRunningException` if a crawl is already in progress. The |
| 12 | * crawler name is injected from the binding. Provide the implementation with |
| 13 | * `Effect.provide(AWS.Glue.StartCrawlerHttp)`. |
| 14 | * ### Running Crawlers |
| 15 | * **Example:** Kick Off a Crawl |
| 16 | * ```typescript |
| 17 | * // init |
| 18 | * const startCrawler = yield* AWS.Glue.StartCrawler(crawler); |
| 19 | * |
| 20 | * // runtime — tolerate an already-running crawl |
| 21 | * yield* startCrawler().pipe( |
| 22 | * Effect.catchTag("CrawlerRunningException", () => Effect.void), |
| 23 | * ); |
| 24 | * ``` |
| 25 | * |
| 26 | * @binding |
| 27 | */ |
| 28 | export interface StartCrawler extends Binding.Service< |
| 29 | StartCrawler, |
| 30 | "AWS.Glue.StartCrawler", |
| 31 | ( |
| 32 | crawler: Crawler, |
| 33 | ) => Effect.Effect< |
| 34 | () => Effect.Effect<glue.StartCrawlerResponse, glue.StartCrawlerError> |
| 35 | > |
| 36 | > {} |
| 37 | |
| 38 | export const StartCrawler = Binding.Service<StartCrawler>( |
| 39 | "AWS.Glue.StartCrawler", |
| 40 | ); |