Help us shape the future of Go! Take the 2026 Go Developer Survey

core

package
v0.15.4 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2017 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionCookieName = "supergiant_session"
)

Variables

View Source
var (
	ErrorBadLogin = errors.New("Invalid credentials")
)

Functions

This section is empty.

Types

type Action

type Action struct {
	Status         *model.ActionStatus
	Core           *Core
	Scope          DBInterface
	Model          model.Model
	ID             *int64
	ResourceID     string
	Fn             func(*Action) error
	CancelExisting bool
}

func (*Action) Async

func (a *Action) Async() error

func (*Action) CancellableWaitFor added in v0.9.0

func (a *Action) CancellableWaitFor(desc string, d time.Duration, i time.Duration, fn func() (bool, error)) error

func (*Action) GetStatus added in v0.11.0

func (a *Action) GetStatus() *model.ActionStatus

func (*Action) Now

func (a *Action) Now() error

type ActionInterface added in v0.11.0

type ActionInterface interface {
	Now() error
	Async() error
	CancellableWaitFor(string, time.Duration, time.Duration, func() (bool, error)) error
	GetStatus() *model.ActionStatus
}

type CapacityService

type CapacityService struct {
	Core            *Core
	WaitBeforeScale time.Duration
}

func (*CapacityService) Perform

func (s *CapacityService) Perform() error

type CloudAccounts

type CloudAccounts struct {
	Collection
}

func (*CloudAccounts) Create

func (c *CloudAccounts) Create(m *model.CloudAccount) error

func (*CloudAccounts) Delete

func (c *CloudAccounts) Delete(id *int64, m *model.CloudAccount) error

type Collection

type Collection struct {
	Core *Core
}

func (*Collection) Create

func (c *Collection) Create(m model.Model) error

func (*Collection) Delete

func (c *Collection) Delete(id *int64, m model.Model) error

func (*Collection) Get

func (c *Collection) Get(id *int64, m model.Model) error

func (*Collection) GetWithIncludes

func (c *Collection) GetWithIncludes(id *int64, m model.Model, includes []string) error

func (*Collection) Update

func (c *Collection) Update(id *int64, oldM model.Model, m model.Model) error

type Core

type Core struct {
	// Version is set by cmd/server/server.go
	Version string
	Settings

	// NOTE we set these 2 in cmd/server.go to prevent having to load all the
	// cloud provider various lib code everytime we load core
	AWSProvider  func(map[string]string) Provider
	DOProvider   func(map[string]string) Provider
	OSProvider   func(map[string]string) Provider
	GCEProvider  func(map[string]string) Provider
	PACKProvider func(map[string]string) Provider

	// A little different from the above
	K8SProvider Provider

	K8S func(*model.Kube) kubernetes.ClientInterface

	DefaultProvisioner Provisioner

	APIClient func(authType string, authToken string) *client.Client

	Log *logrus.Logger

	DB DBInterface

	Sessions      SessionsInterface
	Users         *Users
	CloudAccounts *CloudAccounts
	Kubes         *Kubes
	KubeResources KubeResourcesInterface
	Nodes         NodesInterface
	LoadBalancers *LoadBalancers
	HelmRepos     *HelmRepos
	HelmCharts    *HelmCharts
	HelmReleases  *HelmReleases

	// TODO should this be a pseudo-collection like Sessions?
	Actions *SafeMap
}

func (*Core) APIURL added in v0.9.0

func (c *Core) APIURL() string

func (*Core) BaseURL added in v0.8.6

func (c *Core) BaseURL() string

func (*Core) HTTPSURL added in v0.9.0

func (c *Core) HTTPSURL() string

func (*Core) HTTPURL added in v0.9.0

func (c *Core) HTTPURL() string

func (*Core) Initialize

func (c *Core) Initialize()

NOTE this used to be core.New(), but due to how we load in values from the cli package, I needed to first actually initialize a Core struct and then configure.

func (*Core) InitializeBackground added in v0.9.0

func (c *Core) InitializeBackground()

InitializeBackground starts Action processing and RecurringServices for *Core.

