1import type * as ecr from "@distilled.cloud/aws/ecr";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Repository } from "./Repository.ts";
5
6/**
7 * Request for {@link BatchCheckLayerAvailability} — `repositoryName` is injected from the
8 * bound {@link Repository} (the registry defaults to the caller's account).
9 */
10export interface BatchCheckLayerAvailabilityRequest extends Omit<
11 ecr.BatchCheckLayerAvailabilityRequest,
12 "registryId" | "repositoryName"
13> {}
14
15/**
16 * Runtime binding for `ecr:BatchCheckLayerAvailability`.
17 *
18 * Checks whether image layers already exist in the bound repository — pushed clients call this before uploading to skip blobs the registry already has. Provide the implementation with
19 * `Effect.provide(AWS.ECR.BatchCheckLayerAvailabilityHttp)`.
20 * ### Pushing Images
21 * **Example:** Skip Already-Pushed Layers
22 * ```typescript
23 * const checkLayers = yield* AWS.ECR.BatchCheckLayerAvailability(repository);
24 *
25 * const res = yield* checkLayers({ layerDigests: ["sha256:…"] });
26 * const missing = res.layers?.filter((l) => l.layerAvailability === "UNAVAILABLE");
27 * ```
28 *
29 * @binding
30 */
31export interface BatchCheckLayerAvailability extends Binding.Service<
32 BatchCheckLayerAvailability,
33 "AWS.ECR.BatchCheckLayerAvailability",
34 (
35 repository: Repository,
36 ) => Effect.Effect<
37 (
38 request: BatchCheckLayerAvailabilityRequest,
39 ) => Effect.Effect<
40 ecr.BatchCheckLayerAvailabilityResponse,
41 ecr.BatchCheckLayerAvailabilityError
42 >
43 >
44> {}
45
46export const BatchCheckLayerAvailability =
47 Binding.Service<BatchCheckLayerAvailability>(
48 "AWS.ECR.BatchCheckLayerAvailability",
49 );