diff --git a/pkg/notifier/notifier.pb.go b/pkg/notifier/notifier.pb.go index 0abd4252..30ca2492 100644 --- a/pkg/notifier/notifier.pb.go +++ b/pkg/notifier/notifier.pb.go @@ -20,14 +20,16 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type Empty struct { +type LoadConfigsRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Configs map[string]string `protobuf:"bytes,1,rep,name=configs,proto3" json:"configs,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } -func (x *Empty) Reset() { - *x = Empty{} +func (x *LoadConfigsRequest) Reset() { + *x = LoadConfigsRequest{} if protoimpl.UnsafeEnabled { mi := &file_notifier_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -35,13 +37,13 @@ func (x *Empty) Reset() { } } -func (x *Empty) String() string { +func (x *LoadConfigsRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Empty) ProtoMessage() {} +func (*LoadConfigsRequest) ProtoMessage() {} -func (x *Empty) ProtoReflect() protoreflect.Message { +func (x *LoadConfigsRequest) ProtoReflect() protoreflect.Message { mi := &file_notifier_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -53,21 +55,26 @@ func (x *Empty) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Empty.ProtoReflect.Descriptor instead. -func (*Empty) Descriptor() ([]byte, []int) { +// Deprecated: Use LoadConfigsRequest.ProtoReflect.Descriptor instead. +func (*LoadConfigsRequest) Descriptor() ([]byte, []int) { return file_notifier_proto_rawDescGZIP(), []int{0} } -type ConfigsRequest struct { +func (x *LoadConfigsRequest) GetConfigs() map[string]string { + if x != nil { + return x.Configs + } + return nil +} + +type LoadConfigsResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - - Configs map[string]string `protobuf:"bytes,1,rep,name=configs,proto3" json:"configs,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } -func (x *ConfigsRequest) Reset() { - *x = ConfigsRequest{} +func (x *LoadConfigsResponse) Reset() { + *x = LoadConfigsResponse{} if protoimpl.UnsafeEnabled { mi := &file_notifier_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -75,13 +82,13 @@ func (x *ConfigsRequest) Reset() { } } -func (x *ConfigsRequest) String() string { +func (x *LoadConfigsResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ConfigsRequest) ProtoMessage() {} +func (*LoadConfigsResponse) ProtoMessage() {} -func (x *ConfigsRequest) ProtoReflect() protoreflect.Message { +func (x *LoadConfigsResponse) ProtoReflect() protoreflect.Message { mi := &file_notifier_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -93,42 +100,119 @@ func (x *ConfigsRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ConfigsRequest.ProtoReflect.Descriptor instead. -func (*ConfigsRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use LoadConfigsResponse.ProtoReflect.Descriptor instead. +func (*LoadConfigsResponse) Descriptor() ([]byte, []int) { return file_notifier_proto_rawDescGZIP(), []int{1} } -func (x *ConfigsRequest) GetConfigs() map[string]string { - if x != nil { - return x.Configs +type UpdateX509SVIDRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateX509SVIDRequest) Reset() { + *x = UpdateX509SVIDRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_notifier_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return nil +} + +func (x *UpdateX509SVIDRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateX509SVIDRequest) ProtoMessage() {} + +func (x *UpdateX509SVIDRequest) ProtoReflect() protoreflect.Message { + mi := &file_notifier_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 UpdateX509SVIDRequest.ProtoReflect.Descriptor instead. +func (*UpdateX509SVIDRequest) Descriptor() ([]byte, []int) { + return file_notifier_proto_rawDescGZIP(), []int{2} +} + +type UpdateX509SVIDResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateX509SVIDResponse) Reset() { + *x = UpdateX509SVIDResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_notifier_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateX509SVIDResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateX509SVIDResponse) ProtoMessage() {} + +func (x *UpdateX509SVIDResponse) ProtoReflect() protoreflect.Message { + mi := &file_notifier_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 UpdateX509SVIDResponse.ProtoReflect.Descriptor instead. +func (*UpdateX509SVIDResponse) Descriptor() ([]byte, []int) { + return file_notifier_proto_rawDescGZIP(), []int{3} } var File_notifier_proto protoreflect.FileDescriptor var file_notifier_proto_rawDesc = []byte{ 0x0a, 0x0e, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x08, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x22, 0x8d, 0x01, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, - 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x1a, 0x3a, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, - 0x02, 0x38, 0x01, 0x32, 0x7c, 0x0a, 0x08, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, - 0x3a, 0x0a, 0x0b, 0x4c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x18, - 0x2e, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x6e, 0x6f, 0x74, 0x69, 0x66, - 0x69, 0x65, 0x72, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x0e, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x58, 0x35, 0x30, 0x39, 0x53, 0x56, 0x49, 0x44, 0x12, 0x0f, 0x2e, - 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, - 0x2e, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, - 0x00, 0x42, 0x0d, 0x5a, 0x0b, 0x2e, 0x2f, 0x3b, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x08, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x95, 0x01, 0x0a, 0x12, 0x4c, + 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x43, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x2e, 0x4c, 0x6f, + 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x1a, 0x3a, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, + 0x38, 0x01, 0x22, 0x15, 0x0a, 0x13, 0x4c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x17, 0x0a, 0x15, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x58, 0x35, 0x30, 0x39, 0x53, 0x56, 0x49, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x22, 0x18, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x58, 0x35, 0x30, 0x39, + 0x53, 0x56, 0x49, 0x44, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xaf, 0x01, 0x0a, + 0x08, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x4c, 0x0a, 0x0b, 0x4c, 0x6f, 0x61, + 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x1c, 0x2e, 0x6e, 0x6f, 0x74, 0x69, 0x66, + 0x69, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x65, + 0x72, 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x55, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x58, 0x35, 0x30, 0x39, 0x53, 0x56, 0x49, 0x44, 0x12, 0x1f, 0x2e, 0x6e, 0x6f, 0x74, 0x69, + 0x66, 0x69, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x58, 0x35, 0x30, 0x39, 0x53, + 0x56, 0x49, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x6f, 0x74, + 0x69, 0x66, 0x69, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x58, 0x35, 0x30, 0x39, + 0x53, 0x56, 0x49, 0x44, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x0d, + 0x5a, 0x0b, 0x2e, 0x2f, 0x3b, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -143,18 +227,20 @@ func file_notifier_proto_rawDescGZIP() []byte { return file_notifier_proto_rawDescData } -var file_notifier_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_notifier_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_notifier_proto_goTypes = []interface{}{ - (*Empty)(nil), // 0: notifier.Empty - (*ConfigsRequest)(nil), // 1: notifier.ConfigsRequest - nil, // 2: notifier.ConfigsRequest.ConfigsEntry + (*LoadConfigsRequest)(nil), // 0: notifier.LoadConfigsRequest + (*LoadConfigsResponse)(nil), // 1: notifier.LoadConfigsResponse + (*UpdateX509SVIDRequest)(nil), // 2: notifier.UpdateX509SVIDRequest + (*UpdateX509SVIDResponse)(nil), // 3: notifier.UpdateX509SVIDResponse + nil, // 4: notifier.LoadConfigsRequest.ConfigsEntry } var file_notifier_proto_depIdxs = []int32{ - 2, // 0: notifier.ConfigsRequest.configs:type_name -> notifier.ConfigsRequest.ConfigsEntry - 1, // 1: notifier.Notifier.LoadConfigs:input_type -> notifier.ConfigsRequest - 0, // 2: notifier.Notifier.UpdateX509SVID:input_type -> notifier.Empty - 0, // 3: notifier.Notifier.LoadConfigs:output_type -> notifier.Empty - 0, // 4: notifier.Notifier.UpdateX509SVID:output_type -> notifier.Empty + 4, // 0: notifier.LoadConfigsRequest.configs:type_name -> notifier.LoadConfigsRequest.ConfigsEntry + 0, // 1: notifier.Notifier.LoadConfigs:input_type -> notifier.LoadConfigsRequest + 2, // 2: notifier.Notifier.UpdateX509SVID:input_type -> notifier.UpdateX509SVIDRequest + 1, // 3: notifier.Notifier.LoadConfigs:output_type -> notifier.LoadConfigsResponse + 3, // 4: notifier.Notifier.UpdateX509SVID:output_type -> notifier.UpdateX509SVIDResponse 3, // [3:5] is the sub-list for method output_type 1, // [1:3] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name @@ -169,7 +255,7 @@ func file_notifier_proto_init() { } if !protoimpl.UnsafeEnabled { file_notifier_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Empty); i { + switch v := v.(*LoadConfigsRequest); i { case 0: return &v.state case 1: @@ -181,7 +267,31 @@ func file_notifier_proto_init() { } } file_notifier_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ConfigsRequest); i { + switch v := v.(*LoadConfigsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_notifier_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateX509SVIDRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_notifier_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateX509SVIDResponse); i { case 0: return &v.state case 1: @@ -199,7 +309,7 @@ func file_notifier_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_notifier_proto_rawDesc, NumEnums: 0, - NumMessages: 3, + NumMessages: 5, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/notifier/notifier.proto b/pkg/notifier/notifier.proto index d9b6215c..ae49735a 100644 --- a/pkg/notifier/notifier.proto +++ b/pkg/notifier/notifier.proto @@ -3,13 +3,20 @@ syntax = "proto3"; package notifier; option go_package = "./;notifier"; -message Empty {} - -message ConfigsRequest { +message LoadConfigsRequest { map configs = 1; } +message LoadConfigsResponse { +} + +message UpdateX509SVIDRequest { +} + +message UpdateX509SVIDResponse { +} + service Notifier { - rpc LoadConfigs(ConfigsRequest) returns (Empty) {}; - rpc UpdateX509SVID(Empty) returns (Empty) {}; + rpc LoadConfigs(LoadConfigsRequest) returns (LoadConfigsResponse) {}; + rpc UpdateX509SVID(UpdateX509SVIDRequest) returns (UpdateX509SVIDResponse) {}; } diff --git a/pkg/notifier/notifier_grpc.pb.go b/pkg/notifier/notifier_grpc.pb.go index 8b19df1e..1f48e2c8 100644 --- a/pkg/notifier/notifier_grpc.pb.go +++ b/pkg/notifier/notifier_grpc.pb.go @@ -27,8 +27,8 @@ const ( // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type NotifierClient interface { - LoadConfigs(ctx context.Context, in *ConfigsRequest, opts ...grpc.CallOption) (*Empty, error) - UpdateX509SVID(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) + LoadConfigs(ctx context.Context, in *LoadConfigsRequest, opts ...grpc.CallOption) (*LoadConfigsResponse, error) + UpdateX509SVID(ctx context.Context, in *UpdateX509SVIDRequest, opts ...grpc.CallOption) (*UpdateX509SVIDResponse, error) } type notifierClient struct { @@ -39,8 +39,8 @@ func NewNotifierClient(cc grpc.ClientConnInterface) NotifierClient { return ¬ifierClient{cc} } -func (c *notifierClient) LoadConfigs(ctx context.Context, in *ConfigsRequest, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) +func (c *notifierClient) LoadConfigs(ctx context.Context, in *LoadConfigsRequest, opts ...grpc.CallOption) (*LoadConfigsResponse, error) { + out := new(LoadConfigsResponse) err := c.cc.Invoke(ctx, Notifier_LoadConfigs_FullMethodName, in, out, opts...) if err != nil { return nil, err @@ -48,8 +48,8 @@ func (c *notifierClient) LoadConfigs(ctx context.Context, in *ConfigsRequest, op return out, nil } -func (c *notifierClient) UpdateX509SVID(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) +func (c *notifierClient) UpdateX509SVID(ctx context.Context, in *UpdateX509SVIDRequest, opts ...grpc.CallOption) (*UpdateX509SVIDResponse, error) { + out := new(UpdateX509SVIDResponse) err := c.cc.Invoke(ctx, Notifier_UpdateX509SVID_FullMethodName, in, out, opts...) if err != nil { return nil, err @@ -61,8 +61,8 @@ func (c *notifierClient) UpdateX509SVID(ctx context.Context, in *Empty, opts ... // All implementations must embed UnimplementedNotifierServer // for forward compatibility type NotifierServer interface { - LoadConfigs(context.Context, *ConfigsRequest) (*Empty, error) - UpdateX509SVID(context.Context, *Empty) (*Empty, error) + LoadConfigs(context.Context, *LoadConfigsRequest) (*LoadConfigsResponse, error) + UpdateX509SVID(context.Context, *UpdateX509SVIDRequest) (*UpdateX509SVIDResponse, error) mustEmbedUnimplementedNotifierServer() } @@ -70,10 +70,10 @@ type NotifierServer interface { type UnimplementedNotifierServer struct { } -func (UnimplementedNotifierServer) LoadConfigs(context.Context, *ConfigsRequest) (*Empty, error) { +func (UnimplementedNotifierServer) LoadConfigs(context.Context, *LoadConfigsRequest) (*LoadConfigsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method LoadConfigs not implemented") } -func (UnimplementedNotifierServer) UpdateX509SVID(context.Context, *Empty) (*Empty, error) { +func (UnimplementedNotifierServer) UpdateX509SVID(context.Context, *UpdateX509SVIDRequest) (*UpdateX509SVIDResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateX509SVID not implemented") } func (UnimplementedNotifierServer) mustEmbedUnimplementedNotifierServer() {} @@ -90,7 +90,7 @@ func RegisterNotifierServer(s grpc.ServiceRegistrar, srv NotifierServer) { } func _Notifier_LoadConfigs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ConfigsRequest) + in := new(LoadConfigsRequest) if err := dec(in); err != nil { return nil, err } @@ -102,13 +102,13 @@ func _Notifier_LoadConfigs_Handler(srv interface{}, ctx context.Context, dec fun FullMethod: Notifier_LoadConfigs_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(NotifierServer).LoadConfigs(ctx, req.(*ConfigsRequest)) + return srv.(NotifierServer).LoadConfigs(ctx, req.(*LoadConfigsRequest)) } return interceptor(ctx, in, info, handler) } func _Notifier_UpdateX509SVID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Empty) + in := new(UpdateX509SVIDRequest) if err := dec(in); err != nil { return nil, err } @@ -120,7 +120,7 @@ func _Notifier_UpdateX509SVID_Handler(srv interface{}, ctx context.Context, dec FullMethod: Notifier_UpdateX509SVID_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(NotifierServer).UpdateX509SVID(ctx, req.(*Empty)) + return srv.(NotifierServer).UpdateX509SVID(ctx, req.(*UpdateX509SVIDRequest)) } return interceptor(ctx, in, info, handler) } diff --git a/pkg/notifier/shared.go b/pkg/notifier/shared.go index c1838eb6..1f8c3722 100644 --- a/pkg/notifier/shared.go +++ b/pkg/notifier/shared.go @@ -10,15 +10,9 @@ import ( grpc "google.golang.org/grpc" ) -type Notifier interface { - LoadConfigs(context.Context, *ConfigsRequest) (*Empty, error) - UpdateX509SVID(context.Context, *Empty) (*Empty, error) - mustEmbedUnimplementedNotifierServer() -} - type GRPCNotifier struct { plugin.Plugin - Impl Notifier + Impl NotifierServer } func (p *GRPCNotifier) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error { @@ -34,11 +28,11 @@ type GRPCClient struct { client NotifierClient } -func (m *GRPCClient) LoadConfigs(ctx context.Context, config *ConfigsRequest) (*Empty, error) { +func (m *GRPCClient) LoadConfigs(ctx context.Context, config *LoadConfigsRequest) (*LoadConfigsResponse, error) { return m.client.LoadConfigs(context.Background(), config) } -func (m *GRPCClient) UpdateX509SVID(ctx context.Context, empty *Empty) (*Empty, error) { +func (m *GRPCClient) UpdateX509SVID(ctx context.Context, empty *UpdateX509SVIDRequest) (*UpdateX509SVIDResponse, error) { return m.client.UpdateX509SVID(context.Background(), empty) } @@ -46,17 +40,17 @@ func (m *GRPCClient) mustEmbedUnimplementedNotifierServer() { } type GRPCServer struct { - Impl Notifier + Impl NotifierServer } -func (m *GRPCServer) LoadConfigs(ctx context.Context, config *ConfigsRequest) (*Empty, error) { - _, err := m.Impl.LoadConfigs(ctx, config) - return &Empty{}, err +func (m *GRPCServer) LoadConfigs(ctx context.Context, request *LoadConfigsRequest) (*LoadConfigsResponse, error) { + _, err := m.Impl.LoadConfigs(ctx, request) + return &LoadConfigsResponse{}, err } -func (m *GRPCServer) UpdateX509SVID(ctx context.Context, empty *Empty) (*Empty, error) { - _, err := m.Impl.UpdateX509SVID(ctx, empty) - return &Empty{}, err +func (m *GRPCServer) UpdateX509SVID(ctx context.Context, request *UpdateX509SVIDRequest) (*UpdateX509SVIDResponse, error) { + _, err := m.Impl.UpdateX509SVID(ctx, request) + return &UpdateX509SVIDResponse{}, err } func (m *GRPCServer) mustEmbedUnimplementedNotifierServer() { diff --git a/pkg/notifier/simple-example/simple-example.go b/pkg/notifier/simple-example/simple-example.go index f7b66f18..728ada70 100644 --- a/pkg/notifier/simple-example/simple-example.go +++ b/pkg/notifier/simple-example/simple-example.go @@ -12,15 +12,15 @@ type SimplePlugin struct { pb.NotifierServer } -func (s *SimplePlugin) LoadConfigs(ctx context.Context, request *pb.ConfigsRequest) (*pb.Empty, error) { +func (s *SimplePlugin) LoadConfigs(ctx context.Context, request *pb.LoadConfigsRequest) (*pb.LoadConfigsResponse, error) { configs := request.Configs log.Printf("Message sent by %s to %s: %s", configs["from"], configs["to"], configs["message"]) - return &pb.Empty{}, nil + return &pb.LoadConfigsResponse{}, nil } -func (s *SimplePlugin) UpdateX509SVID(ctx context.Context, empty *pb.Empty) (*pb.Empty, error) { +func (s *SimplePlugin) UpdateX509SVID(ctx context.Context, request *pb.UpdateX509SVIDRequest) (*pb.UpdateX509SVIDResponse, error) { log.Printf("Svid updated") - return &pb.Empty{}, nil + return &pb.UpdateX509SVIDResponse{}, nil } func main() { diff --git a/pkg/sidecar/sidecar.go b/pkg/sidecar/sidecar.go index a42b475c..0522959a 100644 --- a/pkg/sidecar/sidecar.go +++ b/pkg/sidecar/sidecar.go @@ -33,7 +33,7 @@ type Sidecar struct { processRunning int32 process *os.Process certReadyChan chan struct{} - plugins map[string]*pb.Notifier + plugins map[string]*pb.NotifierServer } // New creates a new SPIFFE sidecar @@ -61,7 +61,7 @@ func New(configPath string, log logrus.FieldLogger) (*Sidecar, error) { sidecar := &Sidecar{ config: config, certReadyChan: make(chan struct{}, 1), - plugins: make(map[string]*pb.Notifier), + plugins: make(map[string]*pb.NotifierServer), } sidecar.loadPlugins() @@ -151,7 +151,7 @@ func (s *Sidecar) loadPlugins() { continue } - request := &pb.ConfigsRequest{} + request := &pb.LoadConfigsRequest{} request.Configs = pluginConfig request.Configs["certDir"] = s.config.CertDir request.Configs["addIntermediatesToBundle"] = strconv.FormatBool(s.config.AddIntermediatesToBundle) @@ -179,7 +179,7 @@ func (s *Sidecar) loadPlugins() { continue } - notifier := raw.(pb.Notifier) + notifier := raw.(pb.NotifierServer) response, err := notifier.LoadConfigs(context.Background(), request) if err != nil { s.config.Log.Warnf("Failed to load configs into plugin %s", pluginName) @@ -205,7 +205,7 @@ func (s *Sidecar) checkProcessExit() { func (s *Sidecar) notifyPlugins() { for pluginName := range s.plugins { plugin := *s.plugins[pluginName] - _, err := plugin.UpdateX509SVID(context.Background(), &pb.Empty{}) + _, err := plugin.UpdateX509SVID(context.Background(), &pb.UpdateX509SVIDRequest{}) if err != nil { s.config.Log.Warnf("Failed to update x509 svid to plugin %s", pluginName) continue