Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Virtual Machine Examples (TypeSpec)

This directory contains GTS examples for virtual machine types across different virtualization platforms.

Overview

These examples demonstrate:

  • Base VM type: Common properties shared by all virtual machines
  • Derived VM types: Platform-specific extensions for VMWare ESXi, Nutanix AHV, and Virtuozzo
  • Power states as GTS types: Extensible state machine with vendor support

Schema Definitions (TypeSpec)

Base Type

  • gts.x.infra.compute.vm.v1~ (JSON Schema)
    • Base virtual machine type with common properties
    • Properties: type, id, name, cpuCores, ramMb, powerState, osType, createdAt, environment, owner, metadata
    • powerState uses GTS reference pattern for backward-compatible extensibility

Derived Types

Power States (GTS Reference Pattern)

Power states are defined as separate GTS types in types/states/:

Base State Type

Stable States

State GTS ID
Running gts.x.infra.compute.vm_state.v1~x.infra._.running.v1
Stopped gts.x.infra.compute.vm_state.v1~x.infra._.stopped.v1
Suspended gts.x.infra.compute.vm_state.v1~x.infra._.suspended.v1
Paused gts.x.infra.compute.vm_state.v1~x.infra._.paused.v1

Transient States

State GTS ID Description
Starting gts.x.infra.compute.vm_state.v1~x.infra._.starting.v1 VM is booting
Stopping gts.x.infra.compute.vm_state.v1~x.infra._.stopping.v1 VM is shutting down
Suspending gts.x.infra.compute.vm_state.v1~x.infra._.suspending.v1 Saving state to disk
Rebooting gts.x.infra.compute.vm_state.v1~x.infra._.rebooting.v1 VM is rebooting
Migrating gts.x.infra.compute.vm_state.v1~x.infra._.migrating.v1 Live migration in progress

Vendor-Specific States

Vendors can add custom states using the same pattern:

gts.x.infra.compute.vm_state.v1~vmware.esxi._.paused_due_error.v1

Instance Examples

GTS Identifier Pattern

gts.x.infra.compute.vm.v1~<vendor>.<platform>._.vm.v1~

TypeSpec Compilation

npm install -g @typespec/compiler @typespec/json-schema
tsp compile gts.x.infra.compute.vm.v1~.tsp --emit @typespec/json-schema