| 1 | import * as compute from "@distilled.cloud/gcp/compute_v1"; |
| 2 | import * as Layer from "effect/Layer"; |
| 3 | import { makeInstanceHttpBinding } from "./BindingHttp.ts"; |
| 4 | import { StartInstance } from "./StartInstance.ts"; |
| 5 | |
| 6 | /** |
| 7 | * HTTP implementation of {@link StartInstance}. |
| 8 | * |
| 9 | * Grants `roles/compute.instanceAdmin.v1` on the bound instance only, |
| 10 | * because no narrower predefined role contains `compute.instances.start`. |
| 11 | * |
| 12 | * @layer |
| 13 | * @provides GCP.Compute.StartInstance |
| 14 | */ |
| 15 | export const StartInstanceHttp = Layer.effect( |
| 16 | StartInstance, |
| 17 | makeInstanceHttpBinding({ |
| 18 | tag: "GCP.Compute.StartInstance", |
| 19 | iam: { role: "roles/compute.instanceAdmin.v1", on: "compute.instance" }, |
| 20 | operation: compute.startInstances, |
| 21 | }), |
| 22 | ); |