Documentation ¶
Index ¶
- type API
- type Category
- type CategoryTransaction
- type Column
- type Component
- type ComponentTransaction
- type Database
- type Group
- type GroupTransaction
- type Host
- type HostTransaction
- type IP
- type IPTransaction
- type LDAP
- type Log
- type LogMethod
- type LogTransaction
- type LogType
- type Network
- type NetworkTransaction
- type Order
- type Pagination
- type Search
- type Sort
- type Spec
- type SpecParam
- type Switch
- type SwitchTransaction
- type Transaction
- type User
- type UserTransaction
- type VIP
- type VIPTransaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Category ¶
func (*Category) MarshalJSON ¶
type CategoryTransaction ¶
type CategoryTransaction interface { // Categories returns a list of registered categories. Pagination limit can be 0 that means no pagination. Categories(Pagination) ([]*Category, error) AddCategory(requesterID uint64, name string) (category *Category, duplicated bool, err error) // UpdateCategory updates name of a category specified by id and then returns information of the category. It returns nil if the category does not exist. UpdateCategory(requesterID, categoryID uint64, name string) (category *Category, duplicated bool, err error) // RemoveCategory removes a category specified by id and then returns information of the category before removing. It returns nil if the category does not exist. RemoveCategory(requesterID, categoryID uint64) (*Category, error) }
type Component ¶
func (*Component) MarshalJSON ¶
type ComponentTransaction ¶
type ComponentTransaction interface { // Components returns a list of registered components. Pagination limit can be 0 that means no pagination. Components(categoryID uint64, pagination Pagination) ([]*Component, error) AddComponent(requesterID, categoryID uint64, name string) (component *Component, duplicated bool, err error) // UpdateComponent updates name of a component specified by id and then returns information of the component. It returns nil if the component does not exist. UpdateComponent(requesterID, componentID uint64, name string) (component *Component, duplicated bool, err error) // RemoveComponent removes a component specified by id and then returns information of the component before removing. It returns nil if the component does not exist. RemoveComponent(requesterID, componentID uint64) (*Component, error) }
type Database ¶
type Database interface { // Exec executes all queries of f in a single transaction. f should return the error raised from the Transaction // without any change or wrapping it for deadlock protection. Exec(f func(Transaction) error) error }
type Group ¶
type Group struct { ID uint64 `json:"id"` Name string `json:"name"` Timestamp time.Time `json:"timestamp"` }
func (*Group) MarshalJSON ¶
type GroupTransaction ¶
type GroupTransaction interface { // Groups returns a list of registered groups. Pagination limit can be 0 that means no pagination. Groups(Pagination) ([]*Group, error) AddGroup(requesterID uint64, name string) (group *Group, duplicated bool, err error) // UpdateGroup updates name of a group specified by id and then returns information of the group. It returns nil if the group does not exist. UpdateGroup(requesterID, groupID uint64, name string) (group *Group, duplicated bool, err error) // RemoveGroup removes a group specified by id and then returns information of the group before removing. It returns nil if the group does not exist. RemoveGroup(requesterID, groupID uint64) (*Group, error) }
type Host ¶
type Host struct { ID uint64 IP string // FIXME: Use a native type. Port string Group string MAC string // FIXME: Use a native type. Description string Enabled bool Stale bool Spec []*Spec Timestamp time.Time }
func (*Host) MarshalJSON ¶
type HostTransaction ¶
type HostTransaction interface { Host(id uint64) (*Host, error) // Hosts returns a list of registered hosts. Search can be nil that means no search. Pagination limit can be 0 that means no pagination. Hosts(*Search, Sort, Pagination) ([]*Host, error) AddHost(requesterID, ipID uint64, groupID *uint64, mac net.HardwareAddr, desc string, spec []SpecParam) (host *Host, duplicated bool, err error) // UpdateHost updates a host specified by id and then returns information of the host. The parameters used for update can be nil that means no update about the parameters. UpdateHost(requesterID, hostID uint64, ipID, groupID *uint64, mac net.HardwareAddr, description *string, spec []SpecParam) (host *Host, duplicated bool, err error) // ActivateHost enables a host specified by id and then returns information of the host. It returns nil if the host does not exist. ActivateHost(requesterID, hostID uint64) (*Host, error) // DeactivateHost disables a host specified by id and then returns information of the host. It returns nil if the host does not exist. DeactivateHost(requesterID, hostID uint64) (*Host, error) CountVIPByHostID(id uint64) (count uint64, err error) // RemoveHost removes a host specified by id and then returns information of the host before removing. It returns nil if the host does not exist. RemoveHost(requesterID, hostID uint64) (*Host, error) }
type IPTransaction ¶
type Log ¶
type Log struct { ID uint64 User string Type LogType Method LogMethod Data string Timestamp time.Time }
func (*Log) MarshalJSON ¶
type LogTransaction ¶
type LogTransaction interface { // Logs returns a list of registered logs. Search can be nil that means no search. QueryLog(*Search, Pagination) ([]*Log, error) }
type NetworkTransaction ¶
type NetworkTransaction interface { // Networks returns a list of registered networks. Address can be nil that means no address search. Pagination limit can be 0 that means no pagination. Networks(address *string, pagination Pagination) ([]*Network, error) AddNetwork(requesterID uint64, addr net.IP, mask net.IPMask, gateway net.IP) (network *Network, duplicated bool, err error) // RemoveNetwork removes a network specified by id and then returns information of the network before removing. It returns nil if the network does not exist. RemoveNetwork(requesterID, netID uint64) (*Network, error) }
type Pagination ¶
type Switch ¶
type Switch struct { ID uint64 `json:"id"` DPID uint64 `json:"dpid"` NumPorts uint16 `json:"n_ports"` FirstPort uint16 `json:"first_port"` FirstPrintedPort uint16 `json:"first_printed_port"` Description string `json:"description"` }
func (*Switch) MarshalJSON ¶
type SwitchTransaction ¶
type SwitchTransaction interface { Switches(Pagination) ([]*Switch, error) AddSwitch(requesterID, dpid uint64, nPorts, firstPort, firstPrintedPort uint16, desc string) (sw *Switch, duplicated bool, err error) // RemoveSwitch removes a switch specified by id and then returns information of the switch before removing. It returns nil if the switch does not exist. RemoveSwitch(requesterID, swID uint64) (*Switch, error) }
type Transaction ¶
type User ¶
type User struct { ID uint64 Name string Key string // Key used in OTP Authentication. Enabled bool Admin bool Timestamp time.Time }
func (*User) MarshalJSON ¶
type UserTransaction ¶
type UserTransaction interface { User(name string) (*User, error) Users(Pagination) ([]*User, error) AddUser(requesterID uint64, name, key string) (user *User, duplicated bool, err error) // UpdateUser updates enabled and admin authorization of a user specified by id and then returns information of the user. It returns nil if the user does not exist. UpdateUser(requesterID, userID uint64, enabled, admin *bool) (*User, error) ResetOTPKey(name, key string) (ok bool, err error) }
type VIPTransaction ¶
type VIPTransaction interface { VIPs(Pagination) ([]*VIP, error) AddVIP(requesterID, ipID, activeID, standbyID uint64, desc string) (vip *VIP, duplicated bool, err error) // RemoveVIP removes a VIP specified by id and then returns information of the VIP before removing. It returns nil if the VIP does not exist. RemoveVIP(requesterID, vipID uint64) (*VIP, error) // ToggleVIP swaps active host and standby host of a VIP specified by id and then returns information of the VIP. It returns nil if the VIP does not exist. ToggleVIP(requesterID, vipID uint64) (*VIP, error) }
Click to show internal directories.
Click to hide internal directories.