Documentation
¶
Index ¶
- Constants
- Variables
- type AppControl
- type AppStatus
- type ControlRsp
- type EventReq
- type EventRsp
- type RadarClient
- func (rc *RadarClient) Connect() error
- func (rc *RadarClient) Connected() bool
- func (rc *RadarClient) Disconnect()
- func (rc *RadarClient) GetAppControl(args []ReqArgs) ([]ControlRsp, error)
- func (rc *RadarClient) GetAppStatus(args []ReqArgs) ([]StatusRsp, error)
- func (rc *RadarClient) SetAppControl(operation, domainMoid, resourceMoid, groupMoid, serverMoid, serverName string) (bool, error)
- func (rc *RadarClient) Version() string
- func (rc *RadarClient) WatchAppStatus(args ReqArgs, cb func(rpl EventRsp, err error)) error
- type ReqArgs
- type RspComm
- type StatusRsp
Constants ¶
const ( VERSION = "(moooofly)" DATE = "20200223" )
Variables ¶
var ( // ErrRadarServerLost shows the connection lost err ErrRadarServerLost = errors.New("radar server lost") // ErrRadarClientStopped shows the client has been stopped ErrRadarClientStopped = errors.New("radar client stopped") )
Functions ¶
This section is empty.
Types ¶
type AppControl ¶
type AppControl uint8
AppControl represent the state of an app whether is enabled
const ( // AppDisabled shows the app is disabled AppDisabled AppControl = 0 // AppEnabled shows the app is enabled AppEnabled AppControl = 1 )
func (AppControl) String ¶
func (s AppControl) String() string
String return the string of app status
type ControlRsp ¶
type ControlRsp struct {
RspComm
Control AppControl
}
ControlRsp is used by GetAppControl()
type EventReq ¶
type EventReq uint8
EventReq is the event which happened
const ( // AppStatusEventCreated shows the app has been registered in radar server AppStatusEventCreated EventReq = 1 // AppStatusEventDeleted shows the app has been de-registered in radar server AppStatusEventDeleted EventReq = 2 // AppStatusEventChanged shows the app status has been changed AppStatusEventChanged EventReq = 3 )
type EventRsp ¶
type EventRsp struct {
// contains filtered or unexported fields
}
EventRsp is returned by radar watch API, which will be passed into callback
type RadarClient ¶
RadarClient represent a radar client
func NewRadarClient ¶
func NewRadarClient(ip, port string, logger *logrus.Logger) *RadarClient
NewRadarClient returns a instance of radar client
func (*RadarClient) Connect ¶
func (rc *RadarClient) Connect() error
Connect tries to connect with radar server This API will not return until the REAL connection has been established
func (*RadarClient) Connected ¶
func (rc *RadarClient) Connected() bool
Connected returns the current connection state
func (*RadarClient) Disconnect ¶
func (rc *RadarClient) Disconnect()
Disconnect the client, together will connection will radar server
func (*RadarClient) GetAppControl ¶
func (rc *RadarClient) GetAppControl(args []ReqArgs) ([]ControlRsp, error)
GetAppControl returns the app control state
func (*RadarClient) GetAppStatus ¶
func (rc *RadarClient) GetAppStatus(args []ReqArgs) ([]StatusRsp, error)
GetAppStatus returns the app status
func (*RadarClient) SetAppControl ¶
func (rc *RadarClient) SetAppControl(operation, domainMoid, resourceMoid, groupMoid, serverMoid, serverName string) (bool, error)
NOTE: resourceMoid is equal to machineRoomMoid SetAppControl
func (*RadarClient) Version ¶
func (rc *RadarClient) Version() string
Version returns the current radar client version
func (*RadarClient) WatchAppStatus ¶
func (rc *RadarClient) WatchAppStatus(args ReqArgs, cb func(rpl EventRsp, err error)) error
WatchAppStatus watches the specific app status