From e719e0e8cd82a05c5f51f7d18bebff3f1bc128bd Mon Sep 17 00:00:00 2001 From: Matthew Burns Date: Wed, 29 Nov 2023 10:33:19 -0700 Subject: [PATCH 1/3] SEL capture support added from bmclib, updated to latest bmclib. Signed-off-by: Matthew Burns --- .devcontainer/devcontainer.json | 25 -- api/v1/diagnostic.pb.go | 484 ------------------------------ api/v1/diagnostic.proto | 27 ++ api/v1/diagnostic.validator.pb.go | 59 ---- api/v1/diagnostic_grpc.pb.go | 185 ------------ client/client.go | 9 + cmd/sel.go | 92 ++++++ go.mod | 2 +- go.sum | 7 +- grpc/oob/diagnostic/diagnostic.go | 10 +- grpc/oob/diagnostic/getsel.go | 203 +++++++++++++ grpc/rpc/diagnostic.go | 60 ++++ 12 files changed, 403 insertions(+), 760 deletions(-) delete mode 100644 .devcontainer/devcontainer.json delete mode 100644 api/v1/diagnostic.pb.go delete mode 100644 api/v1/diagnostic.validator.pb.go delete mode 100644 api/v1/diagnostic_grpc.pb.go create mode 100644 grpc/oob/diagnostic/getsel.go diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 762a19e..0000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,25 +0,0 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the -// README at: https://github.com/devcontainers/templates/tree/main/src/go -{ - "name": "Go", - // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "image": "mcr.microsoft.com/devcontainers/go:1-1.21-bullseye", - "features": { - "ghcr.io/devcontainers-contrib/features/protoc-asdf:1": {} - } - - // Features to add to the dev container. More info: https://containers.dev/features. - // "features": {}, - - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - - // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "go version", - - // Configure tool-specific properties. - // "customizations": {}, - - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" -} diff --git a/api/v1/diagnostic.pb.go b/api/v1/diagnostic.pb.go deleted file mode 100644 index 24d5171..0000000 --- a/api/v1/diagnostic.pb.go +++ /dev/null @@ -1,484 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc v4.25.3 -// source: api/v1/diagnostic.proto - -package v1 - -import ( - reflect "reflect" - sync "sync" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - emptypb "google.golang.org/protobuf/types/known/emptypb" -) - -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 ScreenshotRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Authn *Authn `protobuf:"bytes,1,opt,name=authn,proto3" json:"authn,omitempty"` - Vendor *Vendor `protobuf:"bytes,2,opt,name=vendor,proto3" json:"vendor,omitempty"` -} - -func (x *ScreenshotRequest) Reset() { - *x = ScreenshotRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v1_diagnostic_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ScreenshotRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ScreenshotRequest) ProtoMessage() {} - -func (x *ScreenshotRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_diagnostic_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 ScreenshotRequest.ProtoReflect.Descriptor instead. -func (*ScreenshotRequest) Descriptor() ([]byte, []int) { - return file_api_v1_diagnostic_proto_rawDescGZIP(), []int{0} -} - -func (x *ScreenshotRequest) GetAuthn() *Authn { - if x != nil { - return x.Authn - } - return nil -} - -func (x *ScreenshotRequest) GetVendor() *Vendor { - if x != nil { - return x.Vendor - } - return nil -} - -type ScreenshotResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Image []byte `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"` - Filetype string `protobuf:"bytes,2,opt,name=filetype,proto3" json:"filetype,omitempty"` -} - -func (x *ScreenshotResponse) Reset() { - *x = ScreenshotResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v1_diagnostic_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ScreenshotResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ScreenshotResponse) ProtoMessage() {} - -func (x *ScreenshotResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_diagnostic_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 ScreenshotResponse.ProtoReflect.Descriptor instead. -func (*ScreenshotResponse) Descriptor() ([]byte, []int) { - return file_api_v1_diagnostic_proto_rawDescGZIP(), []int{1} -} - -func (x *ScreenshotResponse) GetImage() []byte { - if x != nil { - return x.Image - } - return nil -} - -func (x *ScreenshotResponse) GetFiletype() string { - if x != nil { - return x.Filetype - } - return "" -} - -type ClearSystemEventLogRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Authn *Authn `protobuf:"bytes,1,opt,name=authn,proto3" json:"authn,omitempty"` - Vendor *Vendor `protobuf:"bytes,2,opt,name=vendor,proto3" json:"vendor,omitempty"` -} - -func (x *ClearSystemEventLogRequest) Reset() { - *x = ClearSystemEventLogRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v1_diagnostic_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClearSystemEventLogRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClearSystemEventLogRequest) ProtoMessage() {} - -func (x *ClearSystemEventLogRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_diagnostic_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 ClearSystemEventLogRequest.ProtoReflect.Descriptor instead. -func (*ClearSystemEventLogRequest) Descriptor() ([]byte, []int) { - return file_api_v1_diagnostic_proto_rawDescGZIP(), []int{2} -} - -func (x *ClearSystemEventLogRequest) GetAuthn() *Authn { - if x != nil { - return x.Authn - } - return nil -} - -func (x *ClearSystemEventLogRequest) GetVendor() *Vendor { - if x != nil { - return x.Vendor - } - return nil -} - -type ClearSystemEventLogResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` -} - -func (x *ClearSystemEventLogResponse) Reset() { - *x = ClearSystemEventLogResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v1_diagnostic_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClearSystemEventLogResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClearSystemEventLogResponse) ProtoMessage() {} - -func (x *ClearSystemEventLogResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_diagnostic_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 ClearSystemEventLogResponse.ProtoReflect.Descriptor instead. -func (*ClearSystemEventLogResponse) Descriptor() ([]byte, []int) { - return file_api_v1_diagnostic_proto_rawDescGZIP(), []int{3} -} - -func (x *ClearSystemEventLogResponse) GetTaskId() string { - if x != nil { - return x.TaskId - } - return "" -} - -type SendNMIRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Authn *Authn `protobuf:"bytes,1,opt,name=authn,proto3" json:"authn,omitempty"` -} - -func (x *SendNMIRequest) Reset() { - *x = SendNMIRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v1_diagnostic_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SendNMIRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SendNMIRequest) ProtoMessage() {} - -func (x *SendNMIRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_diagnostic_proto_msgTypes[4] - 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 SendNMIRequest.ProtoReflect.Descriptor instead. -func (*SendNMIRequest) Descriptor() ([]byte, []int) { - return file_api_v1_diagnostic_proto_rawDescGZIP(), []int{4} -} - -func (x *SendNMIRequest) GetAuthn() *Authn { - if x != nil { - return x.Authn - } - return nil -} - -var File_api_v1_diagnostic_proto protoreflect.FileDescriptor - -var file_api_v1_diagnostic_proto_rawDesc = []byte{ - 0x0a, 0x17, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, - 0x74, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x21, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, - 0x2e, 0x70, 0x62, 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, - 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x13, 0x61, 0x70, 0x69, 0x2f, 0x76, - 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x96, - 0x01, 0x0a, 0x11, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x05, 0x61, 0x75, 0x74, 0x68, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, 0x6a, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6e, 0x52, 0x05, 0x61, - 0x75, 0x74, 0x68, 0x6e, 0x12, 0x41, 0x0a, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, - 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x52, - 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x22, 0x46, 0x0a, 0x12, 0x53, 0x63, 0x72, 0x65, 0x65, - 0x6e, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, - 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x69, 0x6d, - 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x74, 0x79, 0x70, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x74, 0x79, 0x70, 0x65, 0x22, - 0x9f, 0x01, 0x0a, 0x1a, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, - 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, - 0x0a, 0x05, 0x61, 0x75, 0x74, 0x68, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, - 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6e, 0x52, 0x05, 0x61, 0x75, 0x74, 0x68, 0x6e, 0x12, 0x41, - 0x0a, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, - 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, - 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x2e, 0x56, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x52, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, - 0x72, 0x22, 0x36, 0x0a, 0x1b, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x50, 0x0a, 0x0e, 0x53, 0x65, 0x6e, - 0x64, 0x4e, 0x4d, 0x49, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x05, 0x61, - 0x75, 0x74, 0x68, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, - 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x41, - 0x75, 0x74, 0x68, 0x6e, 0x52, 0x05, 0x61, 0x75, 0x74, 0x68, 0x6e, 0x32, 0xf4, 0x02, 0x0a, 0x0a, - 0x44, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x12, 0x79, 0x0a, 0x0a, 0x53, 0x63, - 0x72, 0x65, 0x65, 0x6e, 0x73, 0x68, 0x6f, 0x74, 0x12, 0x34, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, - 0x2e, 0x70, 0x62, 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x72, - 0x65, 0x65, 0x6e, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, - 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, - 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x2e, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x94, 0x01, 0x0a, 0x13, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x53, - 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x12, 0x3d, 0x2e, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, - 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3e, 0x2e, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, - 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x76, 0x65, 0x6e, - 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x07, - 0x53, 0x65, 0x6e, 0x64, 0x4e, 0x4d, 0x49, 0x12, 0x31, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, - 0x70, 0x62, 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6e, 0x64, - 0x4e, 0x4d, 0x49, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x42, 0x33, 0x5a, 0x21, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2f, 0x70, 0x62, 0x6e, 0x6a, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0xea, 0x02, 0x0d, 0x50, 0x62, 0x6e, 0x6a, 0x3a, 0x3a, - 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_api_v1_diagnostic_proto_rawDescOnce sync.Once - file_api_v1_diagnostic_proto_rawDescData = file_api_v1_diagnostic_proto_rawDesc -) - -func file_api_v1_diagnostic_proto_rawDescGZIP() []byte { - file_api_v1_diagnostic_proto_rawDescOnce.Do(func() { - file_api_v1_diagnostic_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_v1_diagnostic_proto_rawDescData) - }) - return file_api_v1_diagnostic_proto_rawDescData -} - -var file_api_v1_diagnostic_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_api_v1_diagnostic_proto_goTypes = []interface{}{ - (*ScreenshotRequest)(nil), // 0: github.com.tinkerbell.pbnj.api.v1.ScreenshotRequest - (*ScreenshotResponse)(nil), // 1: github.com.tinkerbell.pbnj.api.v1.ScreenshotResponse - (*ClearSystemEventLogRequest)(nil), // 2: github.com.tinkerbell.pbnj.api.v1.ClearSystemEventLogRequest - (*ClearSystemEventLogResponse)(nil), // 3: github.com.tinkerbell.pbnj.api.v1.ClearSystemEventLogResponse - (*SendNMIRequest)(nil), // 4: github.com.tinkerbell.pbnj.api.v1.SendNMIRequest - (*Authn)(nil), // 5: github.com.tinkerbell.pbnj.api.v1.Authn - (*Vendor)(nil), // 6: github.com.tinkerbell.pbnj.api.v1.Vendor - (*emptypb.Empty)(nil), // 7: google.protobuf.Empty -} -var file_api_v1_diagnostic_proto_depIdxs = []int32{ - 5, // 0: github.com.tinkerbell.pbnj.api.v1.ScreenshotRequest.authn:type_name -> github.com.tinkerbell.pbnj.api.v1.Authn - 6, // 1: github.com.tinkerbell.pbnj.api.v1.ScreenshotRequest.vendor:type_name -> github.com.tinkerbell.pbnj.api.v1.Vendor - 5, // 2: github.com.tinkerbell.pbnj.api.v1.ClearSystemEventLogRequest.authn:type_name -> github.com.tinkerbell.pbnj.api.v1.Authn - 6, // 3: github.com.tinkerbell.pbnj.api.v1.ClearSystemEventLogRequest.vendor:type_name -> github.com.tinkerbell.pbnj.api.v1.Vendor - 5, // 4: github.com.tinkerbell.pbnj.api.v1.SendNMIRequest.authn:type_name -> github.com.tinkerbell.pbnj.api.v1.Authn - 0, // 5: github.com.tinkerbell.pbnj.api.v1.Diagnostic.Screenshot:input_type -> github.com.tinkerbell.pbnj.api.v1.ScreenshotRequest - 2, // 6: github.com.tinkerbell.pbnj.api.v1.Diagnostic.ClearSystemEventLog:input_type -> github.com.tinkerbell.pbnj.api.v1.ClearSystemEventLogRequest - 4, // 7: github.com.tinkerbell.pbnj.api.v1.Diagnostic.SendNMI:input_type -> github.com.tinkerbell.pbnj.api.v1.SendNMIRequest - 1, // 8: github.com.tinkerbell.pbnj.api.v1.Diagnostic.Screenshot:output_type -> github.com.tinkerbell.pbnj.api.v1.ScreenshotResponse - 3, // 9: github.com.tinkerbell.pbnj.api.v1.Diagnostic.ClearSystemEventLog:output_type -> github.com.tinkerbell.pbnj.api.v1.ClearSystemEventLogResponse - 7, // 10: github.com.tinkerbell.pbnj.api.v1.Diagnostic.SendNMI:output_type -> google.protobuf.Empty - 8, // [8:11] is the sub-list for method output_type - 5, // [5:8] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name -} - -func init() { file_api_v1_diagnostic_proto_init() } -func file_api_v1_diagnostic_proto_init() { - if File_api_v1_diagnostic_proto != nil { - return - } - file_api_v1_common_proto_init() - if !protoimpl.UnsafeEnabled { - file_api_v1_diagnostic_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ScreenshotRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v1_diagnostic_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ScreenshotResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v1_diagnostic_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClearSystemEventLogRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v1_diagnostic_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClearSystemEventLogResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v1_diagnostic_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SendNMIRequest); 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_api_v1_diagnostic_proto_rawDesc, - NumEnums: 0, - NumMessages: 5, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_api_v1_diagnostic_proto_goTypes, - DependencyIndexes: file_api_v1_diagnostic_proto_depIdxs, - MessageInfos: file_api_v1_diagnostic_proto_msgTypes, - }.Build() - File_api_v1_diagnostic_proto = out.File - file_api_v1_diagnostic_proto_rawDesc = nil - file_api_v1_diagnostic_proto_goTypes = nil - file_api_v1_diagnostic_proto_depIdxs = nil -} diff --git a/api/v1/diagnostic.proto b/api/v1/diagnostic.proto index a13d371..c3a4662 100644 --- a/api/v1/diagnostic.proto +++ b/api/v1/diagnostic.proto @@ -13,6 +13,8 @@ service Diagnostic { rpc Screenshot (ScreenshotRequest) returns (ScreenshotResponse); rpc ClearSystemEventLog (ClearSystemEventLogRequest) returns (ClearSystemEventLogResponse); rpc SendNMI (SendNMIRequest) returns (google.protobuf.Empty); + rpc GetSystemEventLog (GetSystemEventLogRequest) returns (GetSystemEventLogResponse); + rpc GetSystemEventLogRaw (GetSystemEventLogRawRequest) returns (GetSystemEventLogRawResponse); } message ScreenshotRequest { @@ -37,3 +39,28 @@ message ClearSystemEventLogResponse { message SendNMIRequest { v1.Authn authn = 1; } + +message GetSystemEventLogRequest { + v1.Authn authn = 1; + v1.Vendor vendor = 2; +} + +message SystemEventLogEntry { + string id = 1; + string timestamp = 2; + string description = 3; + string message = 4; +} + +message GetSystemEventLogResponse { + repeated SystemEventLogEntry events = 1; +} + +message GetSystemEventLogRawRequest { + v1.Authn authn = 1; + v1.Vendor vendor = 2; +} + +message GetSystemEventLogRawResponse { + string log = 1; +} diff --git a/api/v1/diagnostic.validator.pb.go b/api/v1/diagnostic.validator.pb.go deleted file mode 100644 index 8fdb97f..0000000 --- a/api/v1/diagnostic.validator.pb.go +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: api/v1/diagnostic.proto - -package v1 - -import ( - fmt "fmt" - math "math" - - proto "github.com/golang/protobuf/proto" - github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" - _ "google.golang.org/protobuf/types/known/emptypb" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -func (this *ScreenshotRequest) Validate() error { - if this.Authn != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Authn); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Authn", err) - } - } - if this.Vendor != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Vendor); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Vendor", err) - } - } - return nil -} -func (this *ScreenshotResponse) Validate() error { - return nil -} -func (this *ClearSystemEventLogRequest) Validate() error { - if this.Authn != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Authn); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Authn", err) - } - } - if this.Vendor != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Vendor); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Vendor", err) - } - } - return nil -} -func (this *ClearSystemEventLogResponse) Validate() error { - return nil -} -func (this *SendNMIRequest) Validate() error { - if this.Authn != nil { - if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Authn); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Authn", err) - } - } - return nil -} diff --git a/api/v1/diagnostic_grpc.pb.go b/api/v1/diagnostic_grpc.pb.go deleted file mode 100644 index 974f9b9..0000000 --- a/api/v1/diagnostic_grpc.pb.go +++ /dev/null @@ -1,185 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.3 -// source: api/v1/diagnostic.proto - -package v1 - -import ( - context "context" - - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - emptypb "google.golang.org/protobuf/types/known/emptypb" -) - -// 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 - -const ( - Diagnostic_Screenshot_FullMethodName = "/github.com.tinkerbell.pbnj.api.v1.Diagnostic/Screenshot" - Diagnostic_ClearSystemEventLog_FullMethodName = "/github.com.tinkerbell.pbnj.api.v1.Diagnostic/ClearSystemEventLog" - Diagnostic_SendNMI_FullMethodName = "/github.com.tinkerbell.pbnj.api.v1.Diagnostic/SendNMI" -) - -// DiagnosticClient is the client API for Diagnostic 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 DiagnosticClient interface { - Screenshot(ctx context.Context, in *ScreenshotRequest, opts ...grpc.CallOption) (*ScreenshotResponse, error) - ClearSystemEventLog(ctx context.Context, in *ClearSystemEventLogRequest, opts ...grpc.CallOption) (*ClearSystemEventLogResponse, error) - SendNMI(ctx context.Context, in *SendNMIRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) -} - -type diagnosticClient struct { - cc grpc.ClientConnInterface -} - -func NewDiagnosticClient(cc grpc.ClientConnInterface) DiagnosticClient { - return &diagnosticClient{cc} -} - -func (c *diagnosticClient) Screenshot(ctx context.Context, in *ScreenshotRequest, opts ...grpc.CallOption) (*ScreenshotResponse, error) { - out := new(ScreenshotResponse) - err := c.cc.Invoke(ctx, Diagnostic_Screenshot_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *diagnosticClient) ClearSystemEventLog(ctx context.Context, in *ClearSystemEventLogRequest, opts ...grpc.CallOption) (*ClearSystemEventLogResponse, error) { - out := new(ClearSystemEventLogResponse) - err := c.cc.Invoke(ctx, Diagnostic_ClearSystemEventLog_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *diagnosticClient) SendNMI(ctx context.Context, in *SendNMIRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, Diagnostic_SendNMI_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// DiagnosticServer is the server API for Diagnostic service. -// All implementations must embed UnimplementedDiagnosticServer -// for forward compatibility -type DiagnosticServer interface { - Screenshot(context.Context, *ScreenshotRequest) (*ScreenshotResponse, error) - ClearSystemEventLog(context.Context, *ClearSystemEventLogRequest) (*ClearSystemEventLogResponse, error) - SendNMI(context.Context, *SendNMIRequest) (*emptypb.Empty, error) - mustEmbedUnimplementedDiagnosticServer() -} - -// UnimplementedDiagnosticServer must be embedded to have forward compatible implementations. -type UnimplementedDiagnosticServer struct { -} - -func (UnimplementedDiagnosticServer) Screenshot(context.Context, *ScreenshotRequest) (*ScreenshotResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Screenshot not implemented") -} -func (UnimplementedDiagnosticServer) ClearSystemEventLog(context.Context, *ClearSystemEventLogRequest) (*ClearSystemEventLogResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClearSystemEventLog not implemented") -} -func (UnimplementedDiagnosticServer) SendNMI(context.Context, *SendNMIRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method SendNMI not implemented") -} -func (UnimplementedDiagnosticServer) mustEmbedUnimplementedDiagnosticServer() {} - -// UnsafeDiagnosticServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to DiagnosticServer will -// result in compilation errors. -type UnsafeDiagnosticServer interface { - mustEmbedUnimplementedDiagnosticServer() -} - -func RegisterDiagnosticServer(s grpc.ServiceRegistrar, srv DiagnosticServer) { - s.RegisterService(&Diagnostic_ServiceDesc, srv) -} - -func _Diagnostic_Screenshot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ScreenshotRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DiagnosticServer).Screenshot(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Diagnostic_Screenshot_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DiagnosticServer).Screenshot(ctx, req.(*ScreenshotRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Diagnostic_ClearSystemEventLog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ClearSystemEventLogRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DiagnosticServer).ClearSystemEventLog(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Diagnostic_ClearSystemEventLog_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DiagnosticServer).ClearSystemEventLog(ctx, req.(*ClearSystemEventLogRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Diagnostic_SendNMI_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SendNMIRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DiagnosticServer).SendNMI(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Diagnostic_SendNMI_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DiagnosticServer).SendNMI(ctx, req.(*SendNMIRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Diagnostic_ServiceDesc is the grpc.ServiceDesc for Diagnostic service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Diagnostic_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "github.com.tinkerbell.pbnj.api.v1.Diagnostic", - HandlerType: (*DiagnosticServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Screenshot", - Handler: _Diagnostic_Screenshot_Handler, - }, - { - MethodName: "ClearSystemEventLog", - Handler: _Diagnostic_ClearSystemEventLog_Handler, - }, - { - MethodName: "SendNMI", - Handler: _Diagnostic_SendNMI_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "api/v1/diagnostic.proto", -} diff --git a/client/client.go b/client/client.go index e53b9a2..488508e 100644 --- a/client/client.go +++ b/client/client.go @@ -150,4 +150,13 @@ func ClearSystemEventLog(ctx context.Context, client v1.DiagnosticClient, taskCl func SendNMI(ctx context.Context, client v1.DiagnosticClient, request *v1.SendNMIRequest) error { _, err := client.SendNMI(ctx, request) return err + +// GetSystemEventLog retrieves the System Event Log of the server. +func GetSystemEventLog(ctx context.Context, client v1.DiagnosticClient, request *v1.GetSystemEventLogRequest) (*v1.GetSystemEventLogResponse, error) { + return client.GetSystemEventLog(ctx, request) +} + +// GetSystemEventLogRaw retrieves the System Event Log of the server. +func GetSystemEventLogRaw(ctx context.Context, client v1.DiagnosticClient, request *v1.GetSystemEventLogRawRequest) (*v1.GetSystemEventLogRawResponse, error) { + return client.GetSystemEventLogRaw(ctx, request) } diff --git a/cmd/sel.go b/cmd/sel.go index 6f892f4..efed567 100644 --- a/cmd/sel.go +++ b/cmd/sel.go @@ -57,8 +57,100 @@ var ( logger.Info("resp", "resp", []interface{}{resp}) }, } + + getSystemEventLogcommand = &cobra.Command{ + Use: "selget", + Short: "Get the System Event Log", + Long: `Get the System Event Log of the target BMC. + Includes the following information: + ID, Timestamp, Description, Message`, + Run: func(cmd *cobra.Command, args []string) { + var opts []grpc.DialOption + ctx := context.Background() + + logger := defaultLogger(logLevel) + + opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) + conn, err := grpc.Dial("localhost:"+port, opts...) + if err != nil { + logger.Error(err, "fail to dial server") + os.Exit(1) + } + defer conn.Close() + client := v1.NewDiagnosticClient(conn) + + resp, err := v1Client.GetSystemEventLog(ctx, client, &v1.GetSystemEventLogRequest{ + Authn: &v1.Authn{ + Authn: &v1.Authn_DirectAuthn{ + DirectAuthn: &v1.DirectAuthn{ + Host: &v1.Host{ + Host: bmcaddress, + }, + Username: bmcuser, + Password: bmcpass, + }, + }, + }, + Vendor: &v1.Vendor{ + Name: bmcvendor, + }, + }) + if err != nil { + logger.Error(err, "error calling") + os.Exit(1) + } + + logger.Info("resp", "resp", []interface{}{resp}) + }, + } + + getSystemEventLogRawcommand = &cobra.Command{ + Use: "selgetraw", + Short: "Get the Raw System Event Log", + Long: `Get the Raw System Event Log of the target BMC`, + Run: func(cmd *cobra.Command, args []string) { + var opts []grpc.DialOption + ctx := context.Background() + + logger := defaultLogger(logLevel) + + opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) + conn, err := grpc.Dial("localhost:"+port, opts...) + if err != nil { + logger.Error(err, "fail to dial server") + os.Exit(1) + } + defer conn.Close() + client := v1.NewDiagnosticClient(conn) + + resp, err := v1Client.GetSystemEventLogRaw(ctx, client, &v1.GetSystemEventLogRawRequest{ + Authn: &v1.Authn{ + Authn: &v1.Authn_DirectAuthn{ + DirectAuthn: &v1.DirectAuthn{ + Host: &v1.Host{ + Host: bmcaddress, + }, + Username: bmcuser, + Password: bmcpass, + }, + }, + }, + Vendor: &v1.Vendor{ + Name: bmcvendor, + }, + }) + if err != nil { + logger.Error(err, "error calling") + os.Exit(1) + } + + logger.Info("resp", "resp", []interface{}{resp}) + }, + } ) func init() { diagnosticCmd.AddCommand(clearSystemEventLogcommand) + diagnosticCmd.AddCommand(getSystemEventLogcommand) + diagnosticCmd.AddCommand(getSystemEventLogRawcommand) } diff --git a/go.mod b/go.mod index b5f27fe..2277ef0 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/bmc-toolbox/bmclib v0.5.7 github.com/bmc-toolbox/bmclib/v2 v2.2.3 github.com/cristalhq/jwt/v3 v3.1.0 - github.com/equinix-labs/otel-init-go v0.0.7 + github.com/equinix-labs/otel-init-go v0.0.9 github.com/fatih/color v1.15.0 github.com/go-logr/logr v1.4.1 github.com/go-logr/zerologr v1.2.3 diff --git a/go.sum b/go.sum index 3e56cdc..feb05d1 100644 --- a/go.sum +++ b/go.sum @@ -104,8 +104,8 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= -github.com/equinix-labs/otel-init-go v0.0.7 h1:5d3iI7qj1Guu58iRYPB0+sMv6mX5G8tD1sfVbVg9J8M= -github.com/equinix-labs/otel-init-go v0.0.7/go.mod h1:J50RUPkjhbaeYujme5mqzYyMPHcZ3mSK3Q3YGUxxhOk= +github.com/equinix-labs/otel-init-go v0.0.9 h1:hdh0Qifs1vzFnaN6UpJz0pO6A6ZejXjvkEFi8OGTfpE= +github.com/equinix-labs/otel-init-go v0.0.9/go.mod h1:5h8apPuPWz/KaMvAb3d0HoPEisQrUnqPmkc2T5SSpX4= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= @@ -146,6 +146,7 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69 github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -376,7 +377,7 @@ go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v8 go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/grpc/oob/diagnostic/diagnostic.go b/grpc/oob/diagnostic/diagnostic.go index 3ee19d6..63daae1 100644 --- a/grpc/oob/diagnostic/diagnostic.go +++ b/grpc/oob/diagnostic/diagnostic.go @@ -8,9 +8,13 @@ import ( type Action struct { common.Accessory - ScreenshotRequest *v1.ScreenshotRequest - ClearSystemEventLogRequest *v1.ClearSystemEventLogRequest - SendNMIRequest *v1.SendNMIRequest + ScreenshotRequest *v1.ScreenshotRequest + ClearSystemEventLogRequest *v1.ClearSystemEventLogRequest + SendNMIRequest *v1.SendNMIRequest + ScreenshotRequest *v1.ScreenshotRequest + ClearSystemEventLogRequest *v1.ClearSystemEventLogRequest + GetSystemEventLogRequest *v1.GetSystemEventLogRequest + GetSystemEventLogRawRequest *v1.GetSystemEventLogRawRequest } // WithLogger adds a logr to an Action struct. diff --git a/grpc/oob/diagnostic/getsel.go b/grpc/oob/diagnostic/getsel.go new file mode 100644 index 0000000..9839eae --- /dev/null +++ b/grpc/oob/diagnostic/getsel.go @@ -0,0 +1,203 @@ +package diagnostic + +import ( + "context" + "fmt" + + "github.com/bmc-toolbox/bmclib/v2" + "github.com/bmc-toolbox/bmclib/v2/bmc" + "github.com/bmc-toolbox/bmclib/v2/providers" + "github.com/prometheus/client_golang/prometheus" + v1 "github.com/tinkerbell/pbnj/api/v1" + common "github.com/tinkerbell/pbnj/grpc/oob" + "github.com/tinkerbell/pbnj/pkg/metrics" + "github.com/tinkerbell/pbnj/pkg/repository" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace" +) + +func NewSystemEventLogGetter(req *v1.GetSystemEventLogRequest, opts ...Option) (*Action, error) { + a := &Action{} + a.GetSystemEventLogRequest = req + for _, opt := range opts { + err := opt(a) + if err != nil { + return nil, err + } + } + return a, nil +} + +func NewSystemEventLogRawGetter(req *v1.GetSystemEventLogRawRequest, opts ...Option) (*Action, error) { + a := &Action{} + a.GetSystemEventLogRawRequest = req + for _, opt := range opts { + err := opt(a) + if err != nil { + return nil, err + } + } + return a, nil +} + +func (m Action) GetSystemEventLog(ctx context.Context) (result bmc.SystemEventLogEntries, err error) { + labels := prometheus.Labels{ + "service": "diagnostic", + "action": "get_system_event_log", + } + + timer := prometheus.NewTimer(metrics.ActionDuration.With(labels)) + defer timer.ObserveDuration() + + tracer := otel.Tracer("pbnj") + ctx, span := tracer.Start(ctx, "diagnostic.GetSystemEventLog", trace.WithAttributes( + attribute.String("bmc.device", m.GetSystemEventLogRequest.GetAuthn().GetDirectAuthn().GetHost().GetHost()), + )) + defer span.End() + + if v := m.GetSystemEventLogRequest.GetVendor(); v != nil { + span.SetAttributes(attribute.String("bmc.vendor", v.GetName())) + } + + host, user, password, parseErr := m.ParseAuth(m.GetSystemEventLogRequest.GetAuthn()) + if parseErr != nil { + span.SetStatus(codes.Error, "error parsing credentials: "+parseErr.Error()) + return result, parseErr + } + + span.SetAttributes(attribute.String("bmc.host", host), attribute.String("bmc.username", user)) + + opts := []bmclib.Option{ + bmclib.WithLogger(m.Log), + bmclib.WithPerProviderTimeout(common.BMCTimeoutFromCtx(ctx)), + } + + client := bmclib.NewClient(host, user, password, opts...) + client.Registry.Drivers = client.Registry.Supports(providers.FeatureGetSystemEventLog) + + m.SendStatusMessage("connecting to BMC") + err = client.Open(ctx) + meta := client.GetMetadata() + span.SetAttributes(attribute.StringSlice("bmc.open.providersAttempted", meta.ProvidersAttempted), + attribute.StringSlice("bmc.open.successfulOpenConns", meta.SuccessfulOpenConns)) + if err != nil { + span.SetStatus(codes.Error, err.Error()) + return nil, &repository.Error{ + Code: v1.Code_value["PERMISSION_DENIED"], + Message: err.Error(), + } + } + log := m.Log.WithValues("host", host, "user", user) + defer func() { + client.Close(ctx) + log.Info("closed connections", logMetadata(client.GetMetadata())...) + }() + log.Info("connected to BMC", logMetadata(client.GetMetadata())...) + m.SendStatusMessage("connected to BMC") + + // Get the system event log + m.SendStatusMessage("getting system event log") + sel, err := client.GetSystemEventLog(ctx) + log = m.Log.WithValues(logMetadata(client.GetMetadata())...) + meta = client.GetMetadata() + span.SetAttributes(attribute.StringSlice("bmc.get_system_event_log.providersAttempted", meta.ProvidersAttempted), + attribute.StringSlice("bmc.get_system_event_log.successfulOpenConns", meta.SuccessfulOpenConns)) + if err != nil { + log.Error(err, "error getting system event log") + span.SetStatus(codes.Error, "error getting system event log: "+err.Error()) + m.SendStatusMessage(fmt.Sprintf("failed to get system event log %v", host)) + + return nil, &repository.Error{ + Code: v1.Code_value["UNKNOWN"], + Message: err.Error(), + } + } + + span.SetStatus(codes.Ok, "") + log.Info("got system event log", logMetadata(client.GetMetadata())...) + m.SendStatusMessage(fmt.Sprintf("got system event log on %v", host)) + + return sel, nil +} + +func (m Action) GetSystemEventLogRaw(ctx context.Context) (result string, err error) { + labels := prometheus.Labels{ + "service": "diagnostic", + "action": "get_system_event_log_raw", + } + + timer := prometheus.NewTimer(metrics.ActionDuration.With(labels)) + defer timer.ObserveDuration() + + tracer := otel.Tracer("pbnj") + ctx, span := tracer.Start(ctx, "diagnostic.GetSystemEventLogRaw", trace.WithAttributes( + attribute.String("bmc.device", m.GetSystemEventLogRawRequest.GetAuthn().GetDirectAuthn().GetHost().GetHost()), + )) + defer span.End() + + if v := m.GetSystemEventLogRawRequest.GetVendor(); v != nil { + span.SetAttributes(attribute.String("bmc.vendor", v.GetName())) + } + + host, user, password, parseErr := m.ParseAuth(m.GetSystemEventLogRawRequest.GetAuthn()) + if parseErr != nil { + span.SetStatus(codes.Error, "error parsing credentials: "+parseErr.Error()) + return result, parseErr + } + + span.SetAttributes(attribute.String("bmc.host", host), attribute.String("bmc.username", user)) + + opts := []bmclib.Option{ + bmclib.WithLogger(m.Log), + bmclib.WithPerProviderTimeout(common.BMCTimeoutFromCtx(ctx)), + } + + client := bmclib.NewClient(host, user, password, opts...) + client.Registry.Drivers = client.Registry.Supports(providers.FeatureGetSystemEventLogRaw) + + m.SendStatusMessage("connecting to BMC") + err = client.Open(ctx) + meta := client.GetMetadata() + span.SetAttributes(attribute.StringSlice("bmc.open.providersAttempted", meta.ProvidersAttempted), + attribute.StringSlice("bmc.open.successfulOpenConns", meta.SuccessfulOpenConns)) + if err != nil { + span.SetStatus(codes.Error, err.Error()) + return "", &repository.Error{ + Code: v1.Code_value["PERMISSION_DENIED"], + Message: err.Error(), + } + } + log := m.Log.WithValues("host", host, "user", user) + defer func() { + client.Close(ctx) + log.Info("closed connections", logMetadata(client.GetMetadata())...) + }() + log.Info("connected to BMC", logMetadata(client.GetMetadata())...) + m.SendStatusMessage("connected to BMC") + + // Get the system event log + m.SendStatusMessage("getting system event log") + sel, err := client.GetSystemEventLogRaw(ctx) + log = m.Log.WithValues(logMetadata(client.GetMetadata())...) + meta = client.GetMetadata() + span.SetAttributes(attribute.StringSlice("bmc.get_system_event_log_raw.providersAttempted", meta.ProvidersAttempted), + attribute.StringSlice("bmc.get_system_event_log_raw.successfulOpenConns", meta.SuccessfulOpenConns)) + if err != nil { + log.Error(err, "error getting raw system event log") + span.SetStatus(codes.Error, "error getting raw system event log: "+err.Error()) + m.SendStatusMessage(fmt.Sprintf("failed to get raw system event log %v", host)) + + return "", &repository.Error{ + Code: v1.Code_value["UNKNOWN"], + Message: err.Error(), + } + } + + span.SetStatus(codes.Ok, "") + log.Info("got raw system event log", logMetadata(client.GetMetadata())...) + m.SendStatusMessage(fmt.Sprintf("got raw system event log on %v", host)) + + return sel, nil +} diff --git a/grpc/rpc/diagnostic.go b/grpc/rpc/diagnostic.go index 9d6f595..221bc4d 100644 --- a/grpc/rpc/diagnostic.go +++ b/grpc/rpc/diagnostic.go @@ -106,4 +106,64 @@ func (d *DiagnosticService) SendNMI(ctx context.Context, in *v1.SendNMIRequest) } return empty, nil + +func (d *DiagnosticService) GetSystemEventLog(ctx context.Context, in *v1.GetSystemEventLogRequest) (*v1.GetSystemEventLogResponse, error) { + l := logging.ExtractLogr(ctx) + + l.Info("start Get System Event Log request", + "username", in.Authn.GetDirectAuthn().GetUsername(), + "vendor", in.Vendor.GetName(), + ) + + selgetter, err := diagnostic.NewSystemEventLogGetter(in, diagnostic.WithLogger(l)) + if err != nil { + l.Error(err, "error creating system event log getter") + return nil, err + } + + entries, err := selgetter.GetSystemEventLog(ctx) + if err != nil { + l.Error(err, "error getting system event log") + return nil, err + } + + var events []*v1.SystemEventLogEntry + + for _, entry := range entries { + events = append(events, &v1.SystemEventLogEntry{ + Id: entry[0], + Timestamp: entry[1], + Description: entry[2], + Message: entry[3], + }) + } + + return &v1.GetSystemEventLogResponse{ + Events: events, + }, nil +} + +func (d *DiagnosticService) GetSystemEventLogRaw(ctx context.Context, in *v1.GetSystemEventLogRawRequest) (*v1.GetSystemEventLogRawResponse, error) { + l := logging.ExtractLogr(ctx) + + l.Info("start Get System Event Log request", + "username", in.Authn.GetDirectAuthn().GetUsername(), + "vendor", in.Vendor.GetName(), + ) + + rawselgetter, err := diagnostic.NewSystemEventLogRawGetter(in, diagnostic.WithLogger(l)) + if err != nil { + l.Error(err, "error creating raw system event log getter") + return nil, err + } + + eventlog, err := rawselgetter.GetSystemEventLogRaw(ctx) + if err != nil { + l.Error(err, "error getting raw system event log") + return nil, err + } + + return &v1.GetSystemEventLogRawResponse{ + Log: eventlog, + }, nil } From fa9ec6b0b33a51f26a16bd338a5f338ba4097d0c Mon Sep 17 00:00:00 2001 From: Matthew Burns Date: Wed, 13 Dec 2023 10:14:40 -0700 Subject: [PATCH 2/3] Addressed review feedback; removed getter, merged into action. Renamed and regenerated protobufs to reflect. Some tests to make codecov happy. Signed-off-by: Matthew Burns --- api/v1/diagnostic.proto | 12 +- client/client.go | 13 ++- cmd/sel.go | 4 +- grpc/oob/diagnostic/diagnostic.go | 23 ++-- grpc/oob/diagnostic/getsel.go | 158 ++++++++----------------- grpc/rpc/diagnostic.go | 59 ++++++---- grpc/rpc/diagnostic_test.go | 186 ++++++++++++++++++++++++++++++ 7 files changed, 302 insertions(+), 153 deletions(-) diff --git a/api/v1/diagnostic.proto b/api/v1/diagnostic.proto index c3a4662..2c8f02f 100644 --- a/api/v1/diagnostic.proto +++ b/api/v1/diagnostic.proto @@ -13,8 +13,8 @@ service Diagnostic { rpc Screenshot (ScreenshotRequest) returns (ScreenshotResponse); rpc ClearSystemEventLog (ClearSystemEventLogRequest) returns (ClearSystemEventLogResponse); rpc SendNMI (SendNMIRequest) returns (google.protobuf.Empty); - rpc GetSystemEventLog (GetSystemEventLogRequest) returns (GetSystemEventLogResponse); - rpc GetSystemEventLogRaw (GetSystemEventLogRawRequest) returns (GetSystemEventLogRawResponse); + rpc SystemEventLog (SystemEventLogRequest) returns (SystemEventLogResponse); + rpc SystemEventLogRaw (SystemEventLogRawRequest) returns (SystemEventLogRawResponse); } message ScreenshotRequest { @@ -40,7 +40,7 @@ message SendNMIRequest { v1.Authn authn = 1; } -message GetSystemEventLogRequest { +message SystemEventLogRequest { v1.Authn authn = 1; v1.Vendor vendor = 2; } @@ -52,15 +52,15 @@ message SystemEventLogEntry { string message = 4; } -message GetSystemEventLogResponse { +message SystemEventLogResponse { repeated SystemEventLogEntry events = 1; } -message GetSystemEventLogRawRequest { +message SystemEventLogRawRequest { v1.Authn authn = 1; v1.Vendor vendor = 2; } -message GetSystemEventLogRawResponse { +message SystemEventLogRawResponse { string log = 1; } diff --git a/client/client.go b/client/client.go index 488508e..92684e4 100644 --- a/client/client.go +++ b/client/client.go @@ -150,13 +150,14 @@ func ClearSystemEventLog(ctx context.Context, client v1.DiagnosticClient, taskCl func SendNMI(ctx context.Context, client v1.DiagnosticClient, request *v1.SendNMIRequest) error { _, err := client.SendNMI(ctx, request) return err +} -// GetSystemEventLog retrieves the System Event Log of the server. -func GetSystemEventLog(ctx context.Context, client v1.DiagnosticClient, request *v1.GetSystemEventLogRequest) (*v1.GetSystemEventLogResponse, error) { - return client.GetSystemEventLog(ctx, request) +// SystemEventLog retrieves the System Event Log of the server. +func SystemEventLog(ctx context.Context, client v1.DiagnosticClient, request *v1.SystemEventLogRequest) (*v1.SystemEventLogResponse, error) { + return client.SystemEventLog(ctx, request) } -// GetSystemEventLogRaw retrieves the System Event Log of the server. -func GetSystemEventLogRaw(ctx context.Context, client v1.DiagnosticClient, request *v1.GetSystemEventLogRawRequest) (*v1.GetSystemEventLogRawResponse, error) { - return client.GetSystemEventLogRaw(ctx, request) +// SystemEventLogRaw retrieves the System Event Log of the server. +func SystemEventLogRaw(ctx context.Context, client v1.DiagnosticClient, request *v1.SystemEventLogRawRequest) (*v1.SystemEventLogRawResponse, error) { + return client.SystemEventLogRaw(ctx, request) } diff --git a/cmd/sel.go b/cmd/sel.go index efed567..a8aee27 100644 --- a/cmd/sel.go +++ b/cmd/sel.go @@ -79,7 +79,7 @@ var ( defer conn.Close() client := v1.NewDiagnosticClient(conn) - resp, err := v1Client.GetSystemEventLog(ctx, client, &v1.GetSystemEventLogRequest{ + resp, err := v1Client.SystemEventLog(ctx, client, &v1.SystemEventLogRequest{ Authn: &v1.Authn{ Authn: &v1.Authn_DirectAuthn{ DirectAuthn: &v1.DirectAuthn{ @@ -123,7 +123,7 @@ var ( defer conn.Close() client := v1.NewDiagnosticClient(conn) - resp, err := v1Client.GetSystemEventLogRaw(ctx, client, &v1.GetSystemEventLogRawRequest{ + resp, err := v1Client.SystemEventLogRaw(ctx, client, &v1.SystemEventLogRawRequest{ Authn: &v1.Authn{ Authn: &v1.Authn_DirectAuthn{ DirectAuthn: &v1.DirectAuthn{ diff --git a/grpc/oob/diagnostic/diagnostic.go b/grpc/oob/diagnostic/diagnostic.go index 63daae1..d58388b 100644 --- a/grpc/oob/diagnostic/diagnostic.go +++ b/grpc/oob/diagnostic/diagnostic.go @@ -8,13 +8,13 @@ import ( type Action struct { common.Accessory - ScreenshotRequest *v1.ScreenshotRequest - ClearSystemEventLogRequest *v1.ClearSystemEventLogRequest - SendNMIRequest *v1.SendNMIRequest - ScreenshotRequest *v1.ScreenshotRequest - ClearSystemEventLogRequest *v1.ClearSystemEventLogRequest - GetSystemEventLogRequest *v1.GetSystemEventLogRequest - GetSystemEventLogRawRequest *v1.GetSystemEventLogRawRequest + ScreenshotRequest *v1.ScreenshotRequest + ClearSystemEventLogRequest *v1.ClearSystemEventLogRequest + SendNMIRequest *v1.SendNMIRequest + SystemEventLogRequest *v1.SystemEventLogRequest + SystemEventLogRawRequest *v1.SystemEventLogRawRequest + ActionName string + RPCName string } // WithLogger adds a logr to an Action struct. @@ -33,5 +33,14 @@ func WithStatusMessage(s chan string) Option { } } +// WithLabels adds the custom tracing and logging labels to an Action struct. +func WithLabels(actionName string, rpcName string) Option { + return func(a *Action) error { + a.ActionName = actionName + a.RPCName = rpcName + return nil + } +} + // Option to add to an Actions. type Option func(a *Action) error diff --git a/grpc/oob/diagnostic/getsel.go b/grpc/oob/diagnostic/getsel.go index 9839eae..1a4fd44 100644 --- a/grpc/oob/diagnostic/getsel.go +++ b/grpc/oob/diagnostic/getsel.go @@ -18,53 +18,50 @@ import ( "go.opentelemetry.io/otel/trace" ) -func NewSystemEventLogGetter(req *v1.GetSystemEventLogRequest, opts ...Option) (*Action, error) { +func NewSystemEventLogAction(req interface{}, opts ...Option) (*Action, error) { a := &Action{} - a.GetSystemEventLogRequest = req - for _, opt := range opts { - err := opt(a) - if err != nil { - return nil, err - } + switch r := req.(type) { + case *v1.SystemEventLogRequest: + a.SystemEventLogRequest = r + case *v1.SystemEventLogRawRequest: + a.SystemEventLogRawRequest = r + default: + return nil, fmt.Errorf("unsupported request type") } - return a, nil -} -func NewSystemEventLogRawGetter(req *v1.GetSystemEventLogRawRequest, opts ...Option) (*Action, error) { - a := &Action{} - a.GetSystemEventLogRawRequest = req for _, opt := range opts { err := opt(a) if err != nil { return nil, err } } + return a, nil } -func (m Action) GetSystemEventLog(ctx context.Context) (result bmc.SystemEventLogEntries, err error) { +func (m Action) SystemEventLog(ctx context.Context) (entries bmc.SystemEventLogEntries, raw string, err error) { labels := prometheus.Labels{ "service": "diagnostic", - "action": "get_system_event_log", + "action": m.ActionName, } timer := prometheus.NewTimer(metrics.ActionDuration.With(labels)) defer timer.ObserveDuration() tracer := otel.Tracer("pbnj") - ctx, span := tracer.Start(ctx, "diagnostic.GetSystemEventLog", trace.WithAttributes( - attribute.String("bmc.device", m.GetSystemEventLogRequest.GetAuthn().GetDirectAuthn().GetHost().GetHost()), + ctx, span := tracer.Start(ctx, "diagnostic."+m.RPCName, trace.WithAttributes( + attribute.String("bmc.device", m.SystemEventLogRequest.GetAuthn().GetDirectAuthn().GetHost().GetHost()), )) defer span.End() - if v := m.GetSystemEventLogRequest.GetVendor(); v != nil { + if v := m.SystemEventLogRequest.GetVendor(); v != nil { span.SetAttributes(attribute.String("bmc.vendor", v.GetName())) } - host, user, password, parseErr := m.ParseAuth(m.GetSystemEventLogRequest.GetAuthn()) + host, user, password, parseErr := m.ParseAuth(m.SystemEventLogRequest.GetAuthn()) if parseErr != nil { span.SetStatus(codes.Error, "error parsing credentials: "+parseErr.Error()) - return result, parseErr + return entries, raw, parseErr } span.SetAttributes(attribute.String("bmc.host", host), attribute.String("bmc.username", user)) @@ -75,88 +72,17 @@ func (m Action) GetSystemEventLog(ctx context.Context) (result bmc.SystemEventLo } client := bmclib.NewClient(host, user, password, opts...) - client.Registry.Drivers = client.Registry.Supports(providers.FeatureGetSystemEventLog) - - m.SendStatusMessage("connecting to BMC") - err = client.Open(ctx) - meta := client.GetMetadata() - span.SetAttributes(attribute.StringSlice("bmc.open.providersAttempted", meta.ProvidersAttempted), - attribute.StringSlice("bmc.open.successfulOpenConns", meta.SuccessfulOpenConns)) - if err != nil { - span.SetStatus(codes.Error, err.Error()) - return nil, &repository.Error{ - Code: v1.Code_value["PERMISSION_DENIED"], - Message: err.Error(), - } - } - log := m.Log.WithValues("host", host, "user", user) - defer func() { - client.Close(ctx) - log.Info("closed connections", logMetadata(client.GetMetadata())...) - }() - log.Info("connected to BMC", logMetadata(client.GetMetadata())...) - m.SendStatusMessage("connected to BMC") - - // Get the system event log - m.SendStatusMessage("getting system event log") - sel, err := client.GetSystemEventLog(ctx) - log = m.Log.WithValues(logMetadata(client.GetMetadata())...) - meta = client.GetMetadata() - span.SetAttributes(attribute.StringSlice("bmc.get_system_event_log.providersAttempted", meta.ProvidersAttempted), - attribute.StringSlice("bmc.get_system_event_log.successfulOpenConns", meta.SuccessfulOpenConns)) - if err != nil { - log.Error(err, "error getting system event log") - span.SetStatus(codes.Error, "error getting system event log: "+err.Error()) - m.SendStatusMessage(fmt.Sprintf("failed to get system event log %v", host)) - - return nil, &repository.Error{ - Code: v1.Code_value["UNKNOWN"], - Message: err.Error(), - } - } - - span.SetStatus(codes.Ok, "") - log.Info("got system event log", logMetadata(client.GetMetadata())...) - m.SendStatusMessage(fmt.Sprintf("got system event log on %v", host)) - - return sel, nil -} - -func (m Action) GetSystemEventLogRaw(ctx context.Context) (result string, err error) { - labels := prometheus.Labels{ - "service": "diagnostic", - "action": "get_system_event_log_raw", - } - - timer := prometheus.NewTimer(metrics.ActionDuration.With(labels)) - defer timer.ObserveDuration() - - tracer := otel.Tracer("pbnj") - ctx, span := tracer.Start(ctx, "diagnostic.GetSystemEventLogRaw", trace.WithAttributes( - attribute.String("bmc.device", m.GetSystemEventLogRawRequest.GetAuthn().GetDirectAuthn().GetHost().GetHost()), - )) - defer span.End() - if v := m.GetSystemEventLogRawRequest.GetVendor(); v != nil { - span.SetAttributes(attribute.String("bmc.vendor", v.GetName())) + // Set the driver(s) to use based on the request type + switch { + case m.SystemEventLogRequest != nil: + client.Registry.Drivers = client.Registry.Supports(providers.FeatureGetSystemEventLog) + case m.SystemEventLogRawRequest != nil: + client.Registry.Drivers = client.Registry.Supports(providers.FeatureGetSystemEventLogRaw) + default: + return entries, raw, fmt.Errorf("unsupported request type") } - host, user, password, parseErr := m.ParseAuth(m.GetSystemEventLogRawRequest.GetAuthn()) - if parseErr != nil { - span.SetStatus(codes.Error, "error parsing credentials: "+parseErr.Error()) - return result, parseErr - } - - span.SetAttributes(attribute.String("bmc.host", host), attribute.String("bmc.username", user)) - - opts := []bmclib.Option{ - bmclib.WithLogger(m.Log), - bmclib.WithPerProviderTimeout(common.BMCTimeoutFromCtx(ctx)), - } - - client := bmclib.NewClient(host, user, password, opts...) - client.Registry.Drivers = client.Registry.Supports(providers.FeatureGetSystemEventLogRaw) - m.SendStatusMessage("connecting to BMC") err = client.Open(ctx) meta := client.GetMetadata() @@ -164,7 +90,7 @@ func (m Action) GetSystemEventLogRaw(ctx context.Context) (result string, err er attribute.StringSlice("bmc.open.successfulOpenConns", meta.SuccessfulOpenConns)) if err != nil { span.SetStatus(codes.Error, err.Error()) - return "", &repository.Error{ + return entries, raw, &repository.Error{ Code: v1.Code_value["PERMISSION_DENIED"], Message: err.Error(), } @@ -177,27 +103,37 @@ func (m Action) GetSystemEventLogRaw(ctx context.Context) (result string, err er log.Info("connected to BMC", logMetadata(client.GetMetadata())...) m.SendStatusMessage("connected to BMC") - // Get the system event log - m.SendStatusMessage("getting system event log") - sel, err := client.GetSystemEventLogRaw(ctx) + m.SendStatusMessage("getting " + m.ActionName + " on " + host) + + switch { + case m.SystemEventLogRequest != nil: + // Get the system event log + entries, err = client.GetSystemEventLog(ctx) + case m.SystemEventLogRawRequest != nil: + // Get the system event log + raw, err = client.GetSystemEventLogRaw(ctx) + default: + return entries, raw, fmt.Errorf("unsupported request type") + } + log = m.Log.WithValues(logMetadata(client.GetMetadata())...) meta = client.GetMetadata() - span.SetAttributes(attribute.StringSlice("bmc.get_system_event_log_raw.providersAttempted", meta.ProvidersAttempted), - attribute.StringSlice("bmc.get_system_event_log_raw.successfulOpenConns", meta.SuccessfulOpenConns)) + span.SetAttributes(attribute.StringSlice("bmc."+m.ActionName+".providersAttempted", meta.ProvidersAttempted), + attribute.StringSlice("bmc."+m.ActionName+".successfulOpenConns", meta.SuccessfulOpenConns)) if err != nil { - log.Error(err, "error getting raw system event log") - span.SetStatus(codes.Error, "error getting raw system event log: "+err.Error()) - m.SendStatusMessage(fmt.Sprintf("failed to get raw system event log %v", host)) + log.Error(err, "error getting "+m.ActionName) + span.SetStatus(codes.Error, "error getting "+m.ActionName+": "+err.Error()) + m.SendStatusMessage(fmt.Sprintf("failed to get "+m.ActionName+" %v", host)) - return "", &repository.Error{ + return entries, raw, &repository.Error{ Code: v1.Code_value["UNKNOWN"], Message: err.Error(), } } span.SetStatus(codes.Ok, "") - log.Info("got raw system event log", logMetadata(client.GetMetadata())...) - m.SendStatusMessage(fmt.Sprintf("got raw system event log on %v", host)) + log.Info("got "+m.ActionName, logMetadata(client.GetMetadata())...) + m.SendStatusMessage(fmt.Sprintf("got "+m.ActionName+" on %v", host)) - return sel, nil + return entries, raw, nil } diff --git a/grpc/rpc/diagnostic.go b/grpc/rpc/diagnostic.go index 221bc4d..dbda509 100644 --- a/grpc/rpc/diagnostic.go +++ b/grpc/rpc/diagnostic.go @@ -4,6 +4,7 @@ import ( "context" "time" + "github.com/bmc-toolbox/bmclib/v2/bmc" "github.com/rs/xid" v1 "github.com/tinkerbell/pbnj/api/v1" "github.com/tinkerbell/pbnj/grpc/oob/diagnostic" @@ -106,8 +107,9 @@ func (d *DiagnosticService) SendNMI(ctx context.Context, in *v1.SendNMIRequest) } return empty, nil +} -func (d *DiagnosticService) GetSystemEventLog(ctx context.Context, in *v1.GetSystemEventLogRequest) (*v1.GetSystemEventLogResponse, error) { +func (d *DiagnosticService) SystemEventLog(ctx context.Context, in *v1.SystemEventLogRequest) (*v1.SystemEventLogResponse, error) { l := logging.ExtractLogr(ctx) l.Info("start Get System Event Log request", @@ -115,55 +117,70 @@ func (d *DiagnosticService) GetSystemEventLog(ctx context.Context, in *v1.GetSys "vendor", in.Vendor.GetName(), ) - selgetter, err := diagnostic.NewSystemEventLogGetter(in, diagnostic.WithLogger(l)) + selaction, err := diagnostic.NewSystemEventLogAction(in, diagnostic.WithLogger(l), + diagnostic.WithLabels("system_event_log", "SystemEventLog")) if err != nil { - l.Error(err, "error creating system event log getter") + l.Error(err, "error creating system event log action") return nil, err } - entries, err := selgetter.GetSystemEventLog(ctx) + entries, _, err := selaction.SystemEventLog(ctx) if err != nil { l.Error(err, "error getting system event log") return nil, err } - var events []*v1.SystemEventLogEntry - - for _, entry := range entries { - events = append(events, &v1.SystemEventLogEntry{ - Id: entry[0], - Timestamp: entry[1], - Description: entry[2], - Message: entry[3], - }) - } + events := convertEntriesToEvents(entries) - return &v1.GetSystemEventLogResponse{ + return &v1.SystemEventLogResponse{ Events: events, }, nil } -func (d *DiagnosticService) GetSystemEventLogRaw(ctx context.Context, in *v1.GetSystemEventLogRawRequest) (*v1.GetSystemEventLogRawResponse, error) { +func (d *DiagnosticService) SystemEventLogRaw(ctx context.Context, in *v1.SystemEventLogRawRequest) (*v1.SystemEventLogRawResponse, error) { l := logging.ExtractLogr(ctx) - l.Info("start Get System Event Log request", + l.Info("start Get System Event Log Raw request", "username", in.Authn.GetDirectAuthn().GetUsername(), "vendor", in.Vendor.GetName(), ) - rawselgetter, err := diagnostic.NewSystemEventLogRawGetter(in, diagnostic.WithLogger(l)) + rawselaction, err := diagnostic.NewSystemEventLogAction(in, diagnostic.WithLogger(l), + diagnostic.WithLabels("system_event_log_raw", "SystemEventLogRaw")) if err != nil { - l.Error(err, "error creating raw system event log getter") + l.Error(err, "error creating raw system event log action") return nil, err } - eventlog, err := rawselgetter.GetSystemEventLogRaw(ctx) + _, eventlog, err := rawselaction.SystemEventLog(ctx) if err != nil { l.Error(err, "error getting raw system event log") return nil, err } - return &v1.GetSystemEventLogRawResponse{ + return &v1.SystemEventLogRawResponse{ Log: eventlog, }, nil } + +func convertEntriesToEvents(entries bmc.SystemEventLogEntries) []*v1.SystemEventLogEntry { + var events []*v1.SystemEventLogEntry + + if len(entries) == 0 { + return events + } + + for _, entry := range entries { + if len(entry) < 4 { + continue + } + events = append(events, &v1.SystemEventLogEntry{ + Id: entry[0], + Timestamp: entry[1], + Description: entry[2], + Message: entry[3], + }) + } + + return events +} diff --git a/grpc/rpc/diagnostic_test.go b/grpc/rpc/diagnostic_test.go index 950e210..e9d2f02 100644 --- a/grpc/rpc/diagnostic_test.go +++ b/grpc/rpc/diagnostic_test.go @@ -5,7 +5,9 @@ import ( "errors" "testing" + "github.com/bmc-toolbox/bmclib/v2/bmc" "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/onsi/gomega" "github.com/philippgille/gokv" "github.com/philippgille/gokv/freecache" @@ -14,6 +16,17 @@ import ( "github.com/tinkerbell/pbnj/grpc/taskrunner" ) +type MockDiagnosticAction struct { + SystemEventLogFunc func(ctx context.Context) (entries []*v1.SystemEventLogEntry, raw string, err error) +} + +func (m *MockDiagnosticAction) SystemEventLog(ctx context.Context) (entries []*v1.SystemEventLogEntry, raw string, err error) { + if m.SystemEventLogFunc != nil { + return m.SystemEventLogFunc(ctx) + } + return nil, "", nil +} + func TestClearSystemEventLog(t *testing.T) { testCases := []struct { name string @@ -84,3 +97,176 @@ func TestClearSystemEventLog(t *testing.T) { }) } } +func TestConvertEntriesToEvents(t *testing.T) { + testCases := []struct { + name string + entries bmc.SystemEventLogEntries + expectedEvents []*v1.SystemEventLogEntry + }{ + { + name: "empty entries", + entries: bmc.SystemEventLogEntries{}, + expectedEvents: nil, + }, + { + name: "valid entries", + entries: bmc.SystemEventLogEntries{ + {"1", "2022-01-01", "Event 1", "Message 1"}, + {"2", "2022-01-02", "Event 2", "Message 2"}, + }, + expectedEvents: []*v1.SystemEventLogEntry{ + { + Id: "1", + Timestamp: "2022-01-01", + Description: "Event 1", + Message: "Message 1", + }, + { + Id: "2", + Timestamp: "2022-01-02", + Description: "Event 2", + Message: "Message 2", + }, + }, + }, + { + name: "invalid entries", + entries: bmc.SystemEventLogEntries{ + {"1", "2022-01-01", "Event 1"}, + {"2", "2022-01-02", "Event 2", "Message 2"}, + }, + expectedEvents: []*v1.SystemEventLogEntry{ + { + Id: "2", + Timestamp: "2022-01-02", + Description: "Event 2", + Message: "Message 2", + }, + }, + }, + } + + for _, tc := range testCases { + testCase := tc + t.Run(testCase.name, func(t *testing.T) { + t.Parallel() + + events := convertEntriesToEvents(testCase.entries) + + if diff := cmp.Diff(testCase.expectedEvents, events, cmpopts.IgnoreUnexported(v1.SystemEventLogEntry{})); diff != "" { + t.Errorf("Mismatch (-expected, +actual):\n%s", diff) + } + }) + } +} +func TestSystemEventLog(t *testing.T) { + testCases := []struct { + name string + req *v1.SystemEventLogRequest + expectedEvents []*v1.SystemEventLogEntry + expectedErr error + }{ + { + name: "success", + req: &v1.SystemEventLogRequest{ + Authn: &v1.Authn{ + Authn: &v1.Authn_DirectAuthn{ + DirectAuthn: &v1.DirectAuthn{ + Username: "testuser", + }, + }, + }, + Vendor: &v1.Vendor{ + Name: "testvendor", + }, + }, + expectedEvents: []*v1.SystemEventLogEntry{ + { + Id: "1", + Timestamp: "2022-01-01", + Description: "Event 1", + Message: "Message 1", + }, + { + Id: "2", + Timestamp: "2022-01-02", + Description: "Event 2", + Message: "Message 2", + }, + }, + expectedErr: nil, + }, + { + name: "error creating system event log action", + req: &v1.SystemEventLogRequest{ + Authn: &v1.Authn{ + Authn: &v1.Authn_DirectAuthn{ + DirectAuthn: &v1.DirectAuthn{ + Username: "testuser", + }, + }, + }, + Vendor: &v1.Vendor{ + Name: "testvendor", + }, + }, + expectedEvents: nil, + expectedErr: errors.New("error creating system event log action"), + }, + { + name: "error getting system event log", + req: &v1.SystemEventLogRequest{ + Authn: &v1.Authn{ + Authn: &v1.Authn_DirectAuthn{ + DirectAuthn: &v1.DirectAuthn{ + Username: "testuser", + }, + }, + }, + Vendor: &v1.Vendor{ + Name: "testvendor", + }, + }, + expectedEvents: nil, + expectedErr: errors.New("error getting system event log"), + }, + } + + for _, tc := range testCases { + testCase := tc + t.Run(testCase.name, func(t *testing.T) { + t.Parallel() + + ctx := context.Background() + + diagnosticService := &MockDiagnosticAction{ + SystemEventLogFunc: func(ctx context.Context) (entries []*v1.SystemEventLogEntry, raw string, err error) { + if testCase.expectedErr != nil { + return nil, "", testCase.expectedErr + } + return []*v1.SystemEventLogEntry{ + {Id: "1", Timestamp: "2022-01-01", Description: "Event 1", Message: "Message 1"}, + {Id: "2", Timestamp: "2022-01-02", Description: "Event 2", Message: "Message 2"}, + }, "", nil + }, + } + + response, _, err := diagnosticService.SystemEventLog(ctx) + + t.Log("Got : ", response) + if err != nil { + if testCase.expectedErr == nil { + t.Fatalf("Unexpected error: %v", err) + } else { + if diff := cmp.Diff(testCase.expectedErr.Error(), err.Error()); diff != "" { + t.Fatalf("Error mismatch (-expected, +actual):\n%s", diff) + } + } + } else { + if diff := cmp.Diff(testCase.expectedEvents, response, cmpopts.IgnoreUnexported(v1.SystemEventLogEntry{})); diff != "" { + t.Fatalf("Events mismatch (-expected, +actual):\n%s", diff) + } + } + }) + } +} From 5d021464772329f04bb1418b42f6da2e8217c0d4 Mon Sep 17 00:00:00 2001 From: Matthew Burns Date: Thu, 4 Apr 2024 11:01:01 -0700 Subject: [PATCH 3/3] rebased on main, fixed grpc docker generation Signed-off-by: Matthew Burns --- api/v1/bmc.pb.go | 14 +- api/v1/bmc.validator.pb.go | 1 - api/v1/bmc_grpc.pb.go | 46 +- api/v1/common.pb.go | 14 +- api/v1/common.validator.pb.go | 1 - api/v1/diagnostic.pb.go | 892 ++++++++++++++++++++++++++++++ api/v1/diagnostic.validator.pb.go | 100 ++++ api/v1/diagnostic_grpc.pb.go | 242 ++++++++ api/v1/machine.pb.go | 14 +- api/v1/machine.validator.pb.go | 1 - api/v1/machine_grpc.pb.go | 26 +- api/v1/task.pb.go | 14 +- api/v1/task.validator.pb.go | 1 - api/v1/task_grpc.pb.go | 21 +- scripts/Dockerfile.pbbuilder | 2 +- scripts/protoc.sh | 10 +- 16 files changed, 1298 insertions(+), 101 deletions(-) create mode 100644 api/v1/diagnostic.pb.go create mode 100644 api/v1/diagnostic.validator.pb.go create mode 100644 api/v1/diagnostic_grpc.pb.go diff --git a/api/v1/bmc.pb.go b/api/v1/bmc.pb.go index 65c98e5..6116ec4 100644 --- a/api/v1/bmc.pb.go +++ b/api/v1/bmc.pb.go @@ -1,18 +1,18 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc-gen-go v1.25.0 +// protoc v3.13.0 // source: api/v1/bmc.proto package v1 import ( - reflect "reflect" - sync "sync" - + proto "github.com/golang/protobuf/proto" _ "github.com/mwitkow/go-proto-validators" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) const ( @@ -22,6 +22,10 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + type UserRole int32 const ( diff --git a/api/v1/bmc.validator.pb.go b/api/v1/bmc.validator.pb.go index 4d75cd0..457cebd 100644 --- a/api/v1/bmc.validator.pb.go +++ b/api/v1/bmc.validator.pb.go @@ -6,7 +6,6 @@ package v1 import ( fmt "fmt" math "math" - proto "github.com/golang/protobuf/proto" _ "github.com/mwitkow/go-proto-validators" github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" diff --git a/api/v1/bmc_grpc.pb.go b/api/v1/bmc_grpc.pb.go index 5a9a616..5504fec 100644 --- a/api/v1/bmc_grpc.pb.go +++ b/api/v1/bmc_grpc.pb.go @@ -1,14 +1,9 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.3 -// source: api/v1/bmc.proto package v1 import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -16,18 +11,8 @@ import ( // 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 -const ( - BMC_NetworkSource_FullMethodName = "/github.com.tinkerbell.pbnj.api.v1.BMC/NetworkSource" - BMC_Reset_FullMethodName = "/github.com.tinkerbell.pbnj.api.v1.BMC/Reset" - BMC_CreateUser_FullMethodName = "/github.com.tinkerbell.pbnj.api.v1.BMC/CreateUser" - BMC_DeleteUser_FullMethodName = "/github.com.tinkerbell.pbnj.api.v1.BMC/DeleteUser" - BMC_UpdateUser_FullMethodName = "/github.com.tinkerbell.pbnj.api.v1.BMC/UpdateUser" - BMC_DeactivateSOL_FullMethodName = "/github.com.tinkerbell.pbnj.api.v1.BMC/DeactivateSOL" -) - // BMCClient is the client API for BMC 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. @@ -50,7 +35,7 @@ func NewBMCClient(cc grpc.ClientConnInterface) BMCClient { func (c *bMCClient) NetworkSource(ctx context.Context, in *NetworkSourceRequest, opts ...grpc.CallOption) (*NetworkSourceResponse, error) { out := new(NetworkSourceResponse) - err := c.cc.Invoke(ctx, BMC_NetworkSource_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/github.com.tinkerbell.pbnj.api.v1.BMC/NetworkSource", in, out, opts...) if err != nil { return nil, err } @@ -59,7 +44,7 @@ func (c *bMCClient) NetworkSource(ctx context.Context, in *NetworkSourceRequest, func (c *bMCClient) Reset(ctx context.Context, in *ResetRequest, opts ...grpc.CallOption) (*ResetResponse, error) { out := new(ResetResponse) - err := c.cc.Invoke(ctx, BMC_Reset_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/github.com.tinkerbell.pbnj.api.v1.BMC/Reset", in, out, opts...) if err != nil { return nil, err } @@ -68,7 +53,7 @@ func (c *bMCClient) Reset(ctx context.Context, in *ResetRequest, opts ...grpc.Ca func (c *bMCClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error) { out := new(CreateUserResponse) - err := c.cc.Invoke(ctx, BMC_CreateUser_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/github.com.tinkerbell.pbnj.api.v1.BMC/CreateUser", in, out, opts...) if err != nil { return nil, err } @@ -77,7 +62,7 @@ func (c *bMCClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts func (c *bMCClient) DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*DeleteUserResponse, error) { out := new(DeleteUserResponse) - err := c.cc.Invoke(ctx, BMC_DeleteUser_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/github.com.tinkerbell.pbnj.api.v1.BMC/DeleteUser", in, out, opts...) if err != nil { return nil, err } @@ -86,7 +71,7 @@ func (c *bMCClient) DeleteUser(ctx context.Context, in *DeleteUserRequest, opts func (c *bMCClient) UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*UpdateUserResponse, error) { out := new(UpdateUserResponse) - err := c.cc.Invoke(ctx, BMC_UpdateUser_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/github.com.tinkerbell.pbnj.api.v1.BMC/UpdateUser", in, out, opts...) if err != nil { return nil, err } @@ -95,7 +80,7 @@ func (c *bMCClient) UpdateUser(ctx context.Context, in *UpdateUserRequest, opts func (c *bMCClient) DeactivateSOL(ctx context.Context, in *DeactivateSOLRequest, opts ...grpc.CallOption) (*DeactivateSOLResponse, error) { out := new(DeactivateSOLResponse) - err := c.cc.Invoke(ctx, BMC_DeactivateSOL_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/github.com.tinkerbell.pbnj.api.v1.BMC/DeactivateSOL", in, out, opts...) if err != nil { return nil, err } @@ -147,7 +132,7 @@ type UnsafeBMCServer interface { } func RegisterBMCServer(s grpc.ServiceRegistrar, srv BMCServer) { - s.RegisterService(&BMC_ServiceDesc, srv) + s.RegisterService(&_BMC_serviceDesc, srv) } func _BMC_NetworkSource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { @@ -160,7 +145,7 @@ func _BMC_NetworkSource_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: BMC_NetworkSource_FullMethodName, + FullMethod: "/github.com.tinkerbell.pbnj.api.v1.BMC/NetworkSource", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(BMCServer).NetworkSource(ctx, req.(*NetworkSourceRequest)) @@ -178,7 +163,7 @@ func _BMC_Reset_Handler(srv interface{}, ctx context.Context, dec func(interface } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: BMC_Reset_FullMethodName, + FullMethod: "/github.com.tinkerbell.pbnj.api.v1.BMC/Reset", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(BMCServer).Reset(ctx, req.(*ResetRequest)) @@ -196,7 +181,7 @@ func _BMC_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: BMC_CreateUser_FullMethodName, + FullMethod: "/github.com.tinkerbell.pbnj.api.v1.BMC/CreateUser", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(BMCServer).CreateUser(ctx, req.(*CreateUserRequest)) @@ -214,7 +199,7 @@ func _BMC_DeleteUser_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: BMC_DeleteUser_FullMethodName, + FullMethod: "/github.com.tinkerbell.pbnj.api.v1.BMC/DeleteUser", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(BMCServer).DeleteUser(ctx, req.(*DeleteUserRequest)) @@ -232,7 +217,7 @@ func _BMC_UpdateUser_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: BMC_UpdateUser_FullMethodName, + FullMethod: "/github.com.tinkerbell.pbnj.api.v1.BMC/UpdateUser", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(BMCServer).UpdateUser(ctx, req.(*UpdateUserRequest)) @@ -250,7 +235,7 @@ func _BMC_DeactivateSOL_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: BMC_DeactivateSOL_FullMethodName, + FullMethod: "/github.com.tinkerbell.pbnj.api.v1.BMC/DeactivateSOL", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(BMCServer).DeactivateSOL(ctx, req.(*DeactivateSOLRequest)) @@ -258,10 +243,7 @@ func _BMC_DeactivateSOL_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } -// BMC_ServiceDesc is the grpc.ServiceDesc for BMC service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var BMC_ServiceDesc = grpc.ServiceDesc{ +var _BMC_serviceDesc = grpc.ServiceDesc{ ServiceName: "github.com.tinkerbell.pbnj.api.v1.BMC", HandlerType: (*BMCServer)(nil), Methods: []grpc.MethodDesc{ diff --git a/api/v1/common.pb.go b/api/v1/common.pb.go index be24ba3..bbb5ddd 100644 --- a/api/v1/common.pb.go +++ b/api/v1/common.pb.go @@ -1,18 +1,18 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc-gen-go v1.25.0 +// protoc v3.13.0 // source: api/v1/common.proto package v1 import ( - reflect "reflect" - sync "sync" - + proto "github.com/golang/protobuf/proto" _ "github.com/mwitkow/go-proto-validators" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) const ( @@ -22,6 +22,10 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + // The canonical error codes for gRPC APIs. // https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto // diff --git a/api/v1/common.validator.pb.go b/api/v1/common.validator.pb.go index 81dc345..824cb44 100644 --- a/api/v1/common.validator.pb.go +++ b/api/v1/common.validator.pb.go @@ -6,7 +6,6 @@ package v1 import ( fmt "fmt" math "math" - proto "github.com/golang/protobuf/proto" _ "github.com/mwitkow/go-proto-validators" github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" diff --git a/api/v1/diagnostic.pb.go b/api/v1/diagnostic.pb.go new file mode 100644 index 0000000..cd9435e --- /dev/null +++ b/api/v1/diagnostic.pb.go @@ -0,0 +1,892 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.13.0 +// source: api/v1/diagnostic.proto + +package v1 + +import ( + proto "github.com/golang/protobuf/proto" + empty "github.com/golang/protobuf/ptypes/empty" + 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) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type ScreenshotRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authn *Authn `protobuf:"bytes,1,opt,name=authn,proto3" json:"authn,omitempty"` + Vendor *Vendor `protobuf:"bytes,2,opt,name=vendor,proto3" json:"vendor,omitempty"` +} + +func (x *ScreenshotRequest) Reset() { + *x = ScreenshotRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v1_diagnostic_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ScreenshotRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScreenshotRequest) ProtoMessage() {} + +func (x *ScreenshotRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_diagnostic_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 ScreenshotRequest.ProtoReflect.Descriptor instead. +func (*ScreenshotRequest) Descriptor() ([]byte, []int) { + return file_api_v1_diagnostic_proto_rawDescGZIP(), []int{0} +} + +func (x *ScreenshotRequest) GetAuthn() *Authn { + if x != nil { + return x.Authn + } + return nil +} + +func (x *ScreenshotRequest) GetVendor() *Vendor { + if x != nil { + return x.Vendor + } + return nil +} + +type ScreenshotResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Image []byte `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"` + Filetype string `protobuf:"bytes,2,opt,name=filetype,proto3" json:"filetype,omitempty"` +} + +func (x *ScreenshotResponse) Reset() { + *x = ScreenshotResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v1_diagnostic_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ScreenshotResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScreenshotResponse) ProtoMessage() {} + +func (x *ScreenshotResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_diagnostic_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 ScreenshotResponse.ProtoReflect.Descriptor instead. +func (*ScreenshotResponse) Descriptor() ([]byte, []int) { + return file_api_v1_diagnostic_proto_rawDescGZIP(), []int{1} +} + +func (x *ScreenshotResponse) GetImage() []byte { + if x != nil { + return x.Image + } + return nil +} + +func (x *ScreenshotResponse) GetFiletype() string { + if x != nil { + return x.Filetype + } + return "" +} + +type ClearSystemEventLogRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authn *Authn `protobuf:"bytes,1,opt,name=authn,proto3" json:"authn,omitempty"` + Vendor *Vendor `protobuf:"bytes,2,opt,name=vendor,proto3" json:"vendor,omitempty"` +} + +func (x *ClearSystemEventLogRequest) Reset() { + *x = ClearSystemEventLogRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v1_diagnostic_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClearSystemEventLogRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClearSystemEventLogRequest) ProtoMessage() {} + +func (x *ClearSystemEventLogRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_diagnostic_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 ClearSystemEventLogRequest.ProtoReflect.Descriptor instead. +func (*ClearSystemEventLogRequest) Descriptor() ([]byte, []int) { + return file_api_v1_diagnostic_proto_rawDescGZIP(), []int{2} +} + +func (x *ClearSystemEventLogRequest) GetAuthn() *Authn { + if x != nil { + return x.Authn + } + return nil +} + +func (x *ClearSystemEventLogRequest) GetVendor() *Vendor { + if x != nil { + return x.Vendor + } + return nil +} + +type ClearSystemEventLogResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` +} + +func (x *ClearSystemEventLogResponse) Reset() { + *x = ClearSystemEventLogResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v1_diagnostic_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClearSystemEventLogResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClearSystemEventLogResponse) ProtoMessage() {} + +func (x *ClearSystemEventLogResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_diagnostic_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 ClearSystemEventLogResponse.ProtoReflect.Descriptor instead. +func (*ClearSystemEventLogResponse) Descriptor() ([]byte, []int) { + return file_api_v1_diagnostic_proto_rawDescGZIP(), []int{3} +} + +func (x *ClearSystemEventLogResponse) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + +type SendNMIRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authn *Authn `protobuf:"bytes,1,opt,name=authn,proto3" json:"authn,omitempty"` +} + +func (x *SendNMIRequest) Reset() { + *x = SendNMIRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v1_diagnostic_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendNMIRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendNMIRequest) ProtoMessage() {} + +func (x *SendNMIRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_diagnostic_proto_msgTypes[4] + 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 SendNMIRequest.ProtoReflect.Descriptor instead. +func (*SendNMIRequest) Descriptor() ([]byte, []int) { + return file_api_v1_diagnostic_proto_rawDescGZIP(), []int{4} +} + +func (x *SendNMIRequest) GetAuthn() *Authn { + if x != nil { + return x.Authn + } + return nil +} + +type SystemEventLogRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authn *Authn `protobuf:"bytes,1,opt,name=authn,proto3" json:"authn,omitempty"` + Vendor *Vendor `protobuf:"bytes,2,opt,name=vendor,proto3" json:"vendor,omitempty"` +} + +func (x *SystemEventLogRequest) Reset() { + *x = SystemEventLogRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v1_diagnostic_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SystemEventLogRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemEventLogRequest) ProtoMessage() {} + +func (x *SystemEventLogRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_diagnostic_proto_msgTypes[5] + 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 SystemEventLogRequest.ProtoReflect.Descriptor instead. +func (*SystemEventLogRequest) Descriptor() ([]byte, []int) { + return file_api_v1_diagnostic_proto_rawDescGZIP(), []int{5} +} + +func (x *SystemEventLogRequest) GetAuthn() *Authn { + if x != nil { + return x.Authn + } + return nil +} + +func (x *SystemEventLogRequest) GetVendor() *Vendor { + if x != nil { + return x.Vendor + } + return nil +} + +type SystemEventLogEntry struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Timestamp string `protobuf:"bytes,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *SystemEventLogEntry) Reset() { + *x = SystemEventLogEntry{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v1_diagnostic_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SystemEventLogEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemEventLogEntry) ProtoMessage() {} + +func (x *SystemEventLogEntry) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_diagnostic_proto_msgTypes[6] + 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 SystemEventLogEntry.ProtoReflect.Descriptor instead. +func (*SystemEventLogEntry) Descriptor() ([]byte, []int) { + return file_api_v1_diagnostic_proto_rawDescGZIP(), []int{6} +} + +func (x *SystemEventLogEntry) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *SystemEventLogEntry) GetTimestamp() string { + if x != nil { + return x.Timestamp + } + return "" +} + +func (x *SystemEventLogEntry) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *SystemEventLogEntry) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type SystemEventLogResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Events []*SystemEventLogEntry `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` +} + +func (x *SystemEventLogResponse) Reset() { + *x = SystemEventLogResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v1_diagnostic_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SystemEventLogResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemEventLogResponse) ProtoMessage() {} + +func (x *SystemEventLogResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_diagnostic_proto_msgTypes[7] + 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 SystemEventLogResponse.ProtoReflect.Descriptor instead. +func (*SystemEventLogResponse) Descriptor() ([]byte, []int) { + return file_api_v1_diagnostic_proto_rawDescGZIP(), []int{7} +} + +func (x *SystemEventLogResponse) GetEvents() []*SystemEventLogEntry { + if x != nil { + return x.Events + } + return nil +} + +type SystemEventLogRawRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authn *Authn `protobuf:"bytes,1,opt,name=authn,proto3" json:"authn,omitempty"` + Vendor *Vendor `protobuf:"bytes,2,opt,name=vendor,proto3" json:"vendor,omitempty"` +} + +func (x *SystemEventLogRawRequest) Reset() { + *x = SystemEventLogRawRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v1_diagnostic_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SystemEventLogRawRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemEventLogRawRequest) ProtoMessage() {} + +func (x *SystemEventLogRawRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_diagnostic_proto_msgTypes[8] + 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 SystemEventLogRawRequest.ProtoReflect.Descriptor instead. +func (*SystemEventLogRawRequest) Descriptor() ([]byte, []int) { + return file_api_v1_diagnostic_proto_rawDescGZIP(), []int{8} +} + +func (x *SystemEventLogRawRequest) GetAuthn() *Authn { + if x != nil { + return x.Authn + } + return nil +} + +func (x *SystemEventLogRawRequest) GetVendor() *Vendor { + if x != nil { + return x.Vendor + } + return nil +} + +type SystemEventLogRawResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Log string `protobuf:"bytes,1,opt,name=log,proto3" json:"log,omitempty"` +} + +func (x *SystemEventLogRawResponse) Reset() { + *x = SystemEventLogRawResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v1_diagnostic_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SystemEventLogRawResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemEventLogRawResponse) ProtoMessage() {} + +func (x *SystemEventLogRawResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_diagnostic_proto_msgTypes[9] + 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 SystemEventLogRawResponse.ProtoReflect.Descriptor instead. +func (*SystemEventLogRawResponse) Descriptor() ([]byte, []int) { + return file_api_v1_diagnostic_proto_rawDescGZIP(), []int{9} +} + +func (x *SystemEventLogRawResponse) GetLog() string { + if x != nil { + return x.Log + } + return "" +} + +var File_api_v1_diagnostic_proto protoreflect.FileDescriptor + +var file_api_v1_diagnostic_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, + 0x74, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x21, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, + 0x2e, 0x70, 0x62, 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, + 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x13, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x96, + 0x01, 0x0a, 0x11, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x05, 0x61, 0x75, 0x74, 0x68, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, 0x6a, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6e, 0x52, 0x05, 0x61, + 0x75, 0x74, 0x68, 0x6e, 0x12, 0x41, 0x0a, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, + 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x52, + 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x22, 0x46, 0x0a, 0x12, 0x53, 0x63, 0x72, 0x65, 0x65, + 0x6e, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x69, 0x6d, + 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x74, 0x79, 0x70, 0x65, 0x22, + 0x9f, 0x01, 0x0a, 0x1a, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, + 0x0a, 0x05, 0x61, 0x75, 0x74, 0x68, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, + 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6e, 0x52, 0x05, 0x61, 0x75, 0x74, 0x68, 0x6e, 0x12, 0x41, + 0x0a, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, + 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, + 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x2e, 0x56, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x52, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, + 0x72, 0x22, 0x36, 0x0a, 0x1b, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x50, 0x0a, 0x0e, 0x53, 0x65, 0x6e, + 0x64, 0x4e, 0x4d, 0x49, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x05, 0x61, + 0x75, 0x74, 0x68, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, + 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x41, + 0x75, 0x74, 0x68, 0x6e, 0x52, 0x05, 0x61, 0x75, 0x74, 0x68, 0x6e, 0x22, 0x9a, 0x01, 0x0a, 0x15, + 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x05, 0x61, 0x75, 0x74, 0x68, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, + 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6e, 0x52, 0x05, + 0x61, 0x75, 0x74, 0x68, 0x6e, 0x12, 0x41, 0x0a, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, + 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x65, 0x6e, 0x64, 0x6f, 0x72, + 0x52, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x22, 0x7f, 0x0a, 0x13, 0x53, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x20, 0x0a, + 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x68, 0x0a, 0x16, 0x53, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x4e, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, 0x6a, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x73, 0x22, 0x9d, 0x01, 0x0a, 0x18, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x61, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x3e, 0x0a, 0x05, 0x61, 0x75, 0x74, 0x68, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x28, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, + 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6e, 0x52, 0x05, 0x61, 0x75, 0x74, 0x68, 0x6e, + 0x12, 0x41, 0x0a, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x29, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x69, + 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, 0x6a, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x52, 0x06, 0x76, 0x65, 0x6e, + 0x64, 0x6f, 0x72, 0x22, 0x2d, 0x0a, 0x19, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x61, 0x77, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6c, + 0x6f, 0x67, 0x32, 0x8d, 0x05, 0x0a, 0x0a, 0x44, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, + 0x63, 0x12, 0x79, 0x0a, 0x0a, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x73, 0x68, 0x6f, 0x74, 0x12, + 0x34, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, + 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, + 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, + 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x94, 0x01, 0x0a, + 0x13, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x4c, 0x6f, 0x67, 0x12, 0x3d, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, + 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x53, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x3e, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, 0x6a, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x53, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x07, 0x53, 0x65, 0x6e, 0x64, 0x4e, 0x4d, 0x49, 0x12, 0x31, + 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, + 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4e, 0x4d, 0x49, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x85, 0x01, 0x0a, 0x0e, 0x53, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x12, 0x38, 0x2e, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, + 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, + 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x39, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, + 0x62, 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x8e, 0x01, 0x0a, 0x11, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x61, 0x77, 0x12, 0x3b, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, + 0x70, 0x62, 0x6e, 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x61, 0x77, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3c, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2e, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x62, 0x6e, + 0x6a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x61, 0x77, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x42, 0x33, 0x5a, 0x21, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x74, 0x69, 0x6e, 0x6b, 0x65, 0x72, 0x62, 0x65, 0x6c, 0x6c, 0x2f, 0x70, 0x62, 0x6e, 0x6a, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0xea, 0x02, 0x0d, 0x50, 0x62, 0x6e, 0x6a, 0x3a, 0x3a, + 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_api_v1_diagnostic_proto_rawDescOnce sync.Once + file_api_v1_diagnostic_proto_rawDescData = file_api_v1_diagnostic_proto_rawDesc +) + +func file_api_v1_diagnostic_proto_rawDescGZIP() []byte { + file_api_v1_diagnostic_proto_rawDescOnce.Do(func() { + file_api_v1_diagnostic_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_v1_diagnostic_proto_rawDescData) + }) + return file_api_v1_diagnostic_proto_rawDescData +} + +var file_api_v1_diagnostic_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_api_v1_diagnostic_proto_goTypes = []interface{}{ + (*ScreenshotRequest)(nil), // 0: github.com.tinkerbell.pbnj.api.v1.ScreenshotRequest + (*ScreenshotResponse)(nil), // 1: github.com.tinkerbell.pbnj.api.v1.ScreenshotResponse + (*ClearSystemEventLogRequest)(nil), // 2: github.com.tinkerbell.pbnj.api.v1.ClearSystemEventLogRequest + (*ClearSystemEventLogResponse)(nil), // 3: github.com.tinkerbell.pbnj.api.v1.ClearSystemEventLogResponse + (*SendNMIRequest)(nil), // 4: github.com.tinkerbell.pbnj.api.v1.SendNMIRequest + (*SystemEventLogRequest)(nil), // 5: github.com.tinkerbell.pbnj.api.v1.SystemEventLogRequest + (*SystemEventLogEntry)(nil), // 6: github.com.tinkerbell.pbnj.api.v1.SystemEventLogEntry + (*SystemEventLogResponse)(nil), // 7: github.com.tinkerbell.pbnj.api.v1.SystemEventLogResponse + (*SystemEventLogRawRequest)(nil), // 8: github.com.tinkerbell.pbnj.api.v1.SystemEventLogRawRequest + (*SystemEventLogRawResponse)(nil), // 9: github.com.tinkerbell.pbnj.api.v1.SystemEventLogRawResponse + (*Authn)(nil), // 10: github.com.tinkerbell.pbnj.api.v1.Authn + (*Vendor)(nil), // 11: github.com.tinkerbell.pbnj.api.v1.Vendor + (*empty.Empty)(nil), // 12: google.protobuf.Empty +} +var file_api_v1_diagnostic_proto_depIdxs = []int32{ + 10, // 0: github.com.tinkerbell.pbnj.api.v1.ScreenshotRequest.authn:type_name -> github.com.tinkerbell.pbnj.api.v1.Authn + 11, // 1: github.com.tinkerbell.pbnj.api.v1.ScreenshotRequest.vendor:type_name -> github.com.tinkerbell.pbnj.api.v1.Vendor + 10, // 2: github.com.tinkerbell.pbnj.api.v1.ClearSystemEventLogRequest.authn:type_name -> github.com.tinkerbell.pbnj.api.v1.Authn + 11, // 3: github.com.tinkerbell.pbnj.api.v1.ClearSystemEventLogRequest.vendor:type_name -> github.com.tinkerbell.pbnj.api.v1.Vendor + 10, // 4: github.com.tinkerbell.pbnj.api.v1.SendNMIRequest.authn:type_name -> github.com.tinkerbell.pbnj.api.v1.Authn + 10, // 5: github.com.tinkerbell.pbnj.api.v1.SystemEventLogRequest.authn:type_name -> github.com.tinkerbell.pbnj.api.v1.Authn + 11, // 6: github.com.tinkerbell.pbnj.api.v1.SystemEventLogRequest.vendor:type_name -> github.com.tinkerbell.pbnj.api.v1.Vendor + 6, // 7: github.com.tinkerbell.pbnj.api.v1.SystemEventLogResponse.events:type_name -> github.com.tinkerbell.pbnj.api.v1.SystemEventLogEntry + 10, // 8: github.com.tinkerbell.pbnj.api.v1.SystemEventLogRawRequest.authn:type_name -> github.com.tinkerbell.pbnj.api.v1.Authn + 11, // 9: github.com.tinkerbell.pbnj.api.v1.SystemEventLogRawRequest.vendor:type_name -> github.com.tinkerbell.pbnj.api.v1.Vendor + 0, // 10: github.com.tinkerbell.pbnj.api.v1.Diagnostic.Screenshot:input_type -> github.com.tinkerbell.pbnj.api.v1.ScreenshotRequest + 2, // 11: github.com.tinkerbell.pbnj.api.v1.Diagnostic.ClearSystemEventLog:input_type -> github.com.tinkerbell.pbnj.api.v1.ClearSystemEventLogRequest + 4, // 12: github.com.tinkerbell.pbnj.api.v1.Diagnostic.SendNMI:input_type -> github.com.tinkerbell.pbnj.api.v1.SendNMIRequest + 5, // 13: github.com.tinkerbell.pbnj.api.v1.Diagnostic.SystemEventLog:input_type -> github.com.tinkerbell.pbnj.api.v1.SystemEventLogRequest + 8, // 14: github.com.tinkerbell.pbnj.api.v1.Diagnostic.SystemEventLogRaw:input_type -> github.com.tinkerbell.pbnj.api.v1.SystemEventLogRawRequest + 1, // 15: github.com.tinkerbell.pbnj.api.v1.Diagnostic.Screenshot:output_type -> github.com.tinkerbell.pbnj.api.v1.ScreenshotResponse + 3, // 16: github.com.tinkerbell.pbnj.api.v1.Diagnostic.ClearSystemEventLog:output_type -> github.com.tinkerbell.pbnj.api.v1.ClearSystemEventLogResponse + 12, // 17: github.com.tinkerbell.pbnj.api.v1.Diagnostic.SendNMI:output_type -> google.protobuf.Empty + 7, // 18: github.com.tinkerbell.pbnj.api.v1.Diagnostic.SystemEventLog:output_type -> github.com.tinkerbell.pbnj.api.v1.SystemEventLogResponse + 9, // 19: github.com.tinkerbell.pbnj.api.v1.Diagnostic.SystemEventLogRaw:output_type -> github.com.tinkerbell.pbnj.api.v1.SystemEventLogRawResponse + 15, // [15:20] is the sub-list for method output_type + 10, // [10:15] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name +} + +func init() { file_api_v1_diagnostic_proto_init() } +func file_api_v1_diagnostic_proto_init() { + if File_api_v1_diagnostic_proto != nil { + return + } + file_api_v1_common_proto_init() + if !protoimpl.UnsafeEnabled { + file_api_v1_diagnostic_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ScreenshotRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v1_diagnostic_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ScreenshotResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v1_diagnostic_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClearSystemEventLogRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v1_diagnostic_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClearSystemEventLogResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v1_diagnostic_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendNMIRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v1_diagnostic_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SystemEventLogRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v1_diagnostic_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SystemEventLogEntry); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v1_diagnostic_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SystemEventLogResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v1_diagnostic_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SystemEventLogRawRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v1_diagnostic_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SystemEventLogRawResponse); 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_api_v1_diagnostic_proto_rawDesc, + NumEnums: 0, + NumMessages: 10, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_v1_diagnostic_proto_goTypes, + DependencyIndexes: file_api_v1_diagnostic_proto_depIdxs, + MessageInfos: file_api_v1_diagnostic_proto_msgTypes, + }.Build() + File_api_v1_diagnostic_proto = out.File + file_api_v1_diagnostic_proto_rawDesc = nil + file_api_v1_diagnostic_proto_goTypes = nil + file_api_v1_diagnostic_proto_depIdxs = nil +} diff --git a/api/v1/diagnostic.validator.pb.go b/api/v1/diagnostic.validator.pb.go new file mode 100644 index 0000000..25ae8ad --- /dev/null +++ b/api/v1/diagnostic.validator.pb.go @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: api/v1/diagnostic.proto + +package v1 + +import ( + fmt "fmt" + math "math" + proto "github.com/golang/protobuf/proto" + _ "github.com/golang/protobuf/ptypes/empty" + github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +func (this *ScreenshotRequest) Validate() error { + if this.Authn != nil { + if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Authn); err != nil { + return github_com_mwitkow_go_proto_validators.FieldError("Authn", err) + } + } + if this.Vendor != nil { + if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Vendor); err != nil { + return github_com_mwitkow_go_proto_validators.FieldError("Vendor", err) + } + } + return nil +} +func (this *ScreenshotResponse) Validate() error { + return nil +} +func (this *ClearSystemEventLogRequest) Validate() error { + if this.Authn != nil { + if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Authn); err != nil { + return github_com_mwitkow_go_proto_validators.FieldError("Authn", err) + } + } + if this.Vendor != nil { + if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Vendor); err != nil { + return github_com_mwitkow_go_proto_validators.FieldError("Vendor", err) + } + } + return nil +} +func (this *ClearSystemEventLogResponse) Validate() error { + return nil +} +func (this *SendNMIRequest) Validate() error { + if this.Authn != nil { + if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Authn); err != nil { + return github_com_mwitkow_go_proto_validators.FieldError("Authn", err) + } + } + return nil +} +func (this *SystemEventLogRequest) Validate() error { + if this.Authn != nil { + if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Authn); err != nil { + return github_com_mwitkow_go_proto_validators.FieldError("Authn", err) + } + } + if this.Vendor != nil { + if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Vendor); err != nil { + return github_com_mwitkow_go_proto_validators.FieldError("Vendor", err) + } + } + return nil +} +func (this *SystemEventLogEntry) Validate() error { + return nil +} +func (this *SystemEventLogResponse) Validate() error { + for _, item := range this.Events { + if item != nil { + if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { + return github_com_mwitkow_go_proto_validators.FieldError("Events", err) + } + } + } + return nil +} +func (this *SystemEventLogRawRequest) Validate() error { + if this.Authn != nil { + if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Authn); err != nil { + return github_com_mwitkow_go_proto_validators.FieldError("Authn", err) + } + } + if this.Vendor != nil { + if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Vendor); err != nil { + return github_com_mwitkow_go_proto_validators.FieldError("Vendor", err) + } + } + return nil +} +func (this *SystemEventLogRawResponse) Validate() error { + return nil +} diff --git a/api/v1/diagnostic_grpc.pb.go b/api/v1/diagnostic_grpc.pb.go new file mode 100644 index 0000000..29c2fc7 --- /dev/null +++ b/api/v1/diagnostic_grpc.pb.go @@ -0,0 +1,242 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package v1 + +import ( + context "context" + empty "github.com/golang/protobuf/ptypes/empty" + 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. +const _ = grpc.SupportPackageIsVersion7 + +// DiagnosticClient is the client API for Diagnostic 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 DiagnosticClient interface { + Screenshot(ctx context.Context, in *ScreenshotRequest, opts ...grpc.CallOption) (*ScreenshotResponse, error) + ClearSystemEventLog(ctx context.Context, in *ClearSystemEventLogRequest, opts ...grpc.CallOption) (*ClearSystemEventLogResponse, error) + SendNMI(ctx context.Context, in *SendNMIRequest, opts ...grpc.CallOption) (*empty.Empty, error) + SystemEventLog(ctx context.Context, in *SystemEventLogRequest, opts ...grpc.CallOption) (*SystemEventLogResponse, error) + SystemEventLogRaw(ctx context.Context, in *SystemEventLogRawRequest, opts ...grpc.CallOption) (*SystemEventLogRawResponse, error) +} + +type diagnosticClient struct { + cc grpc.ClientConnInterface +} + +func NewDiagnosticClient(cc grpc.ClientConnInterface) DiagnosticClient { + return &diagnosticClient{cc} +} + +func (c *diagnosticClient) Screenshot(ctx context.Context, in *ScreenshotRequest, opts ...grpc.CallOption) (*ScreenshotResponse, error) { + out := new(ScreenshotResponse) + err := c.cc.Invoke(ctx, "/github.com.tinkerbell.pbnj.api.v1.Diagnostic/Screenshot", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *diagnosticClient) ClearSystemEventLog(ctx context.Context, in *ClearSystemEventLogRequest, opts ...grpc.CallOption) (*ClearSystemEventLogResponse, error) { + out := new(ClearSystemEventLogResponse) + err := c.cc.Invoke(ctx, "/github.com.tinkerbell.pbnj.api.v1.Diagnostic/ClearSystemEventLog", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *diagnosticClient) SendNMI(ctx context.Context, in *SendNMIRequest, opts ...grpc.CallOption) (*empty.Empty, error) { + out := new(empty.Empty) + err := c.cc.Invoke(ctx, "/github.com.tinkerbell.pbnj.api.v1.Diagnostic/SendNMI", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *diagnosticClient) SystemEventLog(ctx context.Context, in *SystemEventLogRequest, opts ...grpc.CallOption) (*SystemEventLogResponse, error) { + out := new(SystemEventLogResponse) + err := c.cc.Invoke(ctx, "/github.com.tinkerbell.pbnj.api.v1.Diagnostic/SystemEventLog", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *diagnosticClient) SystemEventLogRaw(ctx context.Context, in *SystemEventLogRawRequest, opts ...grpc.CallOption) (*SystemEventLogRawResponse, error) { + out := new(SystemEventLogRawResponse) + err := c.cc.Invoke(ctx, "/github.com.tinkerbell.pbnj.api.v1.Diagnostic/SystemEventLogRaw", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// DiagnosticServer is the server API for Diagnostic service. +// All implementations must embed UnimplementedDiagnosticServer +// for forward compatibility +type DiagnosticServer interface { + Screenshot(context.Context, *ScreenshotRequest) (*ScreenshotResponse, error) + ClearSystemEventLog(context.Context, *ClearSystemEventLogRequest) (*ClearSystemEventLogResponse, error) + SendNMI(context.Context, *SendNMIRequest) (*empty.Empty, error) + SystemEventLog(context.Context, *SystemEventLogRequest) (*SystemEventLogResponse, error) + SystemEventLogRaw(context.Context, *SystemEventLogRawRequest) (*SystemEventLogRawResponse, error) + mustEmbedUnimplementedDiagnosticServer() +} + +// UnimplementedDiagnosticServer must be embedded to have forward compatible implementations. +type UnimplementedDiagnosticServer struct { +} + +func (UnimplementedDiagnosticServer) Screenshot(context.Context, *ScreenshotRequest) (*ScreenshotResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Screenshot not implemented") +} +func (UnimplementedDiagnosticServer) ClearSystemEventLog(context.Context, *ClearSystemEventLogRequest) (*ClearSystemEventLogResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClearSystemEventLog not implemented") +} +func (UnimplementedDiagnosticServer) SendNMI(context.Context, *SendNMIRequest) (*empty.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method SendNMI not implemented") +} +func (UnimplementedDiagnosticServer) SystemEventLog(context.Context, *SystemEventLogRequest) (*SystemEventLogResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SystemEventLog not implemented") +} +func (UnimplementedDiagnosticServer) SystemEventLogRaw(context.Context, *SystemEventLogRawRequest) (*SystemEventLogRawResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SystemEventLogRaw not implemented") +} +func (UnimplementedDiagnosticServer) mustEmbedUnimplementedDiagnosticServer() {} + +// UnsafeDiagnosticServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to DiagnosticServer will +// result in compilation errors. +type UnsafeDiagnosticServer interface { + mustEmbedUnimplementedDiagnosticServer() +} + +func RegisterDiagnosticServer(s grpc.ServiceRegistrar, srv DiagnosticServer) { + s.RegisterService(&_Diagnostic_serviceDesc, srv) +} + +func _Diagnostic_Screenshot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ScreenshotRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DiagnosticServer).Screenshot(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/github.com.tinkerbell.pbnj.api.v1.Diagnostic/Screenshot", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DiagnosticServer).Screenshot(ctx, req.(*ScreenshotRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Diagnostic_ClearSystemEventLog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ClearSystemEventLogRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DiagnosticServer).ClearSystemEventLog(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/github.com.tinkerbell.pbnj.api.v1.Diagnostic/ClearSystemEventLog", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DiagnosticServer).ClearSystemEventLog(ctx, req.(*ClearSystemEventLogRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Diagnostic_SendNMI_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SendNMIRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DiagnosticServer).SendNMI(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/github.com.tinkerbell.pbnj.api.v1.Diagnostic/SendNMI", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DiagnosticServer).SendNMI(ctx, req.(*SendNMIRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Diagnostic_SystemEventLog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SystemEventLogRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DiagnosticServer).SystemEventLog(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/github.com.tinkerbell.pbnj.api.v1.Diagnostic/SystemEventLog", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DiagnosticServer).SystemEventLog(ctx, req.(*SystemEventLogRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Diagnostic_SystemEventLogRaw_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SystemEventLogRawRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DiagnosticServer).SystemEventLogRaw(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/github.com.tinkerbell.pbnj.api.v1.Diagnostic/SystemEventLogRaw", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DiagnosticServer).SystemEventLogRaw(ctx, req.(*SystemEventLogRawRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Diagnostic_serviceDesc = grpc.ServiceDesc{ + ServiceName: "github.com.tinkerbell.pbnj.api.v1.Diagnostic", + HandlerType: (*DiagnosticServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Screenshot", + Handler: _Diagnostic_Screenshot_Handler, + }, + { + MethodName: "ClearSystemEventLog", + Handler: _Diagnostic_ClearSystemEventLog_Handler, + }, + { + MethodName: "SendNMI", + Handler: _Diagnostic_SendNMI_Handler, + }, + { + MethodName: "SystemEventLog", + Handler: _Diagnostic_SystemEventLog_Handler, + }, + { + MethodName: "SystemEventLogRaw", + Handler: _Diagnostic_SystemEventLogRaw_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "api/v1/diagnostic.proto", +} diff --git a/api/v1/machine.pb.go b/api/v1/machine.pb.go index 1eb383b..3dce84d 100644 --- a/api/v1/machine.pb.go +++ b/api/v1/machine.pb.go @@ -1,18 +1,18 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc-gen-go v1.25.0 +// protoc v3.13.0 // source: api/v1/machine.proto package v1 import ( - reflect "reflect" - sync "sync" - + proto "github.com/golang/protobuf/proto" _ "github.com/mwitkow/go-proto-validators" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) const ( @@ -22,6 +22,10 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + type BootDevice int32 const ( diff --git a/api/v1/machine.validator.pb.go b/api/v1/machine.validator.pb.go index 9632e5c..874308a 100644 --- a/api/v1/machine.validator.pb.go +++ b/api/v1/machine.validator.pb.go @@ -6,7 +6,6 @@ package v1 import ( fmt "fmt" math "math" - proto "github.com/golang/protobuf/proto" _ "github.com/mwitkow/go-proto-validators" github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" diff --git a/api/v1/machine_grpc.pb.go b/api/v1/machine_grpc.pb.go index f237d45..9c41bf6 100644 --- a/api/v1/machine_grpc.pb.go +++ b/api/v1/machine_grpc.pb.go @@ -1,14 +1,9 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.3 -// source: api/v1/machine.proto package v1 import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -16,14 +11,8 @@ import ( // 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 -const ( - Machine_BootDevice_FullMethodName = "/github.com.tinkerbell.pbnj.api.v1.Machine/BootDevice" - Machine_Power_FullMethodName = "/github.com.tinkerbell.pbnj.api.v1.Machine/Power" -) - // MachineClient is the client API for Machine 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. @@ -42,7 +31,7 @@ func NewMachineClient(cc grpc.ClientConnInterface) MachineClient { func (c *machineClient) BootDevice(ctx context.Context, in *DeviceRequest, opts ...grpc.CallOption) (*DeviceResponse, error) { out := new(DeviceResponse) - err := c.cc.Invoke(ctx, Machine_BootDevice_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/github.com.tinkerbell.pbnj.api.v1.Machine/BootDevice", in, out, opts...) if err != nil { return nil, err } @@ -51,7 +40,7 @@ func (c *machineClient) BootDevice(ctx context.Context, in *DeviceRequest, opts func (c *machineClient) Power(ctx context.Context, in *PowerRequest, opts ...grpc.CallOption) (*PowerResponse, error) { out := new(PowerResponse) - err := c.cc.Invoke(ctx, Machine_Power_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/github.com.tinkerbell.pbnj.api.v1.Machine/Power", in, out, opts...) if err != nil { return nil, err } @@ -87,7 +76,7 @@ type UnsafeMachineServer interface { } func RegisterMachineServer(s grpc.ServiceRegistrar, srv MachineServer) { - s.RegisterService(&Machine_ServiceDesc, srv) + s.RegisterService(&_Machine_serviceDesc, srv) } func _Machine_BootDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { @@ -100,7 +89,7 @@ func _Machine_BootDevice_Handler(srv interface{}, ctx context.Context, dec func( } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Machine_BootDevice_FullMethodName, + FullMethod: "/github.com.tinkerbell.pbnj.api.v1.Machine/BootDevice", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MachineServer).BootDevice(ctx, req.(*DeviceRequest)) @@ -118,7 +107,7 @@ func _Machine_Power_Handler(srv interface{}, ctx context.Context, dec func(inter } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Machine_Power_FullMethodName, + FullMethod: "/github.com.tinkerbell.pbnj.api.v1.Machine/Power", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MachineServer).Power(ctx, req.(*PowerRequest)) @@ -126,10 +115,7 @@ func _Machine_Power_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } -// Machine_ServiceDesc is the grpc.ServiceDesc for Machine service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Machine_ServiceDesc = grpc.ServiceDesc{ +var _Machine_serviceDesc = grpc.ServiceDesc{ ServiceName: "github.com.tinkerbell.pbnj.api.v1.Machine", HandlerType: (*MachineServer)(nil), Methods: []grpc.MethodDesc{ diff --git a/api/v1/task.pb.go b/api/v1/task.pb.go index 6742773..57fd952 100644 --- a/api/v1/task.pb.go +++ b/api/v1/task.pb.go @@ -1,18 +1,18 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 -// protoc v4.25.3 +// protoc-gen-go v1.25.0 +// protoc v3.13.0 // source: api/v1/task.proto package v1 import ( - reflect "reflect" - sync "sync" - + proto "github.com/golang/protobuf/proto" _ "github.com/mwitkow/go-proto-validators" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) const ( @@ -22,6 +22,10 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + type StatusRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/api/v1/task.validator.pb.go b/api/v1/task.validator.pb.go index 3ce8edb..5e5ffe0 100644 --- a/api/v1/task.validator.pb.go +++ b/api/v1/task.validator.pb.go @@ -6,7 +6,6 @@ package v1 import ( fmt "fmt" math "math" - proto "github.com/golang/protobuf/proto" _ "github.com/mwitkow/go-proto-validators" github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" diff --git a/api/v1/task_grpc.pb.go b/api/v1/task_grpc.pb.go index f6b8d45..c5967dd 100644 --- a/api/v1/task_grpc.pb.go +++ b/api/v1/task_grpc.pb.go @@ -1,14 +1,9 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.3 -// source: api/v1/task.proto package v1 import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -16,13 +11,8 @@ import ( // 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 -const ( - Task_Status_FullMethodName = "/github.com.tinkerbell.pbnj.api.v1.Task/Status" -) - // TaskClient is the client API for Task 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. @@ -40,7 +30,7 @@ func NewTaskClient(cc grpc.ClientConnInterface) TaskClient { func (c *taskClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) { out := new(StatusResponse) - err := c.cc.Invoke(ctx, Task_Status_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/github.com.tinkerbell.pbnj.api.v1.Task/Status", in, out, opts...) if err != nil { return nil, err } @@ -72,7 +62,7 @@ type UnsafeTaskServer interface { } func RegisterTaskServer(s grpc.ServiceRegistrar, srv TaskServer) { - s.RegisterService(&Task_ServiceDesc, srv) + s.RegisterService(&_Task_serviceDesc, srv) } func _Task_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { @@ -85,7 +75,7 @@ func _Task_Status_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Task_Status_FullMethodName, + FullMethod: "/github.com.tinkerbell.pbnj.api.v1.Task/Status", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(TaskServer).Status(ctx, req.(*StatusRequest)) @@ -93,10 +83,7 @@ func _Task_Status_Handler(srv interface{}, ctx context.Context, dec func(interfa return interceptor(ctx, in, info, handler) } -// Task_ServiceDesc is the grpc.ServiceDesc for Task service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Task_ServiceDesc = grpc.ServiceDesc{ +var _Task_serviceDesc = grpc.ServiceDesc{ ServiceName: "github.com.tinkerbell.pbnj.api.v1.Task", HandlerType: (*TaskServer)(nil), Methods: []grpc.MethodDesc{ diff --git a/scripts/Dockerfile.pbbuilder b/scripts/Dockerfile.pbbuilder index a969fbb..3da7162 100644 --- a/scripts/Dockerfile.pbbuilder +++ b/scripts/Dockerfile.pbbuilder @@ -1,4 +1,4 @@ -FROM golang:1.16.9 +FROM golang:1.19 ENV GO111MODULE=on diff --git a/scripts/protoc.sh b/scripts/protoc.sh index 352baba..24a6283 100755 --- a/scripts/protoc.sh +++ b/scripts/protoc.sh @@ -32,12 +32,9 @@ function installDeps { else echo 'Protoc already installed!' >&2 fi - go get google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.0.1 - go get google.golang.org/grpc@v1.35.0 - go get google.golang.org/protobuf/cmd/protoc-gen-go@v1.25.0 - go get github.com/mwitkow/go-proto-validators/protoc-gen-govalidators@v0.3.2 - go get golang.org/x/tools/cmd/goimports - go mod tidy || true + go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.0.1 + go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.25.0 + go install github.com/mwitkow/go-proto-validators/protoc-gen-govalidators@v0.3.2 } if [[ "$1" == "deps" ]]; then @@ -51,5 +48,4 @@ protoc -I . -I "$(go env GOMODCACHE)" --go_out=. --go_opt=module=${REPO} ${PROTO protoc -I . -I "$(go env GOMODCACHE)" --govalidators_out=. --go-grpc_out=. --go-grpc_opt=module=${REPO} ${PROTOS_LOC}/*.proto mv ${REPO}/${PROTOS_LOC}/*.go ${PROTOS_LOC}/ rm -rf github.com -"$(go env GOPATH)/bin/goimports" -w . || true echo "done"