func (*Core) InitializeForeground added in v0.9.0

func (c *Core) InitializeForeground() error

InitializeForeground sets up Log and DB on *Core.

func (*Core) SSLEnabled added in v0.8.6

func (c *Core) SSLEnabled() bool

func (*Core) SetResourceActionStatus

func (c *Core) SetResourceActionStatus(m model.Model)

func (*Core) UIURL added in v0.9.0

func (c *Core) UIURL() string

type DB

type DB struct {
	*gorm.DB
	// contains filtered or unexported fields
}

func (*DB) Count added in v0.11.0

func (db *DB) Count(value interface{}) error

func (*DB) Create

func (db *DB) Create(m model.Model) error

func (*DB) Delete

func (db *DB) Delete(m model.Model) error

func (*DB) Find

func (db *DB) Find(out interface{}, where ...interface{}) error

func (*DB) First

func (db *DB) First(out interface{}, where ...interface{}) error

func (*DB) Limit added in v0.10.1

func (db *DB) Limit(limit interface{}) DBInterface

func (*DB) Model added in v0.11.0

func (db *DB) Model(value interface{}) DBInterface

func (*DB) Offset added in v0.10.1

func (db *DB) Offset(offset interface{}) DBInterface

func (*DB) Preload

func (db *DB) Preload(column string, conditions ...interface{}) DBInterface

func (*DB) Save

func (db *DB) Save(m model.Model) error

func (*DB) Update added in v0.11.0

func (db *DB) Update(attrs ...interface{}) error

func (*DB) Where

func (db *DB) Where(query interface{}, args ...interface{}) DBInterface

type DBInterface added in v0.11.0

type DBInterface interface {
	Create(model.Model) error
	Save(model.Model) error
	Find(out interface{}, where ...interface{}) error
	First(out interface{}, where ...interface{}) error
	Delete(m model.Model) error
	Preload(column string, conditions ...interface{}) DBInterface
	Where(query interface{}, args ...interface{}) DBInterface
	Limit(limit interface{}) DBInterface
	Offset(offset interface{}) DBInterface
	Model(value interface{}) DBInterface
	Update(attrs ...interface{}) error
	Count(interface{}) error
}

type DefaultProvisioner added in v0.11.0

type DefaultProvisioner struct {
	Core *Core
}

func (*DefaultProvisioner) IsRunning added in v0.11.0

func (p *DefaultProvisioner) IsRunning(kubeResource *model.KubeResource) (bool, error)

func (*DefaultProvisioner) Provision added in v0.11.0

func (p *DefaultProvisioner) Provision(kubeResource *model.KubeResource) error

func (*DefaultProvisioner) Teardown added in v0.11.0

func (p *DefaultProvisioner) Teardown(kubeResource *model.KubeResource) error

type ErrorMissingRequiredParent added in v0.11.0

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

func (*ErrorMissingRequiredParent) Error added in v0.11.0

func (err *ErrorMissingRequiredParent) Error() string

type ErrorValidationFailed added in v0.11.0

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

func (*ErrorValidationFailed) Error added in v0.11.0

func (err *ErrorValidationFailed) Error() string

type HelmCharts added in v0.14.0

type HelmCharts struct {
	Collection
}

func (*HelmCharts) Get added in v0.14.0

func (c *HelmCharts) Get(id *int64, m *model.HelmChart) error

func (*HelmCharts) Populate added in v0.14.0

func (c *HelmCharts) Populate() error

type HelmReleases added in v0.14.0

type HelmReleases struct {
	Collection
}

func (*HelmReleases) Create added in v0.14.0

func (c *HelmReleases) Create(m *model.HelmRelease) error

func (*HelmReleases) Delete added in v0.14.0

func (c *HelmReleases) Delete(id *int64, m *model.HelmRelease) ActionInterface

func (*HelmReleases) Populate added in v0.14.0

func (c *HelmReleases) Populate() error

type HelmRepos added in v0.14.0

type HelmRepos struct {
	Collection
}

func (*HelmRepos) Delete added in v0.14.0

func (c *HelmRepos) Delete(id *int64, m *model.HelmRepo) ActionInterface

