Documentation
¶
Index ¶
- Constants
- Variables
- func FilterVars(variables []*TemplateVar) map[string]interface{}
- func ResolveVariables(srcString string, t *Template, space *Space, user *User, ...) (string, error)
- func RoleExists(roleId string) bool
- type CSIVolume
- type CSIVolumeCapability
- type CSIVolumeMountOptions
- type CSIVolumes
- type Group
- type JSONDbArray
- type RoleName
- type Session
- type Space
- type SpaceVolume
- type Template
- type TemplateVar
- type Token
- 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 )
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 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 ¶
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"` 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 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"` 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
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"` 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 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.