From 8b054816fff842ab84ebc5c9ebd4da70992e9637 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 12 May 2019 18:31:57 +0000 Subject: [PATCH] add 'network' and 'vm' to protobuf definition Signed-off-by: Jeff Carr --- Makefile | 3 +- events.pb.go | 221 +++++++++++++++++++++++++++++++++++++++++++-------- events.proto | 26 ++++-- 3 files changed, 209 insertions(+), 41 deletions(-) diff --git a/Makefile b/Makefile index 88698aa..287ab9b 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ all: # You must use the current protoc-gen-go # # apt remove golang-goprotobuf-dev + # apt install protobuf-compiler # # Then: # go get -u github.com/golang/protobuf/protoc-gen-go @@ -9,7 +10,7 @@ all: # go install # # Then: - # make events.pb.go + make events.pb.go events.pb.go: events.proto # protoc --version 3.6++ does not mean that protoc will generate version3 .go files diff --git a/events.pb.go b/events.pb.go index e68e886..53a598e 100644 --- a/events.pb.go +++ b/events.pb.go @@ -60,11 +60,12 @@ func (Event_EventType) EnumDescriptor() ([]byte, []int) { type Event struct { Type Event_EventType `protobuf:"varint,1,opt,name=type,proto3,enum=witProtobuf.Event_EventType" json:"type,omitempty"` Id int32 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` - Results []*Event_Response `protobuf:"bytes,3,rep,name=results,proto3" json:"results,omitempty"` - Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - Comment string `protobuf:"bytes,5,opt,name=comment,proto3" json:"comment,omitempty"` - Email string `protobuf:"bytes,6,opt,name=email,proto3" json:"email,omitempty"` - Reps []int64 `protobuf:"varint,7,rep,packed,name=reps,proto3" json:"reps,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Comment string `protobuf:"bytes,4,opt,name=comment,proto3" json:"comment,omitempty"` + Email string `protobuf:"bytes,5,opt,name=email,proto3" json:"email,omitempty"` + Results []*Event_Response `protobuf:"bytes,6,rep,name=results,proto3" json:"results,omitempty"` + Networks []*Event_Network `protobuf:"bytes,7,rep,name=networks,proto3" json:"networks,omitempty"` + Vms []*Event_VM `protobuf:"bytes,8,rep,name=vms,proto3" json:"vms,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -109,13 +110,6 @@ func (m *Event) GetId() int32 { return 0 } -func (m *Event) GetResults() []*Event_Response { - if m != nil { - return m.Results - } - return nil -} - func (m *Event) GetName() string { if m != nil { return m.Name @@ -137,9 +131,23 @@ func (m *Event) GetEmail() string { return "" } -func (m *Event) GetReps() []int64 { +func (m *Event) GetResults() []*Event_Response { if m != nil { - return m.Reps + return m.Results + } + return nil +} + +func (m *Event) GetNetworks() []*Event_Network { + if m != nil { + return m.Networks + } + return nil +} + +func (m *Event) GetVms() []*Event_VM { + if m != nil { + return m.Vms } return nil } @@ -215,34 +223,177 @@ func (m *Event_Response) GetSnippets() []string { return nil } +type Event_Network struct { + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + TotalCpu int64 `protobuf:"varint,3,opt,name=total_cpu,json=totalCpu,proto3" json:"total_cpu,omitempty"` + TotalMem int64 `protobuf:"varint,4,opt,name=total_mem,json=totalMem,proto3" json:"total_mem,omitempty"` + LoginUrl string `protobuf:"bytes,5,opt,name=login_url,json=loginUrl,proto3" json:"login_url,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Event_Network) Reset() { *m = Event_Network{} } +func (m *Event_Network) String() string { return proto.CompactTextString(m) } +func (*Event_Network) ProtoMessage() {} +func (*Event_Network) Descriptor() ([]byte, []int) { + return fileDescriptor_8f22242cb04491f9, []int{0, 1} +} + +func (m *Event_Network) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Event_Network.Unmarshal(m, b) +} +func (m *Event_Network) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Event_Network.Marshal(b, m, deterministic) +} +func (m *Event_Network) XXX_Merge(src proto.Message) { + xxx_messageInfo_Event_Network.Merge(m, src) +} +func (m *Event_Network) XXX_Size() int { + return xxx_messageInfo_Event_Network.Size(m) +} +func (m *Event_Network) XXX_DiscardUnknown() { + xxx_messageInfo_Event_Network.DiscardUnknown(m) +} + +var xxx_messageInfo_Event_Network proto.InternalMessageInfo + +func (m *Event_Network) GetId() int32 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *Event_Network) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Event_Network) GetTotalCpu() int64 { + if m != nil { + return m.TotalCpu + } + return 0 +} + +func (m *Event_Network) GetTotalMem() int64 { + if m != nil { + return m.TotalMem + } + return 0 +} + +func (m *Event_Network) GetLoginUrl() string { + if m != nil { + return m.LoginUrl + } + return "" +} + +type Event_VM struct { + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Role string `protobuf:"bytes,3,opt,name=role,proto3" json:"role,omitempty"` + BaseImage string `protobuf:"bytes,4,opt,name=baseImage,proto3" json:"baseImage,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Event_VM) Reset() { *m = Event_VM{} } +func (m *Event_VM) String() string { return proto.CompactTextString(m) } +func (*Event_VM) ProtoMessage() {} +func (*Event_VM) Descriptor() ([]byte, []int) { + return fileDescriptor_8f22242cb04491f9, []int{0, 2} +} + +func (m *Event_VM) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Event_VM.Unmarshal(m, b) +} +func (m *Event_VM) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Event_VM.Marshal(b, m, deterministic) +} +func (m *Event_VM) XXX_Merge(src proto.Message) { + xxx_messageInfo_Event_VM.Merge(m, src) +} +func (m *Event_VM) XXX_Size() int { + return xxx_messageInfo_Event_VM.Size(m) +} +func (m *Event_VM) XXX_DiscardUnknown() { + xxx_messageInfo_Event_VM.DiscardUnknown(m) +} + +var xxx_messageInfo_Event_VM proto.InternalMessageInfo + +func (m *Event_VM) GetId() int32 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *Event_VM) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Event_VM) GetRole() string { + if m != nil { + return m.Role + } + return "" +} + +func (m *Event_VM) GetBaseImage() string { + if m != nil { + return m.BaseImage + } + return "" +} + func init() { proto.RegisterEnum("witProtobuf.Event_EventType", Event_EventType_name, Event_EventType_value) proto.RegisterType((*Event)(nil), "witProtobuf.Event") proto.RegisterType((*Event_Response)(nil), "witProtobuf.Event.Response") + proto.RegisterType((*Event_Network)(nil), "witProtobuf.Event.Network") + proto.RegisterType((*Event_VM)(nil), "witProtobuf.Event.VM") } func init() { proto.RegisterFile("events.proto", fileDescriptor_8f22242cb04491f9) } var fileDescriptor_8f22242cb04491f9 = []byte{ - // 309 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x91, 0xc1, 0x6a, 0xf2, 0x40, - 0x10, 0xc7, 0xbf, 0x64, 0x13, 0x63, 0x46, 0x3f, 0x09, 0x43, 0x0f, 0x8b, 0xed, 0x21, 0x78, 0xca, - 0x49, 0x8a, 0xa5, 0x0f, 0x60, 0x71, 0x6d, 0x85, 0x56, 0x65, 0x09, 0x78, 0xd6, 0x3a, 0x85, 0x80, - 0x49, 0x96, 0xec, 0xda, 0xe2, 0x6b, 0xf4, 0xa1, 0xfa, 0x5c, 0x25, 0x9b, 0x46, 0x3c, 0xf4, 0xd8, - 0xcb, 0x32, 0xbf, 0xd9, 0x1f, 0x33, 0xff, 0x65, 0xa1, 0x4f, 0xef, 0x54, 0x18, 0x3d, 0x56, 0x55, - 0x69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0x46, 0x2e, 0xf6, 0xa1, 0xdb, 0xc0, 0x7c, 0x1e, 0x31, - 0xfc, 0x0f, 0xe1, 0xd3, 0xe2, 0x41, 0xc8, 0xe5, 0x34, 0x15, 0x91, 0x57, 0x9b, 0x2f, 0x8b, 0x47, - 0x59, 0x83, 0xbf, 0xeb, 0xd8, 0xcf, 0xbd, 0xfb, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x6d, 0x1f, 0x36, - 0x0f, 0xec, 0x01, 0x00, 0x00, + // 424 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x53, 0x4d, 0x6b, 0xdb, 0x40, + 0x10, 0xad, 0xbe, 0x2c, 0x69, 0x9c, 0x06, 0x31, 0xb4, 0xb0, 0x28, 0x39, 0x88, 0x5c, 0xaa, 0x93, + 0x29, 0x29, 0xed, 0x3d, 0xad, 0x95, 0xd6, 0x50, 0x3b, 0x61, 0x71, 0x13, 0xe8, 0x25, 0xc8, 0xc9, + 0x36, 0x88, 0x6a, 0xb5, 0x62, 0x77, 0x95, 0x90, 0x7b, 0x7f, 0x41, 0x7f, 0x6c, 0xcf, 0x65, 0x57, + 0x96, 0x12, 0xa8, 0x0f, 0xbd, 0xe4, 0x22, 0xe6, 0xbd, 0x79, 0xc3, 0x9b, 0x79, 0x62, 0x61, 0x8f, + 0xdd, 0xb1, 0x46, 0xab, 0x59, 0x2b, 0x85, 0x16, 0x38, 0xbd, 0xaf, 0xf4, 0xb9, 0xa9, 0x36, 0xdd, + 0x8f, 0xa3, 0x3f, 0x01, 0x04, 0x85, 0xe9, 0xe2, 0x5b, 0xf0, 0xf5, 0x43, 0xcb, 0x88, 0x93, 0x39, + 0xf9, 0xfe, 0xf1, 0xe1, 0xec, 0x89, 0x6a, 0x66, 0x15, 0xfd, 0x77, 0xfd, 0xd0, 0x32, 0x6a, 0x95, + 0xb8, 0x0f, 0x6e, 0x75, 0x43, 0x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, 0x64, 0x9d, 0x7e, 0x07, + 0xf7, 0x62, 0xf9, 0x5f, 0x0b, 0x20, 0xf8, 0x52, 0xd4, 0xe3, 0xd9, 0xa6, 0xc6, 0x43, 0x88, 0x37, + 0xa5, 0x62, 0x0b, 0x5e, 0xde, 0xb2, 0xed, 0xe9, 0x8f, 0xc4, 0xd1, 0x25, 0xc4, 0x63, 0x96, 0x18, + 0x82, 0x77, 0x32, 0x9f, 0x27, 0x2f, 0x10, 0x60, 0x32, 0x2f, 0xbe, 0x16, 0xeb, 0x22, 0x71, 0x70, + 0x0a, 0xe1, 0xf9, 0xd9, 0x65, 0x41, 0xcf, 0x56, 0x89, 0x8b, 0x7b, 0x10, 0xf5, 0xe0, 0xf4, 0x34, + 0xf1, 0xf0, 0x25, 0xc4, 0x5f, 0x16, 0x1f, 0x0b, 0xba, 0x3a, 0x59, 0x17, 0x89, 0x6f, 0x94, 0xcb, + 0xc5, 0x67, 0x6a, 0x40, 0xb0, 0x99, 0xd8, 0xc7, 0xf0, 0xee, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xce, 0x8e, 0xb5, 0x00, 0x1c, 0x03, 0x00, 0x00, } diff --git a/events.proto b/events.proto index 2334065..d09327f 100644 --- a/events.proto +++ b/events.proto @@ -4,12 +4,13 @@ package witProtobuf; message Event { EventType type = 1; int32 id = 2; - repeated Response results = 3; - string name = 4; + string name = 3; + string comment = 4; + string email = 5; - string comment = 5; - string email = 6; - repeated int64 reps = 7; + repeated Response results = 6; + repeated Network networks = 7; + repeated VM vms = 8; enum EventType { ADD = 0; @@ -27,4 +28,19 @@ message Event { string error = 4; repeated string snippets = 5; } + + message Network { + int32 id = 1; + string name = 2; + int64 total_cpu = 3; + int64 total_mem = 4; + string login_url = 5; + } + + message VM { + int32 id = 1; + string name = 2; + string role = 3; + string baseImage = 4; + } }