vmconfig

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DefaultProfile string             `json:"default_profile,omitempty"`
	TargetDefaults map[string]string  `json:"target_defaults,omitempty"`
	Profiles       map[string]Profile `json:"profiles,omitempty"`
}

Config is loaded from ~/.lablink/vm-defaults.json by default.

func (Config) Names

func (c Config) Names() []string

type Profile

type Profile struct {
	Target            string  `json:"target,omitempty"`
	BaseVHD           string  `json:"base_vhd,omitempty"`
	VMRoot            string  `json:"vm_root,omitempty"`
	VSwitch           string  `json:"vswitch,omitempty"`
	AdminCredential   string  `json:"admin_password_credential,omitempty"`
	MemoryMB          float64 `json:"memory_mb,omitempty"`
	CPUCount          float64 `json:"cpu_count,omitempty"`
	DynamicMemory     bool    `json:"dynamic_memory,omitempty"`
	DynamicMinMB      float64 `json:"dynamic_min_mb,omitempty"`
	DynamicMaxMB      float64 `json:"dynamic_max_mb,omitempty"`
	DynamicBufferPct  float64 `json:"dynamic_buffer_pct,omitempty"`
	SecureBoot        *bool   `json:"secure_boot,omitempty"`
	Locale            string  `json:"locale,omitempty"`
	TimeZone          string  `json:"timezone,omitempty"`
	AutoLogon         bool    `json:"auto_logon,omitempty"`
	ObfuscatePassword bool    `json:"obfuscate_password,omitempty"`
	RegisterLabLink   bool    `json:"register_with_lablink,omitempty"`
	LabLinkRole       string  `json:"lablink_role,omitempty"`
	LabLinkPort       int     `json:"lablink_port,omitempty"`
}

Profile contains non-secret defaults for creating a Windows Hyper-V VM. AdminCredential is a credential-store profile name, never a password.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is an immutable loaded defaults file.

func Load

func Load(path string) *Store

Load reads VM defaults. A missing file is valid and yields an empty store; malformed content is retained as an error so callers do not silently ignore a broken autonomous-creation policy.

func (*Store) Delete

func (s *Store) Delete(name string) error

func (*Store) List

func (s *Store) List() (Config, error)

func (*Store) Path

func (s *Store) Path() string

func (*Store) Resolve

func (s *Store) Resolve(name string) (Profile, string, error)

Resolve returns the requested profile, or the configured default when name is empty. The returned name is the actual selected profile.

func (*Store) ResolveForTarget

func (s *Store) ResolveForTarget(name, target string) (Profile, string, error)

ResolveForTarget selects an explicit profile, then a target-specific default, then the global default.

func (*Store) Set

func (s *Store) Set(name string, profile Profile, targetDefault bool) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL