1import type * as appconfig from "@distilled.cloud/aws/appconfig";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Application } from "./Application.ts";
5import type { ConfigurationProfile } from "./ConfigurationProfile.ts";
6
7export interface CreateHostedConfigurationVersionRequest extends Omit<
8 appconfig.CreateHostedConfigurationVersionRequest,
9 "ApplicationId" | "ConfigurationProfileId"
10> {}
11
12/**
13 * Write a new configuration version to the AppConfig hosted store from a
14 * Lambda (or other AWS runtime). Pairs with {@link StartDeployment} to build
15 * runtime feature-flag/configuration management services: write the new
16 * content, then roll it out.
17 *
18 * Provide `AppConfig.CreateHostedConfigurationVersionHttp` on the hosting
19 * function's Effect to implement the binding.
20 *
21 * ### Writing Configuration at Runtime
22 * **Example:** Store a new configuration version
23 * ```typescript
24 * const createVersion = yield* AppConfig.CreateHostedConfigurationVersion(
25 * app,
26 * profile,
27 * );
28 * const version = yield* createVersion({
29 * Content: JSON.stringify({ featureX: false }),
30 * ContentType: "application/json",
31 * });
32 * // version.VersionNumber -> 2
33 * ```
34 *
35 * @binding
36 */
37export interface CreateHostedConfigurationVersion extends Binding.Service<
38 CreateHostedConfigurationVersion,
39 "AWS.AppConfig.CreateHostedConfigurationVersion",
40 (
41 application: Application,
42 configurationProfile: ConfigurationProfile,
43 ) => Effect.Effect<
44 (
45 request: CreateHostedConfigurationVersionRequest,
46 ) => Effect.Effect<
47 appconfig.HostedConfigurationVersion,
48 appconfig.CreateHostedConfigurationVersionError
49 >
50 >
51> {}
52export const CreateHostedConfigurationVersion =
53 Binding.Service<CreateHostedConfigurationVersion>(
54 "AWS.AppConfig.CreateHostedConfigurationVersion",
55 );