| 1 | import type * as apprunner from "@distilled.cloud/aws/apprunner"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Service } from "./Service.ts"; |
| 5 | |
| 6 | export interface ListOperationsRequest extends Omit< |
| 7 | apprunner.ListOperationsRequest, |
| 8 | "ServiceArn" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * List the operations that occurred on an App Runner {@link Service} (most |
| 13 | * recent first) from a Lambda (or other AWS runtime) — the tracking |
| 14 | * counterpart to the asynchronous {@link StartDeployment}, |
| 15 | * {@link PauseService}, and {@link ResumeService} calls, whose returned |
| 16 | * `OperationId`s appear here with `Status` transitions |
| 17 | * (`IN_PROGRESS` -> `SUCCEEDED` / `FAILED` / `ROLLBACK_*`). |
| 18 | * |
| 19 | * Provide `AppRunner.ListOperationsHttp` on the hosting function's Effect |
| 20 | * to implement the binding. |
| 21 | * |
| 22 | * ### Tracking Operations |
| 23 | * **Example:** Track a deployment to completion |
| 24 | * ```typescript |
| 25 | * const listOperations = yield* AppRunner.ListOperations(service); |
| 26 | * const { OperationSummaryList } = yield* listOperations({ MaxResults: 5 }); |
| 27 | * const deployment = OperationSummaryList?.find((op) => op.Id === operationId); |
| 28 | * // deployment?.Status -> "IN_PROGRESS" | "SUCCEEDED" | ... |
| 29 | * ``` |
| 30 | * |
| 31 | * @binding |
| 32 | */ |
| 33 | export interface ListOperations extends Binding.Service< |
| 34 | ListOperations, |
| 35 | "AWS.AppRunner.ListOperations", |
| 36 | ( |
| 37 | service: Service, |
| 38 | ) => Effect.Effect< |
| 39 | ( |
| 40 | request?: ListOperationsRequest, |
| 41 | ) => Effect.Effect< |
| 42 | apprunner.ListOperationsResponse, |
| 43 | apprunner.ListOperationsError |
| 44 | > |
| 45 | > |
| 46 | > {} |
| 47 | export const ListOperations = Binding.Service<ListOperations>( |
| 48 | "AWS.AppRunner.ListOperations", |
| 49 | ); |