models

package
v0.1.0-beta.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	// Name is the name of the context
	Name string `json:"name"`
	// Server is the endpoint of the kube apiserver for a cluster
	Server string `json:"server"`
	// Cluster is the name of the cluster
	Cluster string `json:"cluster"`
	// User is the name of the user for a cluster
	User string `json:"user"`
	// Selected determines if the context has been selected for use in the
	// dashboard
	Selected bool `json:"selected"`
}

Context represents the configuration for a single cluster-user pair

type Session

type Session struct {
	gorm.Model
	// Session ID
	Key string `gorm:"unique"`
	// encrypted cookie
	Data []byte
	// Time the session will expire
	ExpiresAt time.Time
}

Session type that extends gorm.Model.

type User

type User struct {
	gorm.Model

	Email         string `json:"email" gorm:"unique"`
	Password      string `json:"password"`
	Contexts      string `json:"contexts"`
	RawKubeConfig []byte `json:"rawKubeConfig"`
}

User type that extends gorm.Model

func (*User) ContextToSlice

func (u *User) ContextToSlice() []string

ContextToSlice converts the serialized context string to an array of strings

func (*User) Externalize

func (u *User) Externalize() *UserExternal

Externalize generates an external User to be shared over REST

type UserExternal

type UserExternal struct {
	ID            uint     `json:"id"`
	Email         string   `json:"email"`
	Contexts      []string `json:"contexts"`
	RawKubeConfig string   `json:"rawKubeConfig"`
}

UserExternal represents the User type that is sent over REST

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL