| 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 BatchDeleteImage} — `repositoryName` is injected from the |
| 8 | * bound {@link Repository} (the registry defaults to the caller's account). |
| 9 | */ |
| 10 | export interface BatchDeleteImageRequest extends Omit< |
| 11 | ecr.BatchDeleteImageRequest, |
| 12 | "registryId" | "repositoryName" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for `ecr:BatchDeleteImage`. |
| 17 | * |
| 18 | * Deletes images (by tag or digest) from the bound repository. Missing images are reported in the response's `failures` array rather than as an error, so deletion is naturally idempotent. Provide the implementation with |
| 19 | * `Effect.provide(AWS.ECR.BatchDeleteImageHttp)`. |
| 20 | * ### Deleting Images |
| 21 | * **Example:** Delete an Image Tag |
| 22 | * ```typescript |
| 23 | * const batchDeleteImage = yield* AWS.ECR.BatchDeleteImage(repository); |
| 24 | * |
| 25 | * const res = yield* batchDeleteImage({ imageIds: [{ imageTag: "stale" }] }); |
| 26 | * console.log(res.imageIds?.length, "deleted"); |
| 27 | * ``` |
| 28 | * |
| 29 | * @binding |
| 30 | */ |
| 31 | export interface BatchDeleteImage extends Binding.Service< |
| 32 | BatchDeleteImage, |
| 33 | "AWS.ECR.BatchDeleteImage", |
| 34 | ( |
| 35 | repository: Repository, |
| 36 | ) => Effect.Effect< |
| 37 | ( |
| 38 | request: BatchDeleteImageRequest, |
| 39 | ) => Effect.Effect<ecr.BatchDeleteImageResponse, ecr.BatchDeleteImageError> |
| 40 | > |
| 41 | > {} |
| 42 | |
| 43 | export const BatchDeleteImage = Binding.Service<BatchDeleteImage>( |
| 44 | "AWS.ECR.BatchDeleteImage", |
| 45 | ); |