| 1 | import type * as codeartifact from "@distilled.cloud/aws/codeartifact"; |
| 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 CopyPackageVersions} — `domain`, `domainOwner`, and |
| 8 | * `destinationRepository` are injected from the bound {@link Repository}; |
| 9 | * `sourceRepository` names a sibling repository in the same domain. |
| 10 | */ |
| 11 | export interface CopyPackageVersionsRequest extends Omit< |
| 12 | codeartifact.CopyPackageVersionsRequest, |
| 13 | "domain" | "domainOwner" | "destinationRepository" |
| 14 | > {} |
| 15 | |
| 16 | /** |
| 17 | * Runtime binding for `codeartifact:CopyPackageVersions`. |
| 18 | * |
| 19 | * Copies package versions from another repository in the same domain into the |
| 20 | * bound repository (the destination) — the standard promotion flow from a |
| 21 | * staging repository to a release repository. Provide the implementation with |
| 22 | * `Effect.provide(AWS.CodeArtifact.CopyPackageVersionsHttp)`. |
| 23 | * ### Promoting Packages |
| 24 | * **Example:** Promote a Version from Staging |
| 25 | * ```typescript |
| 26 | * const copyVersions = yield* AWS.CodeArtifact.CopyPackageVersions(releaseRepo); |
| 27 | * |
| 28 | * const res = yield* copyVersions({ |
| 29 | * sourceRepository: "staging", |
| 30 | * format: "generic", |
| 31 | * namespace: "my-ns", |
| 32 | * package: "my-package", |
| 33 | * versions: ["1.0.0"], |
| 34 | * }); |
| 35 | * console.log(res.successfulVersions); |
| 36 | * ``` |
| 37 | * |
| 38 | * @binding |
| 39 | */ |
| 40 | export interface CopyPackageVersions extends Binding.Service< |
| 41 | CopyPackageVersions, |
| 42 | "AWS.CodeArtifact.CopyPackageVersions", |
| 43 | ( |
| 44 | repository: Repository, |
| 45 | ) => Effect.Effect< |
| 46 | ( |
| 47 | request: CopyPackageVersionsRequest, |
| 48 | ) => Effect.Effect< |
| 49 | codeartifact.CopyPackageVersionsResult, |
| 50 | codeartifact.CopyPackageVersionsError |
| 51 | > |
| 52 | > |
| 53 | > {} |
| 54 | |
| 55 | export const CopyPackageVersions = Binding.Service<CopyPackageVersions>( |
| 56 | "AWS.CodeArtifact.CopyPackageVersions", |
| 57 | ); |