| 1 | import type * as medicalimaging from "@distilled.cloud/aws/medical-imaging"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Role } from "../IAM/Role.ts"; |
| 5 | import type { Datastore } from "./Datastore.ts"; |
| 6 | |
| 7 | /** |
| 8 | * `StartDICOMImportJob` request with `datastoreId` injected from the bound |
| 9 | * data store and `dataAccessRoleArn` defaulting to the bound role. |
| 10 | */ |
| 11 | export interface StartDICOMImportJobRequest extends Omit< |
| 12 | medicalimaging.StartDICOMImportJobRequest, |
| 13 | "datastoreId" | "dataAccessRoleArn" |
| 14 | > { |
| 15 | /** |
| 16 | * IAM role AWS HealthImaging assumes to read the DICOM P10 input from S3 |
| 17 | * and write the import manifests. |
| 18 | * @default the data-access role bound via `StartDICOMImportJob(datastore, role)` |
| 19 | */ |
| 20 | dataAccessRoleArn?: string; |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * Runtime binding for the `StartDICOMImportJob` operation (IAM action |
| 25 | * `medical-imaging:StartDICOMImportJob`), scoped to one {@link Datastore}. |
| 26 | * |
| 27 | * Starts a bulk import of DICOM P10 files from S3 into the bound data |
| 28 | * store. The binding is constructed with the data store and the |
| 29 | * **data-access role** (the IAM role HealthImaging assumes to read |
| 30 | * `inputS3Uri` and write the `outputS3Uri` manifests; its trust policy must |
| 31 | * allow `medical-imaging.amazonaws.com`). The role's ARN is injected as |
| 32 | * `dataAccessRoleArn` on every runtime request and the host is granted |
| 33 | * `iam:PassRole` on it alongside `medical-imaging:StartDICOMImportJob` on |
| 34 | * the data store. Track the job with {@link GetDICOMImportJob}. Provide the |
| 35 | * implementation with |
| 36 | * `Effect.provide(AWS.MedicalImaging.StartDICOMImportJobHttp)`. |
| 37 | * |
| 38 | * ### Importing DICOM Data |
| 39 | * **Example:** Start a Bulk DICOM Import Job |
| 40 | * ```typescript |
| 41 | * // deploy time — bind the data store and the HealthImaging data-access role |
| 42 | * const startImport = yield* MedicalImaging.StartDICOMImportJob(datastore, dataAccessRole); |
| 43 | * |
| 44 | * // runtime |
| 45 | * const job = yield* startImport({ |
| 46 | * clientToken: crypto.randomUUID(), |
| 47 | * inputS3Uri: "s3://my-bucket/dicom-input/", |
| 48 | * outputS3Uri: "s3://my-bucket/dicom-output/", |
| 49 | * }); |
| 50 | * // job.jobId, job.jobStatus === "SUBMITTED" |
| 51 | * ``` |
| 52 | * |
| 53 | * @binding |
| 54 | */ |
| 55 | export interface StartDICOMImportJob extends Binding.Service< |
| 56 | StartDICOMImportJob, |
| 57 | "AWS.MedicalImaging.StartDICOMImportJob", |
| 58 | ( |
| 59 | datastore: Datastore, |
| 60 | dataAccessRole: Role, |
| 61 | ) => Effect.Effect< |
| 62 | ( |
| 63 | request: StartDICOMImportJobRequest, |
| 64 | ) => Effect.Effect< |
| 65 | medicalimaging.StartDICOMImportJobResponse, |
| 66 | medicalimaging.StartDICOMImportJobError |
| 67 | > |
| 68 | > |
| 69 | > {} |
| 70 | export const StartDICOMImportJob = Binding.Service<StartDICOMImportJob>( |
| 71 | "AWS.MedicalImaging.StartDICOMImportJob", |
| 72 | ); |