core

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2016 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionCookieName = "supergiant_session"
)

Variables

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

Functions

func RunCustomDeployment

func RunCustomDeployment(core *Core, component *model.Component) error

Types

type Action

type Action struct {
	Status *model.ActionStatus
	// contains filtered or unexported fields
}

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

func (a *Action) Now() error

type Apps

type Apps struct {
	Collection
}

func (*Apps) Create

func (c *Apps) Create(m *model.App) error

func (*Apps) Delete

func (c *Apps) Delete(id *int64, m *model.App) *Action

type CapacityService

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

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 {
	// contains filtered or unexported fields
}

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 Components

type Components struct {
	Collection
}

func (*Components) Delete

func (c *Components) Delete(id *int64, m *model.Component) *Action

func (*Components) Deploy

func (c *Components) Deploy(requester *model.User, id *int64, m *model.Component) *Action

NOTE deploy has User passed into pass API token to CustomDeployScript if used

type Core

type Core struct {
	Settings

	// NOTE we do this 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

	Log *logrus.Logger

	DB *DB

	Sessions         *Sessions
	Users            *Users
	CloudAccounts    *CloudAccounts
	Kubes            *Kubes
	Apps             *Apps
	Components       *Components
	Releases         *Releases
	Instances        *Instances
	Volumes          *Volumes
	PrivateImageKeys *PrivateImageKeys
	Entrypoints      *Entrypoints
	Nodes            *Nodes

	// 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) K8S

func (c *Core) K8S(m *model.Kube) guber.Client

func (*Core) NewAPIClient

func (c *Core) NewAPIClient(authType string, authToken string) *client.Client

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) 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{}) *DB

func (*DB) Offset added in v0.10.1

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

func (*DB) Preload

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

func (*DB) Save

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

func (*DB) Where

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

type Entrypoints

type Entrypoints struct {
	Collection
}

func (*Entrypoints) Create

func (c *Entrypoints) Create(m *model.Entrypoint) error

func (*Entrypoints) Delete

func (c *Entrypoints) Delete(id *int64, m *model.Entrypoint) *Action

func (*Entrypoints) RemovePort

func (c *Entrypoints) RemovePort(id *int64, m *model.Entrypoint, elbPort int64) error

func (*Entrypoints) SetPort

func (c *Entrypoints) SetPort(id *int64, m *model.Entrypoint, elbPort int64, instancePort int64) error

type InstanceObserver

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

func (*InstanceObserver) Perform

func (s *InstanceObserver) Perform() error

type Instances

type Instances struct {
	Collection
}

func (*Instances) CreateVolumes

func (c *Instances) CreateVolumes(id *int64, m *model.Instance) error

func (*Instances) Delete

func (c *Instances) Delete(id *int64, m *model.Instance) *Action

func (*Instances) Log

func (c *Instances) Log(m *model.Instance) (string, error)

func (*Instances) Start

func (c *Instances) Start(id *int64, m *model.Instance) *Action

func (*Instances) Stop

func (c *Instances) Stop(id *int64, m *model.Instance) *Action

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) *Action

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) *Action

type PodNotFoundError

type PodNotFoundError struct {
	InstanceID *int64
}

func (*PodNotFoundError) Error

func (err *PodNotFoundError) Error() string

type Port

type Port struct {
	*model.Port
	// contains filtered or unexported fields
}

type PrivateImageKeys

type PrivateImageKeys struct {
	Collection
}

func (*PrivateImageKeys) Create

type Procedure added in v0.10.0

type Procedure struct {
	Core  *Core
	Name  string
	Model model.Model
	// 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) error

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

	CreateVolume(*model.Volume, *Action) error
	KubernetesVolumeDefinition(*model.Volume) *guber.Volume
	WaitForVolumeAvailable(*model.Volume, *Action) error
	ResizeVolume(*model.Volume, *Action) error
	DeleteVolume(*model.Volume) error

	CreateEntrypoint(*model.Entrypoint, *Action) error
	AddPortToEntrypoint(*model.Entrypoint, int64, int64) error
	RemovePortFromEntrypoint(*model.Entrypoint, int64) error
	DeleteEntrypoint(*model.Entrypoint) error
}

type RecurringService

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

func (*RecurringService) Run

func (s *RecurringService) Run()

type Releases

type Releases struct {
	Collection
}

func (*Releases) Create

func (c *Releases) Create(m *model.Release) error

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 ServiceSet

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

func NewServiceSet

func NewServiceSet(core *Core, component *model.Component, release *model.Release, baseName string, labelSelector map[string]string, portFilter func(*model.Port) bool) (*ServiceSet, 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 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"`
}

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

type Volumes

type Volumes struct {
	Collection
}

func (*Volumes) Delete

func (c *Volumes) Delete(id *int64, m *model.Volume) *Action

func (*Volumes) Provision

func (c *Volumes) Provision(id *int64, m *model.Volume) *Action

func (*Volumes) Resize

func (c *Volumes) Resize(id *int64, m *model.Volume) *Action

Resize the Volume

func (*Volumes) WaitForAvailable added in v0.8.5

func (c *Volumes) WaitForAvailable(id *int64, m *model.Volume) error

Jump to

Keyboard shortcuts

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