| 1 | import type * as ecrpublic from "@distilled.cloud/aws/ecr-public"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { PublicRepository } from "./Repository.ts"; |
| 5 | |
| 6 | /** Request for {@link InitiateLayerUpload} — `repositoryName` is injected. */ |
| 7 | export interface InitiateLayerUploadRequest extends Omit< |
| 8 | ecrpublic.InitiateLayerUploadRequest, |
| 9 | "repositoryName" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for `ecr-public:InitiateLayerUpload`. |
| 14 | * |
| 15 | * Starts an image layer upload to the bound {@link PublicRepository}, |
| 16 | * returning the `uploadId` used by {@link UploadLayerPart} and |
| 17 | * {@link CompleteLayerUpload}. Provide the implementation with |
| 18 | * `Effect.provide(AWS.ECRPublic.InitiateLayerUploadHttp)`. |
| 19 | * |
| 20 | * ### Pushing Images |
| 21 | * **Example:** Start A Layer Upload |
| 22 | * ```typescript |
| 23 | * // init |
| 24 | * const initiateLayerUpload = yield* AWS.ECRPublic.InitiateLayerUpload(repository); |
| 25 | * |
| 26 | * // runtime |
| 27 | * const { uploadId } = yield* initiateLayerUpload(); |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | */ |
| 32 | export interface InitiateLayerUpload extends Binding.Service< |
| 33 | InitiateLayerUpload, |
| 34 | "AWS.ECRPublic.InitiateLayerUpload", |
| 35 | <R extends PublicRepository>( |
| 36 | repository: R, |
| 37 | ) => Effect.Effect< |
| 38 | ( |
| 39 | request?: InitiateLayerUploadRequest, |
| 40 | ) => Effect.Effect< |
| 41 | ecrpublic.InitiateLayerUploadResponse, |
| 42 | ecrpublic.InitiateLayerUploadError |
| 43 | > |
| 44 | > |
| 45 | > {} |
| 46 | |
| 47 | export const InitiateLayerUpload = Binding.Service<InitiateLayerUpload>( |
| 48 | "AWS.ECRPublic.InitiateLayerUpload", |
| 49 | ); |