| 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 PutImage} — `repositoryName` is injected. */ |
| 7 | export interface PutImageRequest extends Omit< |
| 8 | ecrpublic.PutImageRequest, |
| 9 | "repositoryName" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for `ecr-public:PutImage`. |
| 14 | * |
| 15 | * Creates or updates an image manifest in the bound |
| 16 | * {@link PublicRepository} — the final step of an image push after all |
| 17 | * referenced layers are uploaded ({@link InitiateLayerUpload} → |
| 18 | * {@link UploadLayerPart} → {@link CompleteLayerUpload}). Provide the |
| 19 | * implementation with `Effect.provide(AWS.ECRPublic.PutImageHttp)`. |
| 20 | * |
| 21 | * ### Pushing Images |
| 22 | * **Example:** Put An Image Manifest |
| 23 | * ```typescript |
| 24 | * // init |
| 25 | * const putImage = yield* AWS.ECRPublic.PutImage(repository); |
| 26 | * |
| 27 | * // runtime |
| 28 | * const result = yield* putImage({ |
| 29 | * imageManifest: JSON.stringify(manifest), |
| 30 | * imageManifestMediaType: "application/vnd.oci.image.manifest.v1+json", |
| 31 | * imageTag: "latest", |
| 32 | * }); |
| 33 | * ``` |
| 34 | * |
| 35 | * @binding |
| 36 | */ |
| 37 | export interface PutImage extends Binding.Service< |
| 38 | PutImage, |
| 39 | "AWS.ECRPublic.PutImage", |
| 40 | <R extends PublicRepository>( |
| 41 | repository: R, |
| 42 | ) => Effect.Effect< |
| 43 | ( |
| 44 | request: PutImageRequest, |
| 45 | ) => Effect.Effect<ecrpublic.PutImageResponse, ecrpublic.PutImageError> |
| 46 | > |
| 47 | > {} |
| 48 | |
| 49 | export const PutImage = Binding.Service<PutImage>("AWS.ECRPublic.PutImage"); |