shield

package
v8.7.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: MIT Imports: 18 Imported by: 3 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

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

	Metadata map[string]interface{} `json:"metadata"`

	Problems []string `json:"problems"`
}

type AgentFilter

type AgentFilter struct {
	UUID   string `qs:"uuid"`
	Fuzzy  bool   `qs:"exact:f:t"`
	Hidden *bool  `qs:"hidden:t:f"`
}

type Archive

type Archive struct {
	UUID   string `json:"uuid,omitempty"`
	Key    string `json:"key"`
	Status string `json:"status"`
	Notes  string `json:"notes"`

	Target *Target `json:"target,omitempty"`
	Store  *Store  `json:"store,omitempty"`

	Compression    string `json:"compression"`
	EncryptionType string `json:"encryption_type"`
	Size           int64  `json:"size"`
}

type ArchiveFilter

type ArchiveFilter struct {
	UUID   string `qs:"uuid"`
	Fuzzy  bool   `qs:"exact:f:t"`
	Target string `qs:"target"`
	Store  string `qs:"store"`
	Status string `qs:"status"`
	//Before string `qs:"before"`
	//After string `qs:"after"`
	Limit *int `qs:"limit"`
}

type AuthID

type AuthID struct {
	Unauthenticated bool `json:"unauthenticated,omitempty"`

	User struct {
		Name    string `json:"name"`
		Account string `json:"account"`
		Backend string `json:"backend"`
		SysRole string `json:"sysrole"`
	} `json:"user"`

	Tenants []struct {
		UUID string `json:"uuid"`
		Name string `json:"name"`
		Role string `json:"role"`
	} `json:"tenants"`

	Tenant struct {
		UUID string `json:"uuid"`
		Name string `json:"name"`
		Role string `json:"role"`
	} `json:"tenant"`

	Is struct {
		System struct {
			Admin    bool `json:"admin"`
			Manager  bool `json:"manager"`
			Engineer bool `json:"engineer"`
		} `json:"system"`
		Tenants map[string]struct {
			Admin    bool `json:"admin"`
			Engineer bool `json:"engineer"`
			Operator bool `json:"operator"`
		} `json:"tenant"`
	} `json:"is"`
}

type AuthMethod

type AuthMethod interface {
	Authenticate(*Client) (bool, error)
}

type AuthProvider

type AuthProvider struct {
	Name       string `json:"name"`
	Identifier string `json:"identifier"`
	Type       string `json:"type"`

	WebEntry string `json:"web_entry"`
	CLIEntry string `json:"cli_entry"`
	Redirect string `json:"redirect"`

	Properties map[string]interface{} `json:"properties,omitempty"`
}

type AuthToken

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

type BacklogStatus

type BacklogStatus struct {
	Priority int    `json:"priority"`
	Position int    `json:"position"`
	TaskUUID string `json:"task_uuid"`

	Op    string `json:"op"`
	Agent string `json:"agent"`

	Tenant *struct {
		UUID string `json:"uuid"`
		Name string `json:"name"`
	} `json:"tenant,omitempty"`

	Store *struct {
		UUID string `json:"uuid"`
		Name string `json:"name"`
	} `json:"store,omitempty"`

	System *struct {
		UUID string `json:"uuid"`
		Name string `json:"name"`
	} `json:"system,omitempty"`

	Job *struct {
		UUID     string `json:"uuid"`
		Name     string `json:"name"`
		Schedule string `json:"schedule"`
	} `json:"job,omitempty"`

	Archive *struct {
		UUID string `json:"uuid"`
		Size int64  `json:"size"`
	} `json:"archive,omitempty"`
}

type Client

type Client struct {
	URL   string
	Debug bool
	Trace bool

	InsecureSkipVerify bool
	TrustSystemCAs     bool
	CACertificate      string

	Timeout int
	Session string
	// contains filtered or unexported fields
}

func (*Client) ApplyFixup

func (c *Client) ApplyFixup(id string) (Response, error)

func (*Client) AuthID

func (c *Client) AuthID() (*AuthID, error)

func (*Client) AuthProvider

func (c *Client) AuthProvider(id string) (*AuthProvider, error)

func (*Client) AuthProviderAnonymous

func (c *Client) AuthProviderAnonymous(id string) (*AuthProvider, error)

func (*Client) AuthProviders

func (c *Client) AuthProviders() ([]*AuthProvider, error)

func (*Client) Authenticate

func (c *Client) Authenticate(auth AuthMethod) error

func (*Client) Banish

func (c *Client) Banish(tenant *Tenant, users []*User) (Response, error)

func (*Client) CancelTask

