| 1 | import * as docdbelastic from "@distilled.cloud/aws/docdb-elastic"; |
| 2 | import * as Layer from "effect/Layer"; |
| 3 | import { makeDocDBElasticAccountHttpBinding } from "./BindingHttp.ts"; |
| 4 | import { RestoreClusterFromSnapshot } from "./RestoreClusterFromSnapshot.ts"; |
| 5 | |
| 6 | export const RestoreClusterFromSnapshotHttp = Layer.effect( |
| 7 | RestoreClusterFromSnapshot, |
| 8 | makeDocDBElasticAccountHttpBinding({ |
| 9 | tag: "AWS.DocDBElastic.RestoreClusterFromSnapshot", |
| 10 | operation: docdbelastic.restoreClusterFromSnapshot, |
| 11 | actions: [ |
| 12 | "docdb-elastic:RestoreClusterFromSnapshot", |
| 13 | // Restoring authorizes the creation of the new cluster as a |
| 14 | // CreateCluster on `cluster/*` (verified live: without it the service |
| 15 | // returns AccessDeniedException naming this action). |
| 16 | "docdb-elastic:CreateCluster", |
| 17 | "docdb-elastic:TagResource", |
| 18 | // Restoring provisions a new cluster, which attaches to the VPC via a |
| 19 | // service-managed VPC endpoint using the caller's EC2 permissions. |
| 20 | "ec2:CreateVpcEndpoint", |
| 21 | "ec2:DescribeVpcEndpoints", |
| 22 | "ec2:DeleteVpcEndpoints", |
| 23 | "ec2:ModifyVpcEndpoint", |
| 24 | "ec2:DescribeVpcAttribute", |
| 25 | "ec2:DescribeSubnets", |
| 26 | "ec2:DescribeVpcs", |
| 27 | "ec2:DescribeAvailabilityZones", |
| 28 | "ec2:DescribeAccountAttributes", |
| 29 | "ec2:DescribeSecurityGroups", |
| 30 | "ec2:CreateTags", |
| 31 | ], |
| 32 | }), |
| 33 | ); |