model

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: 4 Imported by: 0 modules, 0 packages

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

Overview

Package model defines the service-layer domain model for assessments.

Unlike the persistence model in internal/store/model, the inventory here is a fully structured domain type (Inventory) rather than a raw jsonb blob. The types mirror the API model in api/v1alpha1 field-for-field (identical JSON tags) so the blob stored by the persistence layer can be unmarshaled directly into these types, and converted to the API model by the handler mappers.

Index

Constants

View Source
const (
	InventoryVersionV1 = 1 + iota
	InventoryVersionV2
)

Inventory versions, mirrored from the persistence layer.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assessment

type Assessment struct {
	ID                uuid.UUID
	CreatedAt         time.Time
	UpdatedAt         *time.Time
	Name              string
	OrgID             string
	Username          string
	OwnerFirstName    *string
	OwnerLastName     *string
	SourceType        string
	SourceID          *uuid.UUID
	MainInventory     AssessmentInventory
	SubsetInventories []AssessmentInventory
	Permissions       []Permission
	Sharing           *Sharing
}

Assessment is the service-layer domain representation of an assessment

func (Assessment) GetSubsetInventory added in v0.32.0

func (a Assessment) GetSubsetInventory(id uuid.UUID) (AssessmentInventory, error)

type AssessmentInventory

type AssessmentInventory struct {
	ID              uuid.UUID
	CreatedAt       time.Time
	Name            string
	IsSubset        bool
	VCenterID       string
	VMsCount        int
	HostsCount      int
	NetworksCount   int
	DatastoresCount int
	Version         uint
	Inventory       Inventory
	AssessmentID    uuid.UUID
}

AssessmentInventory is the service-layer domain representation of a stored inventory snapshot. Unlike the persistence model, Inventory is a structured domain type rather than a raw jsonb blob.

func NewAssessmentInventory

func NewAssessmentInventory(id, assessmentID uuid.UUID, name string, version uint, isSubset bool, inventory Inventory) AssessmentInventory

NewAssessmentInventory builds a snapshot and derives its resource counts.

type AssessmentList

type AssessmentList []AssessmentSummary

AssessmentList contains the lightweight assessment summaries returned by the store.

type AssessmentSummary

type AssessmentSummary struct {
	ID             uuid.UUID
	CreatedAt      time.Time
	Name           string
	OrgID          string
	Username       string
	OwnerFirstName *string
	OwnerLastName  *string
	SourceType     string
	SourceID       *uuid.UUID

	VMsCount        int
	HostsCount      int
	NetworksCount   int
	DatastoresCount int

	Permissions []Permission
	Sharing     *Sharing
}

AssessmentSummary is a lightweight projection of an assessment used by list endpoints.

type ClusterFeatures

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

ClusterFeatures describes cluster-level feature toggles.

type ClusterFeaturesDrsMode

type ClusterFeaturesDrsMode string

ClusterFeaturesDrsMode is the DRS automation mode for a cluster.

const (
	ClusterFeaturesDrsModeFullyAutomated     ClusterFeaturesDrsMode = "Fully Automated"
	ClusterFeaturesDrsModeManual             ClusterFeaturesDrsMode = "Manual"
	ClusterFeaturesDrsModeNone               ClusterFeaturesDrsMode = "None"
	ClusterFeaturesDrsModePartiallyAutomated ClusterFeaturesDrsMode = "Partially Automated"
)

type ClusterUtilization

type ClusterUtilization struct {
	Confidence float64 `json:"confidence"`
	CpuAvg     float64 `json:"cpu_avg"`
	CpuMax     float64 `json:"cpu_max"`
	CpuP95     float64 `json:"cpu_p95"`
	MemAvg     float64 `json:"mem_avg"`
	MemMax     float64 `json:"mem_max"`
	MemP95     float64 `json:"mem_p95"`
}

ClusterUtilization captures CPU/memory utilization statistics for a cluster.

type Datastore

type Datastore struct {
	BackingDeviceIds        *[]string                 `json:"backingDeviceIds,omitempty"`
	FilesystemMajorVersion  *int32                    `json:"filesystemMajorVersion,omitempty"`
	FilesystemType          *string                   `json:"filesystemType,omitempty"`
	DiskId                  string                    `json:"diskId"`
	FreeCapacityGB          int                       `json:"freeCapacityGB"`
	HardwareAcceleratedMove bool                      `json:"hardwareAcceleratedMove"`
	HostId                  *string                   `json:"hostId"`
	Model                   string                    `json:"model"`
	ProtocolType            string                    `json:"protocolType"`
	StorageIoConfiguration  *StorageIoConfiguration   `json:"storageIoConfiguration,omitempty"`
	StorageProtocol         *DatastoreStorageProtocol `json:"storageProtocol,omitempty"`
	TotalCapacityGB         int                       `json:"totalCapacityGB"`
	Type                    string                    `json:"type"`
	Vendor                  string                    `json:"vendor"`
	VsanSnapshotSupport     *bool                     `json:"vsanSnapshotSupport,omitempty"`
}

Datastore describes a single datastore.

type DatastoreStorageProtocol

type DatastoreStorageProtocol string

