| 1 | import * as kafka from "@distilled.cloud/gcp/managedkafka_v1"; |
| 2 | import { Credentials } from "@distilled.cloud/gcp/Credentials"; |
| 3 | import * as Layer from "effect/Layer"; |
| 4 | import * as HttpClient from "effect/http/HttpClient"; |
| 5 | import { makeManagedKafkaHttpBinding } from "./BindingHttp.ts"; |
| 6 | import type { Cluster } from "./Cluster.ts"; |
| 7 | import { GetCluster } from "./GetCluster.ts"; |
| 8 | |
| 9 | /** |
| 10 | * HTTP implementation of {@link GetCluster}. |
| 11 | * |
| 12 | * @layer |
| 13 | * @provides GCP.ManagedKafka.GetCluster |
| 14 | */ |
| 15 | export const GetClusterHttp: Layer.Layer< |
| 16 | GetCluster, |
| 17 | never, |
| 18 | Credentials | HttpClient.HttpClient |
| 19 | > = Layer.effect( |
| 20 | GetCluster, |
| 21 | makeManagedKafkaHttpBinding<Cluster>()< |
| 22 | kafka.GetProjectsLocationsClustersRequest, |
| 23 | kafka.Cluster, |
| 24 | kafka.GetProjectsLocationsClustersError |
| 25 | >({ |
| 26 | tag: "GCP.ManagedKafka.GetCluster", |
| 27 | iam: { role: "roles/managedkafka.viewer", scopeByCondition: true }, |
| 28 | operation: kafka.getProjectsLocationsClusters, |
| 29 | }), |
| 30 | ); |