Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Job ¶
type Job struct {
Name string `json:"name" gorm:"unique,notnull"`
ID string `json:"id" gorm:"<-:create;primarykey"`
IDShort string `json:"-" gorm:"<-:create;notnull;unique"`
Cron string `json:"cron,omitempty"`
Nodes StringArray `json:"nodes" gorm:"notnull;type:bytes"`
Tasks TaskMap `json:"tasks" gorm:"notnull;type:bytes"`
TaskHistory StringArray `json:"task_history,omitempty" gorm:"<-:update;type:bytes"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Job contains the information for a given job.
func (*Job) BeforeCreate ¶
BeforeCreate generates the job ID before saving.
func (*Job) GetIDShort ¶
GetIDShort returns the first 8 bytes of the job ID.
type JobTask ¶
type JobTask struct {
Plugin string `json:"plugin"`
Details StringMap `json:"details" gorm:"type:bytes"`
Node string `json:"node,omitempty"`
}
JobTask represents a single task in a job.
type JobWithTasks ¶
JobWithTasks is a regular Job, but with an expanded TaskHistory.
type Node ¶
type Node struct {
Name string `json:"name" gorm:"<-:create;notnull;unique"`
ID string `json:"id" gorm:"<-:create;primarykey"`
IDShort string `json:"-" gorm:"<-:create;notnull;unique"`
PrivateKey []byte `json:"-" gorm:"<-:create;notnull"`
PublicKey []byte `json:"-" gorm:"<-:create;notnull"`
HostKey []byte `json:"-" gorm:"<-:create;notnull;unique"`
IP string `json:"ip" gorm:"<-:create;notnull"`
Username string `json:"username" gorm:"<-:create;notnull;default:root"`
Password string `json:"password,omitempty" gorm:"-"`
Port string `json:"port" gorm:"<-:create;default:22"`
Config *ssh.ClientConfig `json:"-" gorm:"-"`
CreatedAt time.Time
UpdatedAt time.Time
}
Node contains information about a node.
func (*Node) BeforeCreate ¶
BeforeCreate gets the short ID before saving.
func (*Node) GetIDShort ¶
GetIDShort returns the first 8 bytes of the node ID.
type StringArray ¶
type StringArray []string
StringArray provides SQL scanner bindings for an array of strings.
func (*StringArray) Scan ¶
func (a *StringArray) Scan(value interface{}) error
Scan un-marshals a stored value into a StringArray
type StringMap ¶
StringMap provides SQL scanner bindings for a map of strings.
type Task ¶
type Task struct {
State TaskState `json:"state" gorm:"notnull"`
Plugin string `json:"plugin" gorm:"<-:create;notnull"`
ID string `json:"id" gorm:"<-:create;primarykey"`
IDShort string `json:"-" gorm:"<-:create;notnull;unique"`
Node string `json:"node" gorm:"<-:create;notnull"`
Details StringMap `json:"details" gorm:"<-:create;"`
Log StringArray `json:"log,omitempty" gorm:"<-:update;type:bytea"`
ExitCode int `json:"exit_code" gorm:"notnull"`
Command string `json:"-" gorm:"-"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Task defines the information of a task.
func (*Task) BeforeCreate ¶
BeforeCreate initializes the default values for a Task.
func (*Task) GetIDShort ¶
GetIDShort returns the first 8 bytes of the task ID.
type TaskArray ¶
type TaskArray []Task
TaskArray provides SQL scanner bindings for an array of Tasks.
type TaskMap ¶
TaskMap provides SQL scanner bindings for a map of JobTasks.
type TaskState ¶
type TaskState int
TaskState represents the current state of the task.
const ( // StateDone should be given if the task is complete. StateDone TaskState = iota // StateError should be given if the task fails. StateError // StateRunning should be given if the task is running. StateRunning // StateAborted should be given if the task is aborted (stopped while running). StateAborted // StateCancelled should be given if the queued task is canceled. StateCancelled // StateQueued should be given while the task is waiting to be executed. StateQueued // StateOther should be avoided. StateOther TaskState = 10 // StateInternalError should only be given if the task fails prior to execution. StateInternalError TaskState = 11 )