| 1 | import type * as appconfig from "@distilled.cloud/aws/appconfig"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Application } from "./Application.ts"; |
| 5 | import type { Environment } from "./Environment.ts"; |
| 6 | |
| 7 | export interface GetDeploymentRequest extends Omit< |
| 8 | appconfig.GetDeploymentRequest, |
| 9 | "ApplicationId" | "EnvironmentId" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Read an AppConfig deployment's status from a Lambda (or other AWS runtime) |
| 14 | * — poll a rollout started with {@link StartDeployment} until it reaches a |
| 15 | * terminal state (`COMPLETE`, `ROLLED_BACK`, `REVERTED`). |
| 16 | * |
| 17 | * Provide `AppConfig.GetDeploymentHttp` on the hosting function's Effect to |
| 18 | * implement the binding. |
| 19 | * |
| 20 | * ### Deploying Configuration at Runtime |
| 21 | * **Example:** Check a rollout's progress |
| 22 | * ```typescript |
| 23 | * const getDeployment = yield* AppConfig.GetDeployment(app, env); |
| 24 | * const deployment = yield* getDeployment({ DeploymentNumber: 2 }); |
| 25 | * // deployment.State, deployment.PercentageComplete |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface GetDeployment extends Binding.Service< |
| 31 | GetDeployment, |
| 32 | "AWS.AppConfig.GetDeployment", |
| 33 | ( |
| 34 | application: Application, |
| 35 | environment: Environment, |
| 36 | ) => Effect.Effect< |
| 37 | ( |
| 38 | request: GetDeploymentRequest, |
| 39 | ) => Effect.Effect<appconfig.Deployment, appconfig.GetDeploymentError> |
| 40 | > |
| 41 | > {} |
| 42 | export const GetDeployment = Binding.Service<GetDeployment>( |
| 43 | "AWS.AppConfig.GetDeployment", |
| 44 | ); |