| 1 | import type * as codeconnections from "@distilled.cloud/aws/codeconnections"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { RepositoryLink } from "./RepositoryLink.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Request for {@link GetRepositorySyncStatus} — the branch and sync type to |
| 8 | * read; the repository link ID is injected from the bound resource. |
| 9 | */ |
| 10 | export interface GetRepositorySyncStatusRequest extends Omit< |
| 11 | codeconnections.GetRepositorySyncStatusInput, |
| 12 | "RepositoryLinkId" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for `codeconnections:GetRepositorySyncStatus`. |
| 17 | * |
| 18 | * Bind this operation to a {@link RepositoryLink} to read the latest Git |
| 19 | * sync attempt for a branch — its status and the sync events that led to |
| 20 | * it — from inside a function runtime. Useful for dashboards that surface |
| 21 | * whether a stack is in sync with its repository. Provide the |
| 22 | * implementation with |
| 23 | * `Effect.provide(AWS.CodeConnections.GetRepositorySyncStatusHttp)`. |
| 24 | * ### Monitoring Git Sync |
| 25 | * **Example:** Read a Branch's Latest Sync Attempt |
| 26 | * ```typescript |
| 27 | * // init — bind the operation to the repository link |
| 28 | * const getRepositorySyncStatus = |
| 29 | * yield* AWS.CodeConnections.GetRepositorySyncStatus(link); |
| 30 | * |
| 31 | * // runtime |
| 32 | * const { LatestSync } = yield* getRepositorySyncStatus({ |
| 33 | * Branch: "main", |
| 34 | * SyncType: "CFN_STACK_SYNC", |
| 35 | * }); |
| 36 | * ``` |
| 37 | * |
| 38 | * @binding |
| 39 | */ |
| 40 | export interface GetRepositorySyncStatus extends Binding.Service< |
| 41 | GetRepositorySyncStatus, |
| 42 | "AWS.CodeConnections.GetRepositorySyncStatus", |
| 43 | ( |
| 44 | repositoryLink: RepositoryLink, |
| 45 | ) => Effect.Effect< |
| 46 | ( |
| 47 | request: GetRepositorySyncStatusRequest, |
| 48 | ) => Effect.Effect< |
| 49 | codeconnections.GetRepositorySyncStatusOutput, |
| 50 | codeconnections.GetRepositorySyncStatusError |
| 51 | > |
| 52 | > |
| 53 | > {} |
| 54 | |
| 55 | export const GetRepositorySyncStatus = Binding.Service<GetRepositorySyncStatus>( |
| 56 | "AWS.CodeConnections.GetRepositorySyncStatus", |
| 57 | ); |