| 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 { ConfigurationProfile } from "./ConfigurationProfile.ts"; |
| 6 | import type { DeploymentStrategy } from "./DeploymentStrategy.ts"; |
| 7 | import type { Environment } from "./Environment.ts"; |
| 8 | |
| 9 | export interface StartDeploymentRequest extends Omit< |
| 10 | appconfig.StartDeploymentRequest, |
| 11 | | "ApplicationId" |
| 12 | | "EnvironmentId" |
| 13 | | "ConfigurationProfileId" |
| 14 | | "DeploymentStrategyId" |
| 15 | > {} |
| 16 | |
| 17 | /** |
| 18 | * Start an AppConfig deployment from a Lambda (or other AWS runtime) — roll a |
| 19 | * configuration version out to an environment following a deployment |
| 20 | * strategy. Pairs with {@link CreateHostedConfigurationVersion} to build |
| 21 | * runtime feature-flag/configuration management services. |
| 22 | * |
| 23 | * Provide `AppConfig.StartDeploymentHttp` on the hosting function's Effect to |
| 24 | * implement the binding. |
| 25 | * |
| 26 | * ### Deploying Configuration at Runtime |
| 27 | * **Example:** Roll out a configuration version |
| 28 | * ```typescript |
| 29 | * const startDeployment = yield* AppConfig.StartDeployment( |
| 30 | * app, |
| 31 | * env, |
| 32 | * profile, |
| 33 | * strategy, |
| 34 | * ); |
| 35 | * const deployment = yield* startDeployment({ |
| 36 | * ConfigurationVersion: "2", |
| 37 | * }); |
| 38 | * // deployment.DeploymentNumber, deployment.State ("DEPLOYING", ...) |
| 39 | * ``` |
| 40 | * |
| 41 | * @binding |
| 42 | */ |
| 43 | export interface StartDeployment extends Binding.Service< |
| 44 | StartDeployment, |
| 45 | "AWS.AppConfig.StartDeployment", |
| 46 | ( |
| 47 | application: Application, |
| 48 | environment: Environment, |
| 49 | configurationProfile: ConfigurationProfile, |
| 50 | deploymentStrategy: DeploymentStrategy, |
| 51 | ) => Effect.Effect< |
| 52 | ( |
| 53 | request: StartDeploymentRequest, |
| 54 | ) => Effect.Effect<appconfig.Deployment, appconfig.StartDeploymentError> |
| 55 | > |
| 56 | > {} |
| 57 | export const StartDeployment = Binding.Service<StartDeployment>( |
| 58 | "AWS.AppConfig.StartDeployment", |
| 59 | ); |