db

package
v8.0.8+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2018 License: MIT Imports: 15 Imported by: 4

Documentation

Index

Constants

View Source
const (
	BackupOperation    = "backup"
	RestoreOperation   = "restore"
	PurgeOperation     = "purge"
	TestStoreOperation = "test-store"

	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 Schemas = map[int]Schema{
	1: v1Schema{},
	2: v2Schema{},
	3: v3Schema{},
	4: v4Schema{},
}

Functions

func NewErrExists

func NewErrExists(format string, args ...interface{}) error

NewErrExists makes a new ErrExists object... works a hell of a lot like fmt.Errorf

func Pattern added in v0.4.1

func Pattern(glob string) string

Turns globs ('*search*') into SQL patterns ('%search%')

func ValidateEffectiveUnix added in v0.4.1

func ValidateEffectiveUnix(effective time.Time) int64

Types

type Agent

type Agent struct {
	UUID       uuid.UUID `json:"uuid"`
	Name       string    `json:"name"`
	Address    string    `json:"address"`
	Version    string    `json:"version"`
	Hidden     bool      `json:"hidden"`
	LastSeenAt int64     `json:"last_seen_at"`
	LastError  string    `json:"last_error"`
	Status     string    `json:"status"`
	RawMeta    string    `json:"-"`
}

func (*Agent) Metadata

func (a *Agent) Metadata() (map[string]interface{}, error)

type AgentFilter

type AgentFilter struct {
	Address    string
	Name       string
	Status     string
	OnlyHidden bool
	SkipHidden bool
}

func (*AgentFilter) Query

func (f *AgentFilter) Query() (string, []interface{})

type Archive added in v0.6.4

type Archive struct {
	UUID           uuid.UUID `json:"uuid"`
	StoreKey       string    `json:"key"`
	TakenAt        int64     `json:"taken_at"`
	ExpiresAt      int64     `json:"expires_at"`
	Notes          string    `json:"notes"`
	Status         string    `json:"status"`
	PurgeReason    string    `json:"purge_reason"`
	TargetUUID     uuid.UUID `json:"target_uuid"`
	TargetName     string    `json:"target_name"`
	TargetPlugin   string    `json:"target_plugin"`
	TargetEndpoint string    `json:"target_endpoint"`
	StoreUUID      uuid.UUID `json:"store_uuid"`
	StoreName      string    `json:"store_name"`
	StorePlugin    string    `json:"store_plugin"`
	StoreEndpoint  string    `json:"store_endpoint"`
	Job            string    `json:"job"`
	EncryptionType string    `json:"encryption_type"`
	TenantUUID     uuid.UUID `json:"tenant_uuid"`
	Size           int64     `json:"size"`
}

type ArchiveFilter

type ArchiveFilter struct {
	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 AuthToken

type AuthToken struct {
	UUID      uuid.UUID `json:"uuid"`
	Session   uuid.UUID `json:"session,omitempty"`
	Name      string    `json:"name"`
	CreatedAt int64     `json:"created_at"`
	LastSeen  *int64    `json:"last_seen"`
}

type AuthTokenFilter

type AuthTokenFilter struct {
	UUID string
	User *User
	Name string
}

func (AuthTokenFilter) Query

func (t AuthTokenFilter) Query() (string, []interface{})

type DB

type DB struct {
	Driver string
	DSN    string
	// contains filtered or unexported fields
}

func (*DB) AddUserToTenant

func (db *DB) AddUserToTenant(user, tenant, role string) error

Manual close of sql transaction necessary to avoid database lockup due to defer

func (*DB) Alias

func (db *DB) Alias(name string, sql string) error

Register a SQL query alias

func (*DB) AnnotateTargetArchive

func (db *DB) AnnotateTargetArchive(target uuid.UUID, id string, notes string) error

func (*DB) AnnotateTargetTask

func (db *DB) AnnotateTargetTask(target uuid.UUID, id string, ann *TaskAnnotation) error

func (*DB) ArchiveStorageFootprint

func (db *DB) ArchiveStorageFootprint(filter *ArchiveFilter) (int64, error)

func (*DB) CancelTask

func (db *DB) CancelTask(id uuid.UUID, effective time.Time) error

func (*DB) CheckCurrentSchema

func (db *DB) CheckCurrentSchema() error

func (*DB) ClearAllSessions

func (db *DB) ClearAllSessions() error

func (*DB) ClearExpiredSessions

func (db *DB) ClearExpiredSessions(expiration_threshold time.Time) error

func (*DB) ClearMembershipsFor

func (db *DB) ClearMembershipsFor(user *User) error

func (*DB) ClearSession

func (db *DB) ClearSession(id string) error

func (*DB) CompleteTask

func (db *DB) CompleteTask(id uuid.UUID, effective time.Time) error

func (*DB) Connect

func (db *DB) Connect() error

Connect to the backend database

func (*DB) Connected

func (db *DB) Connected() bool

Are we connected?

func (*DB) Copy

func (db *DB) Copy() *DB

func (*DB) Count

func (db *DB) Count(sql_or_name string, args ...interface{}) (uint, error)

Execute a data query (SELECT) and return how many rows were returned

func (*DB) CountArchives

func (db *DB) CountArchives(filter *ArchiveFilter) (int, error)

func (*DB) CountTargets

func (db *DB) CountTargets(filter *TargetFilter) (int, error)

func (*DB) CreateBackupTask

func (db *DB) CreateBackupTask(owner string, job *Job) (*Task, error)

func (*DB) CreateJob

func (db *DB) CreateJob(job *Job) (*Job, error)

func (*DB) CreatePurgeTask

func (db *DB) CreatePurgeTask(owner string, archive *Archive, agent string) (*Task, error)

func (*DB) CreateRestoreTask

func (db *DB) CreateRestoreTask(owner string, archive *Archive, target *Target) (*Task, error)

func (*DB) CreateRetentionPolicy

func (db *DB) CreateRetentionPolicy(p *RetentionPolicy) (*RetentionPolicy, error)

func (*DB) CreateSession

func (db *DB) CreateSession(session *Session) (*Session, error)

func (*DB) CreateStore

func (db *DB) CreateStore(s *Store) (*Store, error)

func (*DB) CreateTarget

func (db *DB) CreateTarget(in *Target) (*Target, error)

func (*DB) CreateTaskArchive

func (db *DB) CreateTaskArchive(id uuid.UUID, archive_id uuid.UUID, key string, effective time.Time, encryptionType string, archive_size int64, tenant_uuid uuid.UUID) (uuid.UUID, error)

func (*DB) CreateTenant

func (db *DB) CreateTenant(given_uuid string, given_name string) (*Tenant, error)

func (*DB) CreateTestStoreTask

func (db *DB) CreateTestStoreTask(owner string, store *Store) (*Task, error)

func (*DB) CreateUser

func (db *DB) CreateUser(user *User) (*User, error)

func (*DB) DeleteArchive

func (db *DB) DeleteArchive(id uuid.UUID) (bool, error)

func (*DB) DeleteAuthToken

func (db *DB) DeleteAuthToken(id string, user *User) error

func (*DB) DeleteJob

func (db *DB) DeleteJob(id uuid.UUID) (bool, error)

func (*DB) DeleteRetentionPolicy

func (db *DB) DeleteRetentionPolicy(id uuid.UUID) (bool, error)

func (*DB) DeleteStore

func (db *DB) DeleteStore(id uuid.UUID) (bool, error)

func (*DB) DeleteTarget

func (db *DB) DeleteTarget(id uuid.UUID) (bool, error)

func (*DB) DeleteTenant

func (db *DB) DeleteTenant(tenant *Tenant) error

func (*DB) DeleteUser

func (db *DB) DeleteUser(user *User) error

func (*DB) Disconnect

func (db *DB) Disconnect() error

Disconnect from the backend database

func (*DB) EnsureTenant

func (db *DB) EnsureTenant(name string) (*Tenant, error)

func (*DB) Exec

func (db *DB) Exec(sql_or_name string, args ...interface{}) error

Execute a named, non-data query (INSERT, UPDATE, DELETE, etc.)

func (*DB) ExpireArchive

func (db *DB) ExpireArchive(id uuid.UUID) error

func (*DB) FailTask

func (db *DB) FailTask(id uuid.UUID, effective time.Time) error

func (*DB) GenerateAuthToken

func (db *DB) GenerateAuthToken(name string, user *User) (*AuthToken, string, error)

func (*DB) GetAgent

func (db *DB) GetAgent(id uuid.UUID) (*Agent, error)

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) GetAllJobs added in v0.6.4

func (db *DB) GetAllJobs(filter *JobFilter) ([]*Job, error)

func (*DB) GetAllRetentionPolicies added in v0.6.4

func (db *DB) GetAllRetentionPolicies(filter *RetentionFilter) ([]*RetentionPolicy, 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) GetArchive added in v0.6.4

func (db *DB) GetArchive(id uuid.UUID) (*Archive, error)

func (*DB) GetArchivesNeedingPurge

func (db *DB) GetArchivesNeedingPurge() ([]*Archive, error)

func (*DB) GetAuthToken

func (db *DB) GetAuthToken(id string) (*AuthToken, error)

func (*DB) GetExpiredArchives

func (db *DB) GetExpiredArchives() ([]*Archive, error)

func (*DB) GetJob added in v0.6.4

func (db *DB) GetJob(id uuid.UUID) (*Job, error)

func (*DB) GetMembershipsForUser

func (db *DB) GetMembershipsForUser(user uuid.UUID) ([]*Membership, error)

func (*DB) GetRetentionPolicy added in v0.6.4

func (db *DB) GetRetentionPolicy(id uuid.UUID) (*RetentionPolicy, error)

func (*DB) GetSession

func (db *DB) GetSession(id string) (*Session, error)

func (*DB) GetStore added in v0.6.4

func (db *DB) GetStore(id uuid.UUID) (*Store, error)

func (*DB) GetTarget added in v0.6.4

func (db *DB) GetTarget(id uuid.UUID) (*Target, error)

func (*DB) GetTask added in v0.6.4

func (db *DB) GetTask(id uuid.UUID) (*Task, error)

func (*DB) GetTenant

func (db *DB) GetTenant(id string) (*Tenant, error)

func (*DB) GetTenantByName

func (db *DB) GetTenantByName(name string) (*Tenant, error)

func (*DB) GetTenantRole

func (db *DB) GetTenantRole(org string, team string) (uuid.UUID, string, error)

func (*DB) GetTenantsForUser

func (db *DB) GetTenantsForUser(user uuid.UUID) ([]*Tenant, error)

GetTenantsForUser given a user's uuid returns a slice of Tenants that the user has membership with

func (*DB) GetUser

func (db *DB) GetUser(account string, backend string) (*User, error)

func (*DB) GetUserByID

func (db *DB) GetUserByID(id string) (*User, error)

func (*DB) GetUserForSession

func (db *DB) GetUserForSession(id string) (*User, error)

func (*DB) GetUsersForTenant

func (db *DB) GetUsersForTenant(tenant uuid.UUID) ([]*User, error)

func (*DB) InheritRetentionTemplates

func (db *DB) InheritRetentionTemplates(tenant *Tenant) error

InheritRetentionTemplates gives a tenant the global (templated) retention policies

func (*DB) InvalidateArchive

func (db *DB) InvalidateArchive(id uuid.UUID) error

func (*DB) IsTaskRunnable added in v0.6.6

func (db *DB) IsTaskRunnable(task *Task) (bool, error)

func (*DB) MarkTasksIrrelevant

func (db *DB) MarkTasksIrrelevant() error

func (*DB) PauseJob

func (db *DB) PauseJob(id uuid.UUID) (bool, error)

func (*DB) PauseOrUnpauseJob

func (db *DB) PauseOrUnpauseJob(id uuid.UUID, pause bool) (bool, error)

func (*DB) PokeSession

func (db *DB) PokeSession(session *Session) error

func (*DB) PreRegisterAgent

func (db *DB) PreRegisterAgent(host, name string, port int) error

func (*DB) PurgeArchive

func (db *DB) PurgeArchive(id uuid.UUID) error

func (*DB) Query

func (db *DB) Query(sql_or_name string, args ...interface{}) (*sql.Rows, error)

Execute a named, data query (SELECT)

func (*DB) RemoveUserFromTenant

func (db *DB) RemoveUserFromTenant(user, tenant string) error

func (*DB) RescheduleJob

func (db *DB) RescheduleJob(j *Job, t time.Time) error

func (*DB) ScheduledTask

func (db *DB) ScheduledTask(id uuid.UUID) error

func (*DB) SchemaVersion

func (db *DB) SchemaVersion() (int, error)

func (*DB) Setup

func (db *DB) Setup(want int) (int, error)

func (*DB) StartTask

func (db *DB) StartTask(id uuid.UUID, effective time.Time) error

func (*DB) UnpauseJob

func (db *DB) UnpauseJob(id uuid.UUID) (bool, error)

func (*DB) UpdateAgent

func (db *DB) UpdateAgent(agent *Agent) error

func (*DB) UpdateArchive

func (db *DB) UpdateArchive(update *Archive) error

func (*DB) UpdateJob

func (db *DB) UpdateJob(job *Job) error

func (*DB) UpdateRetentionPolicy

func (db *DB) UpdateRetentionPolicy(p *RetentionPolicy) error

func (*DB) UpdateStore

func (db *DB) UpdateStore(s *Store) error

func (*DB) UpdateTarget

func (db *DB) UpdateTarget(t *Target) error

func (*DB) UpdateTaskLog

func (db *DB) UpdateTaskLog(id uuid.UUID, more string) error

func (*DB) UpdateTenant

func (db *DB) UpdateTenant(t *Tenant) (*Tenant, error)

func (*DB) UpdateUser

func (db *DB) UpdateUser(user *User) error

func (*DB) UpdateUserSettings

func (db *DB) UpdateUserSettings(user *User) error

type ErrExists

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

ErrExists is the error that should be returned from a db function if an item could not be inserted because it already exists in the database

func (ErrExists) Error

func (e ErrExists) Error() string

type Job added in v0.6.4

type Job struct {
	TenantUUID uuid.UUID `json:"-"`
	TargetUUID uuid.UUID `json:"-"`
	StoreUUID  uuid.UUID `json:"-"`
	PolicyUUID uuid.UUID `json:"-"`

	UUID     uuid.UUID `json:"uuid"`
	Name     string    `json:"name"`
	Summary  string    `json:"summary"`
	Expiry   int       `json:"expiry"`
	Schedule string    `json:"schedule"`
	Paused   bool      `json:"paused"`
	FixedKey bool      `json:"fixed_key"`

	Target struct {
		UUID   uuid.UUID `json:"uuid"`
		Name   string    `json:"name"`
		Agent  string    `json:"agent"`
		Plugin string    `json:"plugin"`

		Endpoint string                 `json:"endpoint,omitempty"`
		Config   map[string]interface{} `json:"config,omitempty"`
	}

	Store struct {
		UUID    uuid.UUID `json:"uuid"`
		Name    string    `json:"name"`
		Agent   string    `json:"agent"`
		Plugin  string    `json:"plugin"`
		Summary string    `json:"summary"`

		Endpoint string                 `json:"endpoint,omitempty"`
		Config   map[string]interface{} `json:"config,omitempty"`
	} `json:"store"`

	Policy struct {
		UUID    uuid.UUID `json:"uuid"`
		Name    string    `json:"name"`
		Summary string    `json:"summary"`
	} `json:"policy"`

	Agent          string `json:"agent"`
	LastRun        int64  `json:"last_run"`
	LastTaskStatus string `json:"last_task_status"`

	Spec    *timespec.Spec `json:"-"`
	NextRun int64          `json:"-"`
}

func (Job) Healthy

func (j Job) Healthy() bool

func (*Job) Reschedule added in v0.6.4

func (j *Job) Reschedule() error

func (*Job) Runnable added in v0.6.4

func (j *Job) Runnable() bool

type JobFilter

type JobFilter struct {
	SkipPaused   bool
	SkipUnpaused bool

	Overdue bool

	SearchName string

	ForTenant  string
	ForTarget  string
	ForStore   string
	ForPolicy  string
	ExactMatch bool
}

func (*JobFilter) Query

func (f *JobFilter) Query(driver string) (string, []interface{}, error)

type Membership

type Membership struct {
	TenantUUID uuid.UUID
	TenantName string
	Role       string
}

type NullUUID added in v0.6.4

type NullUUID struct {
	Valid bool
	UUID  uuid.UUID
}

func (*NullUUID) Scan added in v0.6.4

func (v *NullUUID) Scan(value interface{}) error

func (NullUUID) Value added in v0.6.4

func (v NullUUID) Value() (driver.Value, error)

type RetentionFilter

type RetentionFilter struct {
	ForTenant  string
	SkipUsed   bool
	SkipUnused bool
	SearchName string
	ExactMatch bool
}

func (*RetentionFilter) Query

func (f *RetentionFilter) Query() (string, []interface{})

type RetentionPolicy added in v0.6.4

type RetentionPolicy struct {
	UUID    uuid.UUID `json:"uuid"`
	Name    string    `json:"name"`
	Summary string    `json:"summary"`
	Expires uint      `json:"expires"`

	TenantUUID uuid.UUID `json:"-"`
}

type Schema

type Schema interface {
	Deploy(*DB) error
}

type Session

type Session struct {
	UUID           uuid.UUID `json:"uuid"`
	UserUUID       uuid.UUID `json:"user_uuid"`
	CreatedAt      int64     `json:"created_at"`
	LastSeen       int64     `json:"last_seen_at"`
	Token          uuid.UUID `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"`
}

func (*Session) Expired

func (s *Session) Expired(lifetime int) bool

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    uuid.UUID `json:"uuid"`
	Name    string    `json:"name"`
	Summary string    `json:"summary"`
	Agent   string    `json:"agent"`
	Plugin  string    `json:"plugin"`
	Global  bool      `json:"global"`

	PublicConfig  string `json:"-"`
	PrivateConfig string `json:"-"`

	Config        map[string]interface{} `json:"config,omitempty"`
	DisplayConfig []StoreConfigItem      `json:"display_config,omitempty"`

	TenantUUID    uuid.UUID `json:"-"`
	DailyIncrease int64     `json:"daily_increase"`
	StorageUsed   int64     `json:"storage_used"`
	Threshold     int64     `json:"threshold"`
	ArchiveCount  int       `json:"archive_count"`

	Healthy          bool      `json:"healthy"`
	LastTestTaskUUID uuid.UUID `json:"last_test_task_uuid"`
}

