models

package
v0.33.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 6 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type About added in v0.13.3

type About struct {
	APIVersion   string
	Product      string
	InstanceUuid string
}

About holds vCenter metadata.

type BackingDeviceIDs added in v0.31.0

type BackingDeviceIDs []string

BackingDeviceIDs scans backing device identifiers from DuckDB values.

func (*BackingDeviceIDs) Scan added in v0.31.0

func (ids *BackingDeviceIDs) Scan(value interface{}) error

type Cluster

type Cluster struct {
	Name            string           `json:"name"`
	ClusterFeatures *ClusterFeatures `json:"clusterFeatures,omitempty"`
	Datastores      []Datastore      `json:"datastores"`
	Hosts           []Host           `json:"hosts"`
	Networks        []Network        `json:"networks"`
}

Cluster represents a VMware cluster with its resources.

type ClusterFeatures added in v0.13.4

type ClusterFeatures struct {
	DrsEnabled *bool   `json:"drsEnabled,omitempty"`
	DrsMode    *string `json:"drsMode,omitempty"`
	HaEnabled  *bool   `json:"haEnabled,omitempty"`
}

ClusterFeatures represents VMware cluster feature settings (DRS, etc).

type Concern

type Concern struct {
	Id         string `json:"id" db:"Concern_ID"`
	Label      string `json:"label" db:"Label"`
	Category   string `json:"category" db:"Category"`
	Assessment string `json:"assessment" db:"Assessment"`
}

Concern represents a validation concern for a VM.

type Concerns

type Concerns []Concern

Concerns is a slice of Concern that implements sql.Scanner for DuckDB LIST type.

func (*Concerns) Scan

func (c *Concerns) Scan(value interface{}) error

func (Concerns) Value

func (c Concerns) Value() (driver.Value, error)

type ControllerTracker added in v0.5.0

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

ControllerTracker generates unique controller keys per bus type.

func NewControllerTracker added in v0.5.0

func NewControllerTracker() *ControllerTracker

NewControllerTracker creates a new ControllerTracker.

func (*ControllerTracker) GetKeyAndBus added in v0.5.0

func (ct *ControllerTracker) GetKeyAndBus(controllerName string) (key int32, bus string)

GetKeyAndBus returns the controller key and bus type for a controller name. It caches results so the same controller name always returns the same key/bus.

type Datastore

type Datastore struct {
	Cluster                 string           `db:"cluster" json:"-"`
	BackingDeviceIDs        BackingDeviceIDs `db:"backingDeviceIds" json:"-"`
	DiskId                  string           `db:"diskId" json:"diskId"`
	FilesystemType          string           `db:"filesystemType" json:"filesystemType,omitempty"`
	FilesystemMajorVersion  int32            `db:"filesystemMajorVersion" json:"filesystemMajorVersion,omitempty"`
	FreeCapacityGB          float64          `db:"freeCapacityGB" json:"freeCapacityGB"`
	HardwareAcceleratedMove bool             `db:"hardwareAcceleratedMove" json:"hardwareAcceleratedMove"`
	HostId                  string           `db:"hostId" json:"hostId"`
	Model                   string           `db:"model" json:"model"`
	ProtocolType            string           `db:"protocolType" json:"protocolType"`
	TotalCapacityGB         float64          `db:"totalCapacityGB" json:"totalCapacityGB"`
	Type                    string           `db:"type" json:"type"`
	Vendor                  string           `db:"vendor" json:"vendor"`
	SiocEnabled             bool             `db:"siocEnabled" json:"siocEnabled"`
	SiocThreshold           int              `db:"siocCongestionThreshold" json:"siocCongestionThreshold"`
	SiocMode                string           `db:"siocCongestionThresholdMode" json:"siocCongestionThresholdMode"`
	SiocPercent             int              `db:"siocPercentOfPeakThroughput" json:"siocPercentOfPeakThroughput"`
}

Datastore represents a VMware datastore.

type Disk

