From db07e26fc8e24215c37748dd140e223f6efb9d25 Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Mon, 20 Jan 2020 21:21:25 +0100 Subject: [PATCH] Update protobuf, rename event&resource props on triggers --- pkg/corredor/service-corredor.pb.go | 177 ++++++++++++++++++---------- pkg/corredor/service.go | 2 +- pkg/corredor/util.go | 20 ++-- pkg/eventbus/eventbus.go | 2 +- 4 files changed, 130 insertions(+), 71 deletions(-) diff --git a/pkg/corredor/service-corredor.pb.go b/pkg/corredor/service-corredor.pb.go index ca58a168a..9054b4c98 100644 --- a/pkg/corredor/service-corredor.pb.go +++ b/pkg/corredor/service-corredor.pb.go @@ -114,9 +114,9 @@ type ServerScriptListRequest struct { // query by name, label, description Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` // filter by resource - exact match - Resource string `protobuf:"bytes,2,opt,name=resource,proto3" json:"resource,omitempty"` + ResourceType string `protobuf:"bytes,2,opt,name=resourceType,proto3" json:"resourceType,omitempty"` // filter by events - script must contain all specified events - Events []string `protobuf:"bytes,3,rep,name=events,proto3" json:"events,omitempty"` + EventTypes []string `protobuf:"bytes,3,rep,name=eventTypes,proto3" json:"eventTypes,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -154,16 +154,16 @@ func (m *ServerScriptListRequest) GetQuery() string { return "" } -func (m *ServerScriptListRequest) GetResource() string { +func (m *ServerScriptListRequest) GetResourceType() string { if m != nil { - return m.Resource + return m.ResourceType } return "" } -func (m *ServerScriptListRequest) GetEvents() []string { +func (m *ServerScriptListRequest) GetEventTypes() []string { if m != nil { - return m.Events + return m.EventTypes } return nil } @@ -211,9 +211,9 @@ type ClientScriptListRequest struct { // query by name, label, description Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` // filter by resource - exact match - Resource string `protobuf:"bytes,2,opt,name=resource,proto3" json:"resource,omitempty"` + ResourceType string `protobuf:"bytes,2,opt,name=resourceType,proto3" json:"resourceType,omitempty"` // filter by events - script must contain all specified events - Events []string `protobuf:"bytes,3,rep,name=events,proto3" json:"events,omitempty"` + EventTypes []string `protobuf:"bytes,3,rep,name=eventTypes,proto3" json:"eventTypes,omitempty"` // filter by bundle - exact match Bundle string `protobuf:"bytes,4,opt,name=bundle,proto3" json:"bundle,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -253,16 +253,16 @@ func (m *ClientScriptListRequest) GetQuery() string { return "" } -func (m *ClientScriptListRequest) GetResource() string { +func (m *ClientScriptListRequest) GetResourceType() string { if m != nil { - return m.Resource + return m.ResourceType } return "" } -func (m *ClientScriptListRequest) GetEvents() []string { +func (m *ClientScriptListRequest) GetEventTypes() []string { if m != nil { - return m.Events + return m.EventTypes } return nil } @@ -550,10 +550,11 @@ func (m *ClientScript) GetErrors() []string { } type Trigger struct { - Events []string `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` - Resources []string `protobuf:"bytes,2,rep,name=resources,proto3" json:"resources,omitempty"` + EventTypes []string `protobuf:"bytes,1,rep,name=eventTypes,proto3" json:"eventTypes,omitempty"` + ResourceTypes []string `protobuf:"bytes,2,rep,name=resourceTypes,proto3" json:"resourceTypes,omitempty"` RunAs string `protobuf:"bytes,3,opt,name=runAs,proto3" json:"runAs,omitempty"` Constraints []*TConstraint `protobuf:"bytes,4,rep,name=constraints,proto3" json:"constraints,omitempty"` + Ui []*TUIOption `protobuf:"bytes,5,rep,name=ui,proto3" json:"ui,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -584,16 +585,16 @@ func (m *Trigger) XXX_DiscardUnknown() { var xxx_messageInfo_Trigger proto.InternalMessageInfo -func (m *Trigger) GetEvents() []string { +func (m *Trigger) GetEventTypes() []string { if m != nil { - return m.Events + return m.EventTypes } return nil } -func (m *Trigger) GetResources() []string { +func (m *Trigger) GetResourceTypes() []string { if m != nil { - return m.Resources + return m.ResourceTypes } return nil } @@ -612,6 +613,13 @@ func (m *Trigger) GetConstraints() []*TConstraint { return nil } +func (m *Trigger) GetUi() []*TUIOption { + if m != nil { + return m.Ui + } + return nil +} + type TConstraint struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Op string `protobuf:"bytes,2,opt,name=op,proto3" json:"op,omitempty"` @@ -667,6 +675,53 @@ func (m *TConstraint) GetValue() []string { return nil } +type TUIOption struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TUIOption) Reset() { *m = TUIOption{} } +func (m *TUIOption) String() string { return proto.CompactTextString(m) } +func (*TUIOption) ProtoMessage() {} +func (*TUIOption) Descriptor() ([]byte, []int) { + return fileDescriptor_c06bb92bf45e37e2, []int{12} +} + +func (m *TUIOption) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TUIOption.Unmarshal(m, b) +} +func (m *TUIOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TUIOption.Marshal(b, m, deterministic) +} +func (m *TUIOption) XXX_Merge(src proto.Message) { + xxx_messageInfo_TUIOption.Merge(m, src) +} +func (m *TUIOption) XXX_Size() int { + return xxx_messageInfo_TUIOption.Size(m) +} +func (m *TUIOption) XXX_DiscardUnknown() { + xxx_messageInfo_TUIOption.DiscardUnknown(m) +} + +var xxx_messageInfo_TUIOption proto.InternalMessageInfo + +func (m *TUIOption) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *TUIOption) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + type Bundle struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` @@ -680,7 +735,7 @@ func (m *Bundle) Reset() { *m = Bundle{} } func (m *Bundle) String() string { return proto.CompactTextString(m) } func (*Bundle) ProtoMessage() {} func (*Bundle) Descriptor() ([]byte, []int) { - return fileDescriptor_c06bb92bf45e37e2, []int{12} + return fileDescriptor_c06bb92bf45e37e2, []int{13} } func (m *Bundle) XXX_Unmarshal(b []byte) error { @@ -737,52 +792,56 @@ func init() { proto.RegisterType((*ClientScript)(nil), "corredor.ClientScript") proto.RegisterType((*Trigger)(nil), "corredor.Trigger") proto.RegisterType((*TConstraint)(nil), "corredor.TConstraint") + proto.RegisterType((*TUIOption)(nil), "corredor.TUIOption") proto.RegisterType((*Bundle)(nil), "corredor.Bundle") } func init() { proto.RegisterFile("service-corredor.proto", fileDescriptor_c06bb92bf45e37e2) } var fileDescriptor_c06bb92bf45e37e2 = []byte{ - // 622 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0xd5, 0x26, 0x6e, 0x52, 0x8f, 0xdb, 0x52, 0x56, 0x6d, 0xba, 0x8a, 0x90, 0x08, 0xe6, 0x52, - 0x21, 0x35, 0x42, 0xa9, 0x50, 0xa1, 0x70, 0x69, 0x4b, 0xc5, 0xa5, 0x5c, 0x5c, 0x7e, 0xc0, 0x75, - 0x46, 0x91, 0x85, 0xf1, 0xba, 0xbb, 0xeb, 0x88, 0x8a, 0x33, 0x57, 0x38, 0x71, 0xe2, 0xc4, 0x07, - 0xf1, 0x4f, 0xc8, 0xbb, 0x6b, 0x7b, 0x21, 0x49, 0x05, 0x52, 0xb9, 0xed, 0xcc, 0xbe, 0x9d, 0x79, - 0xef, 0x65, 0x3c, 0x81, 0x81, 0x44, 0x31, 0x4f, 0x13, 0x3c, 0x48, 0xb8, 0x10, 0x38, 0xe5, 0x62, - 0x5c, 0x08, 0xae, 0x38, 0x5d, 0xaf, 0xe3, 0xf0, 0x2b, 0x81, 0xe0, 0xfc, 0x23, 0x26, 0x11, 0x5e, - 0x97, 0x28, 0x15, 0xa5, 0xe0, 0xe5, 0xf1, 0x07, 0x64, 0x64, 0x44, 0xf6, 0xfd, 0x48, 0x9f, 0xe9, - 0x21, 0x78, 0xb1, 0x98, 0x49, 0xd6, 0x19, 0x75, 0xf7, 0x83, 0xc9, 0xc3, 0x71, 0x53, 0xcc, 0x79, - 0x38, 0x3e, 0x11, 0x33, 0x79, 0x9e, 0x2b, 0x71, 0x13, 0x69, 0xf0, 0xf0, 0x08, 0xfc, 0x26, 0x45, - 0xb7, 0xa1, 0xfb, 0x1e, 0x6f, 0x6c, 0xd1, 0xea, 0x48, 0x77, 0x60, 0x6d, 0x1e, 0x67, 0x25, 0xb2, - 0x8e, 0xce, 0x99, 0xe0, 0xb8, 0xf3, 0x9c, 0x84, 0x9f, 0x09, 0x6c, 0x98, 0xc2, 0xb2, 0xe0, 0xb9, - 0x44, 0x7a, 0x0c, 0x3d, 0x81, 0xb2, 0xcc, 0x94, 0x25, 0x10, 0xfe, 0x49, 0xc0, 0xe0, 0xc6, 0x91, - 0x06, 0x19, 0x0e, 0xf6, 0xc5, 0xf0, 0x05, 0x04, 0x4e, 0xfa, 0x9f, 0x78, 0x24, 0xb0, 0x77, 0x89, - 0x62, 0x8e, 0xe2, 0x32, 0x11, 0x69, 0xa1, 0x2e, 0x52, 0xa9, 0x6a, 0x93, 0x76, 0x60, 0xed, 0xba, - 0x44, 0x51, 0x17, 0x32, 0x01, 0x1d, 0xc2, 0xba, 0x40, 0xc9, 0x4b, 0x91, 0xd4, 0xd5, 0x9a, 0x98, - 0x0e, 0xa0, 0x87, 0x73, 0xcc, 0x95, 0x64, 0xdd, 0x51, 0x77, 0xdf, 0x8f, 0x6c, 0x14, 0x5e, 0x00, - 0x5b, 0x6c, 0x62, 0x75, 0x3f, 0x85, 0xbe, 0xd4, 0x59, 0xc9, 0x88, 0x16, 0x3e, 0x68, 0x85, 0xbb,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, 0x25, 0xe2, 0xb4, 0x2a, 0xe8, 0x69, 0x86, 0xbb, 0x0e, 0xc3, - 0xb3, 0xe6, 0x36, 0x72, 0x91, 0xe1, 0x1b, 0x08, 0x9c, 0xbb, 0xa5, 0xf6, 0x6e, 0x41, 0x87, 0x17, - 0xd6, 0xdb, 0x0e, 0x2f, 0xda, 0x95, 0x61, 0xbe, 0x0b, 0x13, 0x84, 0xaf, 0xa1, 0x77, 0xda, 0xd8, - 0xb7, 0x50, 0xa3, 0xb6, 0xb4, 0xe3, 0x58, 0x4a, 0xc1, 0x4b, 0xf8, 0x14, 0xad, 0x10, 0x7d, 0x9e, - 0x7c, 0x23, 0xb0, 0xe9, 0xce, 0xa4, 0xa4, 0xcf, 0xc0, 0xab, 0xb6, 0x1c, 0xdd, 0x5d, 0xba, 0x76, - 0x87, 0x83, 0xe5, 0xcb, 0x90, 0xbe, 0x05, 0xaf, 0xfa, 0x02, 0xe9, 0xa3, 0xe5, 0x3b, 0xc3, 0x59, - 0x0d, 0xc3, 0xf0, 0x36, 0x88, 0x29, 0x37, 0xf9, 0x4e, 0x60, 0xd3, 0x9d, 0x43, 0x49, 0x5f, 0x36, - 0x7a, 0xf7, 0x16, 0x3e, 0x31, 0x5b, 0x98, 0x2d, 0x5e, 0xac, 0x66, 0xb7, 0x62, 0x71, 0xb9, 0xec, - 0x56, 0xad, 0x97, 0x89, 0x0f, 0xfd, 0x4b, 0xc5, 0x45, 0x3c, 0xc3, 0xab, 0x9e, 0xfe, 0x83, 0x3b, - 0xfc, 0x15, 0x00, 0x00, 0xff, 0xff, 0xe5, 0x77, 0x9e, 0xee, 0xfa, 0x06, 0x00, 0x00, + // 666 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0xcd, 0x6e, 0x13, 0x31, + 0x10, 0xd6, 0x6e, 0x36, 0x49, 0x33, 0x49, 0x4a, 0x31, 0x6d, 0x6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76, + 0xe7, 0x5f, 0x92, 0x3d, 0x08, 0xb2, 0x95, 0x4b, 0x36, 0x16, 0xfe, 0x01, 0xdd, 0xce, 0xe2, 0xcd, + 0x4c, 0xde, 0x41, 0x90, 0xbd, 0x76, 0xf2, 0x78, 0xf1, 0xc2, 0x72, 0xd6, 0x52, 0x97, 0xdd, 0x06, + 0x31, 0xee, 0x06, 0x3f, 0x3c, 0x68, 0xbb, 0x33, 0x2f, 0xc9, 0xcb, 0x22, 0xdf, 0xcd, 0xd2, 0x73, + 0xb6, 0x8e, 0x69, 0xf9, 0x62, 0x39, 0xbb, 0x25, 0x4b, 0xd3, 0x65, 0xb7, 0x6c, 0x95, 0x0d, 0x1a, + 0x50, 0x3f, 0x53, 0x5c, 0x0c, 0xc7, 0x78, 0x51, 0xd3, 0xbf, 0xed, 0xee, 0x9f, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xc9, 0x23, 0xe5, 0x0a, 0x87, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/pkg/corredor/service.go b/pkg/corredor/service.go index b37e9c3f9..af1c01d29 100644 --- a/pkg/corredor/service.go +++ b/pkg/corredor/service.go @@ -267,7 +267,7 @@ func (svc *service) registerTriggers(script *ServerScript) []uintptr { // so let's make a copy we can play with trigger := script.Triggers[i] - if len(trigger.Events) == 0 { + if len(trigger.EventTypes) == 0 { // We've removed the last event // // break now to prevent code below to diff --git a/pkg/corredor/util.go b/pkg/corredor/util.go index 5378c94fc..62c958f21 100644 --- a/pkg/corredor/util.go +++ b/pkg/corredor/util.go @@ -20,12 +20,12 @@ type ( // returns true if event type was removed or // false if there was no onManual event func popOnManualEventType(trigger *Trigger) (found bool) { - for i := len(trigger.Events) - 1; i >= 0; i-- { - if trigger.Events[i] == onManualEventType { + for i := len(trigger.EventTypes) - 1; i >= 0; i-- { + if trigger.EventTypes[i] == onManualEventType { found = true // remove from the list - trigger.Events = append(trigger.Events[:i], trigger.Events[i+1:]...) + trigger.EventTypes = append(trigger.EventTypes[:i], trigger.EventTypes[i+1:]...) } } @@ -46,7 +46,7 @@ func pluckManualTriggers(script *ServerScript) map[string]string { trigger := script.Triggers[i] if popOnManualEventType(trigger) { - for _, res := range trigger.Resources { + for _, res := range trigger.ResourceTypes { hash[res] = trigger.RunAs } } @@ -57,16 +57,16 @@ func pluckManualTriggers(script *ServerScript) map[string]string { // converts trigger's constraint to eventbus' constraint options func makeTriggerOpts(t *Trigger) (oo []eventbus.HandlerRegOp, err error) { - if len(t.Events) == 0 { + if len(t.EventTypes) == 0 { return nil, fmt.Errorf("can not generate trigger without at least one events") } - if len(t.Resources) == 0 { + if len(t.ResourceTypes) == 0 { return nil, fmt.Errorf("can not generate trigger without at least one resource") } - oo = append(oo, eventbus.On(t.Events...)) - oo = append(oo, eventbus.For(t.Resources...)) + oo = append(oo, eventbus.On(t.EventTypes...)) + oo = append(oo, eventbus.For(t.ResourceTypes...)) for _, raw := range t.Constraints { if c, err := eventbus.ConstraintMaker(raw.Name, raw.Op, raw.Value...); err != nil { @@ -101,7 +101,7 @@ func makeScriptFilter(f Filter) func(s *Script) (b bool, err error) { // at least one of the script's triggers should match b = false for _, t := range s.Triggers { - if len(slice.IntersectStrings(f.ResourceTypes, t.Resources)) > 0 { + if len(slice.IntersectStrings(f.ResourceTypes, t.ResourceTypes)) > 0 { b = true } } @@ -117,7 +117,7 @@ func makeScriptFilter(f Filter) func(s *Script) (b bool, err error) { // at least one of the script's triggers should match b = false for _, t := range s.Triggers { - if len(slice.IntersectStrings(f.EventTypes, t.Events)) > 0 { + if len(slice.IntersectStrings(f.EventTypes, t.EventTypes)) > 0 { b = true } } diff --git a/pkg/eventbus/eventbus.go b/pkg/eventbus/eventbus.go index 22b3dcc14..31cf99f4a 100644 --- a/pkg/eventbus/eventbus.go +++ b/pkg/eventbus/eventbus.go @@ -12,7 +12,7 @@ type ( // ResourceType from resource that fired the event ResourceType() string - // Type of event fired + // EventType returns type of event fired EventType() string // Match tests if given constraints match