| 1 | import type * as amplify from "@distilled.cloud/aws/amplify"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { App } from "./App.ts"; |
| 5 | |
| 6 | export interface CreateDeploymentRequest extends Omit< |
| 7 | amplify.CreateDeploymentRequest, |
| 8 | "appId" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `amplify:CreateDeployment`. |
| 13 | * |
| 14 | * Bind an {@link App} in the function's init phase to get a callable that |
| 15 | * creates a manual deployment for a branch of an app with no connected |
| 16 | * repository. The result carries pre-signed upload URLs (`zipUploadUrl`, or |
| 17 | * per-file `fileUploadUrls` when a `fileMap` of MD5 hashes is supplied); |
| 18 | * upload the content there, then release it with {@link StartDeployment}. |
| 19 | * Provide the implementation with |
| 20 | * `Effect.provide(AWS.Amplify.CreateDeploymentHttp)`. |
| 21 | * ### Manual Deployments |
| 22 | * **Example:** Stage a Zip Deployment |
| 23 | * ```typescript |
| 24 | * // init — bind the operation to the app |
| 25 | * const createDeployment = yield* AWS.Amplify.CreateDeployment(app); |
| 26 | * |
| 27 | * // runtime — obtain the upload URL for the deployment artifact |
| 28 | * const { jobId, zipUploadUrl } = yield* createDeployment({ |
| 29 | * branchName: "main", |
| 30 | * }); |
| 31 | * // PUT the site zip to `zipUploadUrl`, then start the deployment with jobId |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface CreateDeployment extends Binding.Service< |
| 37 | CreateDeployment, |
| 38 | "AWS.Amplify.CreateDeployment", |
| 39 | ( |
| 40 | app: App, |
| 41 | ) => Effect.Effect< |
| 42 | ( |
| 43 | request: CreateDeploymentRequest, |
| 44 | ) => Effect.Effect< |
| 45 | amplify.CreateDeploymentResult, |
| 46 | amplify.CreateDeploymentError |
| 47 | > |
| 48 | > |
| 49 | > {} |
| 50 | |
| 51 | export const CreateDeployment = Binding.Service<CreateDeployment>( |
| 52 | "AWS.Amplify.CreateDeployment", |
| 53 | ); |