| 1 | import type * as healthlake from "@distilled.cloud/aws/healthlake"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { FHIRDatastore } from "./FHIRDatastore.ts"; |
| 5 | |
| 6 | /** |
| 7 | * `DescribeFHIRExportJob` request with `DatastoreId` injected from the bound |
| 8 | * data store. |
| 9 | */ |
| 10 | export interface DescribeFHIRExportJobRequest extends Omit< |
| 11 | healthlake.DescribeFHIRExportJobRequest, |
| 12 | "DatastoreId" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for the `DescribeFHIRExportJob` operation (IAM action |
| 17 | * `healthlake:DescribeFHIRExportJob`), scoped to one {@link FHIRDatastore}. |
| 18 | * |
| 19 | * Reads the properties of a bulk FHIR export job started with |
| 20 | * {@link StartFHIRExportJob} — poll `ExportJobProperties.JobStatus` until |
| 21 | * `COMPLETED` (or a failure status). Provide the implementation with |
| 22 | * `Effect.provide(AWS.HealthLake.DescribeFHIRExportJobHttp)`. |
| 23 | * |
| 24 | * ### Exporting FHIR Data |
| 25 | * **Example:** Poll an Export Job Until It Completes |
| 26 | * ```typescript |
| 27 | * const describeExport = yield* HealthLake.DescribeFHIRExportJob(datastore); |
| 28 | * |
| 29 | * const job = yield* describeExport({ JobId: jobId }).pipe( |
| 30 | * Effect.map((r) => r.ExportJobProperties), |
| 31 | * Effect.repeat({ |
| 32 | * schedule: Schedule.spaced("10 seconds"), |
| 33 | * until: (j) => j.JobStatus !== "SUBMITTED" && j.JobStatus !== "IN_PROGRESS", |
| 34 | * times: 30, |
| 35 | * }), |
| 36 | * ); |
| 37 | * ``` |
| 38 | * |
| 39 | * @binding |
| 40 | */ |
| 41 | export interface DescribeFHIRExportJob extends Binding.Service< |
| 42 | DescribeFHIRExportJob, |
| 43 | "AWS.HealthLake.DescribeFHIRExportJob", |
| 44 | ( |
| 45 | datastore: FHIRDatastore, |
| 46 | ) => Effect.Effect< |
| 47 | ( |
| 48 | request: DescribeFHIRExportJobRequest, |
| 49 | ) => Effect.Effect< |
| 50 | healthlake.DescribeFHIRExportJobResponse, |
| 51 | healthlake.DescribeFHIRExportJobError |
| 52 | > |
| 53 | > |
| 54 | > {} |
| 55 | export const DescribeFHIRExportJob = Binding.Service<DescribeFHIRExportJob>( |
| 56 | "AWS.HealthLake.DescribeFHIRExportJob", |
| 57 | ); |