func (*Store) CacheConfigs

func (s *Store) CacheConfigs(db *DB) error

func (Store) ConfigJSON

func (s Store) ConfigJSON() (string, error)

func (*Store) DisplayPrivate

func (s *Store) DisplayPrivate() error

func (*Store) DisplayPublic

func (s *Store) DisplayPublic() error

type StoreConfigItem

type StoreConfigItem struct {
	Label string `json:"label"`
	Value string `json:"value"`
}

type StoreFilter

type StoreFilter struct {
	SkipUsed   bool
	SkipUnused bool
	SearchName string
	ForPlugin  string
	ForTenant  string
	ExactMatch bool
}

func (*StoreFilter) Query

func (f *StoreFilter) Query() (string, []interface{})

type StoreStats

type StoreStats struct {
	DailyIncrease int64 `json:"daily_increase"`
	StorageUsed   int64 `json:"storage_used"`
	ArchiveCount  int   `json:"archive_count"`
}

type Target added in v0.6.4

type Target struct {
	TenantUUID uuid.UUID `json:"-"`

	UUID    uuid.UUID `json:"uuid"`
	Name    string    `json:"name"`
	Summary string    `json:"summary"`
	Plugin  string    `json:"plugin"`
	Agent   string    `json:"agent"`

	Config map[string]interface{} `json:"config,omitempty"`
}

