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