From a3152b9d27b9cbe1c4632da11d10e94a4ad2a9f7 Mon Sep 17 00:00:00 2001 From: Vaibhav Kumbhar Date: Thu, 2 Jun 2022 13:55:01 +0530 Subject: [PATCH] feat(proto): csc version request response --- README.md | 4 + api/api.pb.go | 193 +++++++++++++++++++++++++++++++++++++---- constants/constants.go | 4 + proto/api.proto | 10 +++ 4 files changed, 194 insertions(+), 17 deletions(-) create mode 100644 constants/constants.go diff --git a/README.md b/README.md index 64f1c52..878dd32 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,6 @@ # k8s-collectorset-controller-proto Collectorset Protobufferes + +## Build +Run `make` and commit all changed files. +Create new release as appropriate diff --git a/api/api.pb.go b/api/api.pb.go index 21145c7..1e0d135 100644 --- a/api/api.pb.go +++ b/api/api.pb.go @@ -120,6 +120,93 @@ func (x *CollectorIDReply) GetId() int32 { return 0 } +// The CSCVersionRequest message for a CSC Version. +type CSCVersionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *CSCVersionRequest) Reset() { + *x = CSCVersionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CSCVersionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CSCVersionRequest) ProtoMessage() {} + +func (x *CSCVersionRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_msgTypes[2] + 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 CSCVersionRequest.ProtoReflect.Descriptor instead. +func (*CSCVersionRequest) Descriptor() ([]byte, []int) { + return file_api_proto_rawDescGZIP(), []int{2} +} + +// The CSCVersionReply response message from a CSC Version request. +type CSCVersionReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CSCVersion string `protobuf:"bytes,1,opt,name=CSCVersion,proto3" json:"CSCVersion,omitempty"` +} + +func (x *CSCVersionReply) Reset() { + *x = CSCVersionReply{} + if protoimpl.UnsafeEnabled { + mi := &file_api_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CSCVersionReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CSCVersionReply) ProtoMessage() {} + +func (x *CSCVersionReply) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_msgTypes[3] + 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 CSCVersionReply.ProtoReflect.Descriptor instead. +func (*CSCVersionReply) Descriptor() ([]byte, []int) { + return file_api_proto_rawDescGZIP(), []int{3} +} + +func (x *CSCVersionReply) GetCSCVersion() string { + if x != nil { + return x.CSCVersion + } + return "" +} + var File_api_proto protoreflect.FileDescriptor var file_api_proto_rawDesc = []byte{ @@ -129,18 +216,26 @@ var file_api_proto_rawDesc = []byte{ 0x74, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x22, 0x22, 0x0a, 0x10, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x44, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x32, 0x59, - 0x0a, 0x16, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x74, 0x43, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x3f, 0x0a, 0x0b, 0x43, 0x6f, 0x6c, 0x6c, - 0x65, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x44, 0x12, 0x17, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, - 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, - 0x49, 0x44, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x3f, 0x5a, 0x3d, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x6d, 0x6f, 0x6e, - 0x69, 0x74, 0x6f, 0x72, 0x2f, 0x6b, 0x38, 0x73, 0x2d, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, - 0x6f, 0x72, 0x73, 0x65, 0x74, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, - 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x13, + 0x0a, 0x11, 0x43, 0x53, 0x43, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x22, 0x31, 0x0a, 0x0f, 0x43, 0x53, 0x43, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x53, 0x43, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x43, 0x53, 0x43, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x32, 0x97, 0x01, 0x0a, 0x16, 0x43, 0x6f, 0x6c, 0x6c, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x12, 0x3f, 0x0a, 0x0b, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x44, + 0x12, 0x17, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, + 0x49, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x44, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x22, 0x00, 0x12, 0x3c, 0x0a, 0x0a, 0x43, 0x53, 0x43, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x12, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x53, 0x43, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, + 0x53, 0x43, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, + 0x42, 0x3f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, + 0x6f, 0x67, 0x69, 0x63, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x2f, 0x6b, 0x38, 0x73, 0x2d, + 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x65, 0x74, 0x2d, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x61, 0x70, + 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -155,16 +250,20 @@ func file_api_proto_rawDescGZIP() []byte { return file_api_proto_rawDescData } -var file_api_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_api_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_api_proto_goTypes = []interface{}{ (*CollectorIDRequest)(nil), // 0: api.CollectorIDRequest (*CollectorIDReply)(nil), // 1: api.CollectorIDReply + (*CSCVersionRequest)(nil), // 2: api.CSCVersionRequest + (*CSCVersionReply)(nil), // 3: api.CSCVersionReply } var file_api_proto_depIdxs = []int32{ 0, // 0: api.CollectorSetController.CollectorID:input_type -> api.CollectorIDRequest - 1, // 1: api.CollectorSetController.CollectorID:output_type -> api.CollectorIDReply - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type + 2, // 1: api.CollectorSetController.CSCVersion:input_type -> api.CSCVersionRequest + 1, // 2: api.CollectorSetController.CollectorID:output_type -> api.CollectorIDReply + 3, // 3: api.CollectorSetController.CSCVersion:output_type -> api.CSCVersionReply + 2, // [2:4] is the sub-list for method output_type + 0, // [0:2] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name @@ -200,6 +299,30 @@ func file_api_proto_init() { return nil } } + file_api_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CSCVersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CSCVersionReply); 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{ @@ -207,7 +330,7 @@ func file_api_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_api_proto_rawDesc, NumEnums: 0, - NumMessages: 2, + NumMessages: 4, NumExtensions: 0, NumServices: 1, }, @@ -235,6 +358,7 @@ const _ = grpc.SupportPackageIsVersion6 type CollectorSetControllerClient interface { // Retrieves a collector ID. CollectorID(ctx context.Context, in *CollectorIDRequest, opts ...grpc.CallOption) (*CollectorIDReply, error) + CSCVersion(ctx context.Context, in *CSCVersionRequest, opts ...grpc.CallOption) (*CSCVersionReply, error) } type collectorSetControllerClient struct { @@ -254,10 +378,20 @@ func (c *collectorSetControllerClient) CollectorID(ctx context.Context, in *Coll return out, nil } +func (c *collectorSetControllerClient) CSCVersion(ctx context.Context, in *CSCVersionRequest, opts ...grpc.CallOption) (*CSCVersionReply, error) { + out := new(CSCVersionReply) + err := c.cc.Invoke(ctx, "/api.CollectorSetController/CSCVersion", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // CollectorSetControllerServer is the server API for CollectorSetController service. type CollectorSetControllerServer interface { // Retrieves a collector ID. CollectorID(context.Context, *CollectorIDRequest) (*CollectorIDReply, error) + CSCVersion(context.Context, *CSCVersionRequest) (*CSCVersionReply, error) } // UnimplementedCollectorSetControllerServer can be embedded to have forward compatible implementations. @@ -267,6 +401,9 @@ type UnimplementedCollectorSetControllerServer struct { func (*UnimplementedCollectorSetControllerServer) CollectorID(context.Context, *CollectorIDRequest) (*CollectorIDReply, error) { return nil, status.Errorf(codes.Unimplemented, "method CollectorID not implemented") } +func (*UnimplementedCollectorSetControllerServer) CSCVersion(context.Context, *CSCVersionRequest) (*CSCVersionReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method CSCVersion not implemented") +} func RegisterCollectorSetControllerServer(s *grpc.Server, srv CollectorSetControllerServer) { s.RegisterService(&_CollectorSetController_serviceDesc, srv) @@ -290,6 +427,24 @@ func _CollectorSetController_CollectorID_Handler(srv interface{}, ctx context.Co return interceptor(ctx, in, info, handler) } +func _CollectorSetController_CSCVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CSCVersionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CollectorSetControllerServer).CSCVersion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/api.CollectorSetController/CSCVersion", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CollectorSetControllerServer).CSCVersion(ctx, req.(*CSCVersionRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _CollectorSetController_serviceDesc = grpc.ServiceDesc{ ServiceName: "api.CollectorSetController", HandlerType: (*CollectorSetControllerServer)(nil), @@ -298,6 +453,10 @@ var _CollectorSetController_serviceDesc = grpc.ServiceDesc{ MethodName: "CollectorID", Handler: _CollectorSetController_CollectorID_Handler, }, + { + MethodName: "CSCVersion", + Handler: _CollectorSetController_CSCVersion_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "api.proto", diff --git a/constants/constants.go b/constants/constants.go new file mode 100644 index 0000000..d0464a4 --- /dev/null +++ b/constants/constants.go @@ -0,0 +1,4 @@ +// Package constants has common constants +package constants + +const HealthServerServiceName = "grpc.health.v1.Health" diff --git a/proto/api.proto b/proto/api.proto index d064db5..087e864 100644 --- a/proto/api.proto +++ b/proto/api.proto @@ -8,6 +8,7 @@ package api; service CollectorSetController { // Retrieves a collector ID. rpc CollectorID(CollectorIDRequest) returns (CollectorIDReply) {} + rpc CSCVersion(CSCVersionRequest) returns (CSCVersionReply) {} } // The CollectorIDRequest message for a collector ID. @@ -19,3 +20,12 @@ message CollectorIDRequest { message CollectorIDReply { int32 id = 1; } + +// The CSCVersionRequest message for a CSC Version. +message CSCVersionRequest { +} + +// The CSCVersionReply response message from a CSC Version request. +message CSCVersionReply { + string CSCVersion = 1; +}