Documentation ¶
Index ¶
- Variables
- func CreateApp(app *Application) error
- func CreateDataSource(dataSource *DataSource) error
- func DeleteAccountByName(username string) error
- func DeleteAllVersion(app *Application) error
- func DeleteAppByName(name string) error
- func DeleteDataSourceByName(name string) error
- func DeleteSessionByToken(token string) error
- func DeleteVersionByTag(app *Application, tag string) error
- func ListVersions(app *Application) (*[]Version, error)
- func RegisterAccount(account *Account, password string) error
- type Account
- type Application
- type DataSource
- func FindDataSourceByName(name string) (dataSource DataSource, err error)
- func GetDataSourceOfAccount(dataSourceName string, account *Account) (*DataSource, error)
- func GetDataSourcesOfAccount(account *Account) (dataSources []DataSource, err error)
- func GetDataSourcesOfApp(app *Application) ([]DataSource, error)
- func (dataSource *DataSource) CreateNode(node *DataSourceNode) error
- func (dataSource *DataSource) FindNodeByHost(host string) (dataSourceNode DataSourceNode, err error)
- func (dataSource *DataSource) GetLinkedAppNames() ([]string, error)
- func (dataSource *DataSource) LinkApp(app *Application) error
- func (dataSource *DataSource) ListNodes() (nodes []DataSourceNode, err error)
- func (dataSource *DataSource) SwarmInstances() int
- func (dataSource *DataSource) SwarmNetworkName() string
- func (dataSource *DataSource) SwarmServiceName() string
- func (dataSource *DataSource) UnlinkApp(app *Application) error
- func (dataSource *DataSource) UpdateInstances(instances int) error
- type DataSourceNode
- type DataSourceNodeCommand
- type Session
- type Version
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 DeleteAllVersion ¶
func DeleteAllVersion(app *Application) error
func DeleteAppByName ¶
TODO: Delete app name from `/account/:name/apps`
func DeleteDataSourceByName ¶
func DeleteSessionByToken ¶
func DeleteVersionByTag ¶
func DeleteVersionByTag(app *Application, tag string) error
func ListVersions ¶
func ListVersions(app *Application) (*[]Version, error)
func RegisterAccount ¶
Types ¶
type Account ¶
type Account struct { Username string `json:"username"` PasswordHash string `json:"passwordHash"` Email string `json:"email"` }
func FindAccountByName ¶
func (*Account) ComparePassword ¶
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 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) UpdateStatus ¶
func (v *Version) UpdateStatus(app *Application, status string) error
Click to show internal directories.
Click to hide internal directories.