func (Target) ConfigJSON

func (t Target) ConfigJSON() (string, error)

type TargetFilter

type TargetFilter struct {
	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           uuid.UUID      `json:"uuid"`
	TenantUUID     uuid.UUID      `json:"-"`
	Owner          string         `json:"owner"`
	Op             string         `json:"type"`
	JobUUID        uuid.UUID      `json:"job_uuid"`
	ArchiveUUID    uuid.UUID      `json:"archive_uuid"`
	StoreUUID      uuid.UUID      `json:"-"`
	StorePlugin    string         `json:"-"`
	StoreEndpoint  string         `json:"-"`
	TargetUUID     uuid.UUID      `json:"-"`
	TargetPlugin   string         `json:"-"`
	TargetEndpoint string         `json:"-"`
	Status         string         `json:"status"`
	RequestedAt    int64          `json:"requested_at"`
	StartedAt      int64          `json:"started_at"`
	StoppedAt      int64          `json:"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"`
	Notes          string         `json:"notes"`
	Clear          string         `json:"clear"`
	TaskUUIDChan   chan *TaskInfo `json:"-"`
}

type TaskAnnotation

type TaskAnnotation struct {
	Disposition string
	Notes       string
	Clear       string
}

type TaskFilter

type TaskFilter struct {
	UUID         string
	SkipActive   bool
	SkipInactive bool
	OnlyRelevant bool
	ForOp        string
	ForTenant    string
	ForTarget    string
	ForStatus    string
	ForArchive   string
	Limit        int
}

