| 1 | import type * as comprehend from "@distilled.cloud/aws/comprehend"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Role } from "../IAM/Role.ts"; |
| 5 | |
| 6 | /** |
| 7 | * `StartPiiEntitiesDetectionJob` request with `DataAccessRoleArn` defaulting to the role the |
| 8 | * binding was constructed with. |
| 9 | */ |
| 10 | export interface StartPiiEntitiesDetectionJobRequest extends Omit< |
| 11 | comprehend.StartPiiEntitiesDetectionJobRequest, |
| 12 | "DataAccessRoleArn" |
| 13 | > { |
| 14 | /** |
| 15 | * IAM role Amazon Comprehend assumes to read the input documents and write |
| 16 | * the results. |
| 17 | * @default the data-access role bound via `StartPiiEntitiesDetectionJob(role)` |
| 18 | */ |
| 19 | DataAccessRoleArn?: string; |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * Runtime binding for `comprehend:StartPiiEntitiesDetectionJob` — start an asynchronous |
| 24 | * PII entity detection job over a collection of documents in S3. |
| 25 | * |
| 26 | * The binding is constructed with the **data-access role** (the IAM role |
| 27 | * Amazon Comprehend assumes to read the input documents and write results; |
| 28 | * its trust policy must allow `comprehend.amazonaws.com`). The role's ARN is |
| 29 | * injected as `DataAccessRoleArn` on every runtime request and the host is |
| 30 | * granted `iam:PassRole` on it alongside the `comprehend:StartPiiEntitiesDetectionJob` |
| 31 | * action (which has no resource-level IAM). Track the job with |
| 32 | * {@link DescribePiiEntitiesDetectionJob} and stop it with |
| 33 | * {@link StopPiiEntitiesDetectionJob}. |
| 34 | * |
| 35 | * ### Starting Analysis Jobs |
| 36 | * **Example:** Start an Asynchronous PiiEntities Detection Job |
| 37 | * ```typescript |
| 38 | * // deploy time — bind the Comprehend data-access role |
| 39 | * const startPiiEntitiesDetectionJob = yield* AWS.Comprehend.StartPiiEntitiesDetectionJob(dataAccessRole); |
| 40 | * |
| 41 | * // runtime |
| 42 | * const job = yield* startPiiEntitiesDetectionJob({ |
| 43 | * InputDataConfig: { S3Uri: "s3://my-bucket/input/", InputFormat: "ONE_DOC_PER_LINE" }, |
| 44 | * OutputDataConfig: { S3Uri: "s3://my-bucket/output/" }, |
| 45 | * LanguageCode: "en", |
| 46 | * }); |
| 47 | * // job.JobId, job.JobStatus === "SUBMITTED" |
| 48 | * ``` |
| 49 | * |
| 50 | * @binding |
| 51 | */ |
| 52 | export interface StartPiiEntitiesDetectionJob extends Binding.Service< |
| 53 | StartPiiEntitiesDetectionJob, |
| 54 | "AWS.Comprehend.StartPiiEntitiesDetectionJob", |
| 55 | <R extends Role>( |
| 56 | dataAccessRole: R, |
| 57 | ) => Effect.Effect< |
| 58 | ( |
| 59 | request: StartPiiEntitiesDetectionJobRequest, |
| 60 | ) => Effect.Effect< |
| 61 | comprehend.StartPiiEntitiesDetectionJobResponse, |
| 62 | comprehend.StartPiiEntitiesDetectionJobError |
| 63 | > |
| 64 | > |
| 65 | > {} |
| 66 | export const StartPiiEntitiesDetectionJob = |
| 67 | Binding.Service<StartPiiEntitiesDetectionJob>( |
| 68 | "AWS.Comprehend.StartPiiEntitiesDetectionJob", |
| 69 | ); |