func (c *Client) CancelTask(parent *Tenant, in *Task) (Response, error)

func (*Client) ChangePassword

func (c *Client) ChangePassword(oldpw, newpw string) (Response, error)

func (*Client) CheckTimespec

func (c *Client) CheckTimespec(spec string) (bool, string, error)

func (*Client) CreateArchive

func (c *Client) CreateArchive(parent *Tenant, in *Archive) (*Archive, error)

func (*Client) CreateAuthToken

func (c *Client) CreateAuthToken(t *AuthToken) (*AuthToken, error)

func (*Client) CreateGlobalStore

func (c *Client) CreateGlobalStore(in *Store) (*Store, error)

func (*Client) CreateJob

func (c *Client) CreateJob(parent *Tenant, job *Job) (*Job, error)

func (*Client) CreateStore

func (c *Client) CreateStore(parent *Tenant, in *Store) (*Store, error)

func (*Client) CreateTarget

func (c *Client) CreateTarget(parent *Tenant, in *Target) (*Target, error)

func (*Client) CreateTask

func (c *Client) CreateTask(parent *Tenant, in *Task) (*Task, error)

func (*Client) CreateTenant

func (c *Client) CreateTenant(in *Tenant) (*Tenant, error)

func (*Client) CreateUser

func (c *Client) CreateUser(in *User) (*User, error)

func (*Client) Curl

func (c *Client) Curl(method, path, body string) (int, string, error)

func (*Client) Debugf

func (c *Client) Debugf(s string, args ...interface{})

func (*Client) DeleteAgent

func (c *Client) DeleteAgent(in *Agent) (Response, error)

func (*Client) DeleteArchive

func (c *Client) DeleteArchive(parent *Tenant, in *Archive) (Response, error)

func (*Client) DeleteGlobalStore

func (c *Client) DeleteGlobalStore(in *Store) (Response, error)

func (*Client) DeleteJob

func (c *Client) DeleteJob(parent *Tenant, in *Job) (Response, error)

func (*Client) DeleteSession

func (c *Client) DeleteSession(in *Session) (Response, error)

func (*Client) DeleteStore

func (c *Client) DeleteStore(parent *Tenant, in *Store) (Response, error)

func (*Client) DeleteTarget

func (c *Client) DeleteTarget(parent *Tenant, in *Target) (Response, error)

func (*Client) DeleteTenant

func (c *Client) DeleteTenant(in *Tenant, recurse bool) (Response, error)

func (*Client) DeleteUser

func (c *Client) DeleteUser(in *User) (Response, error)

func (*Client) Export

func (c *Client) Export(task string) (io.Reader, error)

func (*Client) FindAgent

func (c *Client) FindAgent(q string, fuzzy bool) (*Agent, error)

func (*Client) FindArchive

func (c *Client) FindArchive(tenant *Tenant, q string, fuzzy bool) (*Archive, error)

func (*Client) FindGlobalStore

func (c *Client) FindGlobalStore(q string, fuzzy bool) (*Store, error)

func (*Client) FindJob

func (c *Client) FindJob(tenant *Tenant, q string, fuzzy bool) (*Job, error)

func (*Client) FindMyTenant

func (c *Client) FindMyTenant(q string, fuzzy bool) (*Tenant, error)

func (*Client) FindStore

func (c *Client) FindStore(tenant *Tenant, q string, fuzzy bool) (*Store, error)

func (*Client) FindTarget

func (c *Client) FindTarget(tenant *Tenant, q string, fuzzy bool) (*Target, error)

func (*Client) FindTask

func (c *Client) FindTask(parent *Tenant, q string, fuzzy bool) (*Task, error)

func (*Client) FindTenant

func (c *Client) FindTenant(q string, fuzzy bool) (*Tenant, error)

func (*Client) FindUsableStore

func (c *Client) FindUsableStore(tenant *Tenant, q string, fuzzy bool) (*Store, error)

func (*Client) FindUser

func (c *Client) FindUser(q string, fuzzy bool) (*User, error)

func (*Client) GetAgent

func (c *Client) GetAgent(uuid string) (*Agent, error)

func (*Client) GetArchive

func (c *Client) GetArchive(parent *Tenant, uuid string) (*Archive, error)

func (*Client) GetFixup

func (c *Client) GetFixup(id string) (*Fixup, error)

func (*Client) GetGlobalStore

func (c *Client) GetGlobalStore(uuid string) (*Store, error)

func (*Client) GetJob

func (c *Client) GetJob(parent *Tenant, uuid string) (*Job, error)

func (*Client) GetMyTenants

func (c *Client) GetMyTenants() ([]*Tenant, error)

