1import type * as backup from "@distilled.cloud/aws/backup";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Role } from "../IAM/Role.ts";
5import type { BackupVault } from "./BackupVault.ts";
6
7/**
8 * `StartCopyJob` request with `SourceBackupVaultName` injected from the
9 * bound {@link BackupVault} and `IamRoleArn` defaulting to the bound copy
10 * role.
11 */
12export interface StartCopyJobRequest extends Omit<
13 backup.StartCopyJobInput,
14 "SourceBackupVaultName" | "IamRoleArn"
15> {
16 /**
17 * IAM role AWS Backup assumes to perform the copy.
18 * @default the copy role bound via `StartCopyJob(sourceVault, role)`
19 */
20 IamRoleArn?: string;
21}
22
23/**
24 * Runtime binding for the `StartCopyJob` operation (IAM actions
25 * `backup:StartCopyJob` + `backup:CopyIntoBackupVault` + `iam:PassRole` on
26 * the copy role) — copy a recovery point from the bound source vault to a
27 * destination vault (e.g. cross-region or cross-account disaster recovery).
28 *
29 * The binding is constructed with the **source** {@link BackupVault} and the
30 * **copy role** (its trust policy must allow `backup.amazonaws.com`); the
31 * destination vault ARN is a runtime request field. Provide the
32 * implementation with `Effect.provide(AWS.Backup.StartCopyJobHttp)`.
33 * ### Copying Recovery Points
34 * **Example:** Copy A Recovery Point To A DR Vault
35 * ```typescript
36 * const startCopyJob = yield* AWS.Backup.StartCopyJob(vault, backupRole);
37 *
38 * const job = yield* startCopyJob({
39 * RecoveryPointArn: recoveryPointArn,
40 * DestinationBackupVaultArn: drVaultArn,
41 * });
42 * yield* Effect.log(`copy job ${job.CopyJobId} started`);
43 * ```
44 *
45 * @binding
46 */
47export interface StartCopyJob extends Binding.Service<
48 StartCopyJob,
49 "AWS.Backup.StartCopyJob",
50 <R extends Role>(
51 sourceVault: BackupVault,
52 copyRole: R,
53 ) => Effect.Effect<
54 (
55 request: StartCopyJobRequest,
56 ) => Effect.Effect<backup.StartCopyJobOutput, backup.StartCopyJobError>
57 >
58> {}
59export const StartCopyJob = Binding.Service<StartCopyJob>(
60 "AWS.Backup.StartCopyJob",
61);