Documentation
¶
Index ¶
- Constants
- type Agent
- func (a *Agent) CountOnlineAgents(hostname string) (int, error)
- func (a *Agent) CreateAgent(agentData AgentData) error
- func (a *Agent) DeleteAgent(hostname, agentID string) (bool, error)
- func (a *Agent) GetAgent(hostname, agentID string) (*AgentData, error)
- func (a *Agent) GetAgents(hostname string) ([]*AgentData, error)
- func (a *Agent) UpdateAgent(agentData AgentData) error
- type AgentData
- type Backup
- type Cron
- func (c *Cron) CreateRecord(record CronRecord) error
- func (c *Cron) DeleteRecord(hostname, cronID string) (bool, error)
- func (c *Cron) GetCronsToRun() ([]*CronRecord, error)
- func (c *Cron) GetHostCrons(hostname string) ([]*CronRecord, error)
- func (c *Cron) GetRecord(hostname, cronID string) (*CronRecord, error)
- func (c *Cron) UpdateRecord(record CronRecord) error
- type CronRecord
- type Host
- type HostData
- type Job
- func (j *Job) CountHostJobs(hostname, cronID, status string) (int, error)
- func (j *Job) CreateRecord(record JobRecord) error
- func (j *Job) DeleteRecord(hostname, jobID string) (bool, error)
- func (j *Job) GetHostJobs(hostname string) ([]*JobRecord, error)
- func (j *Job) GetRecord(hostname, jobID string) (*JobRecord, error)
- func (j *Job) UpdateRecord(record JobRecord) error
- type JobRecord
- type Option
- type OptionData
- type Request
- type User
- type UserData
Constants ¶
const ( // UnknownStatus const UnknownStatus = "unknown" // UpStatus const UpStatus = "up" // DownStatus const DownStatus = "down" )
const ( // SecondInterval constant SecondInterval = "@second" // MinuteInterval constant MinuteInterval = "@minute" // HourInterval constant HourInterval = "@hour" // DayInterval constant DayInterval = "@day" // MonthInterval constant MonthInterval = "@month" // BackupDirectory constant BackupDirectory = "@BackupDirectory" // BackupMySQL constant BackupMySQL = "@BackupMySQL" // BackupRedis constant // TODO Redis Backup Support BackupRedis = "@BackupRedis" // BackupPostgreSQL constant // TODO PostgreSQL Backup Support BackupPostgreSQL = "@BackupPostgreSQL" // BackupEtcd constant // TODO Etcd Backup Support BackupEtcd = "@BackupEtcd" // BackupDockerVolume constant // TODO Docker Volume Backup Support BackupDockerVolume = "@BackupDockerVolume" // BackupSQLite constant BackupSQLite = "@BackupSQLite" )
const ( // PendingStatus constant PendingStatus = "@pending" // FailedStatus constant FailedStatus = "@failed" // SuccessStatus constant SuccessStatus = "@success" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent type
func NewAgentStore ¶
NewAgentStore creates a new instance
func (*Agent) CountOnlineAgents ¶
CountOnlineAgents counts online agents
func (*Agent) CreateAgent ¶
CreateAgent stores agent data and status
func (*Agent) DeleteAgent ¶
DeleteAgent deletes an agent by id and hostname
func (*Agent) UpdateAgent ¶
UpdateAgent updates agent data
type AgentData ¶
type AgentData struct { ID string `json:"id"` URL string `json:"url"` Hostname string `json:"hostname"` APIKey string `json:"apiKey"` Status string `json:"status"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` LastStatusCheck int64 `json:"lastStatusCheck"` }
AgentData type
type Backup ¶
type Backup struct {
// contains filtered or unexported fields
}
Backup type
func NewBackupStore ¶
NewBackupStore creates a new instance
type Cron ¶
type Cron struct {
// contains filtered or unexported fields
}
Cron type
func (*Cron) CreateRecord ¶
func (c *Cron) CreateRecord(record CronRecord) error
CreateRecord stores a cron record
func (*Cron) DeleteRecord ¶
DeleteRecord deletes a cron record
func (*Cron) GetCronsToRun ¶
func (c *Cron) GetCronsToRun() ([]*CronRecord, error)
GetCronsToRun get crons to run
func (*Cron) GetHostCrons ¶
func (c *Cron) GetHostCrons(hostname string) ([]*CronRecord, error)
GetHostCrons get crons for a host
func (*Cron) GetRecord ¶
func (c *Cron) GetRecord(hostname, cronID string) (*CronRecord, error)
GetRecord gets cron record data
func (*Cron) UpdateRecord ¶
func (c *Cron) UpdateRecord(record CronRecord) error
UpdateRecord updates a cron record
type CronRecord ¶
type CronRecord struct { ID string `json:"id"` Name string `json:"name"` Hostname string `json:"hostname"` Request Request `json:"request"` Interval int `json:"interval"` IntervalType string `json:"intervalType"` SuccessJobs int `json:"successJobs"` FailedJobs int `json:"failedJobs"` LastRun int64 `json:"lastRun"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` }
CronRecord type
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
Host type
func (*Host) CreateHost ¶
CreateHost creates a host
func (*Host) DeleteHost ¶
DeleteHost deletes a host
func (*Host) UpdateHost ¶
UpdateHost updates a host
type HostData ¶
type HostData struct { ID string `json:"id"` Hostname string `json:"hostname"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` }
HostData type
type Job ¶
type Job struct {
// contains filtered or unexported fields
}
Job type
func (*Job) CountHostJobs ¶
CountHostJobs counts host jobs
func (*Job) CreateRecord ¶
CreateRecord stores a job record
func (*Job) DeleteRecord ¶
DeleteRecord deletes a job record
func (*Job) GetHostJobs ¶
GetHostJobs get jobs for a host
func (*Job) UpdateRecord ¶
UpdateRecord updates a job record
type JobRecord ¶
type JobRecord struct { ID string `json:"id"` Hostname string `json:"hostname"` CronID string `json:"cronId"` Status string `json:"status"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` }
JobRecord type
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
Option type
func NewOptionStore ¶
NewOptionStore creates a new instance
func (*Option) CreateOption ¶
func (o *Option) CreateOption(option OptionData) error
CreateOption stores an option
func (*Option) DeleteOptionByKey ¶
DeleteOptionByKey deletes an option by a key
func (*Option) GetOptionByKey ¶
func (o *Option) GetOptionByKey(key string) (*OptionData, error)
GetOptionByKey gets an option by a key
func (*Option) UpdateOptionByKey ¶
func (o *Option) UpdateOptionByKey(option OptionData) error
UpdateOptionByKey updates an option by key
func (*Option) UpdateOptions ¶
func (o *Option) UpdateOptions(options []OptionData) error
UpdateOptions update options
type OptionData ¶
type OptionData struct { Key string `json:"key"` Value string `json:"value"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` }
OptionData struct
type Request ¶
type Request struct { Type string `json:"type"` // @BackupSQLite, @BackupMySQL, @BackupDirectory, @BackupRedis, @BackupPostgreSQL Directory string `json:"directory"` BeforeScript string `json:"beforeScript"` RetentionDays int `json:"retentionDays"` MySQLHost string `json:"mysqlHost"` MySQLPort string `json:"mysqlPort"` MySQLUsername string `json:"mysqlUsername"` MySQLPassword string `json:"mysqlPassword"` MySQLAllDatabases bool `json:"mysqlAllDatabases"` MySQLDatabase string `json:"mysqlDatabase"` MySQLTable string `json:"mysqlTable"` MySQLOptions string `json:"mysqlOptions"` SQLitePath string `json:"sqlitePath"` }
Request type
type User ¶
type User struct {
// contains filtered or unexported fields
}
User type
func (*User) Authenticate ¶
Authenticate authenticates a user
func (*User) DeleteUserByEmail ¶
DeleteUserByEmail deletes a user by email
func (*User) GetUserByEmail ¶
GetUserByEmail gets a user by email
func (*User) UpdateUserByEmail ¶
UpdateUserByEmail updates a user by email
type UserData ¶
type UserData struct { ID string `json:"id"` Name string `json:"name"` Email string `json:"email"` Password string `json:"password"` PasswordHash string `json:"passwordHash"` APIKey string `json:"apiKey"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` }
UserData type