1import * as rds from "@distilled.cloud/aws/rds";
2import * as Layer from "effect/Layer";
3import { makeRdsInstanceHttpBinding } from "./BindingHttp.ts";
4import { CreateDBSnapshot } from "./CreateDBSnapshot.ts";
5
6export const CreateDBSnapshotHttp = Layer.effect(
7 CreateDBSnapshot,
8 makeRdsInstanceHttpBinding({
9 tag: "AWS.RDS.CreateDBSnapshot",
10 operation: rds.createDBSnapshot,
11 actions: ["rds:CreateDBSnapshot", "rds:AddTagsToResource"],
12 // Snapshot creation authorizes against BOTH the source ARN and the
13 // target snapshot ARN — widen the grant to the account's
14 // `snapshot` ARN space.
15 extraResources: (arn) => [
16 `${arn.split(":").slice(0, 5).join(":")}:snapshot:*`,
17 ],
18 }),
19);