1import * as SD from "@distilled.cloud/aws/servicediscovery";
2import * as Layer from "effect/Layer";
3import { makeCloudMapServiceHttpBinding } from "./BindingHttp.ts";
4import { DeregisterInstance } from "./DeregisterInstance.ts";
5
6export const DeregisterInstanceHttp = Layer.effect(
7 DeregisterInstance,
8 makeCloudMapServiceHttpBinding({
9 tag: "AWS.CloudMap.DeregisterInstance",
10 operation: SD.deregisterInstance,
11 actions: ["servicediscovery:DeregisterInstance"],
12 extraStatements: [
13 {
14 // Cloud Map deletes the Route 53 records/health check it created
15 // for the instance; these actions have no resource-level scoping
16 // for this use.
17 Effect: "Allow",
18 Action: [
19 "route53:GetHealthCheck",
20 "route53:DeleteHealthCheck",
21 "route53:UpdateHealthCheck",
22 "route53:ChangeResourceRecordSets",
23 ],
24 Resource: ["*"],
25 },
26 ],
27 }),
28);