type Disk struct {
	Key                             string      `json:"key" db:"Disk Key"`
	UnitNumber                      int32       `json:"unitNumber" db:"Unit #"` // Changed to int32 for OPA
	ControllerKey                   int32       `json:"controllerKey"`          // Populated by scanner using ControllerTracker
	File                            string      `json:"file" db:"Path"`
	Capacity                        int64       `json:"capacity" db:"Capacity MiB"` // SQL returns bytes
	Shared                          bool        `json:"shared" db:"Sharing mode"`
	RDM                             bool        `json:"rdm" db:"Raw"`
	RDMBacking                      *RDMBacking `json:"rdmBacking,omitempty"`
	Bus                             string      `json:"bus" db:"Shared Bus"` // Populated by scanner using ControllerTracker
	Mode                            string      `json:"mode,omitempty" db:"Disk Mode"`
	Serial                          string      `json:"serial" db:"Disk UUID"`
	Thin                            string      `json:"thin" db:"Thin"`
	ThinProvisioned                 *bool       `json:"thinProvisioned,omitempty"`
	EagerlyScrubbed                 *bool       `json:"eagerlyScrubbed,omitempty"`
	Controller                      string      `json:"controller" db:"Controller"`
	Label                           string      `json:"label" db:"Label"`
	SCSIUnit                        string      `json:"scsiUnit" db:"SCSI Unit #"`
	Datastore                       Ref         `json:"datastore"` // Changed from string to Ref
	DatastoreName                   string      `json:"datastoreName,omitempty"`
	DatastoreType                   string      `json:"datastoreType,omitempty"`
	DatastoreFilesystemType         string      `json:"datastoreFilesystemType,omitempty"`
	DatastoreFilesystemMajorVersion int32       `json:"datastoreFilesystemMajorVersion,omitempty"`
	DatastoreStorageProtocol        string      `json:"datastoreStorageProtocol,omitempty"`
	DatastoreBackingDeviceIDs       []string    `json:"datastoreBackingDeviceIds,omitempty"`
	DatastoreVendor                 string      `json:"datastoreVendor,omitempty"`
	DatastoreModel                  string      `json:"datastoreModel,omitempty"`
	ChangeTrackingEnabled           bool        `json:"changeTrackingEnabled"` // Inherited from VM for OPA per-disk CBT check
}

Disk represents a virtual disk from the vdisk table.

type Disks

type Disks []Disk

Disks is a slice of Disk that implements sql.Scanner for DuckDB LIST type.

func (*Disks) Scan

func (d *Disks) Scan(value interface{}) error

func (Disks) Value

func (d Disks) Value() (driver.Value, error)

type GuestApp added in v0.13.5

type GuestApp struct {
	Name    string `json:"name"`
	Version string `json:"version,omitempty"`
}

GuestApp represents a guest application installed on a VM.

type GuestApps added in v0.13.5

type GuestApps []GuestApp

GuestApps is a slice of GuestApp that implements sql.Scanner for JSON string parsing.

func (*GuestApps) Scan added in v0.13.5

func (g *GuestApps) Scan(value interface{}) error

func (GuestApps) Value added in v0.13.5

func (g GuestApps) Value() (driver.Value, error)

type Host

type Host struct {
	Datacenter              string                         `db:"datacenter" json:"datacenter,omitempty"`
	Cluster                 string                         `db:"cluster" json:"-"`
	CpuModel                string                         `db:"cpuModel" json:"cpuModel,omitempty"`
	SerialNumber            string                         `db:"serialNumber" json:"serialNumber,omitempty"`
	CpuCores                int                            `db:"cpuCores" json:"cpuCores"`
	CpuSockets              int                            `db:"cpuSockets" json:"cpuSockets"`
	Id                      string                         `db:"id" json:"id"`
	MemoryMB                int                            `db:"memoryMB" json:"memoryMB"`
	Model                   string                         `db:"model" json:"model"`
	Vendor                  string                         `db:"vendor" json:"vendor"`
	VMotionSupported        *bool                          `db:"vmotionSupported" json:"vmotionSupported"`
	StorageVMotionSupported *bool                          `db:"storageVmotionSupported" json:"storageVmotionSupported"`
	StorageAdapters         []inventory.HostStorageAdapter `db:"-" json:"storageAdapters,omitempty"`
	StorageLuns             []inventory.HostStorageLun     `db:"-" json:"storageLuns,omitempty"`
}

