1import * as serverless from "@distilled.cloud/aws/redshift-serverless";
2import * as Layer from "effect/Layer";
3import {
4 makeServerlessNamespaceHttpBinding,
5 serverlessArnPrefix,
6} from "./BindingHttp.ts";
7import { RestoreFromSnapshot } from "./RestoreFromSnapshot.ts";
8
9export const RestoreFromSnapshotHttp = Layer.effect(
10 RestoreFromSnapshot,
11 makeServerlessNamespaceHttpBinding({
12 tag: "AWS.RedshiftServerless.RestoreFromSnapshot",
13 operation: serverless.restoreFromSnapshot,
14 actions: ["redshift-serverless:RestoreFromSnapshot"],
15 // The operation authorizes against sibling resource ARNs (snapshots,
16 // recovery points, the serving workgroup) in addition to the namespace.
17 extraResources: (arn) => {
18 const prefix = serverlessArnPrefix(arn);
19 return [`${prefix}:snapshot/*`, `${prefix}:workgroup/*`];
20 },
21 }),
22);