The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import type * as ec2 from "@distilled.cloud/aws/ec2"; |
| 2 | import * as Binding from "alchemy/Binding"; |
| 3 | import type * as Effect from "effect/Effect"; |
| 4 | import type { Volume } from "./Volume.ts"; |
| 5 | |
| 6 | /** |
| 7 | * `CreateSnapshot` request with `VolumeId` injected from the bound |
| 8 | * {@link Volume}. |
| 9 | */ |
| 10 | export interface CreateSnapshotRequest extends Omit<ec2.CreateSnapshotRequest, "VolumeId"> {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for the `CreateSnapshot` operation scoped to the bound |
| 14 | * {@link Volume} (IAM actions `ec2:CreateSnapshot` + `ec2:CreateTags` on the |
| 15 | * volume ARN and the region-wide snapshot wildcard — snapshot creation |
| 16 | * authorizes against both the source volume and the new snapshot). |
| 17 | * |
| 18 | * Creates a point-in-time EBS snapshot of the volume — e.g. a Lambda that |
| 19 | * takes an application-consistent backup before a risky migration. The |
| 20 | * snapshot is created `pending` and completes asynchronously. Provide the |
| 21 | * implementation with `Effect.provide(AWS.EC2.CreateSnapshotHttp)`. |
| 22 | * ### Volume Backups |
| 23 | * **Example:** Snapshot the bound volume |
| 24 | * ```typescript |
| 25 | * // init — bind the operation to the volume |
| 26 | * const createSnapshot = yield* AWS.EC2.CreateSnapshot(volume); |
| 27 | * |
| 28 | * // runtime — take a point-in-time backup |
| 29 | * const snapshot = yield* createSnapshot({ |
| 30 | * Description: "pre-migration backup", |
| 31 | * }); |
| 32 | * console.log(snapshot.SnapshotId, snapshot.State); |
| 33 | * ``` |
| 34 | * |
| 35 | * @binding |
| 36 | */ |
| 37 | export interface CreateSnapshot extends Binding.Service< |
| 38 | CreateSnapshot, |
| 39 | "AWS.EC2.CreateSnapshot", |
| 40 | ( |
| 41 | volume: Volume, |
| 42 | ) => Effect.Effect< |
| 43 | (request?: CreateSnapshotRequest) => Effect.Effect<ec2.Snapshot, ec2.CreateSnapshotError> |
| 44 | > |
| 45 | > {} |
| 46 | |
| 47 | export const CreateSnapshot = Binding.Service<CreateSnapshot>("AWS.EC2.CreateSnapshot"); |