func (*TaskFilter) Query

func (f *TaskFilter) Query() (string, []interface{})

type TaskInfo added in v0.6.4

type TaskInfo struct {
	Info string //UUID if not Err. Error message if Err.
	Err  bool
}

type Tenant

type Tenant struct {
	UUID          uuid.UUID `json:"uuid"`
	Name          string    `json:"name"`
	Members       []*User   `json:"members,omitempty"`
	DailyIncrease int64     `json:"daily_increase"`
	StorageUsed   int64     `json:"storage_used"`
	ArchiveCount  int       `json:"archive_count"`
}

type TenantFilter

type TenantFilter struct {
	Name       string
	ExactMatch bool
	UUID       string
	Limit      int
}

func (*TenantFilter) Query

func (f *TenantFilter) Query() (string, []interface{})

type User

type User struct {
	UUID    uuid.UUID `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 (u *User) Authenticate(password string) bool

func (*User) IsLocal

func (u *User) IsLocal() bool

func (*User) SetPassword

func (u *User) SetPassword(password string) error

type UserFilter

type UserFilter struct {
	UUID       string
	Backend    string
	Account    string
	SysRole    string
	ExactMatch bool
	Search     string
	Limit      int
}

func (*UserFilter) Query

func (f *UserFilter) Query() (string, []interface{})

Jump to

Keyboard shortcuts

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