Documentation
¶
Index ¶
- Variables
- func AddServerRegistrar(serverTypeName string, serverReg ServerRegistrar)
- func JsonArrToConfigurablesSlice(data []byte) ([]map[string]string, error)
- func JsonToConfigurables(data []byte) (map[string]string, error)
- type AccountUsage
- type Configurables
- type Credential
- type Server
- type ServerRegistrar
- type ServerRegistrarMap
Constants ¶
This section is empty.
Variables ¶
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") ErrBadJsonObject = errors.New("ulysses/server: bad JSON object") ErrBadJsonArray = errors.New("ulysses/server: bad JSON array") )
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 AddServerRegistrar ¶
func AddServerRegistrar(serverTypeName string, serverReg ServerRegistrar)
AddServerRegistrar adds a registrar to the global ServerRegistrarMap
func JsonArrToConfigurablesSlice ¶
JsonArrToConfigurablesSlice returns a slice of map[string]string representing a Json Array ([{}, {}, {}])
Types ¶
type AccountUsage ¶
It is up to module designer to parse/utilize the AccountUsage.
type Configurables ¶
type Credential ¶
It is up to module designer to parse/utilize the Credential.
type Server ¶
type Server interface { // UpdateServer() should update the internal variable of a Server to reflect the new state. UpdateServer(sconf Configurables) (err error) // AddAccount() utilizes internal server configuration and aconf pased in to create a series of accounts with // same sconf and variable aconf in order. // This function returns immediately upon an error has occured. The returned accID should contain IDs for // all successfully created accounts. AddAccount(aconf []Configurables) (accID []int, err error) // UpdateAccount() utilizes internal server configuration and aconf pased in to update a series of accounts // specified by accID. // This function returns immediately upon an error has occured. The returned successAccID should contain // IDs for all successfully updated accounts. UpdateAccount(accID []int, aconf []Configurables) (successAccID []int, err error) // DeleteAccount() utilizes internal server configuration to delete a series of accounts specified by accID. // This function returns immediately upon an error has occured. The returned successAccID should contain // IDs for all successfully deleted accounts. DeleteAccount(accID []int) (successAccID []int, err error) // GetCredentials() fetch Credentials in JSON string format for each Account specified by accID. GetCredentials(accID []int) ([]Credential, error) // GetUsage() fetch the history usages of each service specified by accID GetUsage(accID []int) ([]AccountUsage, error) }
Server interface-compatible structs should be copyable. Recommended design: - Pointer to struct - Member pointers in struct
func NewServerByType ¶
func NewServerByType(serverType string, sconf Configurables) (Server, error)
NewServerByType returns a Server interface specified by serverType according to the ServerRegistrarMap the internal state of the returned Server interface should reflect sconf.
type ServerRegistrar ¶
type ServerRegistrar interface { // NewServer returns a Server interface with internal state set to reflect sconf. NewServer(sconf Configurables) (Server, error) }
ServerRegistrar interface-compatible structs should be copyable. Recommended design: - Pointer to struct - Member pointers in struct
type ServerRegistrarMap ¶
type ServerRegistrarMap map[string]ServerRegistrar