Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/stratosphere-ve/ozone/llms.txt

Use this file to discover all available pages before exploring further.

The vmparser package provides a suite of functions for reading VM configuration from vms/<vmname>.json. Every function accepts a VM name string, resolves the file path automatically, and returns a typed Go value. You can read the entire VM struct in one call, or use the targeted getter functions to retrieve a specific resource section or even a single field.

Import

import "github.com/stratosphere-ve/ozone/vmparser"

Error handling

Every read function returns an error as its second return value. Always check it — the error wraps the underlying os or encoding/json failure with context about which file was being read.
vm, err := vmparser.VMParser("web-01")
if err != nil {
    log.Fatalf("failed to read VM config: %v", err)
}
Every read function opens and parses the full JSON file on each call. There is no in-memory cache. If you need multiple fields from the same VM in a tight loop, call VMParser or GetVM once and read from the returned struct directly.

Reading by resource

Use VMParser or its alias GetVM to load the entire VM configuration into a *VM struct.
// Using VMParser
vm, err := vmparser.VMParser("web-01")
if err != nil {
    return err
}
fmt.Println(vm.VM.Name)       // "web-01"
fmt.Println(vm.CPU.Cores)     // 4
fmt.Println(vm.Memory.SizeMB) // 2048

// Using the GetVM alias (identical behaviour)
vm, err = vmparser.GetVM("web-01")
if err != nil {
    return err
}
Both functions return (*VM, error). GetVM is a thin wrapper that calls VMParser internally.

Build docs developers (and LLMs) love