model

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UnknownStatus const
	UnknownStatus = "unknown"
	// UpStatus const
	UpStatus = "up"
	// DownStatus const
	DownStatus = "down"
)
View Source
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"
)
View Source
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

func NewAgentStore(db driver.Database) *Agent

NewAgentStore creates a new instance

func (*Agent) CountOnlineAgents

func (a *Agent) CountOnlineAgents(hostname string) (int, error)

CountOnlineAgents counts online agents

func (*Agent) CreateAgent

func (a *Agent) CreateAgent(agentData AgentData) error

CreateAgent stores agent data and status

func (*Agent) DeleteAgent

func (a *Agent) DeleteAgent(hostname, agentID string) (bool, error)

DeleteAgent deletes an agent by id and hostname

func (*Agent) GetAgent

func (a *Agent) GetAgent(hostname, agentID string) (*AgentData, error)

GetAgent gets agent data

func (*Agent) GetAgents

func (a *Agent) GetAgents(hostname string) ([]*AgentData, error)

GetAgents get agents

func (*Agent) UpdateAgent

func (a *Agent) UpdateAgent(agentData AgentData) error

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

func NewBackupStore(db driver.Database) *Backup

NewBackupStore creates a new instance

type Cron

type Cron struct {
	// contains filtered or unexported fields
}

Cron type

func NewCronStore

func NewCronStore(db driver.Database) *Cron

NewCronStore creates a new instance

func (*Cron) CreateRecord

func (c *Cron) CreateRecord(record CronRecord) error

CreateRecord stores a cron record

func (*Cron) DeleteRecord

func (c *Cron) DeleteRecord(hostname, cronID string) (bool, error)

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 NewHostStore

func NewHostStore(db driver.Database) *Host

NewHostStore creates a new instance

func (*Host) CreateHost

func (h *Host) CreateHost(hostData HostData) error

CreateHost creates a host

func (*Host) DeleteHost

func (h *Host) DeleteHost(hostname string) (bool, error)

DeleteHost deletes a host

func (*Host) GetHost

func (h *Host) GetHost(hostname string) (*HostData, error)

GetHost gets a host

func (*Host) GetHosts

func (h *Host) GetHosts() ([]*HostData, error)

GetHosts get hosts

func (*Host) UpdateHost

func (h *Host) UpdateHost(hostData HostData) error

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 NewJobStore

func NewJobStore(db driver.Database) *Job

NewJobStore creates a new instance

func (*Job) CountHostJobs

func (j *Job) CountHostJobs(hostname, cronID, status string) (int, error)

CountHostJobs counts host jobs

func (*Job) CreateRecord

func (j *Job) CreateRecord(record JobRecord) error

CreateRecord stores a job record

func (*Job) DeleteRecord

func (j *Job) DeleteRecord(hostname, jobID string) (bool, error)

DeleteRecord deletes a job record

func (*Job) GetHostJobs

func (j *Job) GetHostJobs(hostname string) ([]*JobRecord, error)

GetHostJobs get jobs for a host

func (*Job) GetRecord

func (j *Job) GetRecord(hostname, jobID string) (*JobRecord, error)

GetRecord gets job record data

func (*Job) UpdateRecord

func (j *Job) UpdateRecord(record JobRecord) error

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

func NewOptionStore(db driver.Database) *Option

NewOptionStore creates a new instance

func (*Option) CreateOption

func (o *Option) CreateOption(option OptionData) error

CreateOption stores an option

func (*Option) DeleteOptionByKey

func (o *Option) DeleteOptionByKey(key string) (bool, error)

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 NewUserStore

func NewUserStore(db driver.Database) *User

NewUserStore creates a new instance

func (*User) Authenticate

func (u *User) Authenticate(email, password string) (bool, error)

Authenticate authenticates a user

func (*User) CreateUser

func (u *User) CreateUser(user UserData) error

CreateUser creates a user

func (*User) DeleteUserByEmail

func (u *User) DeleteUserByEmail(email string) (bool, error)

DeleteUserByEmail deletes a user by email

func (*User) GetUserByEmail

func (u *User) GetUserByEmail(email string) (*UserData, error)

GetUserByEmail gets a user by email

func (*User) UpdateUserByEmail

func (u *User) UpdateUserByEmail(user UserData) error

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

Jump to

Keyboard shortcuts

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