Documentation
¶
Overview ¶
Package project groups machines, storage pools and networks into projects with members and limits (ADR-0060): multi-tenancy for VirtoMir. A project owns the resources created inside it; members reach it by direct membership or through one of their Linux groups, and the highest role wins.
Index ¶
- type Limits
- type Member
- type Project
- type Store
- func (s *Store) Create(p Project) (Project, error)
- func (s *Store) Delete(id string) error
- func (s *Store) Get(id string) (Project, bool)
- func (s *Store) List() []Project
- func (s *Store) ProjectsFor(user string, groups []string) []Project
- func (s *Store) RoleFor(projectID, user string, groups []string) (string, bool)
- func (s *Store) Update(p Project) error
- type Usage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limits ¶
type Limits struct {
Machines int `json:"machines"`
VCPUs int `json:"vcpus"`
MemoryMiB int64 `json:"memoryMiB"`
DiskGiB int64 `json:"diskGiB"`
// GPUs caps GPUs per GPU pool ID (ADR-0071); a pool missing or at 0 is not limited.
GPUs map[string]int `json:"gpus,omitempty"`
}
Limits caps a project's machines together; zero means unlimited.
type Member ¶
type Member struct {
Kind string `json:"kind"` // user or group
Name string `json:"name"`
Role string `json:"role"` // viewer, operator or admin
}
Member gives one user (Kind "user") or everyone in a group (Kind "group") a Role in a project: "viewer", "operator" or "admin".
type Project ¶
type Project struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Members []Member `json:"members"`
Limits Limits `json:"limits"`
StoragePools []string `json:"storagePools"`
Networks []string `json:"networks"`
Created time.Time `json:"created"`
}
Project is one tenant: its machines, storage pools and networks, who may use them and up to how much.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) ProjectsFor ¶
ProjectsFor is every project the user can see, directly or through any of their groups, by ID.