Documentation
¶
Index ¶
- type Config
- type Profile
- type Store
- func (s *Store) Delete(name string) error
- func (s *Store) List() (Config, error)
- func (s *Store) Path() string
- func (s *Store) Resolve(name string) (Profile, string, error)
- func (s *Store) ResolveForTarget(name, target string) (Profile, string, error)
- func (s *Store) Set(name string, profile Profile, targetDefault bool) error
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.
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"`
MinHostReservePct float64 `json:"min_host_reserve_pct,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 ¶
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) Resolve ¶
Resolve returns the requested profile, or the configured default when name is empty. The returned name is the actual selected profile.
func (*Store) ResolveForTarget ¶
ResolveForTarget selects an explicit profile, then a target-specific default, then the global default.