func (*Client) GetSession

func (c *Client) GetSession(uuid string) (*Session, error)

func (*Client) GetStore

func (c *Client) GetStore(parent *Tenant, uuid string) (*Store, error)

func (*Client) GetTarget

func (c *Client) GetTarget(parent *Tenant, uuid string) (*Target, error)

func (*Client) GetTask

func (c *Client) GetTask(parent *Tenant, uuid string) (*Task, error)

func (*Client) GetTenant

func (c *Client) GetTenant(uuid string) (*Tenant, error)

func (*Client) GetUser

func (c *Client) GetUser(uuid string) (*User, error)

func (*Client) GlobalStatus

func (c *Client) GlobalStatus() (*Status, error)

func (*Client) HideAgent

func (c *Client) HideAgent(in *Agent) (Response, error)

func (*Client) Import

func (c *Client) Import(task, key string, in io.Reader) error

func (*Client) Info

func (c *Client) Info() (*Info, error)

func (*Client) Initialize

func (c *Client) Initialize(master string) (string, error)

func (*Client) Invite

func (c *Client) Invite(tenant *Tenant, role string, users []*User) (Response, error)

func (*Client) ListAgents

func (c *Client) ListAgents(filter *AgentFilter) ([]*Agent, error)

func (*Client) ListArchives

func (c *Client) ListArchives(parent *Tenant, filter *ArchiveFilter) ([]*Archive, error)

func (*Client) ListAuthTokens

func (c *Client) ListAuthTokens() ([]*AuthToken, error)

func (*Client) ListFixups

func (c *Client) ListFixups(filter *FixupFilter) ([]*Fixup, error)

func (*Client) ListGlobalStores

func (c *Client) ListGlobalStores(filter *StoreFilter) ([]*Store, error)

func (*Client) ListJobs

func (c *Client) ListJobs(parent *Tenant, filter *JobFilter) ([]*Job, error)

func (*Client) ListSessions

func (c *Client) ListSessions(filter *SessionFilter) ([]*Session, error)

func (*Client) ListStores

func (c *Client) ListStores(parent *Tenant, filter *StoreFilter) ([]*Store, error)

func (*Client) ListTargets

func (c *Client) ListTargets(parent *Tenant, filter *TargetFilter) ([]*Target, error)

func (*Client) ListTasks

func (c *Client) ListTasks(parent *Tenant, filter *TaskFilter) ([]*Task, error)

func (*Client) ListTenants

func (c *Client) ListTenants(filter *TenantFilter) ([]*Tenant, error)

func (*Client) ListUsers

func (c *Client) ListUsers(filter *UserFilter) ([]*User, error)

func (*Client) Lock

func (c *Client) Lock() error

func (*Client) Logout

func (c *Client) Logout() error

func (*Client) PauseJob

func (c *Client) PauseJob(parent *Tenant, job *Job) (Response, error)

func (*Client) Rekey

func (c *Client) Rekey(oldmaster, newmaster string, rotateFixed bool) (string, error)

func (*Client) RestoreArchive

func (c *Client) RestoreArchive(parent *Tenant, a *Archive, t *Target) (*Task, error)

func (*Client) RevokeAuthToken

func (c *Client) RevokeAuthToken(t *AuthToken) error

func (*Client) RunJob

func (c *Client) RunJob(parent *Tenant, job *Job) (Response, error)

func (*Client) SchedulerStatus

func (c *Client) SchedulerStatus() (*SchedulerStatus, error)

func (*Client) ShowAgent

func (c *Client) ShowAgent(in *Agent) (Response, error)

func (*Client) SplitKey

func (c *Client) SplitKey(s string, n int) string

func (*Client) StreamEvents

func (c *Client) StreamEvents(fn func(Event)) error

func (*Client) TenantStatus

func (c *Client) TenantStatus(tenant *Tenant) (*Status, error)

func (*Client) Unlock

func (c *Client) Unlock(master string) error

func (*Client) UnpauseJob

func (c *Client) UnpauseJob(parent *Tenant, job *Job) (Response, error)

func (*Client) UpdateArchive

func (c *Client) UpdateArchive(parent *Tenant, in *Archive) (*Archive, error)

func (*Client) UpdateGlobalStore

func (c *Client) UpdateGlobalStore(in *Store) (*Store, error)

func (*Client) UpdateJob

func (c *Client) UpdateJob(parent *Tenant, job *Job) (*Job, error)

func (*Client) UpdateStore

func (c *Client) UpdateStore(parent *Tenant, in *Store) (*Store, error)

func (*Client) UpdateTarget

