Files
proxmoxaas-common-lib/access-types.go
T
2026-07-23 16:23:31 +00:00

52 lines
1.9 KiB
Go

package proxmoxaas_common_lib
// all the cookies for proxmoxaas
type Auth struct {
Username string
Token string
CSRF string
AccessManagerTicket string
}
type Pool struct {
PoolID string `json:"poolid" mapstructure:"poolid"`
Groups []Group `json:"groups" mapstructure:"groups"`
Resources map[string]any `json:"resources" mapstructure:"resources"`
Templates Templates `json:"templates" mapstructure:"templates"`
AllowedNodes map[string]bool `json:"nodes-allowed" mapstructure:"nodes-allowed"`
AllowedVMIDRange VMID `json:"vmid-allowed" mapstructure:"vmid-allowed"`
AllowedBackups Backups `json:"backups-allowed" mapstructure:"backups-allowed"`
}
// proxmox typically formats as gid-realm for non pve realms
// proxmox realms are formatted without realm values
// I assume that backends store groups by ID only and only proxmox will append the realm string
type Groupname struct {
GroupID string `json:"gid" mapstructure:"gid"`
Realm string `json:"realm" mapstructure:"realm"`
}
type Group struct {
Groupname Groupname `json:"groupname" mapstructure:"groupname"`
Role string `json:"role" mapstructure:"role"` // role in owner pool
Users []User `json:"users" mapstructure:"users"`
}
type Username struct { // ie userid@realm
UserID string `json:"uid" mapstructure:"uid"`
Realm string `json:"realm" mapstructure:"realm"`
}
type User struct {
Username Username `json:"username" mapstructure:"username"`
CN string `json:"cn" mapstructure:"cn"` // aka first name
SN string `json:"sn" mapstructure:"sn"` // aka last name
Mail string `json:"mail" mapstructure:"mail"`
Password string `json:"password" mapstructure:"password"` // only used for POST requests
}
type VMID struct {
Min int `json:"min" mapstructure:"min"`
Max int `json:"max" mapstructure:"max"`
}