| 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 PutImage} — `repositoryName` is injected from the |
| 8 | * bound {@link Repository} (the registry defaults to the caller's account). |
| 9 | */ |
| 10 | export interface PutImageRequest extends Omit< |
| 11 | ecr.PutImageRequest, |
| 12 | "registryId" | "repositoryName" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for `ecr:PutImage`. |
| 17 | * |
| 18 | * Writes an image manifest to the bound repository — the final step of a push, and the write half of re-tagging (`BatchGetImage` → `PutImage` with a new tag). Provide the implementation with |
| 19 | * `Effect.provide(AWS.ECR.PutImageHttp)`. |
| 20 | * ### Pushing Images |
| 21 | * **Example:** Re-tag an Existing Image |
| 22 | * ```typescript |
| 23 | * const batchGetImage = yield* AWS.ECR.BatchGetImage(repository); |
| 24 | * const putImage = yield* AWS.ECR.PutImage(repository); |
| 25 | * |
| 26 | * const res = yield* batchGetImage({ imageIds: [{ imageTag: "latest" }] }); |
| 27 | * yield* putImage({ |
| 28 | * imageManifest: res.images![0]!.imageManifest!, |
| 29 | * imageTag: "stable", |
| 30 | * }); |
| 31 | * ``` |
| 32 | * |
| 33 | * @binding |
| 34 | */ |
| 35 | export interface PutImage extends Binding.Service< |
| 36 | PutImage, |
| 37 | "AWS.ECR.PutImage", |
| 38 | ( |
| 39 | repository: Repository, |
| 40 | ) => Effect.Effect< |
| 41 | ( |
| 42 | request: PutImageRequest, |
| 43 | ) => Effect.Effect<ecr.PutImageResponse, ecr.PutImageError> |
| 44 | > |
| 45 | > {} |
| 46 | |
| 47 | export const PutImage = Binding.Service<PutImage>("AWS.ECR.PutImage"); |