| 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 | /** |
| 7 | * Pause an App Runner {@link Service} from a Lambda (or other AWS runtime). |
| 8 | * App Runner releases the service's compute capacity (the endpoint stops |
| 9 | * serving) while keeping its configuration — e.g. a nightly scheduler that |
| 10 | * pauses non-production services to stop compute billing. The call is |
| 11 | * asynchronous; pair with {@link ListOperations} or {@link ResumeService}. |
| 12 | * |
| 13 | * Provide `AppRunner.PauseServiceHttp` on the hosting function's Effect to |
| 14 | * implement the binding. |
| 15 | * |
| 16 | * ### Pausing and Resuming |
| 17 | * **Example:** Pause a service overnight |
| 18 | * ```typescript |
| 19 | * const pauseService = yield* AppRunner.PauseService(service); |
| 20 | * const { Service: paused } = yield* pauseService(); |
| 21 | * // paused.Status -> "OPERATION_IN_PROGRESS" (settles to "PAUSED") |
| 22 | * ``` |
| 23 | * |
| 24 | * @binding |
| 25 | */ |
| 26 | export interface PauseService extends Binding.Service< |
| 27 | PauseService, |
| 28 | "AWS.AppRunner.PauseService", |
| 29 | ( |
| 30 | service: Service, |
| 31 | ) => Effect.Effect< |
| 32 | () => Effect.Effect< |
| 33 | apprunner.PauseServiceResponse, |
| 34 | apprunner.PauseServiceError |
| 35 | > |
| 36 | > |
| 37 | > {} |
| 38 | export const PauseService = Binding.Service<PauseService>( |
| 39 | "AWS.AppRunner.PauseService", |
| 40 | ); |