add quota related types

This commit is contained in:
alu
2026-07-23 16:23:31 +00:00
parent 05519694e1
commit f4deeb1ab6
2 changed files with 78 additions and 45 deletions
-45
View File
@@ -49,48 +49,3 @@ type VMID struct {
Min int `json:"min" mapstructure:"min"`
Max int `json:"max" mapstructure:"max"`
}
type Backups struct {
MaxPerInstance int `json:"max-per-instance" mapstructure:"max-per-instance"`
MaxTotal int `json:"max-total" mapstructure:"max-total"`
}
type Templates struct {
Instances struct {
LXC map[string]ResourceTemplate `json:"lxc" mapstructure:"lxc"`
QEMU map[string]ResourceTemplate `json:"qemu" mapstructure:"qemu"`
} `json:"instances"`
}
type SimpleResource struct {
Limits struct {
Global SimpleLimit `json:"global" mapstructure:"global"`
Nodes map[string]SimpleLimit `json:"nodes" mapstructure:"nodes"`
} `json:"limits"`
}
type SimpleLimit struct {
Max int `json:"max" mapstructure:"max"`
}
type MatchResource struct {
Limits struct {
Global []MatchLimit `json:"global" mapstructure:""`
Nodes map[string][]MatchLimit `json:"nodes" mapstructure:""`
} `json:"limits"`
}
type MatchLimit struct {
Match string `json:"match" mapstructure:""`
Name string `json:"name" mapstructure:""`
Max int `json:"max" mapstructure:""`
}
type ResourceTemplate struct {
Value string `json:"value" mapstructure:"value"`
Resource struct {
Enabled bool `json:"enabled" mapstructure:"enabled"`
Name string `json:"name" mapstructure:"name"`
Amount int `json:"amount" mapstructure:"amount"`
} `json:"resource" mapstructure:"resource"`
}
+78
View File
@@ -0,0 +1,78 @@
package proxmoxaas_common_lib
// numerical constraint
type Constraint struct {
Max int64 `json:"max" mapstructure:"max"`
Used int64 `json:"used" mapstructure:"used"`
Avail int64 `json:"avail" mapstructure:"avail"`
}
// match constraint
type Match struct {
Constraint `mapstructure:",squash"`
Name string `json:"name" mapstructure:"name"`
Match string `json:"match" mapstructure:"match"`
}
// numerical resource
type NumericResource struct {
Type string
Name string
Multiplier int64
Base uint64
Compact bool
Unit string
Display bool
Global Constraint
Nodes map[string]Constraint
Total Constraint
Category string
}
// storage resource
type StorageResource struct {
Type string
Name string
Multiplier int64
Base uint64
Compact bool
Unit string
Display bool
Disks []string
Global Constraint
Nodes map[string]Constraint
Total Constraint
Category string
}
// list resource
type ListResource struct {
Type string
Whitelist bool
Display bool
Global []Match
Nodes map[string][]Match
Total []Match
Category string
}
type Templates struct {
Instances struct {
LXC map[string]ResourceTemplate `json:"lxc" mapstructure:"lxc"`
QEMU map[string]ResourceTemplate `json:"qemu" mapstructure:"qemu"`
} `json:"instances"`
}
type ResourceTemplate struct {
Value string `json:"value" mapstructure:"value"`
Resource struct {
Enabled bool `json:"enabled" mapstructure:"enabled"`
Name string `json:"name" mapstructure:"name"`
Amount int `json:"amount" mapstructure:"amount"`
} `json:"resource" mapstructure:"resource"`
}
type Backups struct {
MaxPerInstance int `json:"max-per-instance" mapstructure:"max-per-instance"`
MaxTotal int `json:"max-total" mapstructure:"max-total"`
}