Documentation
¶
Overview ¶
Package models has all the type definitions of DRLM Core It's also the responsible of interacting with the DB (e.g. adding records, updating, deleting, querying...)
Index ¶
- func IsErrUsrPwdStrength(err error) bool
- type Agent
- func (a *Agent) Add(ctx *context.Context) error
- func (a *Agent) BeforeCreate() error
- func (a *Agent) Delete(ctx *context.Context) error
- func (a *Agent) Load(ctx *context.Context) error
- func (a *Agent) LoadJobs(ctx *context.Context) error
- func (a *Agent) LoadPlugins(ctx *context.Context) error
- func (a *Agent) Update(ctx *context.Context) error
- type Job
- type JobStatus
- type Plugin
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsErrUsrPwdStrength ¶
IsErrUsrPwdStrength checks if an error is a password strength error
Types ¶
type Agent ¶
type Agent struct { gorm.Model Host string `gorm:"unique;not null"` Accepted bool `gorm:"not null"` MinioKey string `gorm:"not null"` Secret string `gorm:"unique;not null"` // The secret is used for authentication SSHPort int `gorm:"not null"` SSHUser string SSHHostKeys string `gorm:"size:9999"` // The different keys are splitted with `|||` between each one Version string Arch os.Arch OS os.OS OSVersion string Distro string DistroVersion string Jobs []*Job `gorm:"-"` Plugins []*Plugin `gorm:"-"` }
Agent (s) are the clients of DRLM Core that are installed in the servers
func (*Agent) BeforeCreate ¶
BeforeCreate is a hook that gets executed before creating an agent
func (*Agent) LoadPlugins ¶
LoadPlugins loads all the jobs of an agent
type Job ¶
type Job struct { gorm.Model PluginID uint `gorm:"not null"` Plugin *Plugin `gorm:"-"` AgentHost string `gorm:"not null"` Status JobStatus `gorm:"not null"` Time time.Time Config string `gorm:"not null"` BucketName string `gorm:"not null;unique"` Info string Mux sync.Mutex `gorm:"-"` ReconnAttempts int }
Job is an individual job of the scheduler
type JobStatus ¶
type JobStatus int
JobStatus is the status of a job
const ( // JobStatusUnknown is when a job status is not known JobStatusUnknown JobStatus = iota // JobStatusScheduled is when a job has been scheduled JobStatusScheduled // JobStatusRunning is when a job is currently running JobStatusRunning // JobStatusFinished is when a job has already finished JobStatusFinished // JobStatusFailed is when a job has failed during the execution JobStatusFailed // JobStatusCancelled is when a job has been cancelled during the execution JobStatusCancelled )
type Plugin ¶
type Plugin struct { gorm.Model Repo string `gorm:"not null"` Name string `gorm:"not null"` Version string `gorm:"not null"` AgentHost string `gorm:"not null"` Agent *Agent `gorm:"foreignkey:Host;association_foreignkey:AgentHost"` // TODO: This should be stored in the DB Arch []os.Arch `gorm:"-"` OS []os.OS `gorm:"-"` }
Plugin is an individual plugin that's installed in an Agent
type User ¶
type User struct { gorm.Model Username string `gorm:"unique;not null"` Password string `gorm:"not null"` AuthType types.Type `gorm:"not null"` }
User is an individual user of DRLM Core
Click to show internal directories.
Click to hide internal directories.