core

package
v8.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 22, 2019 License: MIT Imports: 28 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version       string
	DefaultConfig Config
)
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
)

Functions

func IsValidSystemRole

func IsValidSystemRole(role string) bool

func IsValidTenantRole

func IsValidTenantRole(role string) bool

func ValidCompressionType

func ValidCompressionType(t string) bool

Types

type AuthProvider

type AuthProvider interface {
	Configure(map[interface{}]interface{}) error
	Configuration(bool) AuthProviderConfig
	WireUpTo(core *Core)

	ReferencedTenants() []string

	Initiate(*route.Request)
	HandleRedirect(*route.Request) *db.User
}

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 (AuthProviderBase) Infof

func (p AuthProviderBase) Infof(m string, args ...interface{})

func (*AuthProviderBase) SaveAssignments

func (p *AuthProviderBase) SaveAssignments(DB *db.DB, user *db.User) bool

type AuthProviderConfig

type AuthProviderConfig 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 Bearing

type Bearing struct {
	Tenant   *db.Tenant    `json:"tenant"`
	Archives []*db.Archive `json:"archives"`
	Jobs     []*db.Job     `json:"jobs"`
	Targets  []*db.Target  `json:"targets"`
	Stores   []*db.Store   `json:"stores"`
	Agents   []*db.Agent   `json:"agents"`
	Role     string        `json:"role"`

	Grants struct {
		Admin    bool `json:"admin"`
		Engineer bool `json:"engineer"`
		Operator bool `json:"operator"`
	} `json:"grants"`
}

type Config

type Config struct {
	Debug       bool     `yaml:"debug"`
	DataDir     string   `yaml:"data-dir"`
	WebRoot     string   `yaml:"web-root"`
	PluginPaths []string `yaml:"plugin_paths"`

	Scheduler struct {
		FastLoop int `yaml:"fast-loop"`
		SlowLoop int `yaml:"slow-loop"`
		Threads  int `yaml:"threads"`
		Timeout  int `yaml:"timeout"`
	} `yaml:"scheduler"`

	API struct {
		Bind    string `yaml:"bind"`
		PProf   string `yaml:"pprof"`
		Session struct {
			ClearOnBoot bool `yaml:"clear-on-boot"`
			Timeout     int  `yaml:"timeout"`
		} `yaml:"session"`

		Failsafe struct {
			Username string `yaml:"username"`
			Password string `yaml:"password"`
		} `yaml:"failsafe"`

		Env   string `yaml:"env"`
		Color string `yaml:"color"`
		MOTD  string `yaml:"motd"`
	} `yaml:"api"`

	Limit struct {
		Retention struct {
			Min int `yaml:"min"`
			Max int `yaml:"max"`
		} `yaml:"retention"`
	} `yaml:"limit"`

	Auth []struct {
		Name       string `yaml:"name"`
		Identifier string `yaml:"identifier"`
		Backend    string `yaml:"backend"`

		Properties map[interface{}]interface{} `yaml:"properties"`
	} `yaml:"auth"`

	Fabrics []struct {
		Name string `yaml:"name"`

		Delay int `yaml:"delay"`

		SSHKey string `yaml:"ssh-key"`
		// contains filtered or unexported fields
	} `yaml:"fabrics"`

	Vault struct {
		Address string `yaml:"address"`
		CACert  string `yaml:"ca"`
		// contains filtered or unexported fields
	} `yaml:"vault"`

	Cipher string `yaml:"cipher"`

	Bootstrapper string `yaml:"bootstrapper"`
}

type Core

type Core struct {
	Config Config
	// contains filtered or unexported fields
}

func Configure

func Configure(file string, config Config) (*Core, error)

func (*Core) AnalyzeStorage

func (c *Core) AnalyzeStorage()

func (*Core) ApplyFixups

func (c *Core) ApplyFixups()

func (*Core) AuthenticatedUser

func (c *Core) AuthenticatedUser(r *route.Request) (*db.User, error)

func (*Core) BearingFor

func (c *Core) BearingFor(m *db.Membership) (Bearing, error)

func (*Core) Bind

func (c *Core) Bind()

func (*Core) CanManageTenants

func (c *Core) CanManageTenants(r *route.Request, tenant string) bool

func (*Core) CanSeeCredentials

func (c *Core) CanSeeCredentials(r *route.Request, tenant string) bool

func (*Core) CanSeeGlobalCredentials

func (c *Core) CanSeeGlobalCredentials(r *route.Request) bool

func (*Core) CheckArchiveExpiries