type KubeResources added in v0.11.0

type KubeResources struct {
	Collection
}

func (*KubeResources) Create added in v0.11.0

func (c *KubeResources) Create(m *model.KubeResource) error

func (*KubeResources) Delete added in v0.11.0

func (*KubeResources) Populate added in v0.14.0

func (c *KubeResources) Populate() error

func (*KubeResources) Refresh added in v0.11.0

func (c *KubeResources) Refresh(m *model.KubeResource) (err error)

TODO TODO TODO

func (*KubeResources) Start added in v0.11.0

func (*KubeResources) Stop added in v0.11.0

func (*KubeResources) Update added in v0.11.0

func (c *KubeResources) Update(id *int64, oldM *model.KubeResource, m *model.KubeResource) error

TODO

type KubeResourcesInterface added in v0.11.0

type KubeResourcesInterface interface {
	Populate() error
	Create(*model.KubeResource) error
	Get(*int64, model.Model) error
	GetWithIncludes(*int64, model.Model, []string) error
	Update(*int64, *model.KubeResource, *model.KubeResource) error
	Delete(*int64, *model.KubeResource) ActionInterface
	Start(*int64, *model.KubeResource) ActionInterface
	Stop(*int64, *model.KubeResource) ActionInterface
	Refresh(*model.KubeResource) error
}

type KubeScaler

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

func (*KubeScaler) Scale

func (s *KubeScaler) Scale() error

type Kubes

type Kubes struct {
	Collection
}

func (*Kubes) Create

func (c *Kubes) Create(m *model.Kube) error

func (*Kubes) Delete

func (c *Kubes) Delete(id *int64, m *model.Kube) ActionInterface

func (*Kubes) Provision added in v0.11.4

func (c *Kubes) Provision(id *int64, m *model.Kube) ActionInterface

type LoadBalancers added in v0.14.0

type LoadBalancers struct {
	Collection
}

func (*LoadBalancers) Create added in v0.14.0

func (c *LoadBalancers) Create(m *model.LoadBalancer) error

func (*LoadBalancers) Delete added in v0.14.0

func (*LoadBalancers) Provision added in v0.14.0

func (c *LoadBalancers) Provision(id *int64, m *model.LoadBalancer) ActionInterface

func (*LoadBalancers) Update added in v0.14.0

func (c *LoadBalancers) Update(id *int64, oldM *model.LoadBalancer, m *model.LoadBalancer) error

type NodeObserver

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

func (*NodeObserver) Perform

func (s *NodeObserver) Perform() error

type NodeSize added in v0.8.5

type NodeSize struct {
	Name     string  `json:"name"`
	RAMGIB   float64 `json:"ram_gib"`
	CPUCores float64 `json:"cpu_cores"`
}

type Nodes

type Nodes struct {
	Collection
}

func (*Nodes) Create

func (c *Nodes) Create(m *model.Node) error

func (*Nodes) Delete

func (c *Nodes) Delete(id *int64, m *model.Node) ActionInterface

func (*Nodes) Provision added in v0.11.4

func (c *Nodes) Provision(id *int64, m *model.Node) ActionInterface

type NodesInterface added in v0.11.2

type NodesInterface interface {
	Create(*model.Node) error
	Provision(*int64, *model.Node) ActionInterface
	Get(*int64, model.Model) error
	GetWithIncludes(*int64, model.Model, []string) error
	Update(*int64, model.Model, model.Model) error
	Delete(*int64, *model.Node) ActionInterface
}

type Procedure added in v0.10.0

type Procedure struct {
	Core   *Core
	Name   string
	Model  model.Model
	Action *Action
	// contains filtered or unexported fields
}

func (*Procedure) AddStep added in v0.10.0

func (p *Procedure) AddStep(desc string, fn func() error)

func (*Procedure) Run added in v0.10.0

func (p *Procedure) Run() error

type Provider added in v0.8.5

