Documentation
¶
Index ¶
- Constants
- Variables
- func ResolveVariables(srcString string, t *Template, space *Space, user *User, ...) (string, error)
- func RoleExists(roleId string) bool
- type AgentState
- type CSIVolume
- type CSIVolumeCapability
- type CSIVolumeMountOptions
- type CSIVolumes
- type Group
- type JSONDbArray
- type RemoteServer
- type RoleName
- type Session
- type Space
- type SpaceVolume
- type Template
- type TemplateVar
- type Token
- type User
- type Volume
Constants ¶
View Source
const ( AGENT_STATE_PING_INTERVAL = 4 * time.Second AGENT_STATE_GC_INTERVAL = 5 * time.Second AGENT_STATE_TIMEOUT = 15 * time.Second )
View Source
const ( REMOTE_SERVER_PING_INTERVAL = 10 * time.Second REMOTE_SERVER_GC_INTERVAL = 20 * time.Second REMOTE_SERVER_TIMEOUT = 30 * time.Second )
View Source
const ( PermissionManageUsers = iota // Can Manage Users PermissionManageTemplates // Can Manage Templates PermissionManageSpaces // Can Manage Spaces PermissionManageVolumes // Can Manage Volumes )
Permissions
View Source
const ( RoleAdmin = "00000000-0000-0000-0000-000000000000" RoleUserManager = "00000000-0000-0000-0000-000000000001" RoleTemplateManager = "00000000-0000-0000-0000-000000000002" RoleSpaceManager = "00000000-0000-0000-0000-000000000003" RoleVolumeManager = "00000000-0000-0000-0000-000000000004" )
Roles
View Source
const ( MANUAL_TEMPLATE_ID = "00000000-0000-0000-0000-000000000000" REMOTE_SERVER_TEMPLATE_FETCH_HASH_INTERVAL = 30 * time.Second )
View Source
const WEBUI_SESSION_COOKIE = "__KNOT_WEBUI_SESSION"
Variables ¶
View Source
var RoleNames = []RoleName{ {RoleAdmin, "Admin"}, {RoleUserManager, "User Manager"}, {RoleTemplateManager, "Template Manager"}, {RoleSpaceManager, "Space Manager"}, {RoleVolumeManager, "Volume Manager"}, }
Functions ¶
func ResolveVariables ¶
func ResolveVariables(srcString string, t *Template, space *Space, user *User, variables *map[string]interface{}) (string, error)
Parse an input string and resolve knot variables
func RoleExists ¶
Types ¶
type AgentState ¶
type AgentState struct {
Id string `json:"space_id"`
AgentVersion string `json:"agent_version"`
AccessToken string `json:"access_token"`
HasCodeServer bool `json:"has_code_server"`
SSHPort int `json:"ssh_port"`
VNCHttpPort int `json:"vnc_http_port"`
HasTerminal bool `json:"has_terminal"`
TcpPorts []int `json:"tcp_ports"`
HttpPorts []int `json:"http_ports"`
ExpiresAfter time.Time `json:"expires_after"`
}
Struct holding the state of an agent
func NewAgentState ¶
func NewAgentState(spaceId string) *AgentState
type CSIVolume ¶
type CSIVolume struct {
Id string `yaml:"id" json:"ID"`
Name string `yaml:"name" json:"Name"`
Namespace string `yaml:"namespace" json:"Namespace"`
PuluginId string `yaml:"plugin_id" json:"PluginID"`
Type string `yaml:"type" json:"Type"`
MountOptions CSIVolumeMountOptions `yaml:"mount_options" json:"MountOptions"`
CapacityMin interface{} `yaml:"capacity_min" json:"RequestedCapacityMin"`
CapacityMax interface{} `yaml:"capacity_max" json:"RequestedCapacityMax"`
Capabilities []CSIVolumeCapability `yaml:"capabilities" json:"RequestedCapabilities"`
Secrets map[string]string `yaml:"secrets" json:"Secrets"`
Parameters map[string]string `yaml:"parameters" json:"Parameters"`
}
type CSIVolumeCapability ¶
type CSIVolumeMountOptions ¶
type CSIVolumes ¶
type CSIVolumes struct {
Volumes []CSIVolume `yaml:"volumes" json:"Volumes"`
}
func LoadVolumesFromYaml ¶
type Group ¶
type Group struct {
Id string `json:"group_id"`
Name string `json:"name"`
CreatedUserId string `json:"created_user_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedUserId string `json:"updated_user_id"`
UpdatedAt time.Time `json:"updated_at"`
}
Group object
type JSONDbArray ¶
type JSONDbArray []string
func (*JSONDbArray) Scan ¶
func (m *JSONDbArray) Scan(src interface{}) error
type RemoteServer ¶ added in v0.9.0
type RemoteServer struct {
Id string `json:"server_id"`
Url string `json:"url"`
ExpiresAfter time.Time `json:"expires_after"`
}
Struct holding the state of a remote server
func NewRemoteServer ¶ added in v0.9.0
func NewRemoteServer(url string) *RemoteServer
type Session ¶
type Session struct {
Id string `json:"session_id"`
Ip string `json:"ip"`
UserId string `json:"user_id"`
RemoteSessionId string `json:"remote_session_id"`
UserAgent string `json:"user_agent"`
ExpiresAfter time.Time `json:"expires_after"`
}
Session object
type Space ¶
type Space struct {
Id string `json:"space_id"`
UserId string `json:"user_id"`
TemplateId string `json:"template_id"`
Name string `json:"name"`
AgentURL string `json:"agent_url"`
Shell string `json:"shell"`
Location string `json:"location"`
TemplateHash string `json:"template_hash"`
NomadNamespace string `json:"nomad_namespace"`
NomadJobId string `json:"nomad_job_id"`
VolumeData map[string]SpaceVolume `json:"volume_data"`
VolumeSizes map[string]int64 `json:"volume_sizes"`
IsDeployed bool `json:"is_deployed"`
IsPending bool `json:"is_pending"` // Flags if the space is pending a state change, starting or stopping
IsDeleting bool `json:"is_deleting"`
AltNames []string `json:"alt_names"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Space object
func (*Space) GetAgentURL ¶
type SpaceVolume ¶
type Template ¶
type Template struct {
Id string `json:"template_id"`
Name string `json:"name"`
Description string `json:"description"`
Hash string `json:"hash"`
Job string `json:"job"`
Volumes string `json:"volumes"`
Groups JSONDbArray `json:"groups"`
CreatedUserId string `json:"created_user_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedUserId string `json:"updated_user_id"`
UpdatedAt time.Time `json:"updated_at"`
}
Template object
func NewTemplate ¶
func (*Template) GetVolumes ¶
func (*Template) UpdateHash ¶
func (template *Template) UpdateHash()
type TemplateVar ¶
type TemplateVar struct {
Id string `json:"templatevar_id"`
Name string `json:"name"`
Location string `json:"location"`
Value string `json:"value"`
Protected bool `json:"protected"`
CreatedUserId string `json:"created_user_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedUserId string `json:"updated_user_id"`
UpdatedAt time.Time `json:"updated_at"`
}
Template Variable object
func NewTemplateVar ¶
func (*TemplateVar) DecryptSetValue ¶
func (templateVar *TemplateVar) DecryptSetValue(text string)
func (*TemplateVar) GetValueEncrypted ¶
func (templateVar *TemplateVar) GetValueEncrypted() string
type Token ¶
type Token struct {
Id string `json:"token_id"`
UserId string `json:"user_id"`
SessionId string `json:"session_id"`
Name string `json:"name"`
ExpiresAfter time.Time `json:"expires_after"`
}
Session object
type User ¶
type User struct {
Id string `json:"user_id"`
Username string `json:"username"`
Email string `json:"email"`
Password string `json:"password"`
ServicePassword string `json:"service_password"`
SSHPublicKey string `json:"ssh_public_key"`
GitHubUsername string `json:"github_username"`
Roles JSONDbArray `json:"roles"`
Groups JSONDbArray `json:"groups"`
Active bool `json:"active"`
MaxSpaces int `json:"max_spaces"`
MaxDiskSpace int `json:"max_disk_space"`
PreferredShell string `json:"preferred_shell"`
Timezone string `json:"timezone"`
LastLoginAt *time.Time `json:"last_login_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedAt time.Time `json:"created_at"`
}
User object
func (*User) CheckPassword ¶
Check the password for the user
func (*User) HasAnyGroup ¶
func (u *User) HasAnyGroup(groups *JSONDbArray) bool
func (*User) HasPermission ¶
func (*User) SetPassword ¶
Set the password for the user
type Volume ¶
type Volume struct {
Id string `json:"volume_id"`
Name string `json:"name"`
Location string `json:"location"`
Definition string `json:"definition"`
Active bool `json:"active"`
CreatedUserId string `json:"created_user_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedUserId string `json:"updated_user_id"`
UpdatedAt time.Time `json:"updated_at"`
}
Template object
Click to show internal directories.
Click to hide internal directories.