models

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2018 License: Apache-2.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAccountNotFound = errors.New("account not found")
View Source
var ErrInvalidDataSourceType = errors.New("invalid datasource type")
View Source
var ErrInvalidName = errors.New("invalid app name")
View Source
var ErrInvalidUsername = errors.New("invalid username")
View Source
var ErrTokenConflict = errors.New("token conflict")
View Source
var ErrTokenNotFound = errors.New("token not found")
View Source
var ErrUpdateConflict = errors.New("update version conflict")
View Source
var ErrUsernameConflict = errors.New("username conflict")

Functions

func CreateApp

func CreateApp(app *Application) error

func CreateDataSource

func CreateDataSource(dataSource *DataSource) error

func DeleteAccountByName

func DeleteAccountByName(username string) error

func DeleteAllVersion

func DeleteAllVersion(app *Application) error

func DeleteAppByName

func DeleteAppByName(name string) error

TODO: Delete app name from `/account/:name/apps`

func DeleteDataSourceByName

func DeleteDataSourceByName(name string) error

func DeleteSessionByToken

func DeleteSessionByToken(token string) error

func DeleteVersionByTag

func DeleteVersionByTag(app *Application, tag string) error

func ListVersions

func ListVersions(app *Application) (*[]Version, error)

func RegisterAccount

func RegisterAccount(account *Account, password string) error

Types

type Account

type Account struct {
	Username     string `json:"username"`
	PasswordHash string `json:"passwordHash"`
	Email        string `json:"email"`
}

func FindAccountByName

func FindAccountByName(username string) (account Account, err error)

func (*Account) ComparePassword

func (account *Account) ComparePassword(password string) error

type Application

type Application struct {
	Name          string `json:"name"`
	Owner         string `json:"owner"`
	GitRepository string `json:"gitRepository"`
	Instances     int    `json:"instances"`
	Version       string `json:"version"`
}

Serialize to /apps/:name

func FindAppByName

func FindAppByName(name string) (app Application, err error)

func GetAppsOfAccount

func GetAppsOfAccount(account *Account) (result []Application, err error)

func (*Application) SwarmInstances

func (app *Application) SwarmInstances() int

func (*Application) SwarmServiceName

func (app *Application) SwarmServiceName() string

func (*Application) Update

func (app *Application) Update(update *Application) error

func (*Application) UpdateVersion

func (app *Application) UpdateVersion(version string) error

type DataSource

type DataSource struct {
	Name      string `json:"name"`
	Owner     string `json:"owner"`
	Type      string `json:"type"`
	Instances int    `json:"instances"`

	// HTTP API token scoped to this dataSource
	AgentToken string `json:"agentToken"`
}

Serialize to /data-sources/:name

func FindDataSourceByName

func FindDataSourceByName(name string) (dataSource DataSource, err error)

func GetDataSourceOfAccount

func GetDataSourceOfAccount(dataSourceName string, account *Account) (*DataSource, error)

func GetDataSourcesOfAccount

func GetDataSourcesOfAccount(account *Account) (dataSources []DataSource, err error)

func GetDataSourcesOfApp

func GetDataSourcesOfApp(app *Application) ([]DataSource, error)

func (*DataSource) CreateNode

func (dataSource *DataSource) CreateNode(node *DataSourceNode) error

func (*DataSource) FindNodeByHost

func (dataSource *DataSource) FindNodeByHost(host string) (dataSourceNode DataSourceNode, err error)

func (*DataSource) GetLinkedAppNames

func (dataSource *DataSource) GetLinkedAppNames() ([]string, error)

func (*DataSource) LinkApp

func (dataSource *DataSource) LinkApp(app *Application) error

func (*DataSource) ListNodes

func (dataSource *DataSource) ListNodes() (nodes []DataSourceNode, err error)

func (*DataSource) SwarmInstances

func (dataSource *DataSource) SwarmInstances() int

func (*DataSource) SwarmNetworkName

func (dataSource *DataSource) SwarmNetworkName() string

func (*DataSource) SwarmServiceName

func (dataSource *DataSource) SwarmServiceName() string

func (*DataSource) UnlinkApp

func (dataSource *DataSource) UnlinkApp(app *Application) error

func (*DataSource) UpdateInstances

func (dataSource *DataSource) UpdateInstances(instances int) error

type DataSourceNode

type DataSourceNode struct {
	// Reference to DataSource.Name
	DataSourceName string `json:"dataSourceName"`
	// Reported address and port, like `10.0.1.1:6380`
	Host string `json:"host"`
	// Reported Role, `master` or `slave`
	Role string `json:"role"`
	// Reported master host, like `10.0.1.1:6380`
	MasterHost string `json:"masterHost"`

	ExpectedRole string `json:"expectedRole"`
}

Serialize to /data-sources/:name/nodes/:host

func (*DataSourceNode) SetMaster

func (node *DataSourceNode) SetMaster() error

func (*DataSourceNode) Update

func (node *DataSourceNode) Update(updates *DataSourceNode) error

func (*DataSourceNode) WaitForCommand

func (node *DataSourceNode) WaitForCommand() (*DataSourceNodeCommand, error)

type DataSourceNodeCommand

type DataSourceNodeCommand struct {
	Command string `json:"command"`
	Role    string `json:"role"`
}

type Session

type Session struct {
	Token    string `json:"token"`
	Username string `json:"username"`
}

func CreateSession

func CreateSession(account *Account) (*Session, error)

func FindSessionByToken

func FindSessionByToken(token string) (session Session, err error)

type Version

type Version struct {
	AppName  string `json:"appName"`
	Tag      string `json:"tag"`
	Registry string `json:"registry"`
	Status   string `json:"status"`
}

Serialize to /apps/:appName/versions/:tag

func FindVersionByTag

func FindVersionByTag(app *Application, tag string) (version Version, err error)

func NewVersion

func NewVersion(app *Application) Version

func (*Version) DockerImageName

func (version *Version) DockerImageName() string

func (*Version) Save

func (version *Version) Save() error

func (*Version) UpdateStatus

func (v *Version) UpdateStatus(app *Application, status string) error

Jump to

Keyboard shortcuts

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