Host represents a VMware ESXi host.

type Labels added in v0.13.3

type Labels []string

Labels is a slice of strings that implements sql.Scanner for DuckDB LIST type.

func (*Labels) Scan added in v0.13.3

func (l *Labels) Scan(value interface{}) error

func (Labels) Value added in v0.13.3

func (l Labels) Value() (driver.Value, error)

type Metadata added in v0.30.0

type Metadata map[string][]string

Metadata maps metadata keys to their values for one VM.

type NIC

type NIC struct {
	Network         Ref      `json:"network"` // Changed from string to Ref
	MAC             string   `json:"mac" db:"Mac Address"`
	Label           string   `json:"label" db:"NIC label"`
	Adapter         string   `json:"adapter" db:"Adapter"`
	Switch          string   `json:"switch" db:"Switch"`
	Connected       bool     `json:"connected" db:"Connected"`
	StartsConnected bool     `json:"startsConnected" db:"Starts Connected"`
	Type            string   `json:"type" db:"Type"`
	IPv4Addresses   []string `json:"ipv4Addresses" db:"IPv4 Addresses"`
	IPv6Addresses   []string `json:"ipv6Addresses" db:"IPv6 Addresses"`
	VlanID          string   `json:"vlanId" db:"VLAN"`
}

NIC represents a network interface from the vnetwork table. IPv4Addresses and IPv6Addresses treat reported values as adapter IP addresses. An IP address may also contain a CIDR suffix; values are not parsed as network ranges.

type NICs

type NICs []NIC

NICs is a slice of NIC that implements sql.Scanner for DuckDB LIST type.

func (*NICs) Scan

func (n *NICs) Scan(value interface{}) error

func (NICs) Value

func (n NICs) Value() (driver.Value, error)

type Network

type Network struct {
	Cluster  string `db:"cluster" json:"-"`
	Dvswitch string `db:"dvswitch" json:"dvswitch"`
	Name     string `db:"name" json:"name"`
	Type     string `db:"type" json:"type"`
	VlanId   string `db:"vlanId" json:"vlanId"`
	VmsCount int    `db:"vmsCount" json:"vmsCount"`
}

Network represents a VMware network.

type Networks

type Networks []string

Networks is a slice of strings that implements sql.Scanner for DuckDB LIST type.

func (*Networks) Scan

func (n *Networks) Scan(value interface{}) error

func (Networks) Value

func (n Networks) Value() (driver.Value, error)

type Os

type Os struct {
	Name                  string  `db:"name" json:"name"`
	Count                 int     `db:"count" json:"count"`
	Supported             bool    `db:"supported" json:"supported"`
	UpgradeRecommendation *string `db:"upgrade_recommendation" json:"upgradeRecommendation,omitempty"`
}

Os represents an operating system summary.

type RDMBacking added in v0.31.0

type RDMBacking struct {
	LunUUID           string      `json:"lunUuid,omitempty"`
	DeviceName        string      `json:"deviceName,omitempty"`
	CompatibilityMode string      `json:"compatibilityMode"`
	BackingUUID       string      `json:"backingUuid,omitempty"`
	HostLun           *RDMHostLun `json:"hostLun,omitempty"`
}

RDMBacking describes the source-reported backing of an RDM disk. CompatibilityMode is physical, virtual, or unknown; identifiers are preserved independently and none is a fallback for another.

type RDMHostLun added in v0.33.0

type RDMHostLun struct {
	HostID        string `json:"hostId"`
	Key           string `json:"key,omitempty"`
	CanonicalName string `json:"canonicalName,omitempty"`
	LunUUID       string `json:"lunUuid,omitempty"`
}

RDMHostLun references the host LUN matched to an RDM disk backing through a verified identifier relationship and the VM's uniquely resolved host.

