1import type * as keyspaces from "@distilled.cloud/aws/keyspaces";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Keyspace } from "./Keyspace.ts";
5import type { Table } from "./Table.ts";
6
7export interface RestoreTableRequest extends Omit<
8 keyspaces.RestoreTableRequest,
9 "sourceKeyspaceName" | "sourceTableName" | "targetKeyspaceName"
10> {}
11
12/**
13 * Runtime binding for `cassandra:Restore` (the Keyspaces `RestoreTable`
14 * operation).
15 *
16 * Bind this operation to a source `Table` (which must have point-in-time
17 * recovery enabled) and a target `Keyspace` to get a callable that restores
18 * the source table's continuous backup into a new table of the target
19 * keyspace, automatically injecting the source keyspace/table and target
20 * keyspace names. `RestoreTable` is asynchronous — the response returns the
21 * new table's ARN while it provisions in the `RESTORING` state. Provide the
22 * `RestoreTableHttp` layer on the Function to satisfy the binding.
23 * ### Backup and Restore
24 * **Example:** Restore to the Current Time
25 * ```typescript
26 * const restore = yield* AWS.Keyspaces.RestoreTable(sourceTable, keyspace);
27 *
28 * const { restoredTableARN } = yield* restore({
29 * targetTableName: "orders_restored",
30 * });
31 * ```
32 *
33 * **Example:** Restore to a Point in Time
34 * ```typescript
35 * const { restoredTableARN } = yield* restore({
36 * targetTableName: "orders_before_incident",
37 * restoreTimestamp: new Date("2026-07-14T12:00:00Z"),
38 * });
39 * ```
40 *
41 * @binding
42 */
43export interface RestoreTable extends Binding.Service<
44 RestoreTable,
45 "AWS.Keyspaces.RestoreTable",
46 <From extends Table, To extends Keyspace>(
47 source: From,
48 targetKeyspace: To,
49 ) => Effect.Effect<
50 (
51 request: RestoreTableRequest,
52 ) => Effect.Effect<
53 keyspaces.RestoreTableResponse,
54 keyspaces.RestoreTableError
55 >
56 >
57> {}
58
59export const RestoreTable = Binding.Service<RestoreTable>(
60 "AWS.Keyspaces.RestoreTable",
61);