DatastoreStorageProtocol is the storage access category derived from a datastore type.

type DiskSizeTierSummary

type DiskSizeTierSummary struct {
	TotalSizeTB float64 `json:"totalSizeTB"`
	VmCount     int     `json:"vmCount"`
}

DiskSizeTierSummary summarizes a disk-size tier.

type DiskTypeSummary

type DiskTypeSummary struct {
	TotalSizeTB float64 `json:"totalSizeTB"`
	VmCount     int     `json:"vmCount"`
}

DiskTypeSummary summarizes a disk type.

type Histogram

type Histogram struct {
	Data     []int `json:"data"`
	MinValue int   `json:"minValue"`
	Step     int   `json:"step"`
}

Histogram is a simple histogram.

type Host

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

Host describes a single ESXi host.

type HostStorageAdapter added in v0.32.0

type HostStorageAdapter struct {
	Device   *string `json:"device,omitempty"`
	Driver   *string `json:"driver,omitempty"`
	Key      *string `json:"key,omitempty"`
	Model    *string `json:"model,omitempty"`
	NodeWwn  *string `json:"nodeWwn,omitempty"`
	PortWwn  *string `json:"portWwn,omitempty"`
	Protocol *string `json:"protocol,omitempty"`
	Type     *string `json:"type,omitempty"`
}

HostStorageAdapter preserves optional adapter facts in assessment snapshots.

type HostStorageLun added in v0.32.0

type HostStorageLun struct {
	AdapterDevices *[]string `json:"adapterDevices,omitempty"`
	CanonicalName  *string   `json:"canonicalName,omitempty"`
	Key            *string   `json:"key,omitempty"`
	LunUuid        *string   `json:"lunUuid,omitempty"`
	Model          *string   `json:"model,omitempty"`
	Vendor         *string   `json:"vendor,omitempty"`
}

HostStorageLun preserves host-visible LUN facts and adapter associations.

type Infra

type Infra struct {
	ClustersPerDatacenter *[]int         `json:"clustersPerDatacenter,omitempty"`
	CpuOverCommitment     *float64       `json:"cpuOverCommitment,omitempty"`
	Datastores            []Datastore    `json:"datastores"`
	HostPowerStates       map[string]int `json:"hostPowerStates"`
	Hosts                 *[]Host        `json:"hosts,omitempty"`
	// Deprecated:
	HostsPerCluster         *[]int    `json:"hostsPerCluster,omitempty"`
	MemoryOverCommitment    *float64  `json:"memoryOverCommitment,omitempty"`
	Networks                []Network `json:"networks"`
	StandaloneHostsDetected *bool     `json:"standaloneHostsDetected,omitempty"`
	// Deprecated:
	TotalClusters    *int `json:"totalClusters,omitempty"`
	TotalDatacenters *int `json:"totalDatacenters,omitempty"`
	TotalHosts       int  `json:"totalHosts"`
	// Deprecated:
	VmsPerCluster     *[]int   `json:"vmsPerCluster,omitempty"`
	VmsPerHostAverage *float64 `json:"vmsPerHostAverage,omitempty"`
}

Infra describes the physical/virtual infrastructure of the inventory.

type Inventory

type Inventory struct {
	Clusters       map[string]InventoryData `json:"clusters"`
	CollectionTime *time.Time               `json:"collection_time"`
	CreatedAt      *time.Time               `json:"created_at,omitempty"`
	Vcenter        *InventoryData           `json:"vcenter,omitempty"`
	VcenterId      string                   `json:"vcenter_id"`
	VcenterVersion *string                  `json:"vcenter_version,omitempty"`
}

Inventory is the top-level structured inventory for an assessment.

type InventoryData

type InventoryData struct {
	ClusterFeatures    *ClusterFeatures    `json:"clusterFeatures,omitempty"`
	ClusterUtilization *ClusterUtilization `json:"clusterUtilization,omitempty"`
	Infra              Infra               `json:"infra"`
	Vcenter            *VCenter            `json:"vcenter,omitempty"`
	Vms                VMs                 `json:"vms"`
}

InventoryData holds the inventory for a single vCenter or cluster.

type IssuesBreakdown

type IssuesBreakdown struct {
	Advisory    int `json:"advisory"`
	Critical    int `json:"critical"`
	Error       int `json:"error"`
	Information int `json:"information"`
	Warning     int `json:"warning"`
}

IssuesBreakdown counts VMs by highest-severity issue.

type MigrationIssue

type MigrationIssue struct {
	Assessment string  `json:"assessment"`
	Count      int     `json:"count"`
	Id         *string `json:"id,omitempty"`
	Label      string  `json:"label"`
}

MigrationIssue describes a single migration warning or blocker.

type Network

type Network struct {
	Dvswitch *string     `json:"dvswitch,omitempty"`
	Name     string      `json:"name"`
	Type     NetworkType `json:"type"`
	VlanId   *string     `json:"vlanId,omitempty"`
	VmsCount *int        `json:"vmsCount,omitempty"`
}

Network describes a single network.

type NetworkType

type NetworkType string

NetworkType is the type of a network.

type OsInfo

