The best way to control Claude Code, Codex and more from any computer or phone

main
ts 54 lines 1.93 KB
Raw
1 import type * as backup from "@distilled.cloud/aws/backup";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { Role } from "../IAM/Role.ts";
5
6 /**
7 * `StartRestoreJob` request with `IamRoleArn` defaulting to the bound
8 * restore role.
9 */
10 export interface StartRestoreJobRequest extends Omit<backup.StartRestoreJobInput, "IamRoleArn"> {
11 /**
12 * IAM role AWS Backup assumes to create the restored resource.
13 * @default the restore role bound via `StartRestoreJob(role)`
14 */
15 IamRoleArn?: string;
16 }
17
18 /**
19 * Runtime binding for the `StartRestoreJob` operation (IAM actions
20 * `backup:StartRestoreJob` + `iam:PassRole` on the restore role) — restore a
21 * recovery point from a deployed Function.
22 *
23 * The binding is constructed with the **restore role** (the IAM role AWS
24 * Backup assumes to recreate the resource; its trust policy must allow
25 * `backup.amazonaws.com`), injected as `IamRoleArn` unless the request
26 * overrides it. `backup:StartRestoreJob` authorizes on the recovery point's
27 * underlying resource ARN, so the grant is on `*`. Provide the
28 * implementation with `Effect.provide(AWS.Backup.StartRestoreJobHttp)`.
29 * ### Restoring Recovery Points
30 * **Example:** Restore The Latest Recovery Point
31 * ```typescript
32 * const startRestoreJob = yield* AWS.Backup.StartRestoreJob(restoreRole);
33 *
34 * const job = yield* startRestoreJob({
35 * RecoveryPointArn: recoveryPointArn,
36 * Metadata: restoreMetadata,
37 * });
38 * yield* Effect.log(`restore job ${job.RestoreJobId} started`);
39 * ```
40 *
41 * @binding
42 */
43 export interface StartRestoreJob extends Binding.Service<
44 StartRestoreJob,
45 "AWS.Backup.StartRestoreJob",
46 <R extends Role>(
47 restoreRole: R,
48 ) => Effect.Effect<
49 (
50 request: StartRestoreJobRequest,
51 ) => Effect.Effect<backup.StartRestoreJobOutput, backup.StartRestoreJobError>
52 >
53 > {}
54 export const StartRestoreJob = Binding.Service<StartRestoreJob>("AWS.Backup.StartRestoreJob");