models

package
v0.0.0-...-d2bc1ab Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backup

type Backup struct {
	gorm.Model
	Name               string        `validate:"required"`
	Compress           compress.Type `validate:"required"`
	Tag                string        `validate:"required"`
	Keystore           string        `validate:"required"`
	Namespace          string        `validate:"required"`
	BackupNameTemplate Template
	Timezone           string
	LastExecutionTime  time.Time

	ExecutionType ExecutionType `validate:"required,oneof=once cron rrule"`
	Cron          string        `validate:"required_if=ExecutionType cron"`
	Rrule         string        `validate:"required_if=ExecutionType rrule"`
	ExecutionTime time.Time     `validate:"required_if=ExecutionType once"`
}

func (*Backup) SetDefaults

func (b *Backup) SetDefaults()

func (Backup) Validate

func (b Backup) Validate() error

type Credential

type Credential struct {
	gorm.DB
	Key      string `validate:"required"`
	Username string
	Password string
	Host     string
	Token    string
	Database string
	KeyId    string
	Secret   string
}

func (Credential) Validate

func (c Credential) Validate() error

type ExecutionType

type ExecutionType string
const (
	OnceExecution  ExecutionType = "once"
	CronExecution  ExecutionType = "cron"
	RruleExecution ExecutionType = "rrule"
)

func (ExecutionType) Validate

func (et ExecutionType) Validate() error

type Group

type Group struct {
	gorm.Model
	Name string
}

type Operation

type Operation string
const (
	WriteOps Operation = "WRITE"
	ReadOps  Operation = "READ"
)

type PendingSnapshot

type PendingSnapshot struct {
	gorm.Model
	BackupID      uint
	Backup        Backup
	ExecutionTime time.Time
}

type Permission

type Permission struct {
	gorm.Model
	Operation string
	GroupID   uint
	Group     Group
}

type Resource

type Resource string
const (
	GroupResource Resource = "GROUP"
	UserResource  Resource = "USER"
)

type Rule

type Rule struct {
	gorm.Model
	Operation Operation
	Resource  Resource
	GroupID   uint
}

type Snapshot

type Snapshot struct {
	gorm.Model
	Status     Status
	Message    string
	Size       uint
	ObjectName string
	ObjectId   string
	Tag        string
	AgentID    uint
	BackupID   uint
	Backup     Backup
	ExecutedAt time.Time
}

type SourceType

type SourceType string
const (
	PostgresType SourceType = "postgres"
	MySQLType    SourceType = "mysql"
	OracleType   SourceType = "oracle"
	SqliteType   SourceType = "sqlite"
	FileType     SourceType = "file"
)

type Status

type Status string
const (
	FailedStatus     Status = "failed"
	OkStatus         Status = "ok"
	PendingStatus    Status = "pending"
	ExportFailStatus Status = "export_failed"
)

type Template

type Template string
const DefaultBackupTemplate Template = "{{ .Name }}-{{ .Timestamp }}.{{ .Ext }}"

type User

type User struct {
	gorm.Model
	Email    string
	Password string
	IsActive bool

	GroupID uint
	Group   Group

	CreatedAt  time.Time
	LastLogged time.Time
}

Jump to

Keyboard shortcuts

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