type OsInfo struct {
	Count                 int                `json:"count"`
	MtvStatus             *OsInfoMtvStatus   `json:"mtvStatus,omitempty"`
	SupportTier           *OsInfoSupportTier `json:"supportTier,omitempty"`
	Supported             bool               `json:"supported"`
	UpgradeRecommendation *string            `json:"upgradeRecommendation,omitempty"`
}

OsInfo describes operating-system distribution information.

type OsInfoMtvStatus added in v0.32.0

type OsInfoMtvStatus string

OsInfoMtvStatus is the migration verification status.

type OsInfoSupportTier

type OsInfoSupportTier string

OsInfoSupportTier is the OS support tier.

type Permission

type Permission string

Permission identifies an action available on an assessment.

const (
	ReadPermission   Permission = "read"
	EditPermission   Permission = "edit"
	SharePermission  Permission = "share"
	DeletePermission Permission = "delete"
)

func (Permission) In

func (p Permission) In(permissions []Permission) bool

In reports whether the permission is present in the given slice.

func (Permission) String

func (p Permission) String() string

type Sharing

type Sharing struct {
	IsShared   bool
	SharedWith []SharingSubject
	SharedBy   *SharingSubject
}

Sharing captures the sharing state of an assessment for a given viewer.

type SharingSubject

type SharingSubject struct {
	Type string
	ID   string
	Name string
}

SharingSubject identifies who an assessment is shared with or by.

type StorageIoConfiguration

type StorageIoConfiguration struct {
	CongestionThreshold     *int                                           `json:"congestionThreshold,omitempty"`
	CongestionThresholdMode *StorageIoConfigurationCongestionThresholdMode `json:"congestionThresholdMode,omitempty"`
	Enabled                 *bool                                          `json:"enabled,omitempty"`
	PercentOfPeakThroughput *int                                           `json:"percentOfPeakThroughput,omitempty"`
}

StorageIoConfiguration describes Storage I/O Control settings for a datastore.

type StorageIoConfigurationCongestionThresholdMode

type StorageIoConfigurationCongestionThresholdMode string

StorageIoConfigurationCongestionThresholdMode is the congestion threshold mode.

type VCenter

type VCenter struct {
	Id string `json:"id"`
}

VCenter identifies a vCenter.

type VMResourceBreakdown

type VMResourceBreakdown struct {
	// Deprecated:
	Histogram                      *Histogram `json:"histogram,omitempty"`
	Total                          int        `json:"total"`
	TotalForMigratable             int        `json:"totalForMigratable"`
	TotalForMigratableWithWarnings int        `json:"totalForMigratableWithWarnings"`
	TotalForNotMigratable          int        `json:"totalForNotMigratable"`
}

VMResourceBreakdown breaks a resource total down by migratability.

type VMs

type VMs struct {
	ComplexityDistribution *map[string]DiskSizeTierSummary `json:"complexityDistribution,omitempty"`
	CpuCores               VMResourceBreakdown             `json:"cpuCores"`
	DiskComplexityTier     *map[string]DiskSizeTierSummary `json:"diskComplexityTier,omitempty"`
	DiskCount              VMResourceBreakdown             `json:"diskCount"`
	DiskGB                 VMResourceBreakdown             `json:"diskGB"`
	DiskSizeTier           *map[string]DiskSizeTierSummary `json:"diskSizeTier,omitempty"`
	DiskTypes              *map[string]DiskTypeSummary     `json:"diskTypes,omitempty"`
	// Deprecated:
	DistributionByComplexity *map[string]int      `json:"distributionByComplexity,omitempty"`
	DistributionByCpuTier    *map[string]int      `json:"distributionByCpuTier,omitempty"`
	DistributionByMemoryTier *map[string]int      `json:"distributionByMemoryTier,omitempty"`
	DistributionByNicCount   *map[string]int      `json:"distributionByNicCount,omitempty"`
	IssuesBreakdown          *IssuesBreakdown     `json:"issuesBreakdown,omitempty"`
	MigrationWarnings        []MigrationIssue     `json:"migrationWarnings"`
	NicCount                 *VMResourceBreakdown `json:"nicCount,omitempty"`
	NotMigratableReasons     []MigrationIssue     `json:"notMigratableReasons"`
	// Deprecated:
	Os                          *map[string]int     `json:"os,omitempty"`
	OsInfo                      *map[string]OsInfo  `json:"osInfo,omitempty"`
	PowerStates                 map[string]int      `json:"powerStates"`
	RamGB                       VMResourceBreakdown `json:"ramGB"`
	Total                       int                 `json:"total"`
	TotalMigratable             int                 `json:"totalMigratable"`
	TotalMigratableWithWarnings *int                `json:"totalMigratableWithWarnings,omitempty"`
	TotalWithFaultTolerance     *int                `json:"totalWithFaultTolerance,omitempty"`
	TotalWithRDM                *int                `json:"totalWithRDM,omitempty"`
	TotalWithSharedDisks        *int                `json:"totalWithSharedDisks,omitempty"`
}

VMs aggregates virtual-machine statistics for an inventory.

Jump to

Keyboard shortcuts

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