entity

package
v0.0.0-...-c8e7285 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProjectNotFound = errors.New("project not found")

	ErrUserNotFound = errors.New("user not found")

	ErrDuplicatedUser = errors.New("user is duplicated")

	ErrNotImplemented = fmt.Errorf("not implemented")

	ErrInvalidRepoType = fmt.Errorf("invalid repo type")

	ErrRuntimeNotFound = fmt.Errorf("runtime not found")

	ErrNoRunningRuntime = fmt.Errorf("no running runtime")

	ErrCapabilitiesNotFound = errors.New("capabilities not found")

	ErrCapabilitiesNotValid = errors.New("capabilities not valid")

	ErrCapabilitiesNoParameters = errors.New("capabilities must contain one of these values: nodeSelector, toleration, affinities")

	ErrCapabilitiesNoName = errors.New("capabilities must have a name")

	ErrCapabilitiesNoKey = errors.New("toleration has no key assigned")

	ErrCapabilitiesNoOperator = errors.New("toleration has no operator assigned")

	ErrCapabilitiesInvalidOperator = errors.New("the following value is not a valid toleration operator")

	ErrCapabilitiesNoValue = errors.New("toleration has no value assigned while operator being 'equal'")

	ErrCapabilitiesHasValue = errors.New("toleration has a value assigned while operator being 'exists'")

	ErrCapabilitiesNoEffect = errors.New("toleration has no effect assigned")

	ErrCapabilitiesInvalidEffect = errors.New("the following value is not a valid toleration effect")

	ErrCapabilitiesInvalidSeconds = errors.New("the following value is not a valid duration for toleration seconds")
)

Functions

func IsTolerationEffect

func IsTolerationEffect(effect string) bool

func IsTolerationOperator

func IsTolerationOperator(operator string) bool

Types

type APIToken

type APIToken struct {
	ID           string
	Name         string
	CreationDate string
	LastUsedDate string
	Token        string
}

APIToken entity definition.

type AccessLevel

type AccessLevel string

AccessLevel is an enum for access levels.

const (
	AccessLevelViewer AccessLevel = "VIEWER"

	AccessLevelManager AccessLevel = "MANAGER"

	AccessLevelAdmin AccessLevel = "ADMIN"
)

func (AccessLevel) IsValid

func (e AccessLevel) IsValid() bool

IsValid checks if the type is valid.

func (AccessLevel) String

func (e AccessLevel) String() string

String implements the fmt.Stringer interface.

type Capabilities

type Capabilities struct {
	ID            string                   `bson:"_id"`
	Name          string                   `bson:"name"`
	Default       bool                     `bson:"default"`
	NodeSelectors map[string]string        `bson:"node_selectors"`
	Tolerations   []map[string]interface{} `bson:"tolerations"`
	Affinities    map[string]interface{}   `bson:"affinities"`
}

Capabilities entity definition.

func (Capabilities) GetAffinities

func (c Capabilities) GetAffinities() map[string]interface{}

func (Capabilities) GetNodeSelectors

func (c Capabilities) GetNodeSelectors() map[string]string

func (Capabilities) GetTolerations

func (c Capabilities) GetTolerations() []map[string]interface{}

func (Capabilities) IsAffinitiesEmpty

func (c Capabilities) IsAffinitiesEmpty() bool

func (Capabilities) IsNodeSelectorsEmpty

func (c Capabilities) IsNodeSelectorsEmpty() bool

func (Capabilities) IsTolerationsEmpty

func (c Capabilities) IsTolerationsEmpty() bool

func (Capabilities) Validate

func (c Capabilities) Validate() error

type Member

type Member struct {
	UserID      string
	AccessLevel AccessLevel
	AddedDate   time.Time
}

Member entity definition.

type Project

type Project struct {
	ID                 string
	Name               string
	Description        string
	CreationDate       time.Time
	LastActivationDate string
	Favorite           bool
	Archived           bool
	Error              *string
	Repository         Repository
	Members            []Member
}

Project entity definition.

func NewProject

func NewProject(id, name, description string) Project

NewProject is a constructor function.

func (Project) HasMember

func (p Project) HasMember(userID string) bool

