1import * as S3 from "@distilled.cloud/aws/s3";
2import * as Effect from "effect/Effect";
3
4import * as Binding from "../../Binding.ts";
5import type { Bucket } from "./Bucket.ts";
6
7export interface UploadPartCopyRequest extends Omit<
8 S3.UploadPartCopyRequest,
9 "Bucket"
10> {}
11
12/**
13 * Runtime binding for `s3:UploadPartCopy`.
14 *
15 * Bind this operation to a bucket to get a callable that uploads a multipart
16 * part by copying from an existing object — the destination bucket name is
17 * injected automatically and `s3:PutObject`, `s3:GetObject`, and
18 * `s3:GetObjectVersion` are granted on the bucket's objects. Select a source
19 * version by appending `?versionId=<encoded version ID>` to the URL-encoded
20 * `CopySource` bucket/key. Copying from a *different* source bucket additionally
21 * requires read access to that bucket (bind `GetObject` on it). Provide the
22 * implementation with `Effect.provide(AWS.S3.UploadPartCopyHttp)`.
23 * ### Multipart Uploads
24 * **Example:** Copy an Existing Object as a Part
25 * ```typescript
26 * const uploadPartCopy = yield* AWS.S3.UploadPartCopy(bucket);
27 *
28 * const part = yield* uploadPartCopy({
29 * Key: "combined.bin",
30 * UploadId: uploadId,
31 * PartNumber: 1,
32 * CopySource: `${bucketName}/source.bin`,
33 * });
34 * ```
35 *
36 * @binding
37 */
38export interface UploadPartCopy extends Binding.Service<
39 UploadPartCopy,
40 "AWS.S3.UploadPartCopy",
41 (
42 bucket: Bucket,
43 ) => Effect.Effect<
44 (
45 request: UploadPartCopyRequest,
46 ) => Effect.Effect<S3.UploadPartCopyOutput, S3.UploadPartCopyError>
47 >
48> {}
49export const UploadPartCopy = Binding.Service<UploadPartCopy>(
50 "AWS.S3.UploadPartCopy",
51);