1import type * as glacier from "@distilled.cloud/aws/glacier";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Vault } from "./Vault.ts";
5
6/**
7 * `UploadArchive` request with `accountId` and `vaultName` injected from the bound
8 * {@link Vault}.
9 */
10export interface UploadArchiveRequest extends Omit<
11 glacier.UploadArchiveInput,
12 "accountId" | "vaultName"
13> {}
14
15/**
16 * Runtime binding for the `UploadArchive` operation (IAM action
17 * `glacier:UploadArchive` on the vault ARN).
18 *
19 * Uploads an archive to the bound {@link Vault} in a single request (up to
20 * 4 GiB; use the multipart bindings for larger archives). The response
21 * carries the new `archiveId` — Glacier has no list-archives API outside of
22 * inventory jobs, so persist it.
23 * Provide the implementation with
24 * `Effect.provide(AWS.Glacier.UploadArchiveHttp)`.
25 * ### Uploading Archives
26 * **Example:** Upload a small archive
27 * ```typescript
28 * const uploadArchive = yield* AWS.Glacier.UploadArchive(vault);
29 *
30 * const { archiveId, checksum } = yield* uploadArchive({
31 * archiveDescription: "nightly backup",
32 * checksum: treeHash,
33 * body: payload,
34 * });
35 * ```
36 *
37 * @binding
38 */
39export interface UploadArchive extends Binding.Service<
40 UploadArchive,
41 "AWS.Glacier.UploadArchive",
42 (
43 vault: Vault,
44 ) => Effect.Effect<
45 (
46 request?: UploadArchiveRequest,
47 ) => Effect.Effect<
48 glacier.ArchiveCreationOutput,
49 glacier.UploadArchiveError
50 >
51 >
52> {}
53export const UploadArchive = Binding.Service<UploadArchive>(
54 "AWS.Glacier.UploadArchive",
55);