JCC-CSScheduler/common/pkgs/mq/collector/slw.go

62 lines
1.6 KiB
Go

package collector
import (
"gitlink.org.cn/cloudream/common/pkgs/mq"
uopsdk "gitlink.org.cn/cloudream/common/sdks/unifyops"
)
type SlwService interface {
GetSlwNodeInfo(msg *GetSlwNodeInfo) (*GetSlwNodeInfoResp, *mq.CodeMessage)
GetAllSlwNodeInfo(msg *GetAllSlwNodeInfo) (*GetAllSlwNodeInfoResp, *mq.CodeMessage)
}
// 获取单个节点的信息
var _ = Register(Service.GetSlwNodeInfo)
type GetSlwNodeInfo struct {
mq.MessageBodyBase
UOPSlwNodeID uopsdk.SlwNodeID `json:"uopSlwNodeID"`
}
type GetSlwNodeInfoResp struct {
mq.MessageBodyBase
uopsdk.SlwNode
}
func NewGetSlwNodeInfo(uopSlwNodeID uopsdk.SlwNodeID) *GetSlwNodeInfo {
return &GetSlwNodeInfo{
UOPSlwNodeID: uopSlwNodeID,
}
}
func NewGetSlwNodeInfoResp(node uopsdk.SlwNode) *GetSlwNodeInfoResp {
return &GetSlwNodeInfoResp{
SlwNode: node,
}
}
func (c *Client) GetSlwNodeInfo(msg *GetSlwNodeInfo, opts ...mq.RequestOption) (*GetSlwNodeInfoResp, error) {
return mq.Request(Service.GetSlwNodeInfo, c.rabbitCli, msg, opts...)
}
// 获取所有节点信息
var _ = Register(Service.GetAllSlwNodeInfo)
type GetAllSlwNodeInfo struct {
mq.MessageBodyBase
}
type GetAllSlwNodeInfoResp struct {
mq.MessageBodyBase
Nodes []uopsdk.SlwNode `json:"nodes"`
}
func NewGetAllSlwNodeInfo() *GetAllSlwNodeInfo {
return &GetAllSlwNodeInfo{}
}
func NewGetAllSlwNodeInfoResp(nodes []uopsdk.SlwNode) *GetAllSlwNodeInfoResp {
return &GetAllSlwNodeInfoResp{
Nodes: nodes,
}
}
func (c *Client) GetAllSlwNodeInfo(msg *GetAllSlwNodeInfo, opts ...mq.RequestOption) (*GetAllSlwNodeInfoResp, error) {
return mq.Request(Service.GetAllSlwNodeInfo, c.rabbitCli, msg, opts...)
}