shield

package
v8.0.15+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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"`
	Policy *Policy `json:"policy,omitempty"`

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

type ArchiveFilter

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

func (c *Client) CreatePolicy(parent *Tenant, in *Policy) (*Policy, error)

func (*Client) CreatePolicyTemplate

func (c *Client) CreatePolicyTemplate(in *Policy) (*Policy, 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) 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) DeletePolicy

func (c *Client) DeletePolicy(parent *Tenant, in *Policy) (Response, error)

func (*Client) DeletePolicyTemplate

func (c *Client) DeletePolicyTemplate(in *Policy) (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) (Response, error)

func (*Client) DeleteUser

func (c *Client) DeleteUser(in *User) (Response, 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) FindPolicy

func (c *Client) FindPolicy(tenant *Tenant, q string, fuzzy bool) (*Policy, error)

func (*Client) FindPolicyTemplate

func (c *Client) FindPolicyTemplate(q string, fuzzy bool) (*Policy, 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) 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) GetArchive

func (c *Client) GetArchive(parent *Tenant, uuid string) (*Archive, 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) GetPolicy

func (c *Client) GetPolicy(parent *Tenant, uuid string) (*Policy, error)

func (*Client) GetPolicyTemplate

func (c *Client) GetPolicyTemplate(uuid string) (*Policy, 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) 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) ListArchives

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

func (*Client) ListAuthTokens

func (c *Client) ListAuthTokens() ([]*AuthToken, 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) ListPolicies

func (c *Client) ListPolicies(parent *Tenant, filter *PolicyFilter) ([]*Policy, error)

func (*Client) ListPolicyTemplates

func (c *Client) ListPolicyTemplates(filter *PolicyFilter) ([]*Policy, 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) 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) SplitKey

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

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) UpdatePolicy

func (c *Client) UpdatePolicy(parent *Tenant, in *Policy) (*Policy, error)

func (*Client) UpdatePolicyTemplate

func (c *Client) UpdatePolicyTemplate(in *Policy) (*Policy, 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 Info

type Info struct {
	Version string `json:"version,omitempty"`
	IP      string `json:"ip,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"`
	Expiry     int    `json:"expiry"`
	Schedule   string `json:"schedule"`
	Paused     bool   `json:"paused"`
	Agent      string `json:"agent"`
	LastStatus string `json:"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"`

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

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

func (Job) Status

func (j Job) Status() string

type JobFilter

type JobFilter struct {
	Fuzzy  bool   `qs:"exact:f:t"`
	Name   string `qs:"name"`
	Store  string `qs:"store"`
	Target string `qs:"target"`
	Policy string `qs:"policy"`
	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 Policy

type Policy struct {
	UUID    string `json:"uuid,omitempty"`
	Name    string `json:"name"`
	Summary string `json:"summary"`
	Expires int    `json:"expires"`
}

type PolicyFilter

type PolicyFilter struct {
	Fuzzy bool   `qs:"exact:f:t"`
	Name  string `qs:"name"`
	Used  *bool  `qs:"unused:f:t"`
}

type Response

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

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

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 {
	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 {
	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 {
	Status string `qs:"status"`
	Active *bool  `qs:"active:t:f"`
	Debug  *bool  `qs:"debug:t:f"`
	Limit  *int   `qs:limit`
	Target string `qs:"target"`
	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"`
		Name    string `json:"name"`
		Account string `json:"account"`
		Backend string `json:"backend"`
		Role    string `json:"role"`
	} `json:"members"`
}

type TenantFilter

type TenantFilter struct {
	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 {
	Fuzzy   bool   `qs:"exact:f:t"`
	Account string `qs:"account"`
	SysRole string `qs:"sysrole"`
}

Jump to

Keyboard shortcuts

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