| 1 | import type * as tpu from "@distilled.cloud/gcp/tpu_v2"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { RuntimeContext } from "../../RuntimeContext.ts"; |
| 5 | import type { Node } from "./Node.ts"; |
| 6 | |
| 7 | export interface GetNodeRequest extends Omit< |
| 8 | tpu.GetProjectsLocationsNodesRequest, |
| 9 | "name" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for Cloud TPU `nodes.get`. |
| 14 | * |
| 15 | * Bind this operation to a {@link Node} in a Function/Action init phase. |
| 16 | * Provide {@link GetNodeHttp}. |
| 17 | * |
| 18 | * Grants `roles/tpu.viewer` on the project because Cloud TPU has no |
| 19 | * resource-level IAM. |
| 20 | * |
| 21 | * ### Observing Nodes |
| 22 | * **Example:** Read the bound node |
| 23 | * ```typescript |
| 24 | * const getNode = yield* GCP.TPU.GetNode(node); |
| 25 | * const live = yield* getNode(); |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | * @category TPU |
| 30 | */ |
| 31 | export interface GetNode extends Binding.Service< |
| 32 | GetNode, |
| 33 | "GCP.TPU.GetNode", |
| 34 | ( |
| 35 | node: Node, |
| 36 | ) => Effect.Effect< |
| 37 | ( |
| 38 | request?: GetNodeRequest, |
| 39 | ) => Effect.Effect< |
| 40 | tpu.Node, |
| 41 | tpu.GetProjectsLocationsNodesError, |
| 42 | RuntimeContext |
| 43 | > |
| 44 | > |
| 45 | > {} |
| 46 | |
| 47 | export const GetNode = Binding.Service<GetNode>("GCP.TPU.GetNode"); |