| 1 | import * as b2bi from "@distilled.cloud/aws/b2bi"; |
| 2 | import * as Layer from "effect/Layer"; |
| 3 | import { makeTransformerScopedHttpBinding } from "./BindingHttp.ts"; |
| 4 | import { StartTransformerJob } from "./StartTransformerJob.ts"; |
| 5 | |
| 6 | export const StartTransformerJobHttp = Layer.effect( |
| 7 | StartTransformerJob, |
| 8 | makeTransformerScopedHttpBinding({ |
| 9 | tag: "AWS.B2BI.StartTransformerJob", |
| 10 | operation: b2bi.startTransformerJob, |
| 11 | actions: ["b2bi:StartTransformerJob"], |
| 12 | // B2BI reads `inputFile` and writes `outputLocation` through the |
| 13 | // caller's session (verified live: "Access denied when getting object |
| 14 | // attributes from s3://…" without these). The buckets are request-time |
| 15 | // values, so the grant cannot be resource-scoped here. |
| 16 | companionStatements: [ |
| 17 | { |
| 18 | Effect: "Allow", |
| 19 | Action: [ |
| 20 | "s3:GetObject", |
| 21 | "s3:GetObjectAttributes", |
| 22 | "s3:PutObject", |
| 23 | "s3:ListBucket", |
| 24 | ], |
| 25 | Resource: ["*"], |
| 26 | }, |
| 27 | ], |
| 28 | }), |
| 29 | ); |