Documentation ¶
Index ¶
- Constants
- Variables
- func IsValidSystemRole(role string) bool
- func IsValidTenantRole(role string) bool
- func JSON(w http.ResponseWriter, thing interface{})
- func JSONLiteral(w http.ResponseWriter, thing string)
- func Sentencify(words []string) string
- func SessionCookie(value string, valid bool) *http.Cookie
- func SetAuthHeaders(r *route.Request, sessionID uuid.UUID)
- func ValidCompressionType(t string) bool
- type AgentClient
- type AgentCommand
- type AuthConfig
- type AuthProvider
- type AuthProviderBase
- func (p *AuthProviderBase) Assign(user *db.User, tenant, role string) bool
- func (p *AuthProviderBase) ClearAssignments()
- func (p AuthProviderBase) Configuration(private bool) AuthProviderConfig
- func (p AuthProviderBase) Debugf(m string, args ...interface{})
- func (p AuthProviderBase) Errorf(m string, args ...interface{})
- func (p AuthProviderBase) Fail(w http.ResponseWriter)
- func (p AuthProviderBase) Infof(m string, args ...interface{})
- func (p *AuthProviderBase) SaveAssignments(DB *db.DB, user *db.User) bool
- type AuthProviderConfig
- type Broadcaster
- type ClientError
- type Config
- type Core
- func (core *Core) AreStoresHealthy() bool
- func (core *Core) AuthenticatedUser(r *route.Request) (*db.User, error)
- func (core *Core) CanManageTenants(r *route.Request, tenant string) bool
- func (core *Core) CanSeeCredentials(r *route.Request, tenant string) bool
- func (core *Core) DeltaIncrease(filter *db.ArchiveFilter) (int64, error)
- func (core *Core) Initialize(master string) (bool, string, error)
- func (core *Core) IsNotAuthenticated(r *route.Request) bool
- func (core *Core) IsNotSystemAdmin(r *route.Request) bool
- func (core *Core) IsNotSystemEngineer(r *route.Request) bool
- func (core *Core) IsNotSystemManager(r *route.Request) bool
- func (core *Core) IsNotTenantAdmin(r *route.Request, tenant string) bool
- func (core *Core) IsNotTenantEngineer(r *route.Request, tenant string) bool
- func (core *Core) IsNotTenantOperator(r *route.Request, tenant string) bool
- func (core *Core) Rekey(current, proposed string, rotateFixed bool) (string, error)
- func (core *Core) Run() error
- func (core *Core) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (core *Core) Unlock(master string) (bool, error)
- type Event
- type FailsafeConfig
- type GithubAuthProvider
- type Health
- type Info
- type InvalidParametersError
- type JSONError
- type JobHealth
- type MissingParametersError
- type StorageHealth
- type UAAAuthProvider
- type Validator
Constants ¶
View Source
const APIVersion = 2
View Source
const SessionCookieName = "shield7"
Variables ¶
View Source
var DataDir = "setme"
View Source
var DefaultCompressionType = "bzip2"
View Source
var Problems = map[string]string{
"legacy-shield-agent-version": "This SHIELD agent is not reporting its version, which means that it is probably a v6.x version of SHIELD. It will not be able to report back health and status information to this SHIELD Core. Similarly, plugin metadata will be unavailable for this agent, and SHIELD operators and site administrators will have to operate without it for all targets that use this agent for backup and restore operations.",
"dev-shield-agent-version": "This SHIELD agent is reporting its version as 'dev', which makes it difficult to determine its exact featureset. Dev builds of SHIELD are not recommended for production.",
}
View Source
var (
RoleTower map[string]int
)
View Source
var Version = "(development)"
Functions ¶
func IsValidSystemRole ¶
func IsValidTenantRole ¶
func JSON ¶
func JSON(w http.ResponseWriter, thing interface{})
func JSONLiteral ¶
func JSONLiteral(w http.ResponseWriter, thing string)
func Sentencify ¶
func ValidCompressionType ¶
Types ¶
type AgentClient ¶
type AgentClient struct {
// contains filtered or unexported fields
}
func NewAgentClient ¶
func NewAgentClient(keyfile string) (*AgentClient, error)
func (*AgentClient) Run ¶
func (c *AgentClient) Run(host string, stdout, stderr chan string, command *AgentCommand) error
FIXME: add a stderr here and move O:/E: out of core/core.go
type AgentCommand ¶
type AgentCommand struct { Op string `json:"operation"` TargetPlugin string `json:"target_plugin,omitempty"` TargetEndpoint string `json:"target_endpoint,omitempty"` StorePlugin string `json:"store_plugin,omitempty"` StoreEndpoint string `json:"store_endpoint,omitempty"` RestoreKey string `json:"restore_key,omitempty"` EncryptType string `json:"encrypt_type,omitempty"` EncryptKey string `json:"encrypt_key,omitempty"` EncryptIV string `json:"encrypt_iv,omitempty"` Compression string `json:"compression,omitempty"` }
type AuthConfig ¶
type AuthProvider ¶
type AuthProviderBase ¶
type AuthProviderBase struct { Name string Identifier string Type string // contains filtered or unexported fields }
func (*AuthProviderBase) Assign ¶
func (p *AuthProviderBase) Assign(user *db.User, tenant, role string) bool
func (*AuthProviderBase) ClearAssignments ¶
func (p *AuthProviderBase) ClearAssignments()
func (AuthProviderBase) Configuration ¶
func (p AuthProviderBase) Configuration(private bool) AuthProviderConfig
func (AuthProviderBase) Debugf ¶
func (p AuthProviderBase) Debugf(m string, args ...interface{})
func (AuthProviderBase) Errorf ¶
func (p AuthProviderBase) Errorf(m string, args ...interface{})
func (AuthProviderBase) Fail ¶
func (p AuthProviderBase) Fail(w http.ResponseWriter)
func (AuthProviderBase) Infof ¶
func (p AuthProviderBase) Infof(m string, args ...interface{})
func (*AuthProviderBase) SaveAssignments ¶
type AuthProviderConfig ¶
type Broadcaster ¶
type Broadcaster struct {
// contains filtered or unexported fields
}
func NewBroadcaster ¶
func NewBroadcaster(slots int) Broadcaster
func (*Broadcaster) Broadcast ¶
func (b *Broadcaster) Broadcast(ev Event)
func (*Broadcaster) Unregister ¶
func (b *Broadcaster) Unregister(idx int) error
type ClientError ¶
type ClientError struct {
Error string `json:"error"`
}
func ClientErrorf ¶
func ClientErrorf(format string, v ...interface{}) ClientError
func (ClientError) JSON ¶
func (e ClientError) JSON() string
type Config ¶
type Config struct { SlowLoop int `yaml:"slow_loop"` FastLoop int `yaml:"fast_loop"` Debug bool `yaml:"debug"` DataDir string `yaml:"data_directory"` Addr string `yaml:"listen_addr"` KeyFile string `yaml:"private_key"` Workers int `yaml:"workers"` Purge string `yaml:"purge_agent"` Timeout int `yaml:"max_timeout"` SkipSSLVerify bool `yaml:"skip_ssl_verify"` WebRoot string `yaml:"web_root"` Environment string `yaml:"env"` Color string `yaml:"color"` MOTD string `yaml:"motd"` EncryptionType string `yaml:"encryption_type"` VaultAddress string `yaml:"vault_address"` VaultCACert string `yaml:"vault_ca_cert"` SessionTimeout int `yaml:"session_timeout"` Failsafe FailsafeConfig `yaml:"failsafe"` Auth []AuthConfig `yaml:"auth"` }
func ReadConfig ¶
type Core ¶
func (*Core) AreStoresHealthy ¶
func (*Core) AuthenticatedUser ¶
func (*Core) CanManageTenants ¶
func (*Core) CanSeeCredentials ¶
func (*Core) DeltaIncrease ¶
func (core *Core) DeltaIncrease(filter *db.ArchiveFilter) (int64, error)
DeltaIncrease calculates the delta in storage space over the period specified. It stores the number of bytes increased/decreased in the period specified in the stores table. Calculation is preformed by taking (total new archives created - any archives newly purged)
func (*Core) IsNotTenantAdmin ¶
func (*Core) IsNotTenantEngineer ¶
func (*Core) IsNotTenantOperator ¶
type FailsafeConfig ¶
type GithubAuthProvider ¶
type GithubAuthProvider struct { AuthProviderBase ClientID string `json:"client_id"` ClientSecret string `json:"client_secret"` GithubEndpoint string `json:"github_endpoint"` GithubAPI string `json:"github_api"` GithubEnterprise bool `json:"github_enterprise"` Mapping []struct { Github string `json:"github"` Tenant string `json:"tenant"` Rights []struct { Team string `json:"team"` Role string `json:"role"` } `json:"rights"` } `json:"mapping"` // contains filtered or unexported fields }
func (*GithubAuthProvider) Configure ¶
func (p *GithubAuthProvider) Configure(raw map[interface{}]interface{}) error
func (*GithubAuthProvider) HandleRedirect ¶
func (p *GithubAuthProvider) HandleRedirect(req *http.Request) *db.User
func (*GithubAuthProvider) Initiate ¶
func (p *GithubAuthProvider) Initiate(w http.ResponseWriter, req *http.Request)
func (*GithubAuthProvider) ReferencedTenants ¶
func (p *GithubAuthProvider) ReferencedTenants() []string
type Health ¶
type Health struct { Health struct { Core string `json:"core"` Storage bool `json:"storage_ok"` Jobs bool `json:"jobs_ok"` } `json:"health"` Storage []StorageHealth `json:"storage"` Jobs []JobHealth `json:"jobs"` Stats struct { Jobs int `json:"jobs"` Systems int `json:"systems"` Archives int `json:"archives"` Storage int64 `json:"storage"` Daily int64 `json:"daily"` } `json:"stats"` }
type InvalidParametersError ¶
func InvalidParameters ¶
func InvalidParameters(names ...string) InvalidParametersError
func (InvalidParametersError) Error ¶
func (e InvalidParametersError) Error() string
func (*InvalidParametersError) IsValid ¶
func (e *InvalidParametersError) IsValid() bool
func (InvalidParametersError) JSON ¶
func (e InvalidParametersError) JSON() string
func (*InvalidParametersError) Validate ¶
func (e *InvalidParametersError) Validate(name string, value interface{}, fn Validator)
type MissingParametersError ¶
type MissingParametersError struct {
Missing []string `json:"missing"`
}
func MissingParameters ¶
func MissingParameters(names ...string) MissingParametersError
func (*MissingParametersError) Check ¶
func (e *MissingParametersError) Check(name string, value string)
func (MissingParametersError) Error ¶
func (e MissingParametersError) Error() string
func (MissingParametersError) IsValid ¶
func (e MissingParametersError) IsValid() bool
func (MissingParametersError) JSON ¶
func (e MissingParametersError) JSON() string
type StorageHealth ¶
type UAAAuthProvider ¶
type UAAAuthProvider struct { AuthProviderBase ClientID string `json:"client_id"` ClientSecret string `json:"client_secret"` UAAEndpoint string `json:"uaa_endpoint"` SkipVerifyTLS bool `json:"skip_verify_tls"` Mapping []struct { Tenant string `json:"tenant"` Rights []struct { SCIM string `json:"scim"` Role string `json:"role"` } `json:"rights"` } `json:"mapping"` // contains filtered or unexported fields }
func (*UAAAuthProvider) Configure ¶
func (p *UAAAuthProvider) Configure(raw map[interface{}]interface{}) error
func (*UAAAuthProvider) HandleRedirect ¶
func (p *UAAAuthProvider) HandleRedirect(req *http.Request) *db.User
func (*UAAAuthProvider) Initiate ¶
func (p *UAAAuthProvider) Initiate(w http.ResponseWriter, req *http.Request)
func (*UAAAuthProvider) ReferencedTenants ¶
func (p *UAAAuthProvider) ReferencedTenants() []string
Click to show internal directories.
Click to hide internal directories.