Documentation
¶
Index ¶
- Constants
- type Command
- type ConnectionOptions
- type ConnectionType
- type DurationJson
- type ExecCommand
- type ExecutionPolicy
- type ExecutionPolicyJson
- type ExecutionStrategy
- type Job
- type JobJson
- type JobOwner
- type JobOwnerJson
- type JobValidationConfig
- type Node
- type NodeJson
- type NodeStatus
- type RunReport
- type RunReportItem
- type RunReportItemJson
- type RunReportJson
- type ShellCommand
- type TimePair
- type TimePairJson
Constants ¶
View Source
const ( POLICY_ALL = "all" POLICY_ANY = "any" )
View Source
const ( CONN_LOCAL = "local" CONN_SSH = "ssh" )
View Source
const ( STATUS_UP = iota STATUS_DOWN )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionOptions ¶
type ConnectionOptions struct {
SshHost string `json:"ssh_host"`
SshUser string `json:"ssh_user"`
SshKeyFile string `json:"ssh_private_key_file"`
}
func (ConnectionOptions) IsValid ¶
func (o ConnectionOptions) IsValid(forType ConnectionType) error
func (ConnectionOptions) SetDefaults ¶
func (o ConnectionOptions) SetDefaults(forType string)
type ConnectionType ¶
type ConnectionType string
type DurationJson ¶
type ExecCommand ¶
type ExecCommand struct {
// contains filtered or unexported fields
}
func (ExecCommand) Command ¶
func (e ExecCommand) Command() []string
type ExecutionPolicy ¶
func NewExecutionPolicyFromJson ¶
func NewExecutionPolicyFromJson(json ExecutionPolicyJson) (ExecutionPolicy, error)
func (ExecutionPolicy) IsValid ¶
func (p ExecutionPolicy) IsValid() error
type ExecutionPolicyJson ¶
type ExecutionStrategy ¶
type ExecutionStrategy interface {
HealthCheck() error
ExecuteCommand(job *Job, report *RunReportItem) error
}
type Job ¶
type Job struct {
// Domain properties
Name string
Description string
Owners []JobOwner
Policy ExecutionPolicy
Schedule cron.Schedule
ScheduleSpec string
Command Command
LastExecution time.Time
Environment map[string]string
// Auxiliary properties
Logger *logging.Logger
Lock sync.RWMutex
}
func (Job) IsValid ¶
func (j Job) IsValid(config JobValidationConfig) error
type JobJson ¶
type JobJson struct {
Description string `json:"description"`
Owners []JobOwnerJson `json:"owners"`
Policy ExecutionPolicyJson `json:"policy"`
Schedule string `json:"schedule"`
ShellCommand string `json:"shell_command"`
Command []string `json:"command"`
Environment map[string]string `json:"environment"`
}
type JobOwner ¶
func NewJobOwnerFromJson ¶
func NewJobOwnerFromJson(json JobOwnerJson) (JobOwner, error)
type JobOwnerJson ¶
type JobValidationConfig ¶
type JobValidationConfig interface {
AllowNoOwner() bool
}
type Node ¶
type Node struct {
Name string
Roles []string
ConnectionType ConnectionType
ConnectionOptions ConnectionOptions
Status NodeStatus
RunningJobs int32
ExecutionStrategy ExecutionStrategy
Lock sync.RWMutex
}
type NodeJson ¶
type NodeJson struct {
Name string `json:"name"`
Roles []string `json:"roles"`
ConnectionType string `json:"connection_type"`
ConnectionOptions ConnectionOptions `json:"connection_options"`
}
type NodeStatus ¶
type NodeStatus int
type RunReport ¶
type RunReport struct {
Id string
Job *Job
Time TimePair
Items []RunReportItem
}
func (*RunReport) Initialize ¶
func (*RunReport) ToJson ¶
func (r *RunReport) ToJson() RunReportJson
type RunReportItem ¶
func (*RunReportItem) Duration ¶
func (i *RunReportItem) Duration() time.Duration
func (*RunReportItem) Summary ¶
func (i *RunReportItem) Summary() string
func (*RunReportItem) ToJson ¶
func (i *RunReportItem) ToJson() RunReportItemJson
type RunReportItemJson ¶
type RunReportItemJson struct {
Time TimePairJson `json:"time"`
Duration DurationJson `json:"duration"`
Success bool `json:"success"`
Output string `json:"output"`
Node string `json:"node"`
}
type RunReportJson ¶
type RunReportJson struct {
Job string `json:"job"`
Time TimePairJson `json:"time"`
Duration DurationJson `json:"duration"`
Success bool `json:"success"`
Items []RunReportItemJson `json:"items"`
}
type ShellCommand ¶
type ShellCommand struct {
// contains filtered or unexported fields
}
func (ShellCommand) Command ¶
func (s ShellCommand) Command() []string
type TimePairJson ¶
Click to show internal directories.
Click to hide internal directories.