The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as S3 from "@distilled.cloud/aws/s3"; |
| 2 | import * as Binding from "alchemy/Binding"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | import type { Bucket } from "./Bucket.ts"; |
| 5 | |
| 6 | export interface DeleteObjectsRequest extends Omit<S3.DeleteObjectsRequest, "Bucket"> {} |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `s3:DeleteObjects` (batch delete). |
| 10 | * |
| 11 | * Bind this operation to a bucket to get a callable that deletes up to 1,000 |
| 12 | * objects in a single request — the bucket name is injected automatically and |
| 13 | * `s3:DeleteObject`/`s3:DeleteObjectVersion` are granted on the bucket's |
| 14 | * objects. Provide the implementation with |
| 15 | * `Effect.provide(AWS.S3.DeleteObjectsHttp)`. |
| 16 | * ### Deleting Objects |
| 17 | * **Example:** Delete Several Objects at Once |
| 18 | * ```typescript |
| 19 | * // init — bind the operation to the bucket |
| 20 | * const deleteObjects = yield* AWS.S3.DeleteObjects(bucket); |
| 21 | * |
| 22 | * // runtime — per-key failures are reported in `Errors`, not thrown |
| 23 | * const result = yield* deleteObjects({ |
| 24 | * Delete: { |
| 25 | * Objects: [{ Key: "a.txt" }, { Key: "b.txt" }], |
| 26 | * Quiet: true, |
| 27 | * }, |
| 28 | * }); |
| 29 | * ``` |
| 30 | * |
| 31 | * @binding |
| 32 | */ |
| 33 | export interface DeleteObjects extends Binding.Service< |
| 34 | DeleteObjects, |
| 35 | "AWS.S3.DeleteObjects", |
| 36 | ( |
| 37 | bucket: Bucket, |
| 38 | ) => Effect.Effect< |
| 39 | (request: DeleteObjectsRequest) => Effect.Effect<S3.DeleteObjectsOutput, S3.DeleteObjectsError> |
| 40 | > |
| 41 | > {} |
| 42 | export const DeleteObjects = Binding.Service<DeleteObjects>("AWS.S3.DeleteObjects"); |