mirror of
https://github.com/lorsanstand/HomeOps-Hub.git
synced 2026-06-19 14:25:16 +03:00
refactor: edit capabilities
This commit is contained in:
@@ -29,7 +29,7 @@ func (c *Connection) Hub() pb.HubClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Connection) RegisterAgent(ctx context.Context, RegisterData domain.RegisterAgentRequest) (domain.RegisterAgentResponse, error) {
|
func (c *Connection) RegisterAgent(ctx context.Context, RegisterData domain.RegisterAgentRequest) (domain.RegisterAgentResponse, error) {
|
||||||
ResponseData, err := c.Hub().RegisterAgent(ctx, new(rpc.ToGRPCAgentRequest(RegisterData)))
|
ResponseData, err := c.Hub().RegisterAgent(ctx, rpc.ToGRPCAgentRequest(RegisterData))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return domain.RegisterAgentResponse{}, fmt.Errorf("send register agent: %w", err)
|
return domain.RegisterAgentResponse{}, fmt.Errorf("send register agent: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-842
@@ -11,7 +11,6 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
|
||||||
unsafe "unsafe"
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -22,855 +21,36 @@ const (
|
|||||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
)
|
)
|
||||||
|
|
||||||
type PongResponse struct {
|
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
|
||||||
Pong string `protobuf:"bytes,1,opt,name=pong,proto3" json:"pong,omitempty"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *PongResponse) Reset() {
|
|
||||||
*x = PongResponse{}
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[0]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *PongResponse) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*PongResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *PongResponse) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[0]
|
|
||||||
if x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use PongResponse.ProtoReflect.Descriptor instead.
|
|
||||||
func (*PongResponse) Descriptor() ([]byte, []int) {
|
|
||||||
return file_homeops_hub_proto_rawDescGZIP(), []int{0}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *PongResponse) GetPong() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Pong
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type RegisterAgentRequest struct {
|
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
|
||||||
AgentId string `protobuf:"bytes,1,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"`
|
|
||||||
AgentName string `protobuf:"bytes,2,opt,name=agent_name,json=agentName,proto3" json:"agent_name,omitempty"`
|
|
||||||
Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`
|
|
||||||
Host *HostInfo `protobuf:"bytes,4,opt,name=host,proto3" json:"host,omitempty"`
|
|
||||||
Capability []*Capability `protobuf:"bytes,5,rep,name=capability,proto3" json:"capability,omitempty"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *RegisterAgentRequest) Reset() {
|
|
||||||
*x = RegisterAgentRequest{}
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[1]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *RegisterAgentRequest) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*RegisterAgentRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *RegisterAgentRequest) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[1]
|
|
||||||
if x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use RegisterAgentRequest.ProtoReflect.Descriptor instead.
|
|
||||||
func (*RegisterAgentRequest) Descriptor() ([]byte, []int) {
|
|
||||||
return file_homeops_hub_proto_rawDescGZIP(), []int{1}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *RegisterAgentRequest) GetAgentId() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.AgentId
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *RegisterAgentRequest) GetAgentName() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.AgentName
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *RegisterAgentRequest) GetVersion() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Version
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *RegisterAgentRequest) GetHost() *HostInfo {
|
|
||||||
if x != nil {
|
|
||||||
return x.Host
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *RegisterAgentRequest) GetCapability() []*Capability {
|
|
||||||
if x != nil {
|
|
||||||
return x.Capability
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type HostInfo struct {
|
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
|
||||||
System string `protobuf:"bytes,1,opt,name=system,proto3" json:"system,omitempty"`
|
|
||||||
Hostname string `protobuf:"bytes,2,opt,name=hostname,proto3" json:"hostname,omitempty"`
|
|
||||||
Arch string `protobuf:"bytes,3,opt,name=arch,proto3" json:"arch,omitempty"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *HostInfo) Reset() {
|
|
||||||
*x = HostInfo{}
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[2]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *HostInfo) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*HostInfo) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *HostInfo) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[2]
|
|
||||||
if x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use HostInfo.ProtoReflect.Descriptor instead.
|
|
||||||
func (*HostInfo) Descriptor() ([]byte, []int) {
|
|
||||||
return file_homeops_hub_proto_rawDescGZIP(), []int{2}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *HostInfo) GetSystem() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.System
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *HostInfo) GetHostname() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Hostname
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *HostInfo) GetArch() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Arch
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type Capability struct {
|
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
|
||||||
Available bool `protobuf:"varint,1,opt,name=available,proto3" json:"available,omitempty"`
|
|
||||||
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
|
|
||||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
|
||||||
Reason string `protobuf:"bytes,4,opt,name=reason,proto3" json:"reason,omitempty"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Capability) Reset() {
|
|
||||||
*x = Capability{}
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[3]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Capability) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*Capability) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *Capability) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[3]
|
|
||||||
if x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use Capability.ProtoReflect.Descriptor instead.
|
|
||||||
func (*Capability) Descriptor() ([]byte, []int) {
|
|
||||||
return file_homeops_hub_proto_rawDescGZIP(), []int{3}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Capability) GetAvailable() bool {
|
|
||||||
if x != nil {
|
|
||||||
return x.Available
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Capability) GetVersion() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Version
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Capability) GetName() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Name
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Capability) GetReason() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Reason
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type RegisterAgentResponse struct {
|
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
|
||||||
HeartbeatIntervalSecond int64 `protobuf:"varint,1,opt,name=heartbeat_interval_second,json=heartbeatIntervalSecond,proto3" json:"heartbeat_interval_second,omitempty"`
|
|
||||||
AgentId string `protobuf:"bytes,2,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *RegisterAgentResponse) Reset() {
|
|
||||||
*x = RegisterAgentResponse{}
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[4]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *RegisterAgentResponse) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*RegisterAgentResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *RegisterAgentResponse) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[4]
|
|
||||||
if x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use RegisterAgentResponse.ProtoReflect.Descriptor instead.
|
|
||||||
func (*RegisterAgentResponse) Descriptor() ([]byte, []int) {
|
|
||||||
return file_homeops_hub_proto_rawDescGZIP(), []int{4}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *RegisterAgentResponse) GetHeartbeatIntervalSecond() int64 {
|
|
||||||
if x != nil {
|
|
||||||
return x.HeartbeatIntervalSecond
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *RegisterAgentResponse) GetAgentId() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.AgentId
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type ServerCommandRequest struct {
|
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
|
||||||
RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
|
||||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
|
||||||
Args map[string]string `protobuf:"bytes,3,rep,name=args,proto3" json:"args,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
|
||||||
TimeoutSeconds int64 `protobuf:"varint,4,opt,name=timeout_seconds,json=timeoutSeconds,proto3" json:"timeout_seconds,omitempty"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *ServerCommandRequest) Reset() {
|
|
||||||
*x = ServerCommandRequest{}
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[5]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *ServerCommandRequest) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*ServerCommandRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *ServerCommandRequest) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[5]
|
|
||||||
if x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use ServerCommandRequest.ProtoReflect.Descriptor instead.
|
|
||||||
func (*ServerCommandRequest) Descriptor() ([]byte, []int) {
|
|
||||||
return file_homeops_hub_proto_rawDescGZIP(), []int{5}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *ServerCommandRequest) GetRequestId() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.RequestId
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *ServerCommandRequest) GetName() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Name
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *ServerCommandRequest) GetArgs() map[string]string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Args
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *ServerCommandRequest) GetTimeoutSeconds() int64 {
|
|
||||||
if x != nil {
|
|
||||||
return x.TimeoutSeconds
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentEvent struct {
|
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
|
||||||
AgentId string `protobuf:"bytes,1,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"`
|
|
||||||
// Types that are valid to be assigned to Event:
|
|
||||||
//
|
|
||||||
// *AgentEvent_Heartbeat
|
|
||||||
// *AgentEvent_CommandResponse
|
|
||||||
// *AgentEvent_Alert
|
|
||||||
Event isAgentEvent_Event `protobuf_oneof:"event"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *AgentEvent) Reset() {
|
|
||||||
*x = AgentEvent{}
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[6]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *AgentEvent) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*AgentEvent) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *AgentEvent) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[6]
|
|
||||||
if x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use AgentEvent.ProtoReflect.Descriptor instead.
|
|
||||||
func (*AgentEvent) Descriptor() ([]byte, []int) {
|
|
||||||
return file_homeops_hub_proto_rawDescGZIP(), []int{6}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *AgentEvent) GetAgentId() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.AgentId
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *AgentEvent) GetEvent() isAgentEvent_Event {
|
|
||||||
if x != nil {
|
|
||||||
return x.Event
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *AgentEvent) GetHeartbeat() *Heartbeat {
|
|
||||||
if x != nil {
|
|
||||||
if x, ok := x.Event.(*AgentEvent_Heartbeat); ok {
|
|
||||||
return x.Heartbeat
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *AgentEvent) GetCommandResponse() *CommandResponse {
|
|
||||||
if x != nil {
|
|
||||||
if x, ok := x.Event.(*AgentEvent_CommandResponse); ok {
|
|
||||||
return x.CommandResponse
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *AgentEvent) GetAlert() *Alert {
|
|
||||||
if x != nil {
|
|
||||||
if x, ok := x.Event.(*AgentEvent_Alert); ok {
|
|
||||||
return x.Alert
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type isAgentEvent_Event interface {
|
|
||||||
isAgentEvent_Event()
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentEvent_Heartbeat struct {
|
|
||||||
Heartbeat *Heartbeat `protobuf:"bytes,2,opt,name=heartbeat,proto3,oneof"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentEvent_CommandResponse struct {
|
|
||||||
CommandResponse *CommandResponse `protobuf:"bytes,3,opt,name=command_response,json=commandResponse,proto3,oneof"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentEvent_Alert struct {
|
|
||||||
Alert *Alert `protobuf:"bytes,4,opt,name=alert,proto3,oneof"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*AgentEvent_Heartbeat) isAgentEvent_Event() {}
|
|
||||||
|
|
||||||
func (*AgentEvent_CommandResponse) isAgentEvent_Event() {}
|
|
||||||
|
|
||||||
func (*AgentEvent_Alert) isAgentEvent_Event() {}
|
|
||||||
|
|
||||||
type Heartbeat struct {
|
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
|
||||||
Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
|
|
||||||
Metrics *SystemMetrics `protobuf:"bytes,2,opt,name=metrics,proto3" json:"metrics,omitempty"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Heartbeat) Reset() {
|
|
||||||
*x = Heartbeat{}
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[7]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Heartbeat) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*Heartbeat) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *Heartbeat) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[7]
|
|
||||||
if x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use Heartbeat.ProtoReflect.Descriptor instead.
|
|
||||||
func (*Heartbeat) Descriptor() ([]byte, []int) {
|
|
||||||
return file_homeops_hub_proto_rawDescGZIP(), []int{7}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Heartbeat) GetTimestamp() int64 {
|
|
||||||
if x != nil {
|
|
||||||
return x.Timestamp
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Heartbeat) GetMetrics() *SystemMetrics {
|
|
||||||
if x != nil {
|
|
||||||
return x.Metrics
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type SystemMetrics struct {
|
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
|
||||||
CpuUsage float32 `protobuf:"fixed32,1,opt,name=cpu_usage,json=cpuUsage,proto3" json:"cpu_usage,omitempty"`
|
|
||||||
MemoryUsage float32 `protobuf:"fixed32,2,opt,name=memory_usage,json=memoryUsage,proto3" json:"memory_usage,omitempty"`
|
|
||||||
DiskUsage float32 `protobuf:"fixed32,3,opt,name=disk_usage,json=diskUsage,proto3" json:"disk_usage,omitempty"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *SystemMetrics) Reset() {
|
|
||||||
*x = SystemMetrics{}
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[8]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *SystemMetrics) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*SystemMetrics) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *SystemMetrics) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[8]
|
|
||||||
if x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use SystemMetrics.ProtoReflect.Descriptor instead.
|
|
||||||
func (*SystemMetrics) Descriptor() ([]byte, []int) {
|
|
||||||
return file_homeops_hub_proto_rawDescGZIP(), []int{8}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *SystemMetrics) GetCpuUsage() float32 {
|
|
||||||
if x != nil {
|
|
||||||
return x.CpuUsage
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *SystemMetrics) GetMemoryUsage() float32 {
|
|
||||||
if x != nil {
|
|
||||||
return x.MemoryUsage
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *SystemMetrics) GetDiskUsage() float32 {
|
|
||||||
if x != nil {
|
|
||||||
return x.DiskUsage
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
type CommandResponse struct {
|
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
|
||||||
RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
|
||||||
Success bool `protobuf:"varint,2,opt,name=success,proto3" json:"success,omitempty"`
|
|
||||||
Output string `protobuf:"bytes,3,opt,name=output,proto3" json:"output,omitempty"`
|
|
||||||
Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"`
|
|
||||||
ExecTimeMs int64 `protobuf:"varint,5,opt,name=exec_time_ms,json=execTimeMs,proto3" json:"exec_time_ms,omitempty"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *CommandResponse) Reset() {
|
|
||||||
*x = CommandResponse{}
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[9]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *CommandResponse) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*CommandResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *CommandResponse) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[9]
|
|
||||||
if x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use CommandResponse.ProtoReflect.Descriptor instead.
|
|
||||||
func (*CommandResponse) Descriptor() ([]byte, []int) {
|
|
||||||
return file_homeops_hub_proto_rawDescGZIP(), []int{9}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *CommandResponse) GetRequestId() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.RequestId
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *CommandResponse) GetSuccess() bool {
|
|
||||||
if x != nil {
|
|
||||||
return x.Success
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *CommandResponse) GetOutput() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Output
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *CommandResponse) GetError() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Error
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *CommandResponse) GetExecTimeMs() int64 {
|
|
||||||
if x != nil {
|
|
||||||
return x.ExecTimeMs
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
type Alert struct {
|
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
|
||||||
Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
|
|
||||||
Level string `protobuf:"bytes,2,opt,name=level,proto3" json:"level,omitempty"`
|
|
||||||
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
|
|
||||||
Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Alert) Reset() {
|
|
||||||
*x = Alert{}
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[10]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Alert) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*Alert) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *Alert) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_homeops_hub_proto_msgTypes[10]
|
|
||||||
if x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use Alert.ProtoReflect.Descriptor instead.
|
|
||||||
func (*Alert) Descriptor() ([]byte, []int) {
|
|
||||||
return file_homeops_hub_proto_rawDescGZIP(), []int{10}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Alert) GetTimestamp() int64 {
|
|
||||||
if x != nil {
|
|
||||||
return x.Timestamp
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Alert) GetLevel() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Level
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Alert) GetTitle() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Title
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Alert) GetDescription() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Description
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
var File_homeops_hub_proto protoreflect.FileDescriptor
|
var File_homeops_hub_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
const file_homeops_hub_proto_rawDesc = "" +
|
const file_homeops_hub_proto_rawDesc = "" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\x11homeops/hub.proto\x1a\x1bgoogle/protobuf/empty.proto\"\"\n" +
|
"\x11homeops/hub.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x16homeops/register.proto\x1a\x14homeops/stream.proto2\xb6\x01\n" +
|
||||||
"\fPongResponse\x12\x12\n" +
|
|
||||||
"\x04pong\x18\x01 \x01(\tR\x04pong\"\xb6\x01\n" +
|
|
||||||
"\x14RegisterAgentRequest\x12\x19\n" +
|
|
||||||
"\bagent_id\x18\x01 \x01(\tR\aagentId\x12\x1d\n" +
|
|
||||||
"\n" +
|
|
||||||
"agent_name\x18\x02 \x01(\tR\tagentName\x12\x18\n" +
|
|
||||||
"\aversion\x18\x03 \x01(\tR\aversion\x12\x1d\n" +
|
|
||||||
"\x04host\x18\x04 \x01(\v2\t.HostInfoR\x04host\x12+\n" +
|
|
||||||
"\n" +
|
|
||||||
"capability\x18\x05 \x03(\v2\v.CapabilityR\n" +
|
|
||||||
"capability\"R\n" +
|
|
||||||
"\bHostInfo\x12\x16\n" +
|
|
||||||
"\x06system\x18\x01 \x01(\tR\x06system\x12\x1a\n" +
|
|
||||||
"\bhostname\x18\x02 \x01(\tR\bhostname\x12\x12\n" +
|
|
||||||
"\x04arch\x18\x03 \x01(\tR\x04arch\"p\n" +
|
|
||||||
"\n" +
|
|
||||||
"Capability\x12\x1c\n" +
|
|
||||||
"\tavailable\x18\x01 \x01(\bR\tavailable\x12\x18\n" +
|
|
||||||
"\aversion\x18\x02 \x01(\tR\aversion\x12\x12\n" +
|
|
||||||
"\x04name\x18\x03 \x01(\tR\x04name\x12\x16\n" +
|
|
||||||
"\x06reason\x18\x04 \x01(\tR\x06reason\"n\n" +
|
|
||||||
"\x15RegisterAgentResponse\x12:\n" +
|
|
||||||
"\x19heartbeat_interval_second\x18\x01 \x01(\x03R\x17heartbeatIntervalSecond\x12\x19\n" +
|
|
||||||
"\bagent_id\x18\x02 \x01(\tR\aagentId\"\xe0\x01\n" +
|
|
||||||
"\x14ServerCommandRequest\x12\x1d\n" +
|
|
||||||
"\n" +
|
|
||||||
"request_id\x18\x01 \x01(\tR\trequestId\x12\x12\n" +
|
|
||||||
"\x04name\x18\x02 \x01(\tR\x04name\x123\n" +
|
|
||||||
"\x04args\x18\x03 \x03(\v2\x1f.ServerCommandRequest.ArgsEntryR\x04args\x12'\n" +
|
|
||||||
"\x0ftimeout_seconds\x18\x04 \x01(\x03R\x0etimeoutSeconds\x1a7\n" +
|
|
||||||
"\tArgsEntry\x12\x10\n" +
|
|
||||||
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
|
||||||
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xbb\x01\n" +
|
|
||||||
"\n" +
|
|
||||||
"AgentEvent\x12\x19\n" +
|
|
||||||
"\bagent_id\x18\x01 \x01(\tR\aagentId\x12*\n" +
|
|
||||||
"\theartbeat\x18\x02 \x01(\v2\n" +
|
|
||||||
".HeartbeatH\x00R\theartbeat\x12=\n" +
|
|
||||||
"\x10command_response\x18\x03 \x01(\v2\x10.CommandResponseH\x00R\x0fcommandResponse\x12\x1e\n" +
|
|
||||||
"\x05alert\x18\x04 \x01(\v2\x06.AlertH\x00R\x05alertB\a\n" +
|
|
||||||
"\x05event\"S\n" +
|
|
||||||
"\tHeartbeat\x12\x1c\n" +
|
|
||||||
"\ttimestamp\x18\x01 \x01(\x03R\ttimestamp\x12(\n" +
|
|
||||||
"\ametrics\x18\x02 \x01(\v2\x0e.SystemMetricsR\ametrics\"n\n" +
|
|
||||||
"\rSystemMetrics\x12\x1b\n" +
|
|
||||||
"\tcpu_usage\x18\x01 \x01(\x02R\bcpuUsage\x12!\n" +
|
|
||||||
"\fmemory_usage\x18\x02 \x01(\x02R\vmemoryUsage\x12\x1d\n" +
|
|
||||||
"\n" +
|
|
||||||
"disk_usage\x18\x03 \x01(\x02R\tdiskUsage\"\x9a\x01\n" +
|
|
||||||
"\x0fCommandResponse\x12\x1d\n" +
|
|
||||||
"\n" +
|
|
||||||
"request_id\x18\x01 \x01(\tR\trequestId\x12\x18\n" +
|
|
||||||
"\asuccess\x18\x02 \x01(\bR\asuccess\x12\x16\n" +
|
|
||||||
"\x06output\x18\x03 \x01(\tR\x06output\x12\x14\n" +
|
|
||||||
"\x05error\x18\x04 \x01(\tR\x05error\x12 \n" +
|
|
||||||
"\fexec_time_ms\x18\x05 \x01(\x03R\n" +
|
|
||||||
"execTimeMs\"s\n" +
|
|
||||||
"\x05Alert\x12\x1c\n" +
|
|
||||||
"\ttimestamp\x18\x01 \x01(\x03R\ttimestamp\x12\x14\n" +
|
|
||||||
"\x05level\x18\x02 \x01(\tR\x05level\x12\x14\n" +
|
|
||||||
"\x05title\x18\x03 \x01(\tR\x05title\x12 \n" +
|
|
||||||
"\vdescription\x18\x04 \x01(\tR\vdescription2\xb6\x01\n" +
|
|
||||||
"\x03Hub\x12/\n" +
|
"\x03Hub\x12/\n" +
|
||||||
"\x04Ping\x12\x16.google.protobuf.Empty\x1a\r.PongResponse\"\x00\x12@\n" +
|
"\x04Ping\x12\x16.google.protobuf.Empty\x1a\r.PongResponse\"\x00\x12@\n" +
|
||||||
"\rRegisterAgent\x12\x15.RegisterAgentRequest\x1a\x16.RegisterAgentResponse\"\x00\x12<\n" +
|
"\rRegisterAgent\x12\x15.RegisterAgentRequest\x1a\x16.RegisterAgentResponse\"\x00\x12<\n" +
|
||||||
"\x10StreamConnection\x12\v.AgentEvent\x1a\x15.ServerCommandRequest\"\x00(\x010\x01B<Z:github.com/lorsanstand/HomeOps-Hub/api/gen/homeops;homeopsb\x06proto3"
|
"\x10StreamConnection\x12\v.AgentEvent\x1a\x15.ServerCommandRequest\"\x00(\x010\x01B<Z:github.com/lorsanstand/HomeOps-Hub/api/gen/homeops;homeopsb\x06proto3"
|
||||||
|
|
||||||
var (
|
|
||||||
file_homeops_hub_proto_rawDescOnce sync.Once
|
|
||||||
file_homeops_hub_proto_rawDescData []byte
|
|
||||||
)
|
|
||||||
|
|
||||||
func file_homeops_hub_proto_rawDescGZIP() []byte {
|
|
||||||
file_homeops_hub_proto_rawDescOnce.Do(func() {
|
|
||||||
file_homeops_hub_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_homeops_hub_proto_rawDesc), len(file_homeops_hub_proto_rawDesc)))
|
|
||||||
})
|
|
||||||
return file_homeops_hub_proto_rawDescData
|
|
||||||
}
|
|
||||||
|
|
||||||
var file_homeops_hub_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
|
|
||||||
var file_homeops_hub_proto_goTypes = []any{
|
var file_homeops_hub_proto_goTypes = []any{
|
||||||
(*PongResponse)(nil), // 0: PongResponse
|
(*emptypb.Empty)(nil), // 0: google.protobuf.Empty
|
||||||
(*RegisterAgentRequest)(nil), // 1: RegisterAgentRequest
|
(*RegisterAgentRequest)(nil), // 1: RegisterAgentRequest
|
||||||
(*HostInfo)(nil), // 2: HostInfo
|
(*AgentEvent)(nil), // 2: AgentEvent
|
||||||
(*Capability)(nil), // 3: Capability
|
(*PongResponse)(nil), // 3: PongResponse
|
||||||
(*RegisterAgentResponse)(nil), // 4: RegisterAgentResponse
|
(*RegisterAgentResponse)(nil), // 4: RegisterAgentResponse
|
||||||
(*ServerCommandRequest)(nil), // 5: ServerCommandRequest
|
(*ServerCommandRequest)(nil), // 5: ServerCommandRequest
|
||||||
(*AgentEvent)(nil), // 6: AgentEvent
|
|
||||||
(*Heartbeat)(nil), // 7: Heartbeat
|
|
||||||
(*SystemMetrics)(nil), // 8: SystemMetrics
|
|
||||||
(*CommandResponse)(nil), // 9: CommandResponse
|
|
||||||
(*Alert)(nil), // 10: Alert
|
|
||||||
nil, // 11: ServerCommandRequest.ArgsEntry
|
|
||||||
(*emptypb.Empty)(nil), // 12: google.protobuf.Empty
|
|
||||||
}
|
}
|
||||||
var file_homeops_hub_proto_depIdxs = []int32{
|
var file_homeops_hub_proto_depIdxs = []int32{
|
||||||
2, // 0: RegisterAgentRequest.host:type_name -> HostInfo
|
0, // 0: Hub.Ping:input_type -> google.protobuf.Empty
|
||||||
3, // 1: RegisterAgentRequest.capability:type_name -> Capability
|
1, // 1: Hub.RegisterAgent:input_type -> RegisterAgentRequest
|
||||||
11, // 2: ServerCommandRequest.args:type_name -> ServerCommandRequest.ArgsEntry
|
2, // 2: Hub.StreamConnection:input_type -> AgentEvent
|
||||||
7, // 3: AgentEvent.heartbeat:type_name -> Heartbeat
|
3, // 3: Hub.Ping:output_type -> PongResponse
|
||||||
9, // 4: AgentEvent.command_response:type_name -> CommandResponse
|
4, // 4: Hub.RegisterAgent:output_type -> RegisterAgentResponse
|
||||||
10, // 5: AgentEvent.alert:type_name -> Alert
|
5, // 5: Hub.StreamConnection:output_type -> ServerCommandRequest
|
||||||
8, // 6: Heartbeat.metrics:type_name -> SystemMetrics
|
3, // [3:6] is the sub-list for method output_type
|
||||||
12, // 7: Hub.Ping:input_type -> google.protobuf.Empty
|
0, // [0:3] is the sub-list for method input_type
|
||||||
1, // 8: Hub.RegisterAgent:input_type -> RegisterAgentRequest
|
0, // [0:0] is the sub-list for extension type_name
|
||||||
6, // 9: Hub.StreamConnection:input_type -> AgentEvent
|
0, // [0:0] is the sub-list for extension extendee
|
||||||
0, // 10: Hub.Ping:output_type -> PongResponse
|
0, // [0:0] is the sub-list for field type_name
|
||||||
4, // 11: Hub.RegisterAgent:output_type -> RegisterAgentResponse
|
|
||||||
5, // 12: Hub.StreamConnection:output_type -> ServerCommandRequest
|
|
||||||
10, // [10:13] is the sub-list for method output_type
|
|
||||||
7, // [7:10] is the sub-list for method input_type
|
|
||||||
7, // [7:7] is the sub-list for extension type_name
|
|
||||||
7, // [7:7] is the sub-list for extension extendee
|
|
||||||
0, // [0:7] is the sub-list for field type_name
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_homeops_hub_proto_init() }
|
func init() { file_homeops_hub_proto_init() }
|
||||||
@@ -878,24 +58,20 @@ func file_homeops_hub_proto_init() {
|
|||||||
if File_homeops_hub_proto != nil {
|
if File_homeops_hub_proto != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
file_homeops_hub_proto_msgTypes[6].OneofWrappers = []any{
|
file_homeops_register_proto_init()
|
||||||
(*AgentEvent_Heartbeat)(nil),
|
file_homeops_stream_proto_init()
|
||||||
(*AgentEvent_CommandResponse)(nil),
|
|
||||||
(*AgentEvent_Alert)(nil),
|
|
||||||
}
|
|
||||||
type x struct{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_homeops_hub_proto_rawDesc), len(file_homeops_hub_proto_rawDesc)),
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_homeops_hub_proto_rawDesc), len(file_homeops_hub_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 12,
|
NumMessages: 0,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
},
|
},
|
||||||
GoTypes: file_homeops_hub_proto_goTypes,
|
GoTypes: file_homeops_hub_proto_goTypes,
|
||||||
DependencyIndexes: file_homeops_hub_proto_depIdxs,
|
DependencyIndexes: file_homeops_hub_proto_depIdxs,
|
||||||
MessageInfos: file_homeops_hub_proto_msgTypes,
|
|
||||||
}.Build()
|
}.Build()
|
||||||
File_homeops_hub_proto = out.File
|
File_homeops_hub_proto = out.File
|
||||||
file_homeops_hub_proto_goTypes = nil
|
file_homeops_hub_proto_goTypes = nil
|
||||||
|
|||||||
@@ -0,0 +1,680 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.36.11
|
||||||
|
// protoc v7.34.1
|
||||||
|
// source: homeops/register.proto
|
||||||
|
|
||||||
|
package homeops
|
||||||
|
|
||||||
|
import (
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
type PongResponse struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Pong string `protobuf:"bytes,1,opt,name=pong,proto3" json:"pong,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PongResponse) Reset() {
|
||||||
|
*x = PongResponse{}
|
||||||
|
mi := &file_homeops_register_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PongResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*PongResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *PongResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_homeops_register_proto_msgTypes[0]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use PongResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*PongResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_homeops_register_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PongResponse) GetPong() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Pong
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type RegisterAgentRequest struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
AgentId string `protobuf:"bytes,1,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"`
|
||||||
|
AgentName string `protobuf:"bytes,2,opt,name=agent_name,json=agentName,proto3" json:"agent_name,omitempty"`
|
||||||
|
Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`
|
||||||
|
Host *HostInfo `protobuf:"bytes,4,opt,name=host,proto3" json:"host,omitempty"`
|
||||||
|
Capability []*Capability `protobuf:"bytes,5,rep,name=capability,proto3" json:"capability,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegisterAgentRequest) Reset() {
|
||||||
|
*x = RegisterAgentRequest{}
|
||||||
|
mi := &file_homeops_register_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegisterAgentRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*RegisterAgentRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *RegisterAgentRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_homeops_register_proto_msgTypes[1]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use RegisterAgentRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*RegisterAgentRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_homeops_register_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegisterAgentRequest) GetAgentId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.AgentId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegisterAgentRequest) GetAgentName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.AgentName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegisterAgentRequest) GetVersion() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Version
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegisterAgentRequest) GetHost() *HostInfo {
|
||||||
|
if x != nil {
|
||||||
|
return x.Host
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegisterAgentRequest) GetCapability() []*Capability {
|
||||||
|
if x != nil {
|
||||||
|
return x.Capability
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type HostInfo struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
System string `protobuf:"bytes,1,opt,name=system,proto3" json:"system,omitempty"`
|
||||||
|
Hostname string `protobuf:"bytes,2,opt,name=hostname,proto3" json:"hostname,omitempty"`
|
||||||
|
Arch string `protobuf:"bytes,3,opt,name=arch,proto3" json:"arch,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HostInfo) Reset() {
|
||||||
|
*x = HostInfo{}
|
||||||
|
mi := &file_homeops_register_proto_msgTypes[2]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HostInfo) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*HostInfo) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *HostInfo) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_homeops_register_proto_msgTypes[2]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use HostInfo.ProtoReflect.Descriptor instead.
|
||||||
|
func (*HostInfo) Descriptor() ([]byte, []int) {
|
||||||
|
return file_homeops_register_proto_rawDescGZIP(), []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HostInfo) GetSystem() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.System
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HostInfo) GetHostname() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Hostname
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HostInfo) GetArch() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Arch
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type Capability struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Available bool `protobuf:"varint,1,opt,name=available,proto3" json:"available,omitempty"` // доступен ли
|
||||||
|
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // версия раздела
|
||||||
|
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` // название раздела по типу докер или управление пк
|
||||||
|
Reason string `protobuf:"bytes,4,opt,name=reason,proto3" json:"reason,omitempty"` // причина если раздел не доступент
|
||||||
|
Command []*CapabilityCommand `protobuf:"bytes,5,rep,name=command,proto3" json:"command,omitempty"` // команды раздела
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Capability) Reset() {
|
||||||
|
*x = Capability{}
|
||||||
|
mi := &file_homeops_register_proto_msgTypes[3]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Capability) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Capability) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Capability) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_homeops_register_proto_msgTypes[3]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Capability.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Capability) Descriptor() ([]byte, []int) {
|
||||||
|
return file_homeops_register_proto_rawDescGZIP(), []int{3}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Capability) GetAvailable() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.Available
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Capability) GetVersion() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Version
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Capability) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Capability) GetReason() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Reason
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Capability) GetCommand() []*CapabilityCommand {
|
||||||
|
if x != nil {
|
||||||
|
return x.Command
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type CapabilityCommand struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // название команды
|
||||||
|
OptArgs []*CommandsArgs `protobuf:"bytes,2,rep,name=opt_args,json=optArgs,proto3" json:"opt_args,omitempty"` // опциоанльные переменные
|
||||||
|
ReqArgs []*CommandsArgs `protobuf:"bytes,3,rep,name=req_args,json=reqArgs,proto3" json:"req_args,omitempty"` // обязательные переменные
|
||||||
|
Version string `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` // версия команды
|
||||||
|
Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` // описание команды для документации
|
||||||
|
TypeOutput string `protobuf:"bytes,7,opt,name=type_output,json=typeOutput,proto3" json:"type_output,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CapabilityCommand) Reset() {
|
||||||
|
*x = CapabilityCommand{}
|
||||||
|
mi := &file_homeops_register_proto_msgTypes[4]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CapabilityCommand) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*CapabilityCommand) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *CapabilityCommand) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_homeops_register_proto_msgTypes[4]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use CapabilityCommand.ProtoReflect.Descriptor instead.
|
||||||
|
func (*CapabilityCommand) Descriptor() ([]byte, []int) {
|
||||||
|
return file_homeops_register_proto_rawDescGZIP(), []int{4}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CapabilityCommand) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CapabilityCommand) GetOptArgs() []*CommandsArgs {
|
||||||
|
if x != nil {
|
||||||
|
return x.OptArgs
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CapabilityCommand) GetReqArgs() []*CommandsArgs {
|
||||||
|
if x != nil {
|
||||||
|
return x.ReqArgs
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CapabilityCommand) GetVersion() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Version
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CapabilityCommand) GetDescription() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Description
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CapabilityCommand) GetTypeOutput() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.TypeOutput
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type CommandsArgs struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // название аргумента
|
||||||
|
Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` // какой тип path int string bool
|
||||||
|
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` // описание для документации
|
||||||
|
Default string `protobuf:"bytes,4,opt,name=default,proto3" json:"default,omitempty"` // значение по умолчанию
|
||||||
|
Enum []string `protobuf:"bytes,5,rep,name=enum,proto3" json:"enum,omitempty"` // enum комманд по типу run stop restart
|
||||||
|
Validation *ArgValidation `protobuf:"bytes,6,opt,name=validation,proto3" json:"validation,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CommandsArgs) Reset() {
|
||||||
|
*x = CommandsArgs{}
|
||||||
|
mi := &file_homeops_register_proto_msgTypes[5]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CommandsArgs) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*CommandsArgs) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *CommandsArgs) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_homeops_register_proto_msgTypes[5]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use CommandsArgs.ProtoReflect.Descriptor instead.
|
||||||
|
func (*CommandsArgs) Descriptor() ([]byte, []int) {
|
||||||
|
return file_homeops_register_proto_rawDescGZIP(), []int{5}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CommandsArgs) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CommandsArgs) GetType() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Type
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CommandsArgs) GetDescription() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Description
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CommandsArgs) GetDefault() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Default
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CommandsArgs) GetEnum() []string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Enum
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CommandsArgs) GetValidation() *ArgValidation {
|
||||||
|
if x != nil {
|
||||||
|
return x.Validation
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgValidation struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
MinValue int64 `protobuf:"varint,1,opt,name=min_value,json=minValue,proto3" json:"min_value,omitempty"` // для чисел
|
||||||
|
MaxValue int64 `protobuf:"varint,2,opt,name=max_value,json=maxValue,proto3" json:"max_value,omitempty"` // для чисел
|
||||||
|
Pattern string `protobuf:"bytes,3,opt,name=pattern,proto3" json:"pattern,omitempty"` // для regex строк
|
||||||
|
AllowedExts []string `protobuf:"bytes,4,rep,name=allowed_exts,json=allowedExts,proto3" json:"allowed_exts,omitempty"` // для путей и файлов по типу .zip .rar итд
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ArgValidation) Reset() {
|
||||||
|
*x = ArgValidation{}
|
||||||
|
mi := &file_homeops_register_proto_msgTypes[6]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ArgValidation) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*ArgValidation) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *ArgValidation) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_homeops_register_proto_msgTypes[6]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use ArgValidation.ProtoReflect.Descriptor instead.
|
||||||
|
func (*ArgValidation) Descriptor() ([]byte, []int) {
|
||||||
|
return file_homeops_register_proto_rawDescGZIP(), []int{6}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ArgValidation) GetMinValue() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.MinValue
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ArgValidation) GetMaxValue() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.MaxValue
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ArgValidation) GetPattern() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Pattern
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ArgValidation) GetAllowedExts() []string {
|
||||||
|
if x != nil {
|
||||||
|
return x.AllowedExts
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type RegisterAgentResponse struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
HeartbeatIntervalSecond int64 `protobuf:"varint,1,opt,name=heartbeat_interval_second,json=heartbeatIntervalSecond,proto3" json:"heartbeat_interval_second,omitempty"`
|
||||||
|
AgentId string `protobuf:"bytes,2,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegisterAgentResponse) Reset() {
|
||||||
|
*x = RegisterAgentResponse{}
|
||||||
|
mi := &file_homeops_register_proto_msgTypes[7]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegisterAgentResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*RegisterAgentResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *RegisterAgentResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_homeops_register_proto_msgTypes[7]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use RegisterAgentResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*RegisterAgentResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_homeops_register_proto_rawDescGZIP(), []int{7}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegisterAgentResponse) GetHeartbeatIntervalSecond() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.HeartbeatIntervalSecond
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegisterAgentResponse) GetAgentId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.AgentId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_homeops_register_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
const file_homeops_register_proto_rawDesc = "" +
|
||||||
|
"\n" +
|
||||||
|
"\x16homeops/register.proto\"\"\n" +
|
||||||
|
"\fPongResponse\x12\x12\n" +
|
||||||
|
"\x04pong\x18\x01 \x01(\tR\x04pong\"\xb6\x01\n" +
|
||||||
|
"\x14RegisterAgentRequest\x12\x19\n" +
|
||||||
|
"\bagent_id\x18\x01 \x01(\tR\aagentId\x12\x1d\n" +
|
||||||
|
"\n" +
|
||||||
|
"agent_name\x18\x02 \x01(\tR\tagentName\x12\x18\n" +
|
||||||
|
"\aversion\x18\x03 \x01(\tR\aversion\x12\x1d\n" +
|
||||||
|
"\x04host\x18\x04 \x01(\v2\t.HostInfoR\x04host\x12+\n" +
|
||||||
|
"\n" +
|
||||||
|
"capability\x18\x05 \x03(\v2\v.CapabilityR\n" +
|
||||||
|
"capability\"R\n" +
|
||||||
|
"\bHostInfo\x12\x16\n" +
|
||||||
|
"\x06system\x18\x01 \x01(\tR\x06system\x12\x1a\n" +
|
||||||
|
"\bhostname\x18\x02 \x01(\tR\bhostname\x12\x12\n" +
|
||||||
|
"\x04arch\x18\x03 \x01(\tR\x04arch\"\x9e\x01\n" +
|
||||||
|
"\n" +
|
||||||
|
"Capability\x12\x1c\n" +
|
||||||
|
"\tavailable\x18\x01 \x01(\bR\tavailable\x12\x18\n" +
|
||||||
|
"\aversion\x18\x02 \x01(\tR\aversion\x12\x12\n" +
|
||||||
|
"\x04name\x18\x03 \x01(\tR\x04name\x12\x16\n" +
|
||||||
|
"\x06reason\x18\x04 \x01(\tR\x06reason\x12,\n" +
|
||||||
|
"\acommand\x18\x05 \x03(\v2\x12.CapabilityCommandR\acommand\"\xd8\x01\n" +
|
||||||
|
"\x11CapabilityCommand\x12\x12\n" +
|
||||||
|
"\x04name\x18\x01 \x01(\tR\x04name\x12(\n" +
|
||||||
|
"\bopt_args\x18\x02 \x03(\v2\r.CommandsArgsR\aoptArgs\x12(\n" +
|
||||||
|
"\breq_args\x18\x03 \x03(\v2\r.CommandsArgsR\areqArgs\x12\x18\n" +
|
||||||
|
"\aversion\x18\x04 \x01(\tR\aversion\x12 \n" +
|
||||||
|
"\vdescription\x18\x05 \x01(\tR\vdescription\x12\x1f\n" +
|
||||||
|
"\vtype_output\x18\a \x01(\tR\n" +
|
||||||
|
"typeOutput\"\xb6\x01\n" +
|
||||||
|
"\fCommandsArgs\x12\x12\n" +
|
||||||
|
"\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" +
|
||||||
|
"\x04type\x18\x02 \x01(\tR\x04type\x12 \n" +
|
||||||
|
"\vdescription\x18\x03 \x01(\tR\vdescription\x12\x18\n" +
|
||||||
|
"\adefault\x18\x04 \x01(\tR\adefault\x12\x12\n" +
|
||||||
|
"\x04enum\x18\x05 \x03(\tR\x04enum\x12.\n" +
|
||||||
|
"\n" +
|
||||||
|
"validation\x18\x06 \x01(\v2\x0e.ArgValidationR\n" +
|
||||||
|
"validation\"\x86\x01\n" +
|
||||||
|
"\rArgValidation\x12\x1b\n" +
|
||||||
|
"\tmin_value\x18\x01 \x01(\x03R\bminValue\x12\x1b\n" +
|
||||||
|
"\tmax_value\x18\x02 \x01(\x03R\bmaxValue\x12\x18\n" +
|
||||||
|
"\apattern\x18\x03 \x01(\tR\apattern\x12!\n" +
|
||||||
|
"\fallowed_exts\x18\x04 \x03(\tR\vallowedExts\"n\n" +
|
||||||
|
"\x15RegisterAgentResponse\x12:\n" +
|
||||||
|
"\x19heartbeat_interval_second\x18\x01 \x01(\x03R\x17heartbeatIntervalSecond\x12\x19\n" +
|
||||||
|
"\bagent_id\x18\x02 \x01(\tR\aagentIdB<Z:github.com/lorsanstand/HomeOps-Hub/api/gen/homeops;homeopsb\x06proto3"
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_homeops_register_proto_rawDescOnce sync.Once
|
||||||
|
file_homeops_register_proto_rawDescData []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_homeops_register_proto_rawDescGZIP() []byte {
|
||||||
|
file_homeops_register_proto_rawDescOnce.Do(func() {
|
||||||
|
file_homeops_register_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_homeops_register_proto_rawDesc), len(file_homeops_register_proto_rawDesc)))
|
||||||
|
})
|
||||||
|
return file_homeops_register_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_homeops_register_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||||
|
var file_homeops_register_proto_goTypes = []any{
|
||||||
|
(*PongResponse)(nil), // 0: PongResponse
|
||||||
|
(*RegisterAgentRequest)(nil), // 1: RegisterAgentRequest
|
||||||
|
(*HostInfo)(nil), // 2: HostInfo
|
||||||
|
(*Capability)(nil), // 3: Capability
|
||||||
|
(*CapabilityCommand)(nil), // 4: CapabilityCommand
|
||||||
|
(*CommandsArgs)(nil), // 5: CommandsArgs
|
||||||
|
(*ArgValidation)(nil), // 6: ArgValidation
|
||||||
|
(*RegisterAgentResponse)(nil), // 7: RegisterAgentResponse
|
||||||
|
}
|
||||||
|
var file_homeops_register_proto_depIdxs = []int32{
|
||||||
|
2, // 0: RegisterAgentRequest.host:type_name -> HostInfo
|
||||||
|
3, // 1: RegisterAgentRequest.capability:type_name -> Capability
|
||||||
|
4, // 2: Capability.command:type_name -> CapabilityCommand
|
||||||
|
5, // 3: CapabilityCommand.opt_args:type_name -> CommandsArgs
|
||||||
|
5, // 4: CapabilityCommand.req_args:type_name -> CommandsArgs
|
||||||
|
6, // 5: CommandsArgs.validation:type_name -> ArgValidation
|
||||||
|
6, // [6:6] is the sub-list for method output_type
|
||||||
|
6, // [6:6] is the sub-list for method input_type
|
||||||
|
6, // [6:6] is the sub-list for extension type_name
|
||||||
|
6, // [6:6] is the sub-list for extension extendee
|
||||||
|
0, // [0:6] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_homeops_register_proto_init() }
|
||||||
|
func file_homeops_register_proto_init() {
|
||||||
|
if File_homeops_register_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_homeops_register_proto_rawDesc), len(file_homeops_register_proto_rawDesc)),
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 8,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_homeops_register_proto_goTypes,
|
||||||
|
DependencyIndexes: file_homeops_register_proto_depIdxs,
|
||||||
|
MessageInfos: file_homeops_register_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_homeops_register_proto = out.File
|
||||||
|
file_homeops_register_proto_goTypes = nil
|
||||||
|
file_homeops_register_proto_depIdxs = nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,560 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.36.11
|
||||||
|
// protoc v7.34.1
|
||||||
|
// source: homeops/stream.proto
|
||||||
|
|
||||||
|
package homeops
|
||||||
|
|
||||||
|
import (
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
type ServerCommandRequest struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
||||||
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
Args map[string]string `protobuf:"bytes,3,rep,name=args,proto3" json:"args,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||||
|
TimeoutSeconds int64 `protobuf:"varint,4,opt,name=timeout_seconds,json=timeoutSeconds,proto3" json:"timeout_seconds,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ServerCommandRequest) Reset() {
|
||||||
|
*x = ServerCommandRequest{}
|
||||||
|
mi := &file_homeops_stream_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ServerCommandRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*ServerCommandRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *ServerCommandRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_homeops_stream_proto_msgTypes[0]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use ServerCommandRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*ServerCommandRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_homeops_stream_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ServerCommandRequest) GetRequestId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.RequestId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ServerCommandRequest) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ServerCommandRequest) GetArgs() map[string]string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Args
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ServerCommandRequest) GetTimeoutSeconds() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.TimeoutSeconds
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentEvent struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
AgentId string `protobuf:"bytes,1,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"`
|
||||||
|
// Types that are valid to be assigned to Event:
|
||||||
|
//
|
||||||
|
// *AgentEvent_Heartbeat
|
||||||
|
// *AgentEvent_CommandResponse
|
||||||
|
// *AgentEvent_Alert
|
||||||
|
Event isAgentEvent_Event `protobuf_oneof:"event"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AgentEvent) Reset() {
|
||||||
|
*x = AgentEvent{}
|
||||||
|
mi := &file_homeops_stream_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AgentEvent) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*AgentEvent) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *AgentEvent) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_homeops_stream_proto_msgTypes[1]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use AgentEvent.ProtoReflect.Descriptor instead.
|
||||||
|
func (*AgentEvent) Descriptor() ([]byte, []int) {
|
||||||
|
return file_homeops_stream_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AgentEvent) GetAgentId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.AgentId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AgentEvent) GetEvent() isAgentEvent_Event {
|
||||||
|
if x != nil {
|
||||||
|
return x.Event
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AgentEvent) GetHeartbeat() *Heartbeat {
|
||||||
|
if x != nil {
|
||||||
|
if x, ok := x.Event.(*AgentEvent_Heartbeat); ok {
|
||||||
|
return x.Heartbeat
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AgentEvent) GetCommandResponse() *CommandResponse {
|
||||||
|
if x != nil {
|
||||||
|
if x, ok := x.Event.(*AgentEvent_CommandResponse); ok {
|
||||||
|
return x.CommandResponse
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AgentEvent) GetAlert() *Alert {
|
||||||
|
if x != nil {
|
||||||
|
if x, ok := x.Event.(*AgentEvent_Alert); ok {
|
||||||
|
return x.Alert
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type isAgentEvent_Event interface {
|
||||||
|
isAgentEvent_Event()
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentEvent_Heartbeat struct {
|
||||||
|
Heartbeat *Heartbeat `protobuf:"bytes,2,opt,name=heartbeat,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentEvent_CommandResponse struct {
|
||||||
|
CommandResponse *CommandResponse `protobuf:"bytes,3,opt,name=command_response,json=commandResponse,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentEvent_Alert struct {
|
||||||
|
Alert *Alert `protobuf:"bytes,4,opt,name=alert,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*AgentEvent_Heartbeat) isAgentEvent_Event() {}
|
||||||
|
|
||||||
|
func (*AgentEvent_CommandResponse) isAgentEvent_Event() {}
|
||||||
|
|
||||||
|
func (*AgentEvent_Alert) isAgentEvent_Event() {}
|
||||||
|
|
||||||
|
type Heartbeat struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
|
||||||
|
Metrics *SystemMetrics `protobuf:"bytes,2,opt,name=metrics,proto3" json:"metrics,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Heartbeat) Reset() {
|
||||||
|
*x = Heartbeat{}
|
||||||
|
mi := &file_homeops_stream_proto_msgTypes[2]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Heartbeat) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Heartbeat) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Heartbeat) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_homeops_stream_proto_msgTypes[2]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Heartbeat.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Heartbeat) Descriptor() ([]byte, []int) {
|
||||||
|
return file_homeops_stream_proto_rawDescGZIP(), []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Heartbeat) GetTimestamp() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Timestamp
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Heartbeat) GetMetrics() *SystemMetrics {
|
||||||
|
if x != nil {
|
||||||
|
return x.Metrics
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type SystemMetrics struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
CpuUsage float32 `protobuf:"fixed32,1,opt,name=cpu_usage,json=cpuUsage,proto3" json:"cpu_usage,omitempty"`
|
||||||
|
MemoryUsage float32 `protobuf:"fixed32,2,opt,name=memory_usage,json=memoryUsage,proto3" json:"memory_usage,omitempty"`
|
||||||
|
DiskUsage float32 `protobuf:"fixed32,3,opt,name=disk_usage,json=diskUsage,proto3" json:"disk_usage,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SystemMetrics) Reset() {
|
||||||
|
*x = SystemMetrics{}
|
||||||
|
mi := &file_homeops_stream_proto_msgTypes[3]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SystemMetrics) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*SystemMetrics) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *SystemMetrics) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_homeops_stream_proto_msgTypes[3]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use SystemMetrics.ProtoReflect.Descriptor instead.
|
||||||
|
func (*SystemMetrics) Descriptor() ([]byte, []int) {
|
||||||
|
return file_homeops_stream_proto_rawDescGZIP(), []int{3}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SystemMetrics) GetCpuUsage() float32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.CpuUsage
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SystemMetrics) GetMemoryUsage() float32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.MemoryUsage
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SystemMetrics) GetDiskUsage() float32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.DiskUsage
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type CommandResponse struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
||||||
|
Success bool `protobuf:"varint,2,opt,name=success,proto3" json:"success,omitempty"`
|
||||||
|
Output string `protobuf:"bytes,3,opt,name=output,proto3" json:"output,omitempty"`
|
||||||
|
Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"`
|
||||||
|
ExecTimeMs int64 `protobuf:"varint,5,opt,name=exec_time_ms,json=execTimeMs,proto3" json:"exec_time_ms,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CommandResponse) Reset() {
|
||||||
|
*x = CommandResponse{}
|
||||||
|
mi := &file_homeops_stream_proto_msgTypes[4]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CommandResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*CommandResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *CommandResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_homeops_stream_proto_msgTypes[4]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use CommandResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*CommandResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_homeops_stream_proto_rawDescGZIP(), []int{4}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CommandResponse) GetRequestId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.RequestId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CommandResponse) GetSuccess() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.Success
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CommandResponse) GetOutput() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Output
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CommandResponse) GetError() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Error
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CommandResponse) GetExecTimeMs() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.ExecTimeMs
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type Alert struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
|
||||||
|
Level string `protobuf:"bytes,2,opt,name=level,proto3" json:"level,omitempty"`
|
||||||
|
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
|
||||||
|
Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Alert) Reset() {
|
||||||
|
*x = Alert{}
|
||||||
|
mi := &file_homeops_stream_proto_msgTypes[5]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Alert) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Alert) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Alert) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_homeops_stream_proto_msgTypes[5]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Alert.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Alert) Descriptor() ([]byte, []int) {
|
||||||
|
return file_homeops_stream_proto_rawDescGZIP(), []int{5}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Alert) GetTimestamp() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Timestamp
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Alert) GetLevel() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Level
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Alert) GetTitle() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Title
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Alert) GetDescription() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Description
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_homeops_stream_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
const file_homeops_stream_proto_rawDesc = "" +
|
||||||
|
"\n" +
|
||||||
|
"\x14homeops/stream.proto\"\xe0\x01\n" +
|
||||||
|
"\x14ServerCommandRequest\x12\x1d\n" +
|
||||||
|
"\n" +
|
||||||
|
"request_id\x18\x01 \x01(\tR\trequestId\x12\x12\n" +
|
||||||
|
"\x04name\x18\x02 \x01(\tR\x04name\x123\n" +
|
||||||
|
"\x04args\x18\x03 \x03(\v2\x1f.ServerCommandRequest.ArgsEntryR\x04args\x12'\n" +
|
||||||
|
"\x0ftimeout_seconds\x18\x04 \x01(\x03R\x0etimeoutSeconds\x1a7\n" +
|
||||||
|
"\tArgsEntry\x12\x10\n" +
|
||||||
|
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
||||||
|
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xbb\x01\n" +
|
||||||
|
"\n" +
|
||||||
|
"AgentEvent\x12\x19\n" +
|
||||||
|
"\bagent_id\x18\x01 \x01(\tR\aagentId\x12*\n" +
|
||||||
|
"\theartbeat\x18\x02 \x01(\v2\n" +
|
||||||
|
".HeartbeatH\x00R\theartbeat\x12=\n" +
|
||||||
|
"\x10command_response\x18\x03 \x01(\v2\x10.CommandResponseH\x00R\x0fcommandResponse\x12\x1e\n" +
|
||||||
|
"\x05alert\x18\x04 \x01(\v2\x06.AlertH\x00R\x05alertB\a\n" +
|
||||||
|
"\x05event\"S\n" +
|
||||||
|
"\tHeartbeat\x12\x1c\n" +
|
||||||
|
"\ttimestamp\x18\x01 \x01(\x03R\ttimestamp\x12(\n" +
|
||||||
|
"\ametrics\x18\x02 \x01(\v2\x0e.SystemMetricsR\ametrics\"n\n" +
|
||||||
|
"\rSystemMetrics\x12\x1b\n" +
|
||||||
|
"\tcpu_usage\x18\x01 \x01(\x02R\bcpuUsage\x12!\n" +
|
||||||
|
"\fmemory_usage\x18\x02 \x01(\x02R\vmemoryUsage\x12\x1d\n" +
|
||||||
|
"\n" +
|
||||||
|
"disk_usage\x18\x03 \x01(\x02R\tdiskUsage\"\x9a\x01\n" +
|
||||||
|
"\x0fCommandResponse\x12\x1d\n" +
|
||||||
|
"\n" +
|
||||||
|
"request_id\x18\x01 \x01(\tR\trequestId\x12\x18\n" +
|
||||||
|
"\asuccess\x18\x02 \x01(\bR\asuccess\x12\x16\n" +
|
||||||
|
"\x06output\x18\x03 \x01(\tR\x06output\x12\x14\n" +
|
||||||
|
"\x05error\x18\x04 \x01(\tR\x05error\x12 \n" +
|
||||||
|
"\fexec_time_ms\x18\x05 \x01(\x03R\n" +
|
||||||
|
"execTimeMs\"s\n" +
|
||||||
|
"\x05Alert\x12\x1c\n" +
|
||||||
|
"\ttimestamp\x18\x01 \x01(\x03R\ttimestamp\x12\x14\n" +
|
||||||
|
"\x05level\x18\x02 \x01(\tR\x05level\x12\x14\n" +
|
||||||
|
"\x05title\x18\x03 \x01(\tR\x05title\x12 \n" +
|
||||||
|
"\vdescription\x18\x04 \x01(\tR\vdescriptionB<Z:github.com/lorsanstand/HomeOps-Hub/api/gen/homeops;homeopsb\x06proto3"
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_homeops_stream_proto_rawDescOnce sync.Once
|
||||||
|
file_homeops_stream_proto_rawDescData []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_homeops_stream_proto_rawDescGZIP() []byte {
|
||||||
|
file_homeops_stream_proto_rawDescOnce.Do(func() {
|
||||||
|
file_homeops_stream_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_homeops_stream_proto_rawDesc), len(file_homeops_stream_proto_rawDesc)))
|
||||||
|
})
|
||||||
|
return file_homeops_stream_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_homeops_stream_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
|
||||||
|
var file_homeops_stream_proto_goTypes = []any{
|
||||||
|
(*ServerCommandRequest)(nil), // 0: ServerCommandRequest
|
||||||
|
(*AgentEvent)(nil), // 1: AgentEvent
|
||||||
|
(*Heartbeat)(nil), // 2: Heartbeat
|
||||||
|
(*SystemMetrics)(nil), // 3: SystemMetrics
|
||||||
|
(*CommandResponse)(nil), // 4: CommandResponse
|
||||||
|
(*Alert)(nil), // 5: Alert
|
||||||
|
nil, // 6: ServerCommandRequest.ArgsEntry
|
||||||
|
}
|
||||||
|
var file_homeops_stream_proto_depIdxs = []int32{
|
||||||
|
6, // 0: ServerCommandRequest.args:type_name -> ServerCommandRequest.ArgsEntry
|
||||||
|
2, // 1: AgentEvent.heartbeat:type_name -> Heartbeat
|
||||||
|
4, // 2: AgentEvent.command_response:type_name -> CommandResponse
|
||||||
|
5, // 3: AgentEvent.alert:type_name -> Alert
|
||||||
|
3, // 4: Heartbeat.metrics:type_name -> SystemMetrics
|
||||||
|
5, // [5:5] is the sub-list for method output_type
|
||||||
|
5, // [5:5] is the sub-list for method input_type
|
||||||
|
5, // [5:5] is the sub-list for extension type_name
|
||||||
|
5, // [5:5] is the sub-list for extension extendee
|
||||||
|
0, // [0:5] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_homeops_stream_proto_init() }
|
||||||
|
func file_homeops_stream_proto_init() {
|
||||||
|
if File_homeops_stream_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
file_homeops_stream_proto_msgTypes[1].OneofWrappers = []any{
|
||||||
|
(*AgentEvent_Heartbeat)(nil),
|
||||||
|
(*AgentEvent_CommandResponse)(nil),
|
||||||
|
(*AgentEvent_Alert)(nil),
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_homeops_stream_proto_rawDesc), len(file_homeops_stream_proto_rawDesc)),
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 7,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_homeops_stream_proto_goTypes,
|
||||||
|
DependencyIndexes: file_homeops_stream_proto_depIdxs,
|
||||||
|
MessageInfos: file_homeops_stream_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_homeops_stream_proto = out.File
|
||||||
|
file_homeops_stream_proto_goTypes = nil
|
||||||
|
file_homeops_stream_proto_depIdxs = nil
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
import "google/protobuf/empty.proto";
|
import "google/protobuf/empty.proto";
|
||||||
import "api/proto/homeops/register.proto";
|
import "homeops/register.proto";
|
||||||
import "api/proto/homeops/stream.proto";
|
import "homeops/stream.proto";
|
||||||
|
|
||||||
option go_package = "github.com/lorsanstand/HomeOps-Hub/api/gen/homeops;homeops";
|
option go_package = "github.com/lorsanstand/HomeOps-Hub/api/gen/homeops;homeops";
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
|
option go_package = "github.com/lorsanstand/HomeOps-Hub/api/gen/homeops;homeops";
|
||||||
|
|
||||||
message PongResponse {
|
message PongResponse {
|
||||||
string pong = 1;
|
string pong = 1;
|
||||||
}
|
}
|
||||||
@@ -32,6 +34,7 @@ message CapabilityCommand {
|
|||||||
repeated CommandsArgs req_args = 3; // обязательные переменные
|
repeated CommandsArgs req_args = 3; // обязательные переменные
|
||||||
string version = 4; // версия команды
|
string version = 4; // версия команды
|
||||||
string description = 5; // описание команды для документации
|
string description = 5; // описание команды для документации
|
||||||
|
string type_output = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
message CommandsArgs {
|
message CommandsArgs {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
|
option go_package = "github.com/lorsanstand/HomeOps-Hub/api/gen/homeops;homeops";
|
||||||
|
|
||||||
message ServerCommandRequest {
|
message ServerCommandRequest {
|
||||||
string request_id = 1;
|
string request_id = 1;
|
||||||
string name = 2;
|
string name = 2;
|
||||||
|
|||||||
@@ -39,38 +39,3 @@ func TestConfig_GetLogLevel(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConfig_GetURLPostgres(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
cfg Config
|
|
||||||
wantURLPostgres string
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "success",
|
|
||||||
cfg: Config{
|
|
||||||
DBHost: "TestHost",
|
|
||||||
DBName: "TestName",
|
|
||||||
DBPassword: "TestPassword",
|
|
||||||
DBPort: 1234,
|
|
||||||
DBUser: "TestUser",
|
|
||||||
},
|
|
||||||
wantURLPostgres: "postgres://TestUser:TestPassword@TestHost:1234/TestName?sslmode=disable",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tt := range tests {
|
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
|
|
||||||
url := tt.cfg.GetURLPostgres()
|
|
||||||
|
|
||||||
if url != tt.wantURLPostgres {
|
|
||||||
t.Fatalf("expected %v, got: %v", tt.wantURLPostgres, url)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -19,6 +19,32 @@ type Capability struct {
|
|||||||
Version string
|
Version string
|
||||||
Name string
|
Name string
|
||||||
Reason string
|
Reason string
|
||||||
|
Command []CapabilityCommand
|
||||||
|
}
|
||||||
|
|
||||||
|
type CapabilityCommand struct {
|
||||||
|
Name string
|
||||||
|
OptionalArgs []CommandArgs
|
||||||
|
RequiredArgs []CommandArgs
|
||||||
|
Version string
|
||||||
|
Description string
|
||||||
|
TypeOutput string
|
||||||
|
}
|
||||||
|
|
||||||
|
type CommandArgs struct {
|
||||||
|
Name string
|
||||||
|
Type string
|
||||||
|
Description string
|
||||||
|
Default string
|
||||||
|
Enum []string
|
||||||
|
Validation ArgValidation
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgValidation struct {
|
||||||
|
MinValue int
|
||||||
|
MaxValue int
|
||||||
|
Pattern string
|
||||||
|
AllowedExts []string
|
||||||
}
|
}
|
||||||
|
|
||||||
type RegisterAgentResponse struct {
|
type RegisterAgentResponse struct {
|
||||||
|
|||||||
+104
-23
@@ -36,27 +36,68 @@ func ToDomainAgentResponse(response *pb.RegisterAgentResponse) (domain.RegisterA
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ToDomainCapabilities(capability []*pb.Capability) []domain.Capability {
|
func ToDomainCapabilities(capabilities []*pb.Capability) []domain.Capability {
|
||||||
var caps []domain.Capability
|
domainCaps := make([]domain.Capability, len(capabilities))
|
||||||
|
|
||||||
for _, capa := range capability {
|
for id, capability := range capabilities {
|
||||||
if capa == nil {
|
if capability == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
caps = append(caps, domain.Capability{
|
domainCaps[id] = domain.Capability{
|
||||||
Name: capa.Name,
|
Name: capability.Name,
|
||||||
Version: capa.Version,
|
Version: capability.Version,
|
||||||
Reason: capa.Reason,
|
Reason: capability.Reason,
|
||||||
Available: capa.Available,
|
Available: capability.Available,
|
||||||
})
|
Command: ToDomainCapabilityCommands(capability.Command),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return caps
|
return domainCaps
|
||||||
}
|
}
|
||||||
|
|
||||||
func ToGRPCAgentRequest(request domain.RegisterAgentRequest) pb.RegisterAgentRequest {
|
func ToDomainCapabilityCommands(commands []*pb.CapabilityCommand) []domain.CapabilityCommand {
|
||||||
return pb.RegisterAgentRequest{
|
domainCommand := make([]domain.CapabilityCommand, len(commands))
|
||||||
|
|
||||||
|
for id, command := range commands {
|
||||||
|
if command == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
domainCommand[id] = domain.CapabilityCommand{
|
||||||
|
Name: command.Name,
|
||||||
|
OptionalArgs: ToDomainCommandArgs(command.OptArgs),
|
||||||
|
RequiredArgs: ToDomainCommandArgs(command.ReqArgs),
|
||||||
|
Version: command.Version,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return domainCommand
|
||||||
|
}
|
||||||
|
|
||||||
|
func ToDomainCommandArgs(args []*pb.CommandsArgs) []domain.CommandArgs {
|
||||||
|
DomainArgs := make([]domain.CommandArgs, len(args))
|
||||||
|
|
||||||
|
for id, arg := range args {
|
||||||
|
DomainArgs[id] = domain.CommandArgs{
|
||||||
|
Name: arg.Name,
|
||||||
|
Type: arg.Type,
|
||||||
|
Default: arg.Default,
|
||||||
|
Description: arg.Description,
|
||||||
|
Enum: arg.Enum,
|
||||||
|
Validation: domain.ArgValidation{
|
||||||
|
AllowedExts: arg.Validation.AllowedExts,
|
||||||
|
MaxValue: int(arg.Validation.MaxValue),
|
||||||
|
MinValue: int(arg.Validation.MinValue),
|
||||||
|
Pattern: arg.Validation.Pattern,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return DomainArgs
|
||||||
|
}
|
||||||
|
|
||||||
|
func ToGRPCAgentRequest(request domain.RegisterAgentRequest) *pb.RegisterAgentRequest {
|
||||||
|
return &pb.RegisterAgentRequest{
|
||||||
AgentId: request.AgentID,
|
AgentId: request.AgentID,
|
||||||
AgentName: request.AgentName,
|
AgentName: request.AgentName,
|
||||||
Host: &pb.HostInfo{
|
Host: &pb.HostInfo{
|
||||||
@@ -73,15 +114,55 @@ func ToGRPCAgentResponse(response domain.RegisterAgentResponse) *pb.RegisterAgen
|
|||||||
return &pb.RegisterAgentResponse{AgentId: response.AgentID, HeartbeatIntervalSecond: int64(response.Heartbeat)}
|
return &pb.RegisterAgentResponse{AgentId: response.AgentID, HeartbeatIntervalSecond: int64(response.Heartbeat)}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ToGRPCCapability(caps []domain.Capability) []*pb.Capability {
|
func ToGRPCCapability(capabilities []domain.Capability) []*pb.Capability {
|
||||||
var capability []*pb.Capability
|
GRPCCapabilities := make([]*pb.Capability, len(capabilities))
|
||||||
for _, capi := range caps {
|
|
||||||
capability = append(capability, &pb.Capability{
|
for id, capability := range capabilities {
|
||||||
Name: capi.Name,
|
GRPCCapabilities[id] = &pb.Capability{
|
||||||
Available: capi.Available,
|
Name: capability.Name,
|
||||||
Version: capi.Version,
|
Available: capability.Available,
|
||||||
Reason: capi.Reason,
|
Version: capability.Version,
|
||||||
})
|
Reason: capability.Reason,
|
||||||
|
Command: ToGRPCCapabilityCommands(capability.Command),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return capability
|
return GRPCCapabilities
|
||||||
|
}
|
||||||
|
|
||||||
|
func ToGRPCCapabilityCommands(commands []domain.CapabilityCommand) []*pb.CapabilityCommand {
|
||||||
|
GRPCCommands := make([]*pb.CapabilityCommand, len(commands))
|
||||||
|
|
||||||
|
for id, command := range commands {
|
||||||
|
GRPCCommands[id] = &pb.CapabilityCommand{
|
||||||
|
Name: command.Name,
|
||||||
|
Version: command.Version,
|
||||||
|
OptArgs: ToGRPCCommandArgs(command.OptionalArgs),
|
||||||
|
ReqArgs: ToGRPCCommandArgs(command.RequiredArgs),
|
||||||
|
TypeOutput: command.TypeOutput,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GRPCCommands
|
||||||
|
}
|
||||||
|
|
||||||
|
func ToGRPCCommandArgs(args []domain.CommandArgs) []*pb.CommandsArgs {
|
||||||
|
GRPCArgs := make([]*pb.CommandsArgs, len(args))
|
||||||
|
|
||||||
|
for id, arg := range args {
|
||||||
|
GRPCArgs[id] = &pb.CommandsArgs{
|
||||||
|
Name: arg.Name,
|
||||||
|
Type: arg.Type,
|
||||||
|
Default: arg.Default,
|
||||||
|
Description: arg.Description,
|
||||||
|
Enum: arg.Enum,
|
||||||
|
Validation: &pb.ArgValidation{
|
||||||
|
AllowedExts: arg.Validation.AllowedExts,
|
||||||
|
MaxValue: int64(arg.Validation.MaxValue),
|
||||||
|
MinValue: int64(arg.Validation.MinValue),
|
||||||
|
Pattern: arg.Validation.Pattern,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GRPCArgs
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user