@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 69 lines 2.48 KB
Raw
1 import type * as comprehend from "@distilled.cloud/aws/comprehend";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { Role } from "../IAM/Role.ts";
5
6 /**
7 * `StartEventsDetectionJob` request with `DataAccessRoleArn` defaulting to the role the
8 * binding was constructed with.
9 */
10 export interface StartEventsDetectionJobRequest extends Omit<
11 comprehend.StartEventsDetectionJobRequest,
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 `StartEventsDetectionJob(role)`
18 */
19 DataAccessRoleArn?: string;
20 }
21
22 /**
23 * Runtime binding for `comprehend:StartEventsDetectionJob` — start an asynchronous
24 * event 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:StartEventsDetectionJob`
31 * action (which has no resource-level IAM). Track the job with
32 * {@link DescribeEventsDetectionJob} and stop it with
33 * {@link StopEventsDetectionJob}.
34 *
35 * ### Starting Analysis Jobs
36 * **Example:** Start an Asynchronous Events Detection Job
37 * ```typescript
38 * // deploy time — bind the Comprehend data-access role
39 * const startEventsDetectionJob = yield* AWS.Comprehend.StartEventsDetectionJob(dataAccessRole);
40 *
41 * // runtime
42 * const job = yield* startEventsDetectionJob({
43 * TargetEventTypes: ["BANKRUPTCY", "EMPLOYMENT"],
44 * InputDataConfig: { S3Uri: "s3://my-bucket/input/", InputFormat: "ONE_DOC_PER_LINE" },
45 * OutputDataConfig: { S3Uri: "s3://my-bucket/output/" },
46 * LanguageCode: "en",
47 * });
48 * // job.JobId, job.JobStatus === "SUBMITTED"
49 * ```
50 *
51 * @binding
52 */
53 export interface StartEventsDetectionJob extends Binding.Service<
54 StartEventsDetectionJob,
55 "AWS.Comprehend.StartEventsDetectionJob",
56 <R extends Role>(
57 dataAccessRole: R,
58 ) => Effect.Effect<
59 (
60 request: StartEventsDetectionJobRequest,
61 ) => Effect.Effect<
62 comprehend.StartEventsDetectionJobResponse,
63 comprehend.StartEventsDetectionJobError
64 >
65 >
66 > {}
67 export const StartEventsDetectionJob = Binding.Service<StartEventsDetectionJob>(
68 "AWS.Comprehend.StartEventsDetectionJob",
69 );