| 1 | import type * as s3control from "@distilled.cloud/aws/s3-control"; |
| 2 | import type * as sts from "@distilled.cloud/aws/sts"; |
| 3 | import type * as Effect from "effect/Effect"; |
| 4 | import * as Binding from "../../Binding.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `s3:CreateJob` (S3 Batch Operations). |
| 8 | * |
| 9 | * Submits a large-scale batch job — copy, tag, ACL, restore, or |
| 10 | * Lambda-invoke — over a manifest of S3 objects, e.g. an ingest Lambda that |
| 11 | * kicks off a bulk re-tagging run. The binding also grants `iam:PassRole` so |
| 12 | * the function can hand the service the job's execution role. The account id |
| 13 | * is resolved once via `sts:GetCallerIdentity`. Provide the implementation |
| 14 | * with `Effect.provide(AWS.S3Control.CreateJobHttp)`. |
| 15 | * ### Running Batch Operations Jobs |
| 16 | * **Example:** Submit a Suspended Tagging Job |
| 17 | * ```typescript |
| 18 | * // init — account-level binding, no resource argument |
| 19 | * const createJob = yield* AWS.S3Control.CreateJob(); |
| 20 | * |
| 21 | * // runtime |
| 22 | * const { JobId } = yield* createJob({ |
| 23 | * ConfirmationRequired: true, |
| 24 | * Priority: 1, |
| 25 | * RoleArn: batchRoleArn, |
| 26 | * Operation: { S3PutObjectTagging: { TagSet: [{ Key: "swept", Value: "true" }] } }, |
| 27 | * Report: { Enabled: false }, |
| 28 | * ClientRequestToken: token, |
| 29 | * ManifestGenerator: { |
| 30 | * S3JobManifestGenerator: { |
| 31 | * SourceBucket: bucketArn, |
| 32 | * EnableManifestOutput: false, |
| 33 | * }, |
| 34 | * }, |
| 35 | * }); |
| 36 | * ``` |
| 37 | * |
| 38 | * @binding |
| 39 | */ |
| 40 | export interface CreateJob extends Binding.Service< |
| 41 | CreateJob, |
| 42 | "AWS.S3Control.CreateJob", |
| 43 | () => Effect.Effect< |
| 44 | ( |
| 45 | request: Omit<s3control.CreateJobRequest, "AccountId">, |
| 46 | ) => Effect.Effect< |
| 47 | s3control.CreateJobResult, |
| 48 | s3control.CreateJobError | sts.GetCallerIdentityError |
| 49 | > |
| 50 | > |
| 51 | > {} |
| 52 | export const CreateJob = Binding.Service<CreateJob>("AWS.S3Control.CreateJob"); |