type Repository

type Repository struct {
	Type            RepositoryType
	ExternalRepoURL string
	RepoName        string
	Error           *string
	AuthMethod      RepositoryAuthMethod
}

Repository entity definition.

type RepositoryAuthMethod

type RepositoryAuthMethod string

RepositoryAuthMethod is an enum for repository authentication method.

const (
	// RepositoryAuthPassword authentication method.
	RepositoryAuthPassword RepositoryAuthMethod = "PASSWORD"

	// RepositoryAuthToken authentication method.
	RepositoryAuthToken RepositoryAuthMethod = "TOKEN"
)

func (RepositoryAuthMethod) IsValid

func (e RepositoryAuthMethod) IsValid() bool

IsValid checks if the auth method is valid.

func (RepositoryAuthMethod) String

func (e RepositoryAuthMethod) String() string

String implements the fmt.Stringer interface.

type RepositoryType

type RepositoryType string

RepositoryType is an enum for repository types.

const (
	// RepositoryTypeInternal repository type.
	RepositoryTypeInternal RepositoryType = "INTERNAL"

	// RepositoryTypeExternal repository type.
	RepositoryTypeExternal RepositoryType = "EXTERNAL"
)

func (RepositoryType) IsValid

func (e RepositoryType) IsValid() bool

IsValid checks if the type is valid.

func (RepositoryType) String

func (e RepositoryType) String() string

String implements the fmt.Stringer interface.

type Runtime

type Runtime struct {
	ID          string
	Name        string
	Desc        string
	Labels      []string
	DockerImage string
	DockerTag   string
	RuntimePod  string
}

Runtime entity definition.

func NewRuntime

func NewRuntime(id, name, dockerImage, dockerTag string) Runtime

NewRuntime is a constructor function.

type SSHKey

type SSHKey struct {
	Public       string
	Private      string
	CreationDate time.Time
	LastActivity *time.Time
}

SSHKey entity definition.

type TaintEffect

type TaintEffect string
const (
	TaintEffectNoSchedule       TaintEffect = "NoSchedule"
	TaintEffectPreferNoSchedule TaintEffect = "PreferNoSchedule"
	TaintEffectNoExecute        TaintEffect = "NoExecute"
)

type TolerationOperator

type TolerationOperator string
const (
	TolerationOpExists TolerationOperator = "Exists"
	TolerationOpEqual  TolerationOperator = "Equal"
)

type ToolUrls

type ToolUrls struct {
	KnowledgeGalaxy string `json:"knowledgeGalaxy"`
	Gitea           string `json:"gitea"`
	Filebrowser     string `json:"filebrowser"`
	VSCode          string `json:"vscode"`
	Drone           string `json:"drone"`
	MLFlow          string `json:"mlflow"`
}

ToolUrls entity definition.

type User

type User struct {
	ID           string
	Email        string
	Username     string
	Deleted      bool
	CreationDate time.Time
	AccessLevel  AccessLevel
	SSHKey       SSHKey
	LastActivity *time.Time
	APITokens    []APIToken
}

User entity definition.

func (User) UsernameSlug

func (u User) UsernameSlug() string

type UserActivity

type UserActivity struct {
	Date   time.Time         `bson:"date"`
	UserID string            `bson:"userId"`
	Type   UserActivityType  `bson:"type"`
	Vars   []UserActivityVar `bson:"vars"`
}

func NewUserActivity

func NewUserActivity(
	date time.Time,
	userID string,
	activityType UserActivityType,
	vars []UserActivityVar,
) UserActivity

type UserActivityType

type UserActivityType string
const (
	UserActivityTypeDeleteProject UserActivityType = "DELETE_PROJECT"
)

func (UserActivityType) IsValid

func (e UserActivityType) IsValid() bool

func (UserActivityType) String

func (e UserActivityType) String() string

type UserActivityVar

type UserActivityVar struct {
	Key   string `bson:"key"`
	Value string `bson:"value"`
}

func NewActivityVarsDeleteRepo

func NewActivityVarsDeleteRepo(projectID, minioBackupBucket string) []UserActivityVar

Jump to

Keyboard shortcuts

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