Documentation ¶
Index ¶
- Constants
- Variables
- func Pattern(glob string) string
- func PatternPrefix(prefix string) string
- func RandomID() string
- type Agent
- type AgentFilter
- type Archive
- type ArchiveFilter
- type AuthToken
- type AuthTokenFilter
- type ConfigItem
- type DB
- func (db *DB) AddUserToTenant(user, tenant, role string) error
- func (db *DB) AnnotateTargetArchive(target, id, notes string) error
- func (db *DB) AnnotateTargetTask(target, id string, t *TaskAnnotation) error
- func (db *DB) ApplyFixups() error
- func (db *DB) ArchiveStorageFootprint(filter *ArchiveFilter) (int64, error)
- func (db *DB) CancelTask(id string, at time.Time) error
- func (db *DB) CheckCurrentSchema() error
- func (db *DB) CleanArchives() error
- func (db *DB) CleanStores() error
- func (db *DB) CleanTargets() error
- func (db *DB) ClearAllSessions() error
- func (db *DB) ClearExpiredSessions(expiration_threshold time.Time) error
- func (db *DB) ClearMembershipsFor(user *User) error
- func (db *DB) ClearSession(id string) error
- func (db *DB) CompleteTask(id string, at time.Time) error
- func (db *DB) Connected() bool
- func (db *DB) Count(sql string, args ...interface{}) (uint, error)
- func (db *DB) CountArchives(filter *ArchiveFilter) (int, error)
- func (db *DB) CountTargets(filter *TargetFilter) (int, error)
- func (db *DB) CreateAgentStatusTask(owner string, agent *Agent) (*Task, error)
- func (db *DB) CreateBackupTask(owner string, job *Job) (*Task, error)
- func (db *DB) CreateInternalTask(owner, op, tenant string) (*Task, error)
- func (db *DB) CreateJob(job *Job) (*Job, error)
- func (db *DB) CreatePurgeTask(owner string, archive *Archive) (*Task, error)
- func (db *DB) CreateRestoreTask(owner string, archive *Archive, target *Target) (*Task, error)
- func (db *DB) CreateSession(session *Session) (*Session, error)
- func (db *DB) CreateStore(store *Store) (*Store, error)
- func (db *DB) CreateTarget(target *Target) (*Target, error)
- func (db *DB) CreateTaskArchive(id, archive_id, key string, at time.Time, encryptionType, compression string, ...) (string, error)
- func (db *DB) CreateTenant(tenant *Tenant) (*Tenant, error)
- func (db *DB) CreateTestStoreTask(owner string, store *Store) (*Task, error)
- func (db *DB) CreateUser(user *User) (*User, error)
- func (db *DB) DeleteAgent(agent *Agent) error
- func (db *DB) DeleteArchive(id string) (bool, error)
- func (db *DB) DeleteAuthToken(id string, user *User) error
- func (db *DB) DeleteJob(id string) (bool, error)
- func (db *DB) DeleteStore(id string) (bool, error)
- func (db *DB) DeleteTarget(id string) (bool, error)
- func (db *DB) DeleteTenant(tenant *Tenant, recurse bool) error
- func (db *DB) DeleteUser(user *User) error
- func (db *DB) Disconnect() error
- func (db *DB) EnsureTenant(name string) (*Tenant, error)
- func (db *DB) Exec(sql string, args ...interface{}) error
- func (db *DB) Exists(sql string, args ...interface{}) (bool, error)
- func (db *DB) ExpireArchive(id string) error
- func (db *DB) FailTask(id string, at time.Time) error
- func (db *DB) GenerateAuthToken(name string, user *User) (*AuthToken, string, error)
- func (db *DB) GetAgent(id string) (*Agent, error)
- func (db *DB) GetAgentByAddress(address string) (*Agent, error)
- func (db *DB) GetAgentPluginMetadata(addr, name string) (*plugin.PluginInfo, error)
- func (db *DB) GetAllAgents(filter *AgentFilter) ([]*Agent, error)
- func (db *DB) GetAllArchives(filter *ArchiveFilter) ([]*Archive, error)
- func (db *DB) GetAllAuthTokens(filter *AuthTokenFilter) ([]*AuthToken, error)
- func (db *DB) GetAllFixups(filter *FixupFilter) ([]*Fixup, error)
- func (db *DB) GetAllJobs(filter *JobFilter) ([]*Job, error)
- func (db *DB) GetAllSessions(filter *SessionFilter) ([]*Session, error)
- func (db *DB) GetAllStores(filter *StoreFilter) ([]*Store, error)
- func (db *DB) GetAllTargets(filter *TargetFilter) ([]*Target, error)
- func (db *DB) GetAllTasks(filter *TaskFilter) ([]*Task, error)
- func (db *DB) GetAllTenants(filter *TenantFilter) ([]*Tenant, error)
- func (db *DB) GetAllUsers(filter *UserFilter) ([]*User, error)
- func (db *DB) GetArchive(id string) (*Archive, error)
- func (db *DB) GetArchivesNeedingPurge() ([]*Archive, error)
- func (db *DB) GetAuthToken(id string) (*AuthToken, error)
- func (db *DB) GetExpiredArchives() ([]*Archive, error)
- func (db *DB) GetFixup(id string) (*Fixup, error)
- func (db *DB) GetJob(id string) (*Job, error)
- func (db *DB) GetMembershipsForUser(user string) ([]*Membership, error)
- func (db *DB) GetSession(id string) (*Session, error)
- func (db *DB) GetStore(id string) (*Store, error)
- func (db *DB) GetTarget(id string) (*Target, error)
- func (db *DB) GetTask(id string) (*Task, error)
- func (db *DB) GetTenant(id string) (*Tenant, error)
- func (db *DB) GetTenantRole(org string, team string) (string, string, error)
- func (db *DB) GetTenantsForUser(user string) ([]*Tenant, error)
- func (db *DB) GetUser(account string, backend string) (*User, error)
- func (db *DB) GetUserByID(id string) (*User, error)
- func (db *DB) GetUserForSession(id string) (*User, error)
- func (db *DB) GetUsersForTenant(tenant string) ([]*User, error)
- func (db *DB) Inform(mbus *bus.Bus)
- func (db *DB) InvalidateArchive(id string) error
- func (db *DB) IsTaskRunnable(task *Task) (bool, error)
- func (db *DB) ManuallyPurgeArchive(id string) error
- func (db *DB) MarkTasksIrrelevant() error
- func (db *DB) PauseJob(id string) (bool, error)
- func (db *DB) PauseOrUnpauseJob(id string, pause bool) (bool, error)
- func (db *DB) PokeSession(session *Session) error
- func (db *DB) PreRegisterAgent(host, name string, port int) error
- func (db *DB) PurgeArchive(id string) error
- func (db *DB) RedactAllTaskLogs(tasks []*Task)
- func (db *DB) RedactTaskLog(task *Task)
- func (db *DB) RemoveUserFromTenant(user, tenant string) error
- func (db *DB) RescheduleJob(j *Job, t time.Time) error
- func (db *DB) ScheduledTask(id string) error
- func (db *DB) SchemaVersion() (int, error)
- func (db *DB) Setup(want int) (int, error)
- func (db *DB) SkipBackupTask(owner string, job *Job, msg string) (*Task, error)
- func (db *DB) StartTask(id string, at time.Time) error
- func (db *DB) UnpauseJob(id string) (bool, error)
- func (db *DB) UnscheduleAllTasks() error
- func (db *DB) UpdateAgent(agent *Agent) error
- func (db *DB) UpdateArchive(update *Archive) error
- func (db *DB) UpdateJob(job *Job) error
- func (db *DB) UpdateStore(store *Store) error
- func (db *DB) UpdateTarget(target *Target) error
- func (db *DB) UpdateTaskLog(id string, more string) error
- func (db *DB) UpdateTenant(tenant *Tenant) (*Tenant, error)
- func (db *DB) UpdateUser(user *User) error
- func (db *DB) UpdateUserSettings(user *User) error
- type Fixup
- type FixupFilter
- type Job
- type JobFilter
- type Membership
- type Schema
- type Session
- type SessionFilter
- type Store
- type StoreFilter
- type StoreStats
- type Target
- type TargetFilter
- type Task
- type TaskAnnotation
- type TaskFilter
- type TaskInfo
- type Tenant
- type TenantFilter
- type User
- type UserFilter
Constants ¶
View Source
const ( BackupOperation = "backup" RestoreOperation = "restore" ShieldRestoreOperation = "shield-restore" PurgeOperation = "purge" TestStoreOperation = "test-store" AgentStatusOperation = "agent-status" AnalyzeStorageOperation = "analyze-storage" PendingStatus = "pending" ScheduledStatus = "scheduled" RunningStatus = "running" CanceledStatus = "canceled" FailedStatus = "failed" DoneStatus = "done" )
View Source
const ( BcryptWorkFactor = 14 LocalBackend = `local` )
Variables ¶
View Source
var CurrentSchema int = currentSchema()
View Source
var GlobalTenantUUID = uuid.NIL.String()
View Source
var Schemas = map[int]Schema{
1: v1Schema{},
2: v2Schema{},
3: v3Schema{},
4: v4Schema{},
5: v5Schema{},
6: v6Schema{},
7: v7Schema{},
8: v8Schema{},
9: v9Schema{},
10: v10Schema{},
}
Functions ¶
func PatternPrefix ¶
Types ¶
type Agent ¶
type Agent struct { UUID string `json:"uuid" mbus:"uuid"` Name string `json:"name" mbus:"name"` Address string `json:"address" mbus:"address"` Version string `json:"version" mbus:"version"` Hidden bool `json:"hidden" mbus:"hidden"` LastSeenAt int64 `json:"last_seen_at" mbus:"last_seen_at"` LastCheckedAt int64 `json:"last_checked_at" mbus:"last_checked_at"` LastError string `json:"last_error" mbus:"last_error"` Status string `json:"status" mbus:"status"` Meta map[string]interface{} `json:"metadata,omitempty"` RawMeta string `json:"-"` }
type AgentFilter ¶
type AgentFilter struct { UUID string ExactMatch bool Address string Name string Status string SkipHidden bool SkipVisible bool InflateMetadata bool }
func (*AgentFilter) Query ¶
func (f *AgentFilter) Query() (string, []interface{})
type Archive ¶ added in v0.6.4
type Archive struct { UUID string `json:"uuid" mbus:"uuid"` TenantUUID string `json:"tenant_uuid" mbus:"tenant_uuid"` TargetUUID string `json:"target_uuid" mbus:"target_uuid"` StoreUUID string `json:"store_uuid" mbus:"store_uuid"` StoreKey string `json:"key" mbus:"key"` TakenAt int64 `json:"taken_at" mbus:"taken_at"` ExpiresAt int64 `json:"expires_at" mbus:"expires_at"` Notes string `json:"notes" mbus:"notes"` Status string `json:"status" mbus:"status"` PurgeReason string `json:"purge_reason" mbus:"purge_reason"` EncryptionType string `json:"encryption_type" mbus:"encryption_type"` Compression string `json:"compression" mbus:"compression"` Size int64 `json:"size" mbus:"size"` TargetName string `json:"target_name"` TargetPlugin string `json:"target_plugin"` TargetEndpoint string `json:"target_endpoint"` StoreName string `json:"store_name"` StorePlugin string `json:"store_plugin"` StoreEndpoint string `json:"store_endpoint"` StoreAgent string `json:"store_agent"` Job string `json:"job"` }
type ArchiveFilter ¶
type ArchiveFilter struct { UUID string ExactMatch bool ForTarget string ForStore string Before *time.Time After *time.Time ExpiresBefore *time.Time ExpiresAfter *time.Time WithStatus []string WithOutStatus []string ForTenant string Limit int }
func (*ArchiveFilter) Query ¶
func (f *ArchiveFilter) Query() (string, []interface{})
type AuthTokenFilter ¶
func (AuthTokenFilter) Query ¶
func (t AuthTokenFilter) Query() (string, []interface{})
type ConfigItem ¶
type ConfigItem struct { Label string `json:"label"` Key string `json:"key"` Value string `json:"value"` Type string `json:"type"` Default string `json:"default"` Redacted bool `json:"redacted"` Obscure bool `json:"obscure"` }
func DisplayableConfig ¶
func DisplayableConfig(typ string, info *plugin.PluginInfo, config map[string]interface{}, private bool) []ConfigItem
type DB ¶
func (*DB) AddUserToTenant ¶
func (*DB) AnnotateTargetArchive ¶
func (*DB) AnnotateTargetTask ¶
func (db *DB) AnnotateTargetTask(target, id string, t *TaskAnnotation) error
func (*DB) ApplyFixups ¶
func (*DB) ArchiveStorageFootprint ¶
func (db *DB) ArchiveStorageFootprint(filter *ArchiveFilter) (int64, error)
func (*DB) CheckCurrentSchema ¶
func (*DB) CleanArchives ¶
func (*DB) CleanStores ¶
func (*DB) CleanTargets ¶
func (*DB) ClearAllSessions ¶
func (*DB) ClearExpiredSessions ¶
func (*DB) ClearMembershipsFor ¶
func (*DB) ClearSession ¶
func (*DB) CountArchives ¶
func (db *DB) CountArchives(filter *ArchiveFilter) (int, error)
func (*DB) CountTargets ¶
func (db *DB) CountTargets(filter *TargetFilter) (int, error)
func (*DB) CreateAgentStatusTask ¶
func (*DB) CreateInternalTask ¶
func (*DB) CreatePurgeTask ¶
func (*DB) CreateRestoreTask ¶
func (*DB) CreateTaskArchive ¶
func (*DB) CreateTestStoreTask ¶
func (*DB) DeleteAgent ¶
func (*DB) DeleteUser ¶
func (*DB) ExpireArchive ¶
func (*DB) GenerateAuthToken ¶
func (*DB) GetAgentPluginMetadata ¶
func (db *DB) GetAgentPluginMetadata(addr, name string) (*plugin.PluginInfo, error)
func (*DB) GetAllAgents ¶
func (db *DB) GetAllAgents(filter *AgentFilter) ([]*Agent, error)
func (*DB) GetAllArchives ¶ added in v0.6.4
func (db *DB) GetAllArchives(filter *ArchiveFilter) ([]*Archive, error)
func (*DB) GetAllAuthTokens ¶
func (db *DB) GetAllAuthTokens(filter *AuthTokenFilter) ([]*AuthToken, error)
func (*DB) GetAllFixups ¶
func (db *DB) GetAllFixups(filter *FixupFilter) ([]*Fixup, error)
func (*DB) GetAllSessions ¶
func (db *DB) GetAllSessions(filter *SessionFilter) ([]*Session, error)
func (*DB) GetAllStores ¶ added in v0.6.4
func (db *DB) GetAllStores(filter *StoreFilter) ([]*Store, error)
func (*DB) GetAllTargets ¶ added in v0.6.4
func (db *DB) GetAllTargets(filter *TargetFilter) ([]*Target, error)
func (*DB) GetAllTasks ¶ added in v0.6.4
func (db *DB) GetAllTasks(filter *TaskFilter) ([]*Task, error)
func (*DB) GetAllTenants ¶
func (db *DB) GetAllTenants(filter *TenantFilter) ([]*Tenant, error)
func (*DB) GetAllUsers ¶
func (db *DB) GetAllUsers(filter *UserFilter) ([]*User, error)
func (*DB) GetArchivesNeedingPurge ¶
func (*DB) GetExpiredArchives ¶
func (*DB) GetMembershipsForUser ¶
func (db *DB) GetMembershipsForUser(user string) ([]*Membership, error)
func (*DB) GetTenantRole ¶
func (*DB) GetTenantsForUser ¶
GetTenantsForUser given a user's uuid returns a slice of Tenants that the user has membership with
func (*DB) InvalidateArchive ¶
func (*DB) ManuallyPurgeArchive ¶
func (*DB) MarkTasksIrrelevant ¶
func (*DB) PokeSession ¶
func (*DB) PurgeArchive ¶
func (*DB) RedactAllTaskLogs ¶
func (*DB) RedactTaskLog ¶
func (*DB) RemoveUserFromTenant ¶
func (*DB) ScheduledTask ¶
func (*DB) SchemaVersion ¶
func (*DB) SkipBackupTask ¶
func (*DB) UnscheduleAllTasks ¶
UnscheduleAllTasks takes all tasks which are in the scheduled state and puts them back in a pending state.
func (*DB) UpdateAgent ¶
func (*DB) UpdateArchive ¶
func (*DB) UpdateStore ¶
func (*DB) UpdateTarget ¶
func (*DB) UpdateUser ¶
func (*DB) UpdateUserSettings ¶
type Fixup ¶
type FixupFilter ¶
func (*FixupFilter) Query ¶
func (f *FixupFilter) Query() (string, []interface{})
type Job ¶ added in v0.6.4
type Job struct { TenantUUID string `json:"-" mbus:"tenant_uuid"` TargetUUID string `json:"-" mbus:"target_uuid"` StoreUUID string `json:"-" mbus:"store_uuid"` UUID string `json:"uuid" mbus:"uuid"` Name string `json:"name" mbus:"name"` Summary string `json:"summary" mbus:"summary"` KeepN int `json:"keep_n" mbus:"keep_n"` KeepDays int `json:"keep_days" mbus:"keep_days"` Schedule string `json:"schedule" mbus:"schedule"` Paused bool `json:"paused" mbus:"paused"` FixedKey bool `json:"fixed_key" mbus:"fixed_key"` Target struct { UUID string `json:"uuid"` Name string `json:"name"` Agent string `json:"agent"` Plugin string `json:"plugin"` Compression string `json:"compression"` Endpoint string `json:"endpoint,omitempty"` Config map[string]interface{} `json:"config,omitempty"` } `json:"target"` Store struct { UUID string `json:"uuid"` Name string `json:"name"` Agent string `json:"agent"` Plugin string `json:"plugin"` Summary string `json:"summary"` Healthy bool `json:"healthy"` Endpoint string `json:"endpoint,omitempty"` Config map[string]interface{} `json:"config,omitempty"` } `json:"store"` Agent string `json:"agent"` Healthy bool `json:"healthy" mbus:"healthy"` LastRun int64 `json:"last_run"` LastTaskStatus string `json:"last_task_status"` Spec *timespec.Spec `json:"-"` NextRun int64 `json:"-"` }
func (*Job) Reschedule ¶ added in v0.6.4
type JobFilter ¶
type Membership ¶
type Session ¶
type Session struct { UUID string `json:"uuid"` UserUUID string `json:"user_uuid"` CreatedAt int64 `json:"created_at"` LastSeen int64 `json:"last_seen_at"` Token string `json:"token_uuid"` Name string `json:"name"` IP string `json:"ip_addr"` UserAgent string `json:"user_agent"` UserAccount string `json:"user_account"` CurrentSession bool `json:"current_session"` }
type SessionFilter ¶
type SessionFilter struct { Name string ExactMatch bool UUID string UserUUID string Limit int IP string IsToken bool }
func (*SessionFilter) Query ¶
func (f *SessionFilter) Query() (string, []interface{})
type Store ¶ added in v0.6.4
type Store struct { UUID string `json:"uuid" mbus:"uuid"` TenantUUID string `json:"-" mbus:"tenant_uuid"` Name string `json:"name" mbus:"name"` Summary string `json:"summary" mbus:"summary"` Agent string `json:"agent" mbus:"agent"` Plugin string `json:"plugin" mbus:"plugin"` Global bool `json:"global" mbus:"global"` Healthy bool `json:"healthy" mbus:"healthy"` DailyIncrease int64 `json:"daily_increase" mbus:"daily_increase"` StorageUsed int64 `json:"storage_used" mbus:"storage_used"` Threshold int64 `json:"threshold" mbus:"threshold"` ArchiveCount int `json:"archive_count" mbus:"archive_count"` Config map[string]interface{} `json:"config,omitempty" mbus:"config"` LastTestTaskUUID string `json:"last_test_task_uuid"` }
func (Store) ConfigJSON ¶
func (*Store) Configuration ¶
func (store *Store) Configuration(db *DB, private bool) ([]ConfigItem, error)
type StoreFilter ¶
type StoreFilter struct { UUID string SkipUsed bool SkipUnused bool SearchName string ForPlugin string ForTenant string ExactMatch bool }
func (*StoreFilter) Query ¶
func (f *StoreFilter) Query() (string, []interface{})
type StoreStats ¶
type Target ¶ added in v0.6.4
type Target struct { UUID string `json:"uuid" mbus:"uuid"` TenantUUID string `json:"-" mbus:"tenant_uuid"` Name string `json:"name" mbus:"name"` Summary string `json:"summary" mbus:"summary"` Plugin string `json:"plugin" mbus:"plugin"` Agent string `json:"agent" mbus:"agent"` Compression string `json:"compression" mbus:"compression"` Config map[string]interface{} `json:"config,omitempty" mbus:"config"` }
func (Target) ConfigJSON ¶
func (*Target) Configuration ¶
func (target *Target) Configuration(db *DB, private bool) ([]ConfigItem, error)
type TargetFilter ¶
type TargetFilter struct { UUID string SkipUsed bool SkipUnused bool SearchName string ForTenant string ForPlugin string ExactMatch bool }
func (*TargetFilter) Query ¶
func (f *TargetFilter) Query() (string, []interface{})
type Task ¶ added in v0.6.4
type Task struct { UUID string `json:"uuid" mbus:"uuid"` TenantUUID string `json:"tenant_uuid" mbus:"tenant_uuid"` Owner string `json:"owner" mbus:"owner"` Op string `json:"type" mbus:"op"` JobUUID string `json:"job_uuid" mbus:"job_uuid"` ArchiveUUID string `json:"archive_uuid" mbus:"archive_uuid"` StoreUUID string `json:"store_uuid" mbus:"store_uuid"` StorePlugin string `json:"-"` StoreEndpoint string `json:"-"` TargetUUID string `json:"target_uuid" mbus:"target_uuid"` TargetPlugin string `json:"-"` TargetEndpoint string `json:"-"` Compression string `json:"-"` Status string `json:"status" mbus:"status"` RequestedAt int64 `json:"requested_at" mbus:"requested_at"` StartedAt int64 `json:"started_at" mbus:"started_at"` StoppedAt int64 `json:"stopped_at" mbus:"stopped_at"` TimeoutAt int64 `json:"-"` Attempts int `json:"-"` RestoreKey string `json:"-"` FixedKey bool `json:"-"` Agent string `json:"-"` Log string `json:"log"` OK bool `json:"ok" mbus:"ok"` Notes string `json:"notes" mbus:"notes"` Clear string `json:"clear" mbus:"clear"` TaskUUIDChan chan *TaskInfo `json:"-"` }
type TaskAnnotation ¶
type TaskFilter ¶
type TaskFilter struct { UUID string ExactMatch bool SkipActive bool SkipInactive bool OnlyRelevant bool ForOp string ForAgent string SkipStopped bool ForTenant string ForTarget string ForStore string ForStatus string ForArchive string Limit int RequestedAt int64 Before int64 StartedAfter *time.Duration StoppedAfter *time.Duration StartedBefore *time.Duration StoppedBefore *time.Duration }
func (*TaskFilter) Query ¶
func (f *TaskFilter) Query() (string, []interface{})
type Tenant ¶
type Tenant struct { UUID string `json:"uuid" mbus:"uuid"` Name string `json:"name" mbus:"name"` Members []*User `json:"members,omitempty"` DailyIncrease int64 `json:"daily_increase" mbus:"daily_increase"` StorageUsed int64 `json:"storage_used" mbus:"storage_used"` ArchiveCount int `json:"archive_count" mbus:"archive_count"` }
type TenantFilter ¶
func (*TenantFilter) Query ¶
func (f *TenantFilter) Query() (string, []interface{})
type User ¶
type User struct { UUID string `json:"uuid"` Name string `json:"name"` Account string `json:"account"` Backend string `json:"backend"` SysRole string `json:"sysrole"` Role string `json:"role,omitempty"` DefaultTenant string `json:"default_tenant"` // contains filtered or unexported fields }
func (*User) Authenticate ¶
func (*User) SetPassword ¶
Source Files ¶
- agents.go
- archives.go
- bus.go
- config_item.go
- db.go
- fixup.go
- jobs.go
- memberships.go
- patterns.go
- schema.go
- schema_v1.go
- schema_v10.go
- schema_v2.go
- schema_v3.go
- schema_v4.go
- schema_v5.go
- schema_v6.go
- schema_v7.go
- schema_v8.go
- schema_v9.go
- sessions.go
- stores.go
- targets.go
- tasks.go
- tenants.go
- tokens.go
- users.go
Click to show internal directories.
Click to hide internal directories.