| 1 | import * as SD from "@distilled.cloud/aws/servicediscovery"; |
| 2 | import * as Layer from "effect/Layer"; |
| 3 | import { makeCloudMapServiceHttpBinding } from "./BindingHttp.ts"; |
| 4 | import { RegisterInstance } from "./RegisterInstance.ts"; |
| 5 | |
| 6 | export const RegisterInstanceHttp = Layer.effect( |
| 7 | RegisterInstance, |
| 8 | makeCloudMapServiceHttpBinding({ |
| 9 | tag: "AWS.CloudMap.RegisterInstance", |
| 10 | operation: SD.registerInstance, |
| 11 | actions: ["servicediscovery:RegisterInstance"], |
| 12 | extraStatements: [ |
| 13 | { |
| 14 | // For DNS services Cloud Map creates Route 53 records and |
| 15 | // (optionally) health checks on the caller's behalf; these |
| 16 | // actions have no resource-level scoping for this use. |
| 17 | Effect: "Allow", |
| 18 | Action: [ |
| 19 | "route53:GetHealthCheck", |
| 20 | "route53:CreateHealthCheck", |
| 21 | "route53:UpdateHealthCheck", |
| 22 | "route53:ChangeResourceRecordSets", |
| 23 | "ec2:DescribeInstances", |
| 24 | ], |
| 25 | Resource: ["*"], |
| 26 | }, |
| 27 | ], |
| 28 | }), |
| 29 | ); |