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 UploadPartRequest extends Omit<
8 S3.UploadPartRequest,
9 "Bucket"
10> {}
11
12/**
13 * Runtime binding for `s3:UploadPart`.
14 *
15 * Uploads one part of a multipart upload started with
16 * `CreateMultipartUpload`. Keep each part's returned `ETag` — the final
17 * `CompleteMultipartUpload` call needs the full `{ ETag, PartNumber }` list.
18 * Provide the implementation with `Effect.provide(AWS.S3.UploadPartHttp)`.
19 * ### Multipart Uploads
20 * **Example:** Upload a Part
21 * ```typescript
22 * // init — bind the operation to the bucket
23 * const uploadPart = yield* AWS.S3.UploadPart(bucket);
24 *
25 * // runtime — PartNumber is 1-based; collect the ETag for completion
26 * const part = yield* uploadPart({
27 * Key: "backups/archive.tar",
28 * UploadId,
29 * PartNumber: 1,
30 * Body: chunk, // 5 MiB–5 GiB except the last part
31 * });
32 * parts.push({ ETag: part.ETag, PartNumber: 1 });
33 * ```
34 *
35 * @binding
36 */
37export interface UploadPart extends Binding.Service<
38 UploadPart,
39 "AWS.S3.UploadPart",
40 (
41 bucket: Bucket,
42 ) => Effect.Effect<
43 (
44 request: UploadPartRequest,
45 ) => Effect.Effect<S3.UploadPartOutput, S3.UploadPartError>
46 >
47> {}
48export const UploadPart = Binding.Service<UploadPart>("AWS.S3.UploadPart");