mirror of
https://github.com/lorsanstand/HomeOps-Hub.git
synced 2026-06-21 17:35:16 +03:00
refactor: switch slices to map
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.36.11
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v7.34.1
|
// protoc v7.35.0
|
||||||
// source: homeops/hub.proto
|
// source: homeops/hub.proto
|
||||||
|
|
||||||
package homeops
|
package homeops
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// - protoc-gen-go-grpc v1.6.1
|
// - protoc-gen-go-grpc v1.6.1
|
||||||
// - protoc v7.34.1
|
// - protoc v7.35.0
|
||||||
// source: homeops/hub.proto
|
// source: homeops/hub.proto
|
||||||
|
|
||||||
package homeops
|
package homeops
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.36.11
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v7.34.1
|
// protoc v7.35.0
|
||||||
// source: homeops/register.proto
|
// source: homeops/register.proto
|
||||||
|
|
||||||
package homeops
|
package homeops
|
||||||
@@ -71,7 +71,7 @@ type RegisterAgentRequest struct {
|
|||||||
AgentName string `protobuf:"bytes,2,opt,name=agent_name,json=agentName,proto3" json:"agent_name,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"`
|
Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`
|
||||||
Host *HostInfo `protobuf:"bytes,4,opt,name=host,proto3" json:"host,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"`
|
Capability map[string]*Capability `protobuf:"bytes,5,rep,name=capability,proto3" json:"capability,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@@ -134,7 +134,7 @@ func (x *RegisterAgentRequest) GetHost() *HostInfo {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RegisterAgentRequest) GetCapability() []*Capability {
|
func (x *RegisterAgentRequest) GetCapability() map[string]*Capability {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Capability
|
return x.Capability
|
||||||
}
|
}
|
||||||
@@ -202,12 +202,12 @@ func (x *HostInfo) GetArch() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Capability struct {
|
type Capability struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Available bool `protobuf:"varint,1,opt,name=available,proto3" json:"available,omitempty"` // доступен ли
|
Available bool `protobuf:"varint,1,opt,name=available,proto3" json:"available,omitempty"` // доступен ли
|
||||||
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,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"` // название раздела по типу докер или управление пк
|
// string name = 3; // название раздела по типу докер или управление пк
|
||||||
Reason string `protobuf:"bytes,4,opt,name=reason,proto3" json:"reason,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"` // команды раздела
|
Command map[string]*CapabilityCommand `protobuf:"bytes,5,rep,name=command,proto3" json:"command,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` // команды раздела
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@@ -256,13 +256,6 @@ func (x *Capability) GetVersion() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Capability) GetName() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Name
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Capability) GetReason() string {
|
func (x *Capability) GetReason() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Reason
|
return x.Reason
|
||||||
@@ -270,7 +263,7 @@ func (x *Capability) GetReason() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Capability) GetCommand() []*CapabilityCommand {
|
func (x *Capability) GetCommand() map[string]*CapabilityCommand {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Command
|
return x.Command
|
||||||
}
|
}
|
||||||
@@ -278,13 +271,13 @@ func (x *Capability) GetCommand() []*CapabilityCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CapabilityCommand struct {
|
type CapabilityCommand struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // название команды
|
// string name = 1; // название команды
|
||||||
OptArgs []*CommandsArgs `protobuf:"bytes,2,rep,name=opt_args,json=optArgs,proto3" json:"opt_args,omitempty"` // опциоанльные переменные
|
OptArgs map[string]*CommandsArgs `protobuf:"bytes,2,rep,name=opt_args,json=optArgs,proto3" json:"opt_args,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` // опциоанльные переменные
|
||||||
ReqArgs []*CommandsArgs `protobuf:"bytes,3,rep,name=req_args,json=reqArgs,proto3" json:"req_args,omitempty"` // обязательные переменные
|
ReqArgs map[string]*CommandsArgs `protobuf:"bytes,3,rep,name=req_args,json=reqArgs,proto3" json:"req_args,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` // обязательные переменные
|
||||||
Version string `protobuf:"bytes,4,opt,name=version,proto3" json:"version,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"` // описание команды для документации
|
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"`
|
TypeOutput string `protobuf:"bytes,7,opt,name=type_output,json=typeOutput,proto3" json:"type_output,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@@ -319,21 +312,14 @@ func (*CapabilityCommand) Descriptor() ([]byte, []int) {
|
|||||||
return file_homeops_register_proto_rawDescGZIP(), []int{4}
|
return file_homeops_register_proto_rawDescGZIP(), []int{4}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CapabilityCommand) GetName() string {
|
func (x *CapabilityCommand) GetOptArgs() map[string]*CommandsArgs {
|
||||||
if x != nil {
|
|
||||||
return x.Name
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *CapabilityCommand) GetOptArgs() []*CommandsArgs {
|
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.OptArgs
|
return x.OptArgs
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CapabilityCommand) GetReqArgs() []*CommandsArgs {
|
func (x *CapabilityCommand) GetReqArgs() map[string]*CommandsArgs {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.ReqArgs
|
return x.ReqArgs
|
||||||
}
|
}
|
||||||
@@ -362,13 +348,13 @@ func (x *CapabilityCommand) GetTypeOutput() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CommandsArgs struct {
|
type CommandsArgs struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // название аргумента
|
// string name = 1; // название аргумента
|
||||||
Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` // какой тип path int string bool
|
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"` // описание для документации
|
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` // описание для документации
|
||||||
Default string `protobuf:"bytes,4,opt,name=default,proto3" json:"default,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
|
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"`
|
Validation *ArgValidation `protobuf:"bytes,6,opt,name=validation,proto3" json:"validation,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@@ -403,13 +389,6 @@ func (*CommandsArgs) Descriptor() ([]byte, []int) {
|
|||||||
return file_homeops_register_proto_rawDescGZIP(), []int{5}
|
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 {
|
func (x *CommandsArgs) GetType() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Type
|
return x.Type
|
||||||
@@ -571,37 +550,46 @@ const file_homeops_register_proto_rawDesc = "" +
|
|||||||
"\n" +
|
"\n" +
|
||||||
"\x16homeops/register.proto\"\"\n" +
|
"\x16homeops/register.proto\"\"\n" +
|
||||||
"\fPongResponse\x12\x12\n" +
|
"\fPongResponse\x12\x12\n" +
|
||||||
"\x04pong\x18\x01 \x01(\tR\x04pong\"\xb6\x01\n" +
|
"\x04pong\x18\x01 \x01(\tR\x04pong\"\x9c\x02\n" +
|
||||||
"\x14RegisterAgentRequest\x12\x19\n" +
|
"\x14RegisterAgentRequest\x12\x19\n" +
|
||||||
"\bagent_id\x18\x01 \x01(\tR\aagentId\x12\x1d\n" +
|
"\bagent_id\x18\x01 \x01(\tR\aagentId\x12\x1d\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"agent_name\x18\x02 \x01(\tR\tagentName\x12\x18\n" +
|
"agent_name\x18\x02 \x01(\tR\tagentName\x12\x18\n" +
|
||||||
"\aversion\x18\x03 \x01(\tR\aversion\x12\x1d\n" +
|
"\aversion\x18\x03 \x01(\tR\aversion\x12\x1d\n" +
|
||||||
"\x04host\x18\x04 \x01(\v2\t.HostInfoR\x04host\x12+\n" +
|
"\x04host\x18\x04 \x01(\v2\t.HostInfoR\x04host\x12E\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"capability\x18\x05 \x03(\v2\v.CapabilityR\n" +
|
"capability\x18\x05 \x03(\v2%.RegisterAgentRequest.CapabilityEntryR\n" +
|
||||||
"capability\"R\n" +
|
"capability\x1aJ\n" +
|
||||||
|
"\x0fCapabilityEntry\x12\x10\n" +
|
||||||
|
"\x03key\x18\x01 \x01(\tR\x03key\x12!\n" +
|
||||||
|
"\x05value\x18\x02 \x01(\v2\v.CapabilityR\x05value:\x028\x01\"R\n" +
|
||||||
"\bHostInfo\x12\x16\n" +
|
"\bHostInfo\x12\x16\n" +
|
||||||
"\x06system\x18\x01 \x01(\tR\x06system\x12\x1a\n" +
|
"\x06system\x18\x01 \x01(\tR\x06system\x12\x1a\n" +
|
||||||
"\bhostname\x18\x02 \x01(\tR\bhostname\x12\x12\n" +
|
"\bhostname\x18\x02 \x01(\tR\bhostname\x12\x12\n" +
|
||||||
"\x04arch\x18\x03 \x01(\tR\x04arch\"\x9e\x01\n" +
|
"\x04arch\x18\x03 \x01(\tR\x04arch\"\xe0\x01\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"Capability\x12\x1c\n" +
|
"Capability\x12\x1c\n" +
|
||||||
"\tavailable\x18\x01 \x01(\bR\tavailable\x12\x18\n" +
|
"\tavailable\x18\x01 \x01(\bR\tavailable\x12\x18\n" +
|
||||||
"\aversion\x18\x02 \x01(\tR\aversion\x12\x12\n" +
|
"\aversion\x18\x02 \x01(\tR\aversion\x12\x16\n" +
|
||||||
"\x04name\x18\x03 \x01(\tR\x04name\x12\x16\n" +
|
"\x06reason\x18\x04 \x01(\tR\x06reason\x122\n" +
|
||||||
"\x06reason\x18\x04 \x01(\tR\x06reason\x12,\n" +
|
"\acommand\x18\x05 \x03(\v2\x18.Capability.CommandEntryR\acommand\x1aN\n" +
|
||||||
"\acommand\x18\x05 \x03(\v2\x12.CapabilityCommandR\acommand\"\xd8\x01\n" +
|
"\fCommandEntry\x12\x10\n" +
|
||||||
"\x11CapabilityCommand\x12\x12\n" +
|
"\x03key\x18\x01 \x01(\tR\x03key\x12(\n" +
|
||||||
"\x04name\x18\x01 \x01(\tR\x04name\x12(\n" +
|
"\x05value\x18\x02 \x01(\v2\x12.CapabilityCommandR\x05value:\x028\x01\"\xfe\x02\n" +
|
||||||
"\bopt_args\x18\x02 \x03(\v2\r.CommandsArgsR\aoptArgs\x12(\n" +
|
"\x11CapabilityCommand\x12:\n" +
|
||||||
"\breq_args\x18\x03 \x03(\v2\r.CommandsArgsR\areqArgs\x12\x18\n" +
|
"\bopt_args\x18\x02 \x03(\v2\x1f.CapabilityCommand.OptArgsEntryR\aoptArgs\x12:\n" +
|
||||||
|
"\breq_args\x18\x03 \x03(\v2\x1f.CapabilityCommand.ReqArgsEntryR\areqArgs\x12\x18\n" +
|
||||||
"\aversion\x18\x04 \x01(\tR\aversion\x12 \n" +
|
"\aversion\x18\x04 \x01(\tR\aversion\x12 \n" +
|
||||||
"\vdescription\x18\x05 \x01(\tR\vdescription\x12\x1f\n" +
|
"\vdescription\x18\x05 \x01(\tR\vdescription\x12\x1f\n" +
|
||||||
"\vtype_output\x18\a \x01(\tR\n" +
|
"\vtype_output\x18\a \x01(\tR\n" +
|
||||||
"typeOutput\"\xb6\x01\n" +
|
"typeOutput\x1aI\n" +
|
||||||
|
"\fOptArgsEntry\x12\x10\n" +
|
||||||
|
"\x03key\x18\x01 \x01(\tR\x03key\x12#\n" +
|
||||||
|
"\x05value\x18\x02 \x01(\v2\r.CommandsArgsR\x05value:\x028\x01\x1aI\n" +
|
||||||
|
"\fReqArgsEntry\x12\x10\n" +
|
||||||
|
"\x03key\x18\x01 \x01(\tR\x03key\x12#\n" +
|
||||||
|
"\x05value\x18\x02 \x01(\v2\r.CommandsArgsR\x05value:\x028\x01\"\xa2\x01\n" +
|
||||||
"\fCommandsArgs\x12\x12\n" +
|
"\fCommandsArgs\x12\x12\n" +
|
||||||
"\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" +
|
|
||||||
"\x04type\x18\x02 \x01(\tR\x04type\x12 \n" +
|
"\x04type\x18\x02 \x01(\tR\x04type\x12 \n" +
|
||||||
"\vdescription\x18\x03 \x01(\tR\vdescription\x12\x18\n" +
|
"\vdescription\x18\x03 \x01(\tR\vdescription\x12\x18\n" +
|
||||||
"\adefault\x18\x04 \x01(\tR\adefault\x12\x12\n" +
|
"\adefault\x18\x04 \x01(\tR\adefault\x12\x12\n" +
|
||||||
@@ -630,7 +618,7 @@ func file_homeops_register_proto_rawDescGZIP() []byte {
|
|||||||
return file_homeops_register_proto_rawDescData
|
return file_homeops_register_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_homeops_register_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
var file_homeops_register_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
|
||||||
var file_homeops_register_proto_goTypes = []any{
|
var file_homeops_register_proto_goTypes = []any{
|
||||||
(*PongResponse)(nil), // 0: PongResponse
|
(*PongResponse)(nil), // 0: PongResponse
|
||||||
(*RegisterAgentRequest)(nil), // 1: RegisterAgentRequest
|
(*RegisterAgentRequest)(nil), // 1: RegisterAgentRequest
|
||||||
@@ -640,19 +628,27 @@ var file_homeops_register_proto_goTypes = []any{
|
|||||||
(*CommandsArgs)(nil), // 5: CommandsArgs
|
(*CommandsArgs)(nil), // 5: CommandsArgs
|
||||||
(*ArgValidation)(nil), // 6: ArgValidation
|
(*ArgValidation)(nil), // 6: ArgValidation
|
||||||
(*RegisterAgentResponse)(nil), // 7: RegisterAgentResponse
|
(*RegisterAgentResponse)(nil), // 7: RegisterAgentResponse
|
||||||
|
nil, // 8: RegisterAgentRequest.CapabilityEntry
|
||||||
|
nil, // 9: Capability.CommandEntry
|
||||||
|
nil, // 10: CapabilityCommand.OptArgsEntry
|
||||||
|
nil, // 11: CapabilityCommand.ReqArgsEntry
|
||||||
}
|
}
|
||||||
var file_homeops_register_proto_depIdxs = []int32{
|
var file_homeops_register_proto_depIdxs = []int32{
|
||||||
2, // 0: RegisterAgentRequest.host:type_name -> HostInfo
|
2, // 0: RegisterAgentRequest.host:type_name -> HostInfo
|
||||||
3, // 1: RegisterAgentRequest.capability:type_name -> Capability
|
8, // 1: RegisterAgentRequest.capability:type_name -> RegisterAgentRequest.CapabilityEntry
|
||||||
4, // 2: Capability.command:type_name -> CapabilityCommand
|
9, // 2: Capability.command:type_name -> Capability.CommandEntry
|
||||||
5, // 3: CapabilityCommand.opt_args:type_name -> CommandsArgs
|
10, // 3: CapabilityCommand.opt_args:type_name -> CapabilityCommand.OptArgsEntry
|
||||||
5, // 4: CapabilityCommand.req_args:type_name -> CommandsArgs
|
11, // 4: CapabilityCommand.req_args:type_name -> CapabilityCommand.ReqArgsEntry
|
||||||
6, // 5: CommandsArgs.validation:type_name -> ArgValidation
|
6, // 5: CommandsArgs.validation:type_name -> ArgValidation
|
||||||
6, // [6:6] is the sub-list for method output_type
|
3, // 6: RegisterAgentRequest.CapabilityEntry.value:type_name -> Capability
|
||||||
6, // [6:6] is the sub-list for method input_type
|
4, // 7: Capability.CommandEntry.value:type_name -> CapabilityCommand
|
||||||
6, // [6:6] is the sub-list for extension type_name
|
5, // 8: CapabilityCommand.OptArgsEntry.value:type_name -> CommandsArgs
|
||||||
6, // [6:6] is the sub-list for extension extendee
|
5, // 9: CapabilityCommand.ReqArgsEntry.value:type_name -> CommandsArgs
|
||||||
0, // [0:6] is the sub-list for field type_name
|
10, // [10:10] is the sub-list for method output_type
|
||||||
|
10, // [10:10] is the sub-list for method input_type
|
||||||
|
10, // [10:10] is the sub-list for extension type_name
|
||||||
|
10, // [10:10] is the sub-list for extension extendee
|
||||||
|
0, // [0:10] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_homeops_register_proto_init() }
|
func init() { file_homeops_register_proto_init() }
|
||||||
@@ -666,7 +662,7 @@ func file_homeops_register_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_homeops_register_proto_rawDesc), len(file_homeops_register_proto_rawDesc)),
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_homeops_register_proto_rawDesc), len(file_homeops_register_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 8,
|
NumMessages: 12,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.36.11
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v7.34.1
|
// protoc v7.35.0
|
||||||
// source: homeops/stream.proto
|
// source: homeops/stream.proto
|
||||||
|
|
||||||
package homeops
|
package homeops
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ message RegisterAgentRequest {
|
|||||||
string agent_name = 2;
|
string agent_name = 2;
|
||||||
string version = 3;
|
string version = 3;
|
||||||
HostInfo host = 4;
|
HostInfo host = 4;
|
||||||
repeated Capability capability = 5;
|
map<string, Capability> capability = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message HostInfo {
|
message HostInfo {
|
||||||
@@ -23,22 +23,22 @@ message HostInfo {
|
|||||||
message Capability {
|
message Capability {
|
||||||
bool available = 1; // доступен ли
|
bool available = 1; // доступен ли
|
||||||
string version = 2; // версия раздела
|
string version = 2; // версия раздела
|
||||||
string name = 3; // название раздела по типу докер или управление пк
|
// string name = 3; // название раздела по типу докер или управление пк
|
||||||
string reason = 4; // причина если раздел не доступент
|
string reason = 4; // причина если раздел не доступент
|
||||||
repeated CapabilityCommand command = 5; // команды раздела
|
map<string, CapabilityCommand> command = 5; // команды раздела
|
||||||
}
|
}
|
||||||
|
|
||||||
message CapabilityCommand {
|
message CapabilityCommand {
|
||||||
string name = 1; // название команды
|
// string name = 1; // название команды
|
||||||
repeated CommandsArgs opt_args = 2; // опциоанльные переменные
|
map<string, CommandsArgs> opt_args = 2; // опциоанльные переменные
|
||||||
repeated CommandsArgs req_args = 3; // обязательные переменные
|
map<string, CommandsArgs> req_args = 3; // обязательные переменные
|
||||||
string version = 4; // версия команды
|
string version = 4; // версия команды
|
||||||
string description = 5; // описание команды для документации
|
string description = 5; // описание команды для документации
|
||||||
string type_output = 7;
|
string type_output = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
message CommandsArgs {
|
message CommandsArgs {
|
||||||
string name = 1; // название аргумента
|
// string name = 1; // название аргумента
|
||||||
string type = 2; // какой тип path int string bool
|
string type = 2; // какой тип path int string bool
|
||||||
string description = 3; // описание для документации
|
string description = 3; // описание для документации
|
||||||
string default = 4; // значение по умолчанию
|
string default = 4; // значение по умолчанию
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ type RegisterAgentRequest struct {
|
|||||||
AgentName string
|
AgentName string
|
||||||
AgentVersion string
|
AgentVersion string
|
||||||
Host HostInfo
|
Host HostInfo
|
||||||
Capabilities []Capability
|
Capabilities map[string]Capability
|
||||||
}
|
}
|
||||||
|
|
||||||
type HostInfo struct {
|
type HostInfo struct {
|
||||||
@@ -17,22 +17,19 @@ type HostInfo struct {
|
|||||||
type Capability struct {
|
type Capability struct {
|
||||||
Available bool
|
Available bool
|
||||||
Version string
|
Version string
|
||||||
Name string
|
|
||||||
Reason string
|
Reason string
|
||||||
Command []CapabilityCommand
|
Command map[string]CapabilityCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
type CapabilityCommand struct {
|
type CapabilityCommand struct {
|
||||||
Name string
|
OptionalArgs map[string]CommandArgs
|
||||||
OptionalArgs []CommandArgs
|
RequiredArgs map[string]CommandArgs
|
||||||
RequiredArgs []CommandArgs
|
|
||||||
Version string
|
Version string
|
||||||
Description string
|
Description string
|
||||||
TypeOutput string
|
TypeOutput string
|
||||||
}
|
}
|
||||||
|
|
||||||
type CommandArgs struct {
|
type CommandArgs struct {
|
||||||
Name string
|
|
||||||
Type string
|
Type string
|
||||||
Description string
|
Description string
|
||||||
Default string
|
Default string
|
||||||
|
|||||||
@@ -36,16 +36,15 @@ func ToDomainAgentResponse(response *pb.RegisterAgentResponse) (domain.RegisterA
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ToDomainCapabilities(capabilities []*pb.Capability) []domain.Capability {
|
func ToDomainCapabilities(capabilities map[string]*pb.Capability) map[string]domain.Capability {
|
||||||
domainCaps := make([]domain.Capability, len(capabilities))
|
domainCaps := make(map[string]domain.Capability, len(capabilities))
|
||||||
|
|
||||||
for id, capability := range capabilities {
|
for name, capability := range capabilities {
|
||||||
if capability == nil {
|
if capability == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
domainCaps[id] = domain.Capability{
|
domainCaps[name] = domain.Capability{
|
||||||
Name: capability.Name,
|
|
||||||
Version: capability.Version,
|
Version: capability.Version,
|
||||||
Reason: capability.Reason,
|
Reason: capability.Reason,
|
||||||
Available: capability.Available,
|
Available: capability.Available,
|
||||||
@@ -56,16 +55,15 @@ func ToDomainCapabilities(capabilities []*pb.Capability) []domain.Capability {
|
|||||||
return domainCaps
|
return domainCaps
|
||||||
}
|
}
|
||||||
|
|
||||||
func ToDomainCapabilityCommands(commands []*pb.CapabilityCommand) []domain.CapabilityCommand {
|
func ToDomainCapabilityCommands(commands map[string]*pb.CapabilityCommand) map[string]domain.CapabilityCommand {
|
||||||
domainCommand := make([]domain.CapabilityCommand, len(commands))
|
domainCommand := make(map[string]domain.CapabilityCommand, len(commands))
|
||||||
|
|
||||||
for id, command := range commands {
|
for name, command := range commands {
|
||||||
if command == nil {
|
if command == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
domainCommand[id] = domain.CapabilityCommand{
|
domainCommand[name] = domain.CapabilityCommand{
|
||||||
Name: command.Name,
|
|
||||||
OptionalArgs: ToDomainCommandArgs(command.OptArgs),
|
OptionalArgs: ToDomainCommandArgs(command.OptArgs),
|
||||||
RequiredArgs: ToDomainCommandArgs(command.ReqArgs),
|
RequiredArgs: ToDomainCommandArgs(command.ReqArgs),
|
||||||
Version: command.Version,
|
Version: command.Version,
|
||||||
@@ -74,12 +72,11 @@ func ToDomainCapabilityCommands(commands []*pb.CapabilityCommand) []domain.Capab
|
|||||||
return domainCommand
|
return domainCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
func ToDomainCommandArgs(args []*pb.CommandsArgs) []domain.CommandArgs {
|
func ToDomainCommandArgs(args map[string]*pb.CommandsArgs) map[string]domain.CommandArgs {
|
||||||
DomainArgs := make([]domain.CommandArgs, len(args))
|
DomainArgs := make(map[string]domain.CommandArgs, len(args))
|
||||||
|
|
||||||
for id, arg := range args {
|
for name, arg := range args {
|
||||||
DomainArgs[id] = domain.CommandArgs{
|
DomainArgs[name] = domain.CommandArgs{
|
||||||
Name: arg.Name,
|
|
||||||
Type: arg.Type,
|
Type: arg.Type,
|
||||||
Default: arg.Default,
|
Default: arg.Default,
|
||||||
Description: arg.Description,
|
Description: arg.Description,
|
||||||
@@ -114,12 +111,11 @@ 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(capabilities []domain.Capability) []*pb.Capability {
|
func ToGRPCCapability(capabilities map[string]domain.Capability) map[string]*pb.Capability {
|
||||||
GRPCCapabilities := make([]*pb.Capability, len(capabilities))
|
GRPCCapabilities := make(map[string]*pb.Capability, len(capabilities))
|
||||||
|
|
||||||
for id, capability := range capabilities {
|
for name, capability := range capabilities {
|
||||||
GRPCCapabilities[id] = &pb.Capability{
|
GRPCCapabilities[name] = &pb.Capability{
|
||||||
Name: capability.Name,
|
|
||||||
Available: capability.Available,
|
Available: capability.Available,
|
||||||
Version: capability.Version,
|
Version: capability.Version,
|
||||||
Reason: capability.Reason,
|
Reason: capability.Reason,
|
||||||
@@ -129,12 +125,11 @@ func ToGRPCCapability(capabilities []domain.Capability) []*pb.Capability {
|
|||||||
return GRPCCapabilities
|
return GRPCCapabilities
|
||||||
}
|
}
|
||||||
|
|
||||||
func ToGRPCCapabilityCommands(commands []domain.CapabilityCommand) []*pb.CapabilityCommand {
|
func ToGRPCCapabilityCommands(commands map[string]domain.CapabilityCommand) map[string]*pb.CapabilityCommand {
|
||||||
GRPCCommands := make([]*pb.CapabilityCommand, len(commands))
|
GRPCCommands := make(map[string]*pb.CapabilityCommand, len(commands))
|
||||||
|
|
||||||
for id, command := range commands {
|
for name, command := range commands {
|
||||||
GRPCCommands[id] = &pb.CapabilityCommand{
|
GRPCCommands[name] = &pb.CapabilityCommand{
|
||||||
Name: command.Name,
|
|
||||||
Version: command.Version,
|
Version: command.Version,
|
||||||
OptArgs: ToGRPCCommandArgs(command.OptionalArgs),
|
OptArgs: ToGRPCCommandArgs(command.OptionalArgs),
|
||||||
ReqArgs: ToGRPCCommandArgs(command.RequiredArgs),
|
ReqArgs: ToGRPCCommandArgs(command.RequiredArgs),
|
||||||
@@ -145,12 +140,11 @@ func ToGRPCCapabilityCommands(commands []domain.CapabilityCommand) []*pb.Capabil
|
|||||||
return GRPCCommands
|
return GRPCCommands
|
||||||
}
|
}
|
||||||
|
|
||||||
func ToGRPCCommandArgs(args []domain.CommandArgs) []*pb.CommandsArgs {
|
func ToGRPCCommandArgs(args map[string]domain.CommandArgs) map[string]*pb.CommandsArgs {
|
||||||
GRPCArgs := make([]*pb.CommandsArgs, len(args))
|
GRPCArgs := make(map[string]*pb.CommandsArgs, len(args))
|
||||||
|
|
||||||
for id, arg := range args {
|
for name, arg := range args {
|
||||||
GRPCArgs[id] = &pb.CommandsArgs{
|
GRPCArgs[name] = &pb.CommandsArgs{
|
||||||
Name: arg.Name,
|
|
||||||
Type: arg.Type,
|
Type: arg.Type,
|
||||||
Default: arg.Default,
|
Default: arg.Default,
|
||||||
Description: arg.Description,
|
Description: arg.Description,
|
||||||
|
|||||||
Reference in New Issue
Block a user