type Provider interface {
	ValidateAccount(*model.CloudAccount) error

	CreateKube(*model.Kube, *Action) error
	DeleteKube(*model.Kube, *Action) error

	CreateNode(*model.Node, *Action) error
	DeleteNode(*model.Node, *Action) error

	CreateLoadBalancer(*model.LoadBalancer, *Action) error
	UpdateLoadBalancer(*model.LoadBalancer, *Action) error
	DeleteLoadBalancer(*model.LoadBalancer, *Action) error
}

type Provisioner added in v0.11.0

type Provisioner interface {
	Provision(*model.KubeResource) error
	IsRunning(*model.KubeResource) (bool, error)
	Teardown(*model.KubeResource) error
}

type RecurringService

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

func (*RecurringService) Run

func (s *RecurringService) Run()

type RepeatedActionError

type RepeatedActionError struct {
	ResourceID string
}

func (*RepeatedActionError) Error

func (err *RepeatedActionError) Error() string

type SafeMap added in v0.9.0

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

SafeMap is a concurrently-accessible map

func NewSafeMap added in v0.9.0

func NewSafeMap(core *Core) *SafeMap

func (*SafeMap) Delete added in v0.9.0

func (m *SafeMap) Delete(desc string, key string)

func (*SafeMap) Get added in v0.9.0

func (m *SafeMap) Get(key string) interface{}

func (*SafeMap) List added in v0.9.0

func (m *SafeMap) List() []interface{}

func (*SafeMap) Put added in v0.9.0

func (m *SafeMap) Put(desc string, key string, value interface{})

type Service

type Service interface {
	Perform() error
}

type SessionExpirer added in v0.9.0

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

func (*SessionExpirer) Perform added in v0.9.0

func (s *SessionExpirer) Perform() error

type Sessions added in v0.9.0

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

func NewSessions added in v0.9.0

func NewSessions(core *Core) *Sessions

func (*Sessions) Client added in v0.9.0

func (c *Sessions) Client(id string) *client.Client

Each Session reuses a single Client instance, and this method fetches that.

func (*Sessions) Create added in v0.9.0

func (c *Sessions) Create(m *model.Session) error

func (*Sessions) Delete added in v0.9.0

func (c *Sessions) Delete(id string) error

func (*Sessions) Get added in v0.9.0

func (c *Sessions) Get(id string, m *model.Session) error

func (*Sessions) List added in v0.9.0

func (c *Sessions) List() (items []*model.Session)

type SessionsInterface added in v0.11.2

type SessionsInterface interface {
	Client(id string) *client.Client
	List() []*model.Session
	Create(*model.Session) error
	Get(id string, m *model.Session) error
	Delete(id string) error
}

type Settings added in v0.8.2

type Settings struct {
	ConfigFilePath string

	PsqlHost               string `json:"psql_host"`
	PsqlDb                 string `json:"psql_db"`
	PsqlUser               string `json:"psql_user"`
	PsqlPass               string `json:"psql_pass"`
	SQLiteFile             string `json:"sqlite_file"`
	PublishHost            string `json:"publish_host"`
	HTTPPort               string `json:"http_port"`
	HTTPSPort              string `json:"https_port"`
	SSLCertFile            string `json:"ssl_cert_file"`
	SSLKeyFile             string `json:"ssl_key_file"`
	LogPath                string `json:"log_file"`
	LogLevel               string `json:"log_level"`
	UIEnabled              bool   `json:"ui_enabled"`
	CapacityServiceEnabled bool   `json:"capacity_service_enabled"`

	// NOTE these MUST be provided in ascending order by cost in order to
	// correctly provision the smallest size on Kube creation
	//
	// NodeSizes is a map of provider name (ex. "aws") and node sizes
	NodeSizes map[string][]*NodeSize `json:"node_sizes"`

	// NOTE this is only exposed for the purpose of testing
	KubeResourceStartTimeout time.Duration
	HelmJobStartTimeout      time.Duration
}

type Step added in v0.10.0

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

type Users added in v0.9.0

type Users struct {
	Collection
}

func (*Users) RegenerateAPIToken added in v0.9.0

func (c *Users) RegenerateAPIToken(id *int64, m *model.User) error

Jump to

Keyboard shortcuts

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