| 1 | import type * as compute from "@distilled.cloud/gcp/compute_v1"; |
| 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 { Instance } from "./Instance.ts"; |
| 6 | |
| 7 | export interface GetInstanceRequest extends Omit< |
| 8 | compute.GetInstancesRequest, |
| 9 | "instance" | "zone" | "project" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for Compute Engine `instances.get`. |
| 14 | * |
| 15 | * Bind this operation to an {@link Instance} in a Function/Action init phase. |
| 16 | * Provide {@link GetInstanceHttp}. |
| 17 | * |
| 18 | * ### Observing Instances |
| 19 | * **Example:** Read the bound instance |
| 20 | * ```typescript |
| 21 | * const getInstance = yield* GCP.Compute.GetInstance(vm); |
| 22 | * const live = yield* getInstance(); |
| 23 | * ``` |
| 24 | * |
| 25 | * @binding |
| 26 | * @category Compute |
| 27 | */ |
| 28 | export interface GetInstance extends Binding.Service< |
| 29 | GetInstance, |
| 30 | "GCP.Compute.GetInstance", |
| 31 | ( |
| 32 | instance: Instance, |
| 33 | ) => Effect.Effect< |
| 34 | ( |
| 35 | request?: GetInstanceRequest, |
| 36 | ) => Effect.Effect< |
| 37 | compute.Instance, |
| 38 | compute.GetInstancesError, |
| 39 | RuntimeContext |
| 40 | > |
| 41 | > |
| 42 | > {} |
| 43 | |
| 44 | export const GetInstance = Binding.Service<GetInstance>( |
| 45 | "GCP.Compute.GetInstance", |
| 46 | ); |