func (c *Client) UpdateTarget(parent *Tenant, in *Target) (*Target, error)

func (*Client) UpdateTask

func (c *Client) UpdateTask(parent *Tenant, in *Task) (*Task, error)

func (*Client) UpdateTenant

func (c *Client) UpdateTenant(in *Tenant) (*Tenant, error)

func (*Client) UpdateUser

func (c *Client) UpdateUser(in *User) (*User, error)

type Error

type Error struct {
	Message string   `json:"error"`
	Missing []string `json:"missing"`
	Extra   string   `json:"diagnostic"`
}

func (Error) Error

func (e Error) Error() string

type Event

type Event struct {
	Event string      `json:"event"`
	Queue string      `json:"queue"`
	Type  string      `json:"type,omitempty"`
	Data  interface{} `json:"data"`
}

type Fixup

type Fixup struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Summary   string `json:"summary"`
	CreatedAt int64  `json:"created_at"`
	AppliedAt int64  `json:"applied_at"`
}

type FixupFilter

type FixupFilter struct {
}

type Info

type Info struct {
	Version string `json:"version,omitempty"`
	Env     string `json:"env,omitempty"`
	Color   string `json:"color,omitempty"`
	MOTD    string `json:"motd,omitempty"`

	API int `json:"api"`
}

type Job

type Job struct {
	UUID       string `json:"uuid,omitempty"`
	Name       string `json:"name"`
	Summary    string `json:"summary"`
	Schedule   string `json:"schedule"`
	KeepDays   int    `json:"keep_days"`
	KeepN      int    `json:"keep_n"`
	Retain     string `json:"-"`
	Paused     bool   `json:"paused"`
	Agent      string `json:"agent"`
	LastStatus string `json:"last_task_status"`
	LastRun    int64  `json:"last_run"`
	FixedKey   bool   `json:"fixed_key"`

	TargetUUID string `json:"-"`
	Target     struct {
		UUID   string `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"`
	} `json:"target"`

	StoreUUID string `json:"-"`
	Store     struct {
		UUID    string `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"`

	AgentHost string `json:"-"`
	AgentPort int    `json:"-"`
}

func (Job) Status

func (j Job) Status() string

type JobFilter

type JobFilter struct {
	UUID   string `qs:"uuid"`
	Fuzzy  bool   `qs:"exact:f:t"`
	Name   string `qs:"name"`
	Store  string `qs:"store"`
	Target string `qs:"target"`
	Paused *bool  `qs:"paused:t:f"`
}

type LocalAuth

type LocalAuth struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

func (*LocalAuth) Authenticate

func (auth *LocalAuth) Authenticate(c *Client) (bool, error)

type Plugin

type Plugin struct {
	ID        string
	Name      string
	Author    string
	Version   string
	CanStore  bool
	CanTarget bool
}

func ParseAgentMetadata

func ParseAgentMetadata(in map[string]interface{}) ([]*Plugin, error)

type Response

type Response struct {
	OK string `json:"ok"`

	TaskUUID string `json:"task_uuid,omitempty"`
}

type SchedulerStatus

type SchedulerStatus struct {
	Backlog []BacklogStatus `json:"backlog"`
	Workers []WorkerStatus  `json:"workers"`
}

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 `qs:"name"`
	ExactMatch bool   `qs:"exact:f:t"`
	UUID       string
	UserUUID   string `qs:"user_uuid"`
	Limit      int    `qs:"limit"`
	IP         string `qs:"ip_addr"`
	IsToken    bool   `qs:"is_token"`
}

type Status

type Status struct {
	Health  StatusHealth  `json:"health"`
	Storage StatusStorage `json:"storage"`
	Jobs    StatusJobs    `json:"jobs"`
	Stats   StatusStats   `json:"stats"`
}

type StatusHealth

type StatusHealth struct {
	Core      string `json:"core"`
	StorageOK bool   `json:"storage_ok"`
	JobsOK    bool   `json:"jobs_ok"`
}

type StatusJobs

type StatusJobs []struct {
	UUID    string `json:"uuid"`
	Target  string `json:"target"`
	Job     string `json:"job"`
	Healthy bool   `json:"healthy"`
}

type StatusStats

type StatusStats struct {
	Jobs        int   `json:"jobs"`
	Systems     int   `json:"systems"`
	Archives    int   `json:"archives"`
	StorageUsed int64 `json:"storage"`
	DailyDelta  int   `json:"daily"`
}

type StatusStorage

type StatusStorage []struct {
	Name   string `json:"name"`
	Health bool   `json:"healthy"`
}

type Store

