Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrServerUnknown = errors.New("ulysses/server: server type is not registered") ErrServerConfigurables = errors.New("ulysses/server: bad server config") ErrAccountConfigurables = errors.New("ulysses/server: bad account config") )
Caller of this module should check the returned error against the list provided below. Any error returned not appearing in the list should be considered as an Internal Error and should not be displayed to Customer/Non-Dev.
Functions ¶
func RegisterServer ¶ added in v0.0.11
func RegisterServer(serverTypeName string, serverGen ProvisioningServerGen)
RegisterServer tells the server module how to instantiate a server struct
Types ¶
type Account ¶ added in v0.0.13
type Account interface {
Credentials() (AccountCredentials, error)
ResourceGroup() (AccountResourceGroup, error)
}
type AccountCredentials ¶ added in v0.0.11
type AccountCredentials interface {
Customer() (credentials map[string]string)
Admin() (credentials map[string]string)
}
It is up to module designer to parse/utilize the Credential.
type AccountResourceGroup ¶ added in v0.0.11
type AccountResourceGroup interface {
ListResources() []uint64
SelectedResources(res ...string) map[uint64]*Resource
}
It is up to module designer to parse/utilize the AccountUsage.
type ProvisioningServer ¶ added in v0.0.13
type ProvisioningServer interface {
// ResourceGroup() shows usage statistics of all allocatable resources on the server
ResourceGroup() ServerResourceGroup
// CreateAccount() utilizes internal server configuration and aconf pased in to create a series of accounts with
// same sconf and variable aconf in order.
CreateAccount(productID uint64, accountConfiguration interface{}) error
// ReadAccount() returns an ServerAccount-compatible struct
GetAccount(productID uint64) (Account, error)
// UpdateAccount() utilizes internal server configuration and aconf pased in to update a series of accounts
// specified by productID.
UpdateAccount(productID uint64, accountConfiguration interface{}) error
// DeleteAccount() utilizes internal server configuration to delete a series of accounts specified by accID.
DeleteAccount(productID uint64) error
// Temporarily disable an account from being used or recover it
SuspendAccount(productID uint64) error
UnsuspendAccount(productID uint64) error
// PurgeResourceUsage sets all USED resource counter to 0 for all users.
// usecase: clean-reinstall
// Won't be automatically called on a time-basis. Not a cronjob mounting point.
PurgeResourceUsage()
}
func NewServer ¶ added in v0.0.11
func NewServer(db *sql.DB, serverType string, instanceID string, serverConfiguration interface{}) (ProvisioningServer, error)
NewServer returns a Server interface specified by serverType according to the ServerRegistrarMap the internal state of the returned Server interface should reflect sconf.
type ProvisioningServerGen ¶ added in v0.0.13
type ProvisioningServerGen func(db *sql.DB, instanceID string, serverConfiguration interface{}) (ProvisioningServer, error)
type ServerResourceAllocation ¶ added in v0.0.11
type ServerResourceGroup ¶ added in v0.0.11
type ServerResourceGroup interface {
ListResources() []uint64 // uint64 is enum of resource name
SelectedResources(res ...uint64) map[uint64]*Resource // uint64 is enum of resource name
ResourceAllocations(res ...uint64) map[uint64]*ServerResourceAllocation // uint64 is enum of resource name
}
It is up to module designer to parse/utilize the AccountUsage.
Click to show internal directories.
Click to hide internal directories.