func (c *Core) CheckArchiveExpiries()

func (*Core) CleanupLeftoverTasks

func (c *Core) CleanupLeftoverTasks()

func (*Core) CleanupOrphanedObjects

func (c *Core) CleanupOrphanedObjects()

func (*Core) ConfigureMessageBus

func (c *Core) ConfigureMessageBus()

func (*Core) ConnectToDatabase

func (c *Core) ConnectToDatabase()

func (*Core) ConnectToVault

func (c *Core) ConnectToVault()

func (*Core) CreateFailsafeUser

func (c *Core) CreateFailsafeUser()

func (*Core) CryptFile

func (c *Core) CryptFile() string

func (*Core) DataFile

func (c *Core) DataFile(rel string) string

func (*Core) DeltaIncrease

func (c *Core) DeltaIncrease(filter *db.ArchiveFilter) (int64, error)

func (*Core) ExpireInteractiveSessions

func (c *Core) ExpireInteractiveSessions()

func (*Core) FabricFor

func (c *Core) FabricFor(task *db.Task) (fabric.Fabric, error)

func (*Core) IsNotAuthenticated

func (c *Core) IsNotAuthenticated(r *route.Request) bool

func (*Core) IsNotSystemAdmin

func (c *Core) IsNotSystemAdmin(r *route.Request) bool

func (*Core) IsNotSystemEngineer

func (c *Core) IsNotSystemEngineer(r *route.Request) bool

func (*Core) IsNotSystemManager

func (c *Core) IsNotSystemManager(r *route.Request) bool

func (*Core) IsNotTenantAdmin

func (c *Core) IsNotTenantAdmin(r *route.Request, tenant string) bool

func (*Core) IsNotTenantEngineer

func (c *Core) IsNotTenantEngineer(r *route.Request, tenant string) bool

func (*Core) IsNotTenantOperator

func (c *Core) IsNotTenantOperator(r *route.Request, tenant string) bool

func (Core) Main

func (c Core) Main()

func (*Core) MarkIrrelevantTasks

func (c *Core) MarkIrrelevantTasks()

func (*Core) MaybeTerminate

func (c *Core) MaybeTerminate(err error)

func (*Core) PrecreateTenants

func (c *Core) PrecreateTenants()

func (*Core) PurgeExpiredAPISessions

func (c *Core) PurgeExpiredAPISessions()

func (*Core) ScheduleAgentStatusCheckTasks

func (c *Core) ScheduleAgentStatusCheckTasks(f *db.AgentFilter)

func (*Core) ScheduleBackupTasks

func (c *Core) ScheduleBackupTasks()

func (*Core) SchedulePurgeTasks

func (c *Core) SchedulePurgeTasks()

func (*Core) ScheduleStorageTestTasks

func (c *Core) ScheduleStorageTestTasks()

func (*Core) StartScheduler

func (c *Core) StartScheduler()

func (*Core) TaskErrored

func (c *Core) TaskErrored(task *db.Task, fail string, args ...interface{})

func (*Core) TasksToChores

func (c *Core) TasksToChores()

func (*Core) Terminate

func (c *Core) Terminate(err error)

func (*Core) Unlocked

func (c *Core) Unlocked() bool

func (*Core) WireUpAuthenticationProviders

func (c *Core) WireUpAuthenticationProviders()

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"`
}

func (*GithubAuthProvider) Configure

func (p *GithubAuthProvider) Configure(raw map[interface{}]interface{}) error

func (*GithubAuthProvider) HandleRedirect

func (p *GithubAuthProvider) HandleRedirect(r *route.Request) *db.User

func (*GithubAuthProvider) Initiate

func (p *GithubAuthProvider) Initiate(r *route.Request)

func (*GithubAuthProvider) ReferencedTenants

func (p *GithubAuthProvider) ReferencedTenants() []string

func (*GithubAuthProvider) WireUpTo

func (p *GithubAuthProvider) WireUpTo(c *Core)

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 JobHealth

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

type StorageHealth

type StorageHealth struct {
	UUID    string `json:"uuid"`
	Name    string `json:"name"`
	Healthy bool   `json:"healthy"`
}

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(r *route.Request) *db.User

func (*UAAAuthProvider) Initiate

func (p *UAAAuthProvider) Initiate(r *route.Request)

func (*UAAAuthProvider) ReferencedTenants

func (p *UAAAuthProvider) ReferencedTenants() []string

func (*UAAAuthProvider) WireUpTo

func (p *UAAAuthProvider) WireUpTo(c *Core)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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