type Store struct {
	UUID      string `json:"uuid,omitempty"`
	Name      string `json:"name"`
	Summary   string `json:"summary"`
	Plugin    string `json:"plugin"`
	Agent     string `json:"agent"`
	Healthy   bool   `json:"healthy"`
	Threshold int64  `json:"threshold"`

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

type StoreFilter

type StoreFilter struct {
	UUID   string `qs:"uuid"`
	Fuzzy  bool   `qs:"exact:f:t"`
	Name   string `qs:"name"`
	Plugin string `qs:"plugin"`
	Used   *bool  `qs:"unused:f:t"`
}

type Target

type Target struct {
	UUID        string `json:"uuid,omitempty"`
	Name        string `json:"name"`
	Summary     string `json:"summary"`
	Plugin      string `json:"plugin"`
	Agent       string `json:"agent"`
	Compression string `json:"compression"`

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

type TargetFilter

type TargetFilter struct {
	UUID   string `qs:"uuid"`
	Fuzzy  bool   `qs:"exact:f:t"`
	Name   string `qs:"name"`
	Plugin string `qs:"plugin"`
	Used   *bool  `qs:"unused:f:t"`
}

type Task

type Task struct {
	UUID        string `json:"uuid,omitempty"`
	Type        string `json:"type"`
	Status      string `json:"status"`
	Owner       string `json:"owner"`
	StartedAt   int64  `json:"started_at"`
	StoppedAt   int64  `json:"stopped_at"`
	RequestedAt int64  `json:"requested_at"`
	Log         string `json:"log"`
	OK          bool   `json:"ok"`
	Notes       string `json:"notes"`
	Clear       string `json:"clear"`
	JobUUID     string `json:"job_uuid"`
	ArchiveUUID string `json:"archive_uuid"`
}

type TaskFilter

type TaskFilter struct {
	UUID   string `qs:"uuid"`
	Fuzzy  bool   `qs:"exact:f:t"`
	Status string `qs:"status"`
	Active *bool  `qs:"active:t:f"`
	Debug  *bool  `qs:"debug:t:f"`
	Limit  *int   `qs:"limit"`
	Target string `qs:"target"`
	Store  string `qs:"store"`
	Type   string `qs:"type"`
	Before int64  `qs:"before"`
}

type Tenant

type Tenant struct {
	UUID string `json:"uuid,omitempty"`
	Name string `json:"name"`

	Members []struct {
		UUID    string `json:"uuid,omitempty"`
		Fuzzy   bool   `json:"exact:f:t"`
		Name    string `json:"name"`
		Account string `json:"account"`
		Backend string `json:"backend"`
		Role    string `json:"role"`
	} `json:"members"`
}

type TenantFilter

type TenantFilter struct {
	UUID  string `qs:"uuid"`
	Fuzzy bool   `qs:"exact:f:t"`
	Name  string `qs:"name"`
}

type TokenAuth

type TokenAuth struct {
	Token string
}

func (*TokenAuth) Authenticate

func (auth *TokenAuth) Authenticate(c *Client) (bool, error)

type User

type User struct {
	UUID     string `json:"uuid,omitempty"`
	Name     string `json:"name"`
	Account  string `json:"account"`
	SysRole  string `json:"sysrole"`
	Password string `json:"password,omitempty"`

	Tenants []struct {
		UUID string `json:"uuid"`
		Name string `json:"name"`
		Role string `json:"role"`
	} `json:"tenants"`
}

type UserFilter

type UserFilter struct {
	UUID    string `qs:"uuid"`
	Fuzzy   bool   `qs:"exact:f:t"`
	Account string `qs:"account"`
	SysRole string `qs:"sysrole"`
}

type WorkerStatus

type WorkerStatus struct {
	ID       int    `json:"id"`
	Idle     bool   `json:"idle"`
	TaskUUID string `json:"task_uuid"`

	Op     string `json:"op"`
	Status string `json:"status"`
	Agent  string `json:"agent"`

	Tenant *struct {
		UUID string `json:"uuid"`
		Name string `json:"name"`
	} `json:"tenant,omitempty"`

	Store *struct {
		UUID string `json:"uuid"`
		Name string `json:"name"`
	} `json:"store,omitempty"`

	System *struct {
		UUID string `json:"uuid"`
		Name string `json:"name"`
	} `json:"system,omitempty"`

	Job *struct {
		UUID     string `json:"uuid"`
		Name     string `json:"name"`
		Schedule string `json:"schedule"`
	} `json:"job,omitempty"`

	Archive *struct {
		UUID string `json:"uuid"`
		Size int64  `json:"size"`
	} `json:"archive,omitempty"`
}

Jump to

Keyboard shortcuts

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