| 1 | import * as sqladmin from "@distilled.cloud/gcp/sqladmin_v1"; |
| 2 | import * as Layer from "effect/Layer"; |
| 3 | import { makeSqlUserHttpBinding } from "./BindingHttp.ts"; |
| 4 | import { GetUser } from "./GetUser.ts"; |
| 5 | |
| 6 | /** |
| 7 | * HTTP implementation of {@link GetUser}. |
| 8 | * |
| 9 | * @layer |
| 10 | * @provides GCP.SQL.GetUser |
| 11 | */ |
| 12 | export const GetUserHttp = Layer.effect( |
| 13 | GetUser, |
| 14 | makeSqlUserHttpBinding({ |
| 15 | tag: "GCP.SQL.GetUser", |
| 16 | // `users.get` is not evaluated against the instance's resource name, so |
| 17 | // an instance-scoped IAM Condition never matches it (observed: |
| 18 | // SqlInstanceNotAuthorized); no narrower predefined role has it. |
| 19 | iam: { role: "roles/cloudsql.viewer" }, |
| 20 | operation: sqladmin.getUsers, |
| 21 | }), |
| 22 | ); |