type Ref added in v0.5.0

type Ref struct {
	ID string `json:"id"`
}

Ref represents an object reference with ID.

type VM

type VM struct {
	ID                       string    `json:"id" db:"VM ID"`
	Name                     string    `json:"name" db:"VM"`
	Folder                   string    `json:"folder" db:"Folder ID"`
	Host                     string    `json:"host" db:"Host"`
	UUID                     string    `json:"uuid" db:"SMBIOS UUID"`
	Firmware                 string    `json:"firmware" db:"Firmware"`
	PowerState               string    `json:"powerState" db:"Powerstate"`
	ConnectionState          string    `json:"connectionState" db:"Connection state"`
	CpuHotAddEnabled         bool      `json:"cpuHotAddEnabled" db:"Hot Add"`       // vcpu
	CpuHotRemoveEnabled      bool      `json:"cpuHotRemoveEnabled" db:"Hot Remove"` // vcpu
	MemoryHotAddEnabled      bool      `json:"memoryHotAddEnabled" db:"Hot Add"`    // vmemory
	FaultToleranceEnabled    bool      `json:"faultToleranceEnabled" db:"FT State"` // vinfo
	CpuCount                 int32     `json:"cpuCount" db:"CPUs"`                  // vinfo
	CpuSockets               int32     `json:"cpuSockets" db:"Sockets"`             // vcpu
	CoresPerSocket           int32     `json:"coresPerSocket" db:"Cores p/s"`       // vcpu
	MemoryMB                 int32     `json:"memoryMB" db:"Memory"`                // vinfo
	GuestName                string    `json:"guestName" db:"OS according to the configuration file"`
	GuestNameFromVmwareTools string    `json:"guestNameFromVmwareTools" db:"OS according to the VMware Tools"`
	HostName                 string    `json:"hostName" db:"DNS Name"`
	BalloonedMemory          int32     `json:"balloonedMemory" db:"Ballooned"` // vmemory
	IpAddress                string    `json:"ipAddress" db:"Primary IP Address"`
	StorageUsed              int64     `json:"storageUsed" db:"In Use MiB"` // SQL returns bytes
	IsTemplate               bool      `json:"isTemplate" db:"Template"`
	ChangeTrackingEnabled    bool      `json:"changeTrackingEnabled" db:"CBT"`
	NICs                     NICs      `json:"nics"`
	Disks                    Disks     `json:"disks"`
	Networks                 Networks  `json:"networks" db:"network_object_id"`
	DiskEnableUuid           bool      `json:"diskEnableUuid" db:"EnableUUID"`
	Datacenter               string    `json:"datacenter" db:"Datacenter"`
	Cluster                  string    `json:"cluster" db:"Cluster"`
	HWVersion                string    `json:"hwVersion" db:"HW version"`
	TotalDiskCapacityMiB     int32     `json:"totalDiskCapacityMiB" db:"Total disk capacity MiB"`
	ProvisionedMiB           int32     `json:"provisionedMiB" db:"Provisioned MiB"`
	ResourcePool             string    `json:"resourcePool" db:"Resource pool"`
	OsDiskComplexity         int32     `json:"osDiskComplexity" db:"OsDiskComplexity"`
	Concerns                 Concerns  `json:"concerns"`
	NumaNodeAffinity         []string  `json:"numaNodeAffinity"` // Always empty for RVTools, included for OPA compatibility
	MigrationExcluded        bool      `json:"migrationExcluded" db:"migration_excluded"`
	Labels                   Labels    `json:"labels" db:"labels"`
	GuestApps                GuestApps `json:"guestApps" db:"guest_apps"`
	Metadata                 Metadata  `json:"metadata" db:"metadata"`
}

VM represents a virtual machine from VMware inventory.

func (VM) EffectiveGuestName added in v0.5.0

func (vm VM) EffectiveGuestName() string

EffectiveGuestName returns the best available guest OS name. Prefers VMware Tools detection over configuration file.

Jump to

Keyboard shortcuts

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