Documentation ¶
Index ¶
- Variables
- func ConfigureStorage(dstype string, connInfo string, args []string) error
- func DeleteNetwork(networkName string) error
- func DeleteXname(xname string) error
- func GetAllHardware() ([]sls_common.GenericHardware, error)
- func GetAllNetworks() ([]sls_common.Network, error)
- func GetAllXnameObjects() ([]sls_common.GenericHardware, error)
- func GetAllXnames() ([]string, error)
- func GetNetwork(name string) (sls_common.Network, error)
- func GetXname(xname string) (*sls_common.GenericHardware, error)
- func InsertNetwork(network sls_common.Network) (validationErr error, dbErr error)
- func NormalizeFields(obj *sls_common.GenericHardware) error
- func ReplaceAllNetworks(networks []sls_common.Network) error
- func ReplaceGenericHardware(hardware []sls_common.GenericHardware) error
- func SearchGenericHardware(searchHardware sls_common.GenericHardware) (returnHardware []sls_common.GenericHardware, validationErr error, dbErr error)
- func SearchNetworks(network sls_common.Network) (networks []sls_common.Network, err error)
- func SetNetwork(network sls_common.Network) (verificationErr error, dbErr error)
- func SetXname(xname string, obj sls_common.GenericHardware) (err error, created bool)
- func UpdateNetwork(network sls_common.Network) error
- func ValidateFields(obj sls_common.GenericHardware) error
- func VerifyNetwork(nw sls_common.Network) error
Constants ¶
This section is empty.
Variables ¶
var InvalidClass = errors.New("class is invalid")
var InvalidExtraProperties = errors.New("extra properties does not match expected format")
var InvalidNetworkName = errors.New("invalid network name")
var InvalidNetworkType = errors.New("invalid network type")
var InvalidXname = errors.New("xname is invalid")
var InvalidXnameType = errors.New("xname type is invalid")
var UnknownType = errors.New("type is unknown")
var UnsupportedType = errors.New("type can not be stored in SLS")
Functions ¶
func ConfigureStorage ¶
ConfigureStorage configures the interface for interacting with the storage module. Args: * dstype (string) - the type of database to use. Always "etcd" * connInfo (string) - the databse-specific connection information * args ([]string) - a list of arguments to pass to teh database engine
func DeleteNetwork ¶
DeleteNetwork removes a network from the DB.
func DeleteXname ¶
DeleteXname removes hardware witht he appropriate name from the datastore. It handles updating the parent and any peers.
func GetAllHardware ¶
func GetAllHardware() ([]sls_common.GenericHardware, error)
func GetAllNetworks ¶
func GetAllNetworks() ([]sls_common.Network, error)
GetAllNetworks returns all the network objects in the DB.
func GetAllXnameObjects ¶
func GetAllXnameObjects() ([]sls_common.GenericHardware, error)
GetAllXnameObjects get a list of all stored GenericHardware objects
func GetAllXnames ¶
GetAllXnames gets a list of names of all stored xnames
func GetNetwork ¶
func GetNetwork(name string) (sls_common.Network, error)
GetNetwork returns the network object matching the given name.
func GetXname ¶
func GetXname(xname string) (*sls_common.GenericHardware, error)
GetXname retrieves an object by its xname. Objects are returned as GenericHardware objects. Callers should use reflect.GetType if they wish to have this object as a more specific type, then cast as: reflect.ValueOf(GenericHardwareObject).Interface().(Type) Parameters:
- xname (string): The xname to look up
Returns:
- *GenericHardware: The object corresponding to that xname or nil if the xname was not found.
- *error: Any error that occurred during the lookup
func InsertNetwork ¶
func InsertNetwork(network sls_common.Network) (validationErr error, dbErr error)
InsertNetwork adds a given network into the database assuming it passes validation.
func NormalizeFields ¶ added in v1.26.0
func NormalizeFields(obj *sls_common.GenericHardware) error
func ReplaceAllNetworks ¶
func ReplaceAllNetworks(networks []sls_common.Network) error
func ReplaceGenericHardware ¶
func ReplaceGenericHardware(hardware []sls_common.GenericHardware) error
ReplaceGenericHardware will in a single transaction remove all hardware from the database and subsequently insert all of the provided hardware in its place. This make this a safe function to use for any bulk load operations.
func SearchGenericHardware ¶
func SearchGenericHardware(searchHardware sls_common.GenericHardware) (returnHardware []sls_common.GenericHardware, validationErr error, dbErr error)
func SearchNetworks ¶
func SearchNetworks(network sls_common.Network) (networks []sls_common.Network, err error)
func SetNetwork ¶
func SetNetwork(network sls_common.Network) (verificationErr error, dbErr error)
Insert or update a network
func SetXname ¶
func SetXname(xname string, obj sls_common.GenericHardware) (err error, created bool)
SetXname updates a specified xname with new or updated properties
func UpdateNetwork ¶
func UpdateNetwork(network sls_common.Network) error
UpdateNetwork updates all of the fields for a given network in the DB *except* for the name which is read-only. Therefore, this function does no validation on network name.
func ValidateFields ¶ added in v1.26.0
func ValidateFields(obj sls_common.GenericHardware) error
func VerifyNetwork ¶ added in v1.26.0
func VerifyNetwork(nw sls_common.Network) error
Helper function to verify network is of a correct type and name.
Types ¶
This section is empty.