From 5b50255c578c6524aa20214f21bcc8f0ec1bed62 Mon Sep 17 00:00:00 2001 From: abhisek Date: Fri, 17 Feb 2023 17:05:05 +0530 Subject: [PATCH] Add filter suite spec --- Makefile | 6 +- api/filter_suite_spec.proto | 14 ++ gen/filtersuite/filter_suite_spec.pb.go | 236 ++++++++++++++++++++++++ 3 files changed, 255 insertions(+), 1 deletion(-) create mode 100644 api/filter_suite_spec.proto create mode 100644 gen/filtersuite/filter_suite_spec.pb.go diff --git a/Makefile b/Makefile index 22dc625..1666ba8 100644 --- a/Makefile +++ b/Makefile @@ -21,9 +21,13 @@ protoc-codegen: --go_out=./gen/filterinput \ --go_opt=paths=source_relative \ ./api/filter_input_spec.proto + protoc -I ./api \ + --go_out=./gen/filtersuite \ + --go_opt=paths=source_relative \ + ./api/filter_suite_spec.proto setup: - mkdir -p out gen/insightapi gen/controlplane gen/filterinput + mkdir -p out gen/insightapi gen/controlplane gen/filterinput gen/filtersuite GO_CFLAGS=-X main.commit=$(GITCOMMIT) -X main.version=$(VERSION) GO_LDFLAGS=-ldflags "-w $(GO_CFLAGS)" diff --git a/api/filter_suite_spec.proto b/api/filter_suite_spec.proto new file mode 100644 index 0000000..38df80e --- /dev/null +++ b/api/filter_suite_spec.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +option go_package = "github.com/safedep/vet/gen/filtersuite"; + +message Filter { + string name = 1; + string value = 2; +} + +message FilterSuite { + string name = 1; + string description = 2; + repeated Filter filters = 3; +} diff --git a/gen/filtersuite/filter_suite_spec.pb.go b/gen/filtersuite/filter_suite_spec.pb.go new file mode 100644 index 0000000..d3515f8 --- /dev/null +++ b/gen/filtersuite/filter_suite_spec.pb.go @@ -0,0 +1,236 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.18.0 +// source: filter_suite_spec.proto + +package filtersuite + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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 Filter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *Filter) Reset() { + *x = Filter{} + if protoimpl.UnsafeEnabled { + mi := &file_filter_suite_spec_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Filter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Filter) ProtoMessage() {} + +func (x *Filter) ProtoReflect() protoreflect.Message { + mi := &file_filter_suite_spec_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Filter.ProtoReflect.Descriptor instead. +func (*Filter) Descriptor() ([]byte, []int) { + return file_filter_suite_spec_proto_rawDescGZIP(), []int{0} +} + +func (x *Filter) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Filter) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +type FilterSuite struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + Filters []*Filter `protobuf:"bytes,3,rep,name=filters,proto3" json:"filters,omitempty"` +} + +func (x *FilterSuite) Reset() { + *x = FilterSuite{} + if protoimpl.UnsafeEnabled { + mi := &file_filter_suite_spec_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FilterSuite) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FilterSuite) ProtoMessage() {} + +func (x *FilterSuite) ProtoReflect() protoreflect.Message { + mi := &file_filter_suite_spec_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FilterSuite.ProtoReflect.Descriptor instead. +func (*FilterSuite) Descriptor() ([]byte, []int) { + return file_filter_suite_spec_proto_rawDescGZIP(), []int{1} +} + +func (x *FilterSuite) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *FilterSuite) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *FilterSuite) GetFilters() []*Filter { + if x != nil { + return x.Filters + } + return nil +} + +var File_filter_suite_spec_proto protoreflect.FileDescriptor + +var file_filter_suite_spec_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x75, 0x69, 0x74, 0x65, 0x5f, 0x73, + 0x70, 0x65, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x32, 0x0a, 0x06, 0x46, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x66, 0x0a, + 0x0b, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x53, 0x75, 0x69, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, + 0x6c, 0x74, 0x65, 0x72, 0x73, 0x42, 0x28, 0x5a, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x61, 0x66, 0x65, 0x64, 0x65, 0x70, 0x2f, 0x76, 0x65, 0x74, 0x2f, + 0x67, 0x65, 0x6e, 0x2f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x75, 0x69, 0x74, 0x65, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_filter_suite_spec_proto_rawDescOnce sync.Once + file_filter_suite_spec_proto_rawDescData = file_filter_suite_spec_proto_rawDesc +) + +func file_filter_suite_spec_proto_rawDescGZIP() []byte { + file_filter_suite_spec_proto_rawDescOnce.Do(func() { + file_filter_suite_spec_proto_rawDescData = protoimpl.X.CompressGZIP(file_filter_suite_spec_proto_rawDescData) + }) + return file_filter_suite_spec_proto_rawDescData +} + +var file_filter_suite_spec_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_filter_suite_spec_proto_goTypes = []interface{}{ + (*Filter)(nil), // 0: Filter + (*FilterSuite)(nil), // 1: FilterSuite +} +var file_filter_suite_spec_proto_depIdxs = []int32{ + 0, // 0: FilterSuite.filters:type_name -> Filter + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_filter_suite_spec_proto_init() } +func file_filter_suite_spec_proto_init() { + if File_filter_suite_spec_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_filter_suite_spec_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Filter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filter_suite_spec_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FilterSuite); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_filter_suite_spec_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_filter_suite_spec_proto_goTypes, + DependencyIndexes: file_filter_suite_spec_proto_depIdxs, + MessageInfos: file_filter_suite_spec_proto_msgTypes, + }.Build() + File_filter_suite_spec_proto = out.File + file_filter_suite_spec_proto_rawDesc = nil + file_filter_suite_spec_proto_goTypes = nil + file_filter_suite_spec_proto_depIdxs = nil +}