| 1 | import type * as eks from "@distilled.cloud/aws/eks"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Cluster } from "./Cluster.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `eks:DescribeCluster`. |
| 8 | * |
| 9 | * Reads the bound cluster's live control-plane state — status, Kubernetes API `endpoint`, `certificateAuthority` data, version, and network config. The building block for constructing a kubeconfig at runtime. |
| 10 | * The cluster `name` is injected from the bound {@link Cluster} and `eks:DescribeCluster` is granted on the cluster's ARN. |
| 11 | * Provide the implementation with |
| 12 | * `Effect.provide(AWS.EKS.DescribeClusterHttp)`. |
| 13 | * ### Reading Cluster State |
| 14 | * **Example:** Build Kubernetes Connection Settings at Runtime |
| 15 | * ```typescript |
| 16 | * // init |
| 17 | * const describeCluster = yield* AWS.EKS.DescribeCluster(cluster); |
| 18 | * |
| 19 | * // runtime |
| 20 | * const { cluster: live } = yield* describeCluster(); |
| 21 | * const endpoint = live?.endpoint; |
| 22 | * const caData = live?.certificateAuthority?.data; |
| 23 | * ``` |
| 24 | * |
| 25 | * @binding |
| 26 | */ |
| 27 | export interface DescribeCluster extends Binding.Service< |
| 28 | DescribeCluster, |
| 29 | "AWS.EKS.DescribeCluster", |
| 30 | ( |
| 31 | cluster: Cluster, |
| 32 | ) => Effect.Effect< |
| 33 | ( |
| 34 | request?: Omit<eks.DescribeClusterRequest, "name">, |
| 35 | ) => Effect.Effect<eks.DescribeClusterResponse, eks.DescribeClusterError> |
| 36 | > |
| 37 | > {} |
| 38 | export const DescribeCluster = Binding.Service<DescribeCluster>( |
| 39 | "AWS.EKS.DescribeCluster", |
| 40 | ); |