Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteRoleFromCache(roleId string)
- func FilterVars(variables []*TemplateVar) map[string]interface{}
- func ResolveVariables(srcString string, t *Template, space *Space, user *User, ...) (string, error)
- func RoleExists(roleId string) bool
- func SaveRoleToCache(role *Role)
- func SetRoleCache(roles []*Role)
- type CSIVolume
- type CSIVolumeCapability
- type CSIVolumeMountOptions
- type CSIVolumes
- type Group
- type JSONDbArray
- type JSONDbScheduleDays
- type JSONDbUIntArray
- type PermissionName
- type Role
- type Session
- type Space
- type SpaceVolume
- type Template
- type TemplateScheduleDays
- type TemplateVar
- type Token
- type Usage
- type User
- type Volume
Constants ¶
View Source
const ( PermissionManageUsers = iota // Can Manage Users PermissionManageTemplates // Can Manage Templates PermissionManageSpaces // Can Manage Spaces PermissionManageVolumes // Can Manage Volumes PermissionManageGroups // Can Manage Groups PermissionManageRoles // Can Manage Roles PermissionManageVariables // Can Manage Variables PermissionUseSpaces // Can Use Spaces PermissionUseTunnels // Can Use Tunnels )
Permissions
View Source
const (
RoleAdminUUID = "00000000-0000-0000-0000-000000000000"
)
Roles
View Source
const WEBUI_SESSION_COOKIE = "__KNOT_WEBUI_SESSION"
Variables ¶
View Source
var PermissionNames = []PermissionName{ {PermissionManageGroups, "Manage Groups"}, {PermissionManageRoles, "Manage Roles"}, {PermissionManageSpaces, "Manage Spaces"}, {PermissionManageTemplates, "Manage Templates"}, {PermissionManageUsers, "Manage Users"}, {PermissionManageVariables, "Manage Variables"}, {PermissionManageVolumes, "Manage Volumes"}, {PermissionUseSpaces, "Can Use Spaces"}, {PermissionUseTunnels, "Can Use Tunnels"}, }
Functions ¶
func DeleteRoleFromCache ¶ added in v0.12.0
func DeleteRoleFromCache(roleId string)
func FilterVars ¶ added in v0.10.0
func FilterVars(variables []*TemplateVar) map[string]interface{}
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 ¶
func SaveRoleToCache ¶ added in v0.12.0
func SaveRoleToCache(role *Role)
func SetRoleCache ¶ added in v0.12.0
func SetRoleCache(roles []*Role)
Types ¶
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,omitempty" json:"RequestedCapacityMin,omitempty"` CapacityMax interface{} `yaml:"capacity_max,omitempty" json:"RequestedCapacityMax,omitempty"` Capabilities []CSIVolumeCapability `yaml:"capabilities,omitempty" json:"RequestedCapabilities,omitempty"` Secrets map[string]string `yaml:"secrets,omitempty" json:"Secrets,omitempty"` Parameters map[string]string `yaml:"parameters,omitempty" json:"Parameters,omitempty"` }
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"` MaxSpaces uint32 `json:"max_spaces"` ComputeUnits uint32 `json:"compute_units"` StorageUnits uint32 `json:"storage_units"` MaxTunnels uint32 `json:"max_tunnels"` 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 JSONDbScheduleDays ¶ added in v0.12.0
type JSONDbScheduleDays []TemplateScheduleDays
func (*JSONDbScheduleDays) Scan ¶ added in v0.12.0
func (m *JSONDbScheduleDays) Scan(src interface{}) error
type JSONDbUIntArray ¶ added in v0.12.0
type JSONDbUIntArray []uint16
func (*JSONDbUIntArray) Scan ¶ added in v0.12.0
func (m *JSONDbUIntArray) Scan(src interface{}) error
type PermissionName ¶ added in v0.12.0
type Role ¶ added in v0.12.0
type Role struct { Id string `json:"role_id"` Name string `json:"name"` Permissions JSONDbUIntArray `json:"permissions"` CreatedUserId string `json:"created_user_id"` CreatedAt time.Time `json:"created_at"` UpdatedUserId string `json:"updated_user_id"` UpdatedAt time.Time `json:"updated_at"` }
Role
func GetRoleFromCache ¶ added in v0.12.0
func GetRolesFromCache ¶ added in v0.12.0
func GetRolesFromCache() []*Role
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"` Shell string `json:"shell"` Location string `json:"location"` TemplateHash string `json:"template_hash"` NomadNamespace string `json:"nomad_namespace"` ContainerId string `json:"container_id"` VolumeData map[string]SpaceVolume `json:"volume_data"` 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"` SSHHostSigner string `json:"ssh_host_signer"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
Space object
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"` LocalContainer bool `json:"local_container"` IsManual bool `json:"is_manual"` WithTerminal bool `json:"with_terminal"` WithVSCodeTunnel bool `json:"with_vscode_tunnel"` WithCodeServer bool `json:"with_code_server"` WithSSH bool `json:"with_ssh"` ComputeUnits uint32 `json:"compute_units"` StorageUnits uint32 `json:"storage_units"` ScheduleEnabled bool `json:"schedule_enabled"` Schedule JSONDbScheduleDays `json:"schedule"` 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 NewTemplate(name string, description string, job string, volumes string, userId string, groups []string, localContainer bool, isManual bool, withTerminal bool, withVSCodeTunnel bool, withCodeServer bool, withSSH bool, computeUnits uint32, storageUnits uint32, scheduleEnabled bool, schedule *[]TemplateScheduleDays) *Template
func (*Template) AllowedBySchedule ¶ added in v0.12.0
func (*Template) GetVolumes ¶
func (*Template) UpdateHash ¶
func (template *Template) UpdateHash()
type TemplateScheduleDays ¶ added in v0.12.0
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"` Local bool `json:"local"` Restricted bool `json:"restricted"` 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 uint32 `json:"max_spaces"` ComputeUnits uint32 `json:"compute_units"` StorageUnits uint32 `json:"storage_units"` MaxTunnels uint32 `json:"max_tunnels"` 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"` LocalContainer bool `json:"local_container"` 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.