| 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 | /** |
| 7 | * Request for {@link BatchCheckLayerAvailability} — `repositoryName` is |
| 8 | * injected. |
| 9 | */ |
| 10 | export interface BatchCheckLayerAvailabilityRequest extends Omit< |
| 11 | ecrpublic.BatchCheckLayerAvailabilityRequest, |
| 12 | "repositoryName" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for `ecr-public:BatchCheckLayerAvailability`. |
| 17 | * |
| 18 | * Checks whether image layers already exist in the bound |
| 19 | * {@link PublicRepository} so a push can skip re-uploading them. Provide |
| 20 | * the implementation with |
| 21 | * `Effect.provide(AWS.ECRPublic.BatchCheckLayerAvailabilityHttp)`. |
| 22 | * |
| 23 | * ### Pushing Images |
| 24 | * **Example:** Check Layer Availability Before Uploading |
| 25 | * ```typescript |
| 26 | * // init |
| 27 | * const checkLayers = yield* AWS.ECRPublic.BatchCheckLayerAvailability(repository); |
| 28 | * |
| 29 | * // runtime |
| 30 | * const result = yield* checkLayers({ layerDigests: ["sha256:abc..."] }); |
| 31 | * const missing = (result.failures ?? []).map((f) => f.layerDigest); |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface BatchCheckLayerAvailability extends Binding.Service< |
| 37 | BatchCheckLayerAvailability, |
| 38 | "AWS.ECRPublic.BatchCheckLayerAvailability", |
| 39 | <R extends PublicRepository>( |
| 40 | repository: R, |
| 41 | ) => Effect.Effect< |
| 42 | ( |
| 43 | request: BatchCheckLayerAvailabilityRequest, |
| 44 | ) => Effect.Effect< |
| 45 | ecrpublic.BatchCheckLayerAvailabilityResponse, |
| 46 | ecrpublic.BatchCheckLayerAvailabilityError |
| 47 | > |
| 48 | > |
| 49 | > {} |
| 50 | |
| 51 | export const BatchCheckLayerAvailability = |
| 52 | Binding.Service<BatchCheckLayerAvailability>( |
| 53 | "AWS.ECRPublic.BatchCheckLayerAvailability", |
| 54 | ); |