diff --git a/sdk/golang/ccnp/eventlog/eventlog.go b/sdk/golang/ccnp/eventlog/eventlog.go new file mode 100644 index 00000000..36243f67 --- /dev/null +++ b/sdk/golang/ccnp/eventlog/eventlog.go @@ -0,0 +1,166 @@ +/* +* Copyright (c) 2023, Intel Corporation. All rights reserved.
+* SPDX-License-Identifier: Apache-2.0 + */ + +package eventlog + +import ( + "context" + "encoding/json" + "log" + "os" + "time" + + pb "github.com/intel/confidential-cloud-native-primitives/sdk/golang/ccnp/eventlog/proto" + el "github.com/intel/confidential-cloud-native-primitives/service/eventlog-server/resources" + pkgerrors "github.com/pkg/errors" + "google.golang.org/grpc" +) + +const ( + UDS_PATH = "unix:/run/ccnp/uds/eventlog.sock" +) + +type CCEventLogEntry struct { + RegIdx uint32 + EvtType uint32 + EvtSize uint32 + AlgId uint16 + Event []uint8 + Digest []uint8 +} + +type GetPlatformEventlogOptions struct { + eventlogCategory pb.CATEGORY + startPosition int32 + count int32 +} + +func WithEventlogCategory(eventlogCategory pb.CATEGORY) func(*GetPlatformEventlogOptions) { + return func(opts *GetPlatformEventlogOptions) { + opts.eventlogCategory = eventlogCategory + } +} + +func WithStartPosition(startPosition int32) func(*GetPlatformEventlogOptions) { + return func(opts *GetPlatformEventlogOptions) { + opts.startPosition = startPosition + } +} + +func WithCount(count int32) func(*GetPlatformEventlogOptions) { + return func(opts *GetPlatformEventlogOptions) { + opts.count = count + } +} + +func isEventlogCategoryValid(eventlogCategory pb.CATEGORY) bool { + return eventlogCategory == pb.CATEGORY_TDX_EVENTLOG || eventlogCategory == pb.CATEGORY_TPM_EVENTLOG +} + +func getRawEventlogs(response *pb.GetEventlogReply) ([]byte, error) { + path := response.EventlogDataLoc + if path == "" { + log.Fatalf("[getRawEventlogs] Failed to get eventlog from server") + } + + data, err := os.ReadFile(path) + if err != nil { + log.Fatalf("[getRawEventlogs] Error reading data from %v: %v", path, err) + } + + return data, nil +} + +func parseTdxEventlog(rawEventlog []byte) ([]CCEventLogEntry, error) { + var jsonEventlog = el.TDEventLogs{} + err := json.Unmarshal(rawEventlog, &jsonEventlog) + if err != nil { + log.Fatalf("[parseEventlog] Error unmarshal raw eventlog: %v", err) + } + + rawEventLogList := jsonEventlog.EventLogs + var parsedEventLogList []CCEventLogEntry + for i := 0; i < len(rawEventLogList); i++ { + rawEventlog := rawEventLogList[i] + eventLog := CCEventLogEntry{} + + if rawEventlog.DigestCount < 1 { + continue + } + + eventLog.RegIdx = rawEventlog.Rtmr + eventLog.EvtType = rawEventlog.Etype + eventLog.EvtSize = rawEventlog.EventSize + eventLog.AlgId = rawEventlog.AlgorithmId + eventLog.Event = rawEventlog.Event + eventLog.Digest = []uint8(rawEventlog.Digests[rawEventlog.DigestCount-1]) + parsedEventLogList = append(parsedEventLogList, eventLog) + + } + + return parsedEventLogList, nil +} + +func GetPlatformEventlog(opts ...func(*GetPlatformEventlogOptions)) ([]CCEventLogEntry, error) { + + input := GetPlatformEventlogOptions{eventlogCategory: pb.CATEGORY_TDX_EVENTLOG, startPosition: 0, count: 0} + for _, opt := range opts { + opt(&input) + } + + if !isEventlogCategoryValid(input.eventlogCategory) { + log.Fatalf("[GetPlatformEventlog] Invalid eventlogCategory specified") + } + + if input.eventlogCategory == pb.CATEGORY_TPM_EVENTLOG { + log.Fatalf("[GetPlatformEventlog] TPM to be supported later") + } + + if input.startPosition < 0 { + log.Fatalf("[GetPlatformEventlog] Invalid startPosition specified") + } + + if input.count < 0 { + log.Fatalf("[GetPlatformEventlog] Invalid count specified") + } + + channel, err := grpc.Dial(UDS_PATH, grpc.WithInsecure()) + if err != nil { + log.Fatalf("[GetPlatformEventlog] can not connect to UDS: %v", err) + } + defer channel.Close() + + client := pb.NewEventlogClient(channel) + + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + + response, err := client.GetEventlog(ctx, &pb.GetEventlogRequest{ + EventlogLevel: pb.LEVEL_PAAS, + EventlogCategory: input.eventlogCategory, + StartPosition: input.startPosition, + Count: input.count, + }) + if err != nil { + log.Fatalf("[GetPlatformEventlog] fail to get Platform Eventlog: %v", err) + } + + switch input.eventlogCategory { + case pb.CATEGORY_TDX_EVENTLOG: + rawEventlog, err := getRawEventlogs(response) + if err != nil { + log.Fatalf("[GetPlatformEventlog] fail to get raw eventlog: %v", err) + } + + return parseTdxEventlog(rawEventlog) + + case pb.CATEGORY_TPM_EVENTLOG: + return nil, pkgerrors.New("[GetPlatformEventlog] vTPM to be supported later") + default: + log.Fatalf("[GetPlatformEventlog] unknown TEE enviroment!") + } + + return nil, nil +} diff --git a/sdk/golang/ccnp/eventlog/eventlog_test.go b/sdk/golang/ccnp/eventlog/eventlog_test.go new file mode 100644 index 00000000..e3f17940 --- /dev/null +++ b/sdk/golang/ccnp/eventlog/eventlog_test.go @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2023, Intel Corporation. All rights reserved.
+* SPDX-License-Identifier: Apache-2.0 + */ + +package eventlog + +import ( + "testing" + + pb "github.com/intel/confidential-cloud-native-primitives/sdk/golang/ccnp/eventlog/proto" +) + +func TestGetPlatformEventlogDefault(t *testing.T) { + eventlogs, err := GetPlatformEventlog() + + if err != nil { + t.Fatalf("[TestGetPlatformEventlogDefault] get Platform Eventlog error: %v", err) + } + + if len(eventlogs) == 0 { + t.Fatalf("[TestGetPlatformEventlogDefault] error: no eventlog returns") + } + +} + +func TestGetPlatformEventlogWithEventlogCategory(t *testing.T) { + + eventlogs, err := GetPlatformEventlog(WithEventlogCategory(pb.CATEGORY_TDX_EVENTLOG)) + + if err != nil { + t.Fatalf("[TestGetPlatformEventlogWithEventlogCategory] get Platform Eventlog error: %v", err) + } + + if len(eventlogs) == 0 { + t.Fatalf("[TestGetPlatformEventlogWithEventlogCategory] error: no eventlog returns") + } + +} + +func TestGetPlatformEventlogWithStartPosition(t *testing.T) { + + eventlogs, err := GetPlatformEventlog(WithStartPosition(2)) + + if err != nil { + t.Fatalf("[TestGetPlatformEventlogWithEventlogCategory] get Platform Eventlog error: %v", err) + } + + if len(eventlogs) == 0 { + t.Fatalf("[TestGetPlatformEventlogWithEventlogCategory] error: no eventlog returns") + } + +} + +func TestGetPlatformEventlogWithStartPositionAndCount(t *testing.T) { + + eventlogs, err := GetPlatformEventlog(WithStartPosition(2), WithCount(5)) + + if err != nil { + t.Fatalf("[TestGetPlatformEventlogWithStartPositionAndCount] get Platform Eventlog error: %v", err) + } + + if len(eventlogs) != 5 { + t.Fatalf("[TestGetPlatformEventlogWithStartPositionAndCount] error: expected number of logs is 5, retrieved %v", len(eventlogs)) + } + +} + +func TestGetPlatformEventlogWithAllOptions(t *testing.T) { + + eventlogs, err := GetPlatformEventlog(WithEventlogCategory(pb.CATEGORY_TDX_EVENTLOG), WithStartPosition(2), WithCount(3)) + + if err != nil { + t.Fatalf("[TestGetPlatformEventlogWithAllOptions] get Platform Eventlog error: %v", err) + } + + if len(eventlogs) != 3 { + t.Fatalf("[TestGetPlatformEventlogWithAllOptions] error: expected number of logs is 3, retrieved %v", len(eventlogs)) + } + +} diff --git a/sdk/golang/ccnp/eventlog/proto/eventlog-server.pb.go b/sdk/golang/ccnp/eventlog/proto/eventlog-server.pb.go new file mode 100644 index 00000000..2c0d7734 --- /dev/null +++ b/sdk/golang/ccnp/eventlog/proto/eventlog-server.pb.go @@ -0,0 +1,208 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: proto/eventlog-server.proto + +package getEventlog + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type CATEGORY int32 + +const ( + CATEGORY_TDX_EVENTLOG CATEGORY = 0 + CATEGORY_TPM_EVENTLOG CATEGORY = 1 +) + +var CATEGORY_name = map[int32]string{ + 0: "TDX_EVENTLOG", + 1: "TPM_EVENTLOG", +} + +var CATEGORY_value = map[string]int32{ + "TDX_EVENTLOG": 0, + "TPM_EVENTLOG": 1, +} + +func (x CATEGORY) String() string { + return proto.EnumName(CATEGORY_name, int32(x)) +} + +func (CATEGORY) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_3d123471d781508e, []int{0} +} + +type LEVEL int32 + +const ( + LEVEL_PAAS LEVEL = 0 + LEVEL_SAAS LEVEL = 1 +) + +var LEVEL_name = map[int32]string{ + 0: "PAAS", + 1: "SAAS", +} + +var LEVEL_value = map[string]int32{ + "PAAS": 0, + "SAAS": 1, +} + +func (x LEVEL) String() string { + return proto.EnumName(LEVEL_name, int32(x)) +} + +func (LEVEL) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_3d123471d781508e, []int{1} +} + +type GetEventlogRequest struct { + EventlogLevel LEVEL `protobuf:"varint,1,opt,name=eventlog_level,json=eventlogLevel,proto3,enum=LEVEL" json:"eventlog_level,omitempty"` + EventlogCategory CATEGORY `protobuf:"varint,2,opt,name=eventlog_category,json=eventlogCategory,proto3,enum=CATEGORY" json:"eventlog_category,omitempty"` + StartPosition int32 `protobuf:"varint,3,opt,name=start_position,json=startPosition,proto3" json:"start_position,omitempty"` + Count int32 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetEventlogRequest) Reset() { *m = GetEventlogRequest{} } +func (m *GetEventlogRequest) String() string { return proto.CompactTextString(m) } +func (*GetEventlogRequest) ProtoMessage() {} +func (*GetEventlogRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_3d123471d781508e, []int{0} +} + +func (m *GetEventlogRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetEventlogRequest.Unmarshal(m, b) +} +func (m *GetEventlogRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetEventlogRequest.Marshal(b, m, deterministic) +} +func (m *GetEventlogRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetEventlogRequest.Merge(m, src) +} +func (m *GetEventlogRequest) XXX_Size() int { + return xxx_messageInfo_GetEventlogRequest.Size(m) +} +func (m *GetEventlogRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetEventlogRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetEventlogRequest proto.InternalMessageInfo + +func (m *GetEventlogRequest) GetEventlogLevel() LEVEL { + if m != nil { + return m.EventlogLevel + } + return LEVEL_PAAS +} + +func (m *GetEventlogRequest) GetEventlogCategory() CATEGORY { + if m != nil { + return m.EventlogCategory + } + return CATEGORY_TDX_EVENTLOG +} + +func (m *GetEventlogRequest) GetStartPosition() int32 { + if m != nil { + return m.StartPosition + } + return 0 +} + +func (m *GetEventlogRequest) GetCount() int32 { + if m != nil { + return m.Count + } + return 0 +} + +type GetEventlogReply struct { + EventlogDataLoc string `protobuf:"bytes,1,opt,name=eventlog_data_loc,json=eventlogDataLoc,proto3" json:"eventlog_data_loc,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetEventlogReply) Reset() { *m = GetEventlogReply{} } +func (m *GetEventlogReply) String() string { return proto.CompactTextString(m) } +func (*GetEventlogReply) ProtoMessage() {} +func (*GetEventlogReply) Descriptor() ([]byte, []int) { + return fileDescriptor_3d123471d781508e, []int{1} +} + +func (m *GetEventlogReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetEventlogReply.Unmarshal(m, b) +} +func (m *GetEventlogReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetEventlogReply.Marshal(b, m, deterministic) +} +func (m *GetEventlogReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetEventlogReply.Merge(m, src) +} +func (m *GetEventlogReply) XXX_Size() int { + return xxx_messageInfo_GetEventlogReply.Size(m) +} +func (m *GetEventlogReply) XXX_DiscardUnknown() { + xxx_messageInfo_GetEventlogReply.DiscardUnknown(m) +} + +var xxx_messageInfo_GetEventlogReply proto.InternalMessageInfo + +func (m *GetEventlogReply) GetEventlogDataLoc() string { + if m != nil { + return m.EventlogDataLoc + } + return "" +} + +func init() { + proto.RegisterEnum("CATEGORY", CATEGORY_name, CATEGORY_value) + proto.RegisterEnum("LEVEL", LEVEL_name, LEVEL_value) + proto.RegisterType((*GetEventlogRequest)(nil), "GetEventlogRequest") + proto.RegisterType((*GetEventlogReply)(nil), "GetEventlogReply") +} + +func init() { proto.RegisterFile("proto/eventlog-server.proto", fileDescriptor_3d123471d781508e) } + +var fileDescriptor_3d123471d781508e = []byte{ + // 350 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0x51, 0x6b, 0xf2, 0x30, + 0x14, 0x86, 0xed, 0xf7, 0xa9, 0x68, 0x36, 0x5d, 0xcd, 0x76, 0x51, 0xe6, 0x8d, 0x08, 0x03, 0x11, + 0xda, 0x82, 0x83, 0xed, 0x6e, 0xe0, 0xb4, 0x78, 0xd3, 0x4d, 0xa9, 0x22, 0xdb, 0x6e, 0x4a, 0x8c, + 0x59, 0x17, 0x88, 0x4d, 0xd7, 0x9e, 0x16, 0xfc, 0x67, 0xfb, 0x79, 0xa3, 0xd1, 0x4e, 0xe7, 0xee, + 0x4e, 0x9f, 0xf7, 0x2d, 0x79, 0x92, 0x83, 0xda, 0x51, 0x2c, 0x41, 0xda, 0x2c, 0x63, 0x21, 0x08, + 0x19, 0x98, 0x09, 0x8b, 0x33, 0x16, 0x5b, 0x8a, 0x76, 0xbf, 0x34, 0x84, 0x27, 0x0c, 0x9c, 0x7d, + 0xe8, 0xb1, 0xcf, 0x94, 0x25, 0x80, 0x4d, 0xd4, 0x2c, 0xfa, 0xbe, 0x60, 0x19, 0x13, 0x86, 0xd6, + 0xd1, 0x7a, 0xcd, 0x41, 0xd5, 0x72, 0x9d, 0xa5, 0xe3, 0x7a, 0x8d, 0x22, 0x75, 0xf3, 0x10, 0xdf, + 0xa1, 0xd6, 0x4f, 0x9d, 0x12, 0x60, 0x81, 0x8c, 0xb7, 0xc6, 0x3f, 0xf5, 0x47, 0xdd, 0x1a, 0x0d, + 0x17, 0xce, 0x64, 0xea, 0xbd, 0x7a, 0x7a, 0xd1, 0x19, 0xed, 0x2b, 0xf8, 0x06, 0x35, 0x13, 0x20, + 0x31, 0xf8, 0x91, 0x4c, 0x38, 0x70, 0x19, 0x1a, 0xff, 0x3b, 0x5a, 0xaf, 0xe2, 0x35, 0x14, 0x9d, + 0xed, 0x21, 0xbe, 0x42, 0x15, 0x2a, 0xd3, 0x10, 0x8c, 0xb2, 0x4a, 0x77, 0x1f, 0xdd, 0x07, 0xa4, + 0xff, 0x32, 0x8f, 0xc4, 0x16, 0xf7, 0x8f, 0x44, 0xd6, 0x04, 0x88, 0x2f, 0x24, 0x55, 0xea, 0x75, + 0xef, 0xa2, 0x08, 0xc6, 0x04, 0x88, 0x2b, 0x69, 0xdf, 0x42, 0xb5, 0x42, 0x0d, 0xeb, 0xe8, 0x7c, + 0x31, 0x7e, 0xf1, 0x9d, 0xa5, 0xf3, 0xbc, 0x70, 0xa7, 0x13, 0xbd, 0xa4, 0xc8, 0xec, 0xe9, 0x40, + 0xb4, 0x7e, 0x1b, 0x55, 0xd4, 0xe5, 0x71, 0x0d, 0x95, 0x67, 0xc3, 0xe1, 0x5c, 0x2f, 0xe5, 0xd3, + 0x3c, 0x9f, 0xb4, 0xc1, 0x08, 0xd5, 0x0a, 0x13, 0x7c, 0x8f, 0xce, 0x8e, 0xc4, 0xf0, 0xa5, 0xf5, + 0xf7, 0x81, 0xaf, 0x5b, 0xd6, 0xa9, 0x7b, 0xb7, 0xf4, 0x48, 0xde, 0xfc, 0x80, 0xc3, 0x47, 0xba, + 0xb2, 0xa8, 0xdc, 0xd8, 0x3c, 0x04, 0x26, 0x6c, 0x2a, 0xc3, 0x77, 0xbe, 0x66, 0x21, 0x70, 0x22, + 0x4c, 0x2a, 0x64, 0xba, 0x36, 0x43, 0x02, 0x3c, 0x63, 0x66, 0x14, 0xf3, 0x0d, 0xcf, 0xa7, 0xc4, + 0xce, 0x57, 0xca, 0x29, 0x3b, 0xdd, 0xb1, 0xbd, 0xdb, 0x7c, 0x70, 0x38, 0x69, 0x55, 0x55, 0xe8, + 0xf6, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x51, 0xe1, 0x30, 0x36, 0x15, 0x02, 0x00, 0x00, +} diff --git a/sdk/golang/ccnp/eventlog/proto/eventlog-server.proto b/sdk/golang/ccnp/eventlog/proto/eventlog-server.proto new file mode 100644 index 00000000..2d17846f --- /dev/null +++ b/sdk/golang/ccnp/eventlog/proto/eventlog-server.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; +option go_package = "github.com/intel/confidential-cloud-native-primitives/service/eventlog-server/proto/getEventlog"; + +enum CATEGORY { + TDX_EVENTLOG = 0; + TPM_EVENTLOG = 1; +} + +enum LEVEL { + PAAS = 0; + SAAS = 1; +} + +message GetEventlogRequest { + LEVEL eventlog_level = 1; + CATEGORY eventlog_category = 2; + int32 start_position = 3; + int32 count = 4; +} + +message GetEventlogReply { + string eventlog_data_loc = 1; +} + +service Eventlog { + rpc GetEventlog (GetEventlogRequest) returns (GetEventlogReply) {} +} diff --git a/sdk/golang/ccnp/eventlog/proto/eventlog-server_grpc.pb.go b/sdk/golang/ccnp/eventlog/proto/eventlog-server_grpc.pb.go new file mode 100644 index 00000000..fa97032a --- /dev/null +++ b/sdk/golang/ccnp/eventlog/proto/eventlog-server_grpc.pb.go @@ -0,0 +1,105 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.11.4 +// source: proto/eventlog-server.proto + +package getEventlog + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// EventlogClient is the client API for Eventlog service. +// +// 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 EventlogClient interface { + GetEventlog(ctx context.Context, in *GetEventlogRequest, opts ...grpc.CallOption) (*GetEventlogReply, error) +} + +type eventlogClient struct { + cc grpc.ClientConnInterface +} + +func NewEventlogClient(cc grpc.ClientConnInterface) EventlogClient { + return &eventlogClient{cc} +} + +func (c *eventlogClient) GetEventlog(ctx context.Context, in *GetEventlogRequest, opts ...grpc.CallOption) (*GetEventlogReply, error) { + out := new(GetEventlogReply) + err := c.cc.Invoke(ctx, "/Eventlog/GetEventlog", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// EventlogServer is the server API for Eventlog service. +// All implementations must embed UnimplementedEventlogServer +// for forward compatibility +type EventlogServer interface { + GetEventlog(context.Context, *GetEventlogRequest) (*GetEventlogReply, error) + mustEmbedUnimplementedEventlogServer() +} + +// UnimplementedEventlogServer must be embedded to have forward compatible implementations. +type UnimplementedEventlogServer struct { +} + +func (UnimplementedEventlogServer) GetEventlog(context.Context, *GetEventlogRequest) (*GetEventlogReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetEventlog not implemented") +} +func (UnimplementedEventlogServer) mustEmbedUnimplementedEventlogServer() {} + +// UnsafeEventlogServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to EventlogServer will +// result in compilation errors. +type UnsafeEventlogServer interface { + mustEmbedUnimplementedEventlogServer() +} + +func RegisterEventlogServer(s grpc.ServiceRegistrar, srv EventlogServer) { + s.RegisterService(&Eventlog_ServiceDesc, srv) +} + +func _Eventlog_GetEventlog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetEventlogRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(EventlogServer).GetEventlog(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/Eventlog/GetEventlog", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EventlogServer).GetEventlog(ctx, req.(*GetEventlogRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Eventlog_ServiceDesc is the grpc.ServiceDesc for Eventlog service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Eventlog_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "Eventlog", + HandlerType: (*EventlogServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetEventlog", + Handler: _Eventlog_GetEventlog_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "proto/eventlog-server.proto", +}