diff --git a/client/api/system/v1alpha1/api.pb.go b/client/api/system/v1alpha1/api.pb.go index af6b8817..6eb3ce7f 100644 --- a/client/api/system/v1alpha1/api.pb.go +++ b/client/api/system/v1alpha1/api.pb.go @@ -1,252 +1,154 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.25.0-devel -// protoc v3.11.2 // source: src/github.com/kubernetes-csi/csi-proxy/client/api/system/v1alpha1/api.proto package v1alpha1 import ( context "context" + fmt "fmt" proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" + math "math" ) -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) -) +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -type GetSerialNumberRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields +type GetBIOSSerialNumberRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *GetSerialNumberRequest) Reset() { - *x = GetSerialNumberRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } +func (m *GetBIOSSerialNumberRequest) Reset() { *m = GetBIOSSerialNumberRequest{} } +func (m *GetBIOSSerialNumberRequest) String() string { return proto.CompactTextString(m) } +func (*GetBIOSSerialNumberRequest) ProtoMessage() {} +func (*GetBIOSSerialNumberRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_714d71facb074551, []int{0} } -func (x *GetSerialNumberRequest) String() string { - return protoimpl.X.MessageStringOf(x) +func (m *GetBIOSSerialNumberRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetBIOSSerialNumberRequest.Unmarshal(m, b) } - -func (*GetSerialNumberRequest) ProtoMessage() {} - -func (x *GetSerialNumberRequest) ProtoReflect() protoreflect.Message { - mi := &file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_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) +func (m *GetBIOSSerialNumberRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetBIOSSerialNumberRequest.Marshal(b, m, deterministic) } - -// Deprecated: Use GetSerialNumberRequest.ProtoReflect.Descriptor instead. -func (*GetSerialNumberRequest) Descriptor() ([]byte, []int) { - return file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_rawDescGZIP(), []int{0} +func (m *GetBIOSSerialNumberRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetBIOSSerialNumberRequest.Merge(m, src) +} +func (m *GetBIOSSerialNumberRequest) XXX_Size() int { + return xxx_messageInfo_GetBIOSSerialNumberRequest.Size(m) +} +func (m *GetBIOSSerialNumberRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetBIOSSerialNumberRequest.DiscardUnknown(m) } -type GetSerialNumberResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields +var xxx_messageInfo_GetBIOSSerialNumberRequest proto.InternalMessageInfo +type GetBIOSSerialNumberResponse struct { // Serial number - SerialNumber string `protobuf:"bytes,1,opt,name=serial_number,json=serialNumber,proto3" json:"serial_number,omitempty"` + SerialNumber string `protobuf:"bytes,1,opt,name=serial_number,json=serialNumber,proto3" json:"serial_number,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *GetSerialNumberResponse) Reset() { - *x = GetSerialNumberResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } +func (m *GetBIOSSerialNumberResponse) Reset() { *m = GetBIOSSerialNumberResponse{} } +func (m *GetBIOSSerialNumberResponse) String() string { return proto.CompactTextString(m) } +func (*GetBIOSSerialNumberResponse) ProtoMessage() {} +func (*GetBIOSSerialNumberResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_714d71facb074551, []int{1} } -func (x *GetSerialNumberResponse) String() string { - return protoimpl.X.MessageStringOf(x) +func (m *GetBIOSSerialNumberResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetBIOSSerialNumberResponse.Unmarshal(m, b) } - -func (*GetSerialNumberResponse) ProtoMessage() {} - -func (x *GetSerialNumberResponse) ProtoReflect() protoreflect.Message { - mi := &file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_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) +func (m *GetBIOSSerialNumberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetBIOSSerialNumberResponse.Marshal(b, m, deterministic) } - -// Deprecated: Use GetSerialNumberResponse.ProtoReflect.Descriptor instead. -func (*GetSerialNumberResponse) Descriptor() ([]byte, []int) { - return file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_rawDescGZIP(), []int{1} +func (m *GetBIOSSerialNumberResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetBIOSSerialNumberResponse.Merge(m, src) } - -func (x *GetSerialNumberResponse) GetSerialNumber() string { - if x != nil { - return x.SerialNumber - } - return "" +func (m *GetBIOSSerialNumberResponse) XXX_Size() int { + return xxx_messageInfo_GetBIOSSerialNumberResponse.Size(m) } - -var File_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto protoreflect.FileDescriptor - -var file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_rawDesc = []byte{ - 0x0a, 0x4c, 0x73, 0x72, 0x63, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2d, 0x63, 0x73, 0x69, 0x2f, - 0x63, 0x73, 0x69, 0x2d, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, - 0x70, 0x68, 0x61, 0x31, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, - 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x22, 0x18, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x53, - 0x65, 0x72, 0x69, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x22, 0x3e, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x4e, - 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, - 0x0d, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x32, 0x62, 0x0a, 0x06, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x12, 0x58, 0x0a, 0x0f, - 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, - 0x20, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, - 0x72, 0x69, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x21, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, - 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x40, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2d, - 0x63, 0x73, 0x69, 0x2f, 0x63, 0x73, 0x69, 0x2d, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x63, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, - 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +func (m *GetBIOSSerialNumberResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetBIOSSerialNumberResponse.DiscardUnknown(m) } -var ( - file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_rawDescOnce sync.Once - file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_rawDescData = file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_rawDesc -) +var xxx_messageInfo_GetBIOSSerialNumberResponse proto.InternalMessageInfo -func file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_rawDescGZIP() []byte { - file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_rawDescOnce.Do(func() { - file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_rawDescData = protoimpl.X.CompressGZIP(file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_rawDescData) - }) - return file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_rawDescData +func (m *GetBIOSSerialNumberResponse) GetSerialNumber() string { + if m != nil { + return m.SerialNumber + } + return "" } -var file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_goTypes = []interface{}{ - (*GetSerialNumberRequest)(nil), // 0: v1alpha1.GetSerialNumberRequest - (*GetSerialNumberResponse)(nil), // 1: v1alpha1.GetSerialNumberResponse +func init() { + proto.RegisterType((*GetBIOSSerialNumberRequest)(nil), "v1alpha1.GetBIOSSerialNumberRequest") + proto.RegisterType((*GetBIOSSerialNumberResponse)(nil), "v1alpha1.GetBIOSSerialNumberResponse") } -var file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_depIdxs = []int32{ - 0, // 0: v1alpha1.System.GetSerialNumber:input_type -> v1alpha1.GetSerialNumberRequest - 1, // 1: v1alpha1.System.GetSerialNumber:output_type -> v1alpha1.GetSerialNumberResponse - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + +func init() { + proto.RegisterFile("src/github.com/kubernetes-csi/csi-proxy/client/api/system/v1alpha1/api.proto", fileDescriptor_714d71facb074551) } -func init() { file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_init() } -func file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_init() { - if File_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetSerialNumberRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetSerialNumberResponse); 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_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_goTypes, - DependencyIndexes: file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_depIdxs, - MessageInfos: file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_msgTypes, - }.Build() - File_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto = out.File - file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_rawDesc = nil - file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_goTypes = nil - file_src_github_com_kubernetes_csi_csi_proxy_client_api_system_v1alpha1_api_proto_depIdxs = nil +var fileDescriptor_714d71facb074551 = []byte{ + // 211 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xf2, 0x29, 0x2e, 0x4a, 0xd6, + 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0xcf, 0x2e, 0x4d, 0x4a, 0x2d, + 0xca, 0x4b, 0x2d, 0x49, 0x2d, 0xd6, 0x4d, 0x2e, 0xce, 0xd4, 0x4f, 0x2e, 0xce, 0xd4, 0x2d, 0x28, + 0xca, 0xaf, 0xa8, 0xd4, 0x4f, 0xce, 0xc9, 0x4c, 0xcd, 0x2b, 0xd1, 0x4f, 0x2c, 0xc8, 0xd4, 0x2f, + 0xae, 0x2c, 0x2e, 0x49, 0xcd, 0xd5, 0x2f, 0x33, 0x4c, 0xcc, 0x29, 0xc8, 0x48, 0x34, 0x04, 0x89, + 0xe9, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0x71, 0xc0, 0xc4, 0x94, 0x64, 0xb8, 0xa4, 0xdc, 0x53, + 0x4b, 0x9c, 0x3c, 0xfd, 0x83, 0x83, 0x53, 0x8b, 0x32, 0x13, 0x73, 0xfc, 0x4a, 0x73, 0x93, 0x52, + 0x8b, 0x82, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x94, 0x9c, 0xb8, 0xa4, 0xb1, 0xca, 0x16, 0x17, + 0xe4, 0xe7, 0x15, 0xa7, 0x0a, 0x29, 0x73, 0xf1, 0x16, 0x83, 0xc5, 0xe3, 0xf3, 0xc0, 0x12, 0x12, + 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x3c, 0xc5, 0x48, 0x8a, 0x8d, 0xf2, 0xb8, 0xd8, 0x82, 0xc1, + 0x0e, 0x11, 0x4a, 0xe1, 0x12, 0xc6, 0x62, 0x9a, 0x90, 0x8a, 0x1e, 0xcc, 0x35, 0x7a, 0xb8, 0x9d, + 0x22, 0xa5, 0x4a, 0x40, 0x15, 0xc4, 0x49, 0x4a, 0x0c, 0x4e, 0x0e, 0x51, 0x76, 0x94, 0x85, 0x53, + 0x12, 0x1b, 0x38, 0x90, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8b, 0x01, 0xa9, 0x3f, 0x74, + 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. var _ context.Context -var _ grpc.ClientConnInterface +var _ grpc.ClientConn // 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.SupportPackageIsVersion6 +const _ = grpc.SupportPackageIsVersion4 // SystemClient is the client API for System service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type SystemClient interface { - // GetSerialNumber returns the device's serial number - GetSerialNumber(ctx context.Context, in *GetSerialNumberRequest, opts ...grpc.CallOption) (*GetSerialNumberResponse, error) + // GetBIOSSerialNumber returns the device's serial number + GetBIOSSerialNumber(ctx context.Context, in *GetBIOSSerialNumberRequest, opts ...grpc.CallOption) (*GetBIOSSerialNumberResponse, error) } type systemClient struct { - cc grpc.ClientConnInterface + cc *grpc.ClientConn } -func NewSystemClient(cc grpc.ClientConnInterface) SystemClient { +func NewSystemClient(cc *grpc.ClientConn) SystemClient { return &systemClient{cc} } -func (c *systemClient) GetSerialNumber(ctx context.Context, in *GetSerialNumberRequest, opts ...grpc.CallOption) (*GetSerialNumberResponse, error) { - out := new(GetSerialNumberResponse) - err := c.cc.Invoke(ctx, "/v1alpha1.System/GetSerialNumber", in, out, opts...) +func (c *systemClient) GetBIOSSerialNumber(ctx context.Context, in *GetBIOSSerialNumberRequest, opts ...grpc.CallOption) (*GetBIOSSerialNumberResponse, error) { + out := new(GetBIOSSerialNumberResponse) + err := c.cc.Invoke(ctx, "/v1alpha1.System/GetBIOSSerialNumber", in, out, opts...) if err != nil { return nil, err } @@ -255,36 +157,36 @@ func (c *systemClient) GetSerialNumber(ctx context.Context, in *GetSerialNumberR // SystemServer is the server API for System service. type SystemServer interface { - // GetSerialNumber returns the device's serial number - GetSerialNumber(context.Context, *GetSerialNumberRequest) (*GetSerialNumberResponse, error) + // GetBIOSSerialNumber returns the device's serial number + GetBIOSSerialNumber(context.Context, *GetBIOSSerialNumberRequest) (*GetBIOSSerialNumberResponse, error) } // UnimplementedSystemServer can be embedded to have forward compatible implementations. type UnimplementedSystemServer struct { } -func (*UnimplementedSystemServer) GetSerialNumber(context.Context, *GetSerialNumberRequest) (*GetSerialNumberResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetSerialNumber not implemented") +func (*UnimplementedSystemServer) GetBIOSSerialNumber(ctx context.Context, req *GetBIOSSerialNumberRequest) (*GetBIOSSerialNumberResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBIOSSerialNumber not implemented") } func RegisterSystemServer(s *grpc.Server, srv SystemServer) { s.RegisterService(&_System_serviceDesc, srv) } -func _System_GetSerialNumber_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetSerialNumberRequest) +func _System_GetBIOSSerialNumber_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetBIOSSerialNumberRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(SystemServer).GetSerialNumber(ctx, in) + return srv.(SystemServer).GetBIOSSerialNumber(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/v1alpha1.System/GetSerialNumber", + FullMethod: "/v1alpha1.System/GetBIOSSerialNumber", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SystemServer).GetSerialNumber(ctx, req.(*GetSerialNumberRequest)) + return srv.(SystemServer).GetBIOSSerialNumber(ctx, req.(*GetBIOSSerialNumberRequest)) } return interceptor(ctx, in, info, handler) } @@ -294,8 +196,8 @@ var _System_serviceDesc = grpc.ServiceDesc{ HandlerType: (*SystemServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "GetSerialNumber", - Handler: _System_GetSerialNumber_Handler, + MethodName: "GetBIOSSerialNumber", + Handler: _System_GetBIOSSerialNumber_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/client/api/system/v1alpha1/api.proto b/client/api/system/v1alpha1/api.proto index 6da8caaf..8640c151 100644 --- a/client/api/system/v1alpha1/api.proto +++ b/client/api/system/v1alpha1/api.proto @@ -5,15 +5,15 @@ package v1alpha1; option go_package = "github.com/kubernetes-csi/csi-proxy/client/api/system/v1alpha1"; service System { - // GetSerialNumber returns the device's serial number - rpc GetSerialNumber(GetSerialNumberRequest) returns (GetSerialNumberResponse) {} + // GetBIOSSerialNumber returns the device's serial number + rpc GetBIOSSerialNumber(GetBIOSSerialNumberRequest) returns (GetBIOSSerialNumberResponse) {} } -message GetSerialNumberRequest { +message GetBIOSSerialNumberRequest { // Intentionally empty } -message GetSerialNumberResponse { +message GetBIOSSerialNumberResponse { // Serial number string serial_number = 1; } diff --git a/client/groups/system/v1alpha1/client_generated.go b/client/groups/system/v1alpha1/client_generated.go index 55097e4e..7c8a6d6f 100644 --- a/client/groups/system/v1alpha1/client_generated.go +++ b/client/groups/system/v1alpha1/client_generated.go @@ -51,6 +51,6 @@ func (w *Client) Close() error { // ensures we implement all the required methods var _ v1alpha1.SystemClient = &Client{} -func (w *Client) GetSerialNumber(context context.Context, request *v1alpha1.GetSerialNumberRequest, opts ...grpc.CallOption) (*v1alpha1.GetSerialNumberResponse, error) { - return w.client.GetSerialNumber(context, request, opts...) +func (w *Client) GetBIOSSerialNumber(context context.Context, request *v1alpha1.GetBIOSSerialNumberRequest, opts ...grpc.CallOption) (*v1alpha1.GetBIOSSerialNumberResponse, error) { + return w.client.GetBIOSSerialNumber(context, request, opts...) } diff --git a/integrationtests/system_test.go b/integrationtests/system_test.go index 08ded680..7ec29016 100644 --- a/integrationtests/system_test.go +++ b/integrationtests/system_test.go @@ -2,6 +2,8 @@ package integrationtests import ( "context" + "os/exec" + "strings" "testing" "github.com/kubernetes-csi/csi-proxy/client/api/system/v1alpha1" @@ -9,17 +11,23 @@ import ( "github.com/stretchr/testify/require" ) -func TestGetSerialNumber(t *testing.T) { - t.Run("GetSerialNumber", func(t *testing.T) { +func TestGetBIOSSerialNumber(t *testing.T) { + t.Run("GetBIOSSerialNumber", func(t *testing.T) { client, err := v1alpha1client.NewClient() require.Nil(t, err) defer client.Close() - request := &v1alpha1.GetSerialNumberRequest{} - response, err := client.GetSerialNumber(context.TODO(), request) + request := &v1alpha1.GetBIOSSerialNumberRequest{} + response, err := client.GetBIOSSerialNumber(context.TODO(), request) require.Nil(t, err) require.NotNil(t, response) - require.NotEmpty(t, response.SerialNumber) + + result, err := exec.Command("wmic", "bios", "get", "serialnumber").Output() + require.Nil(t, err) + t.Logf("The serial number is %s", response.SerialNumber) + + resultString := string(result) + require.True(t, strings.Contains(resultString, response.SerialNumber)) }) } diff --git a/internal/os/system/api.go b/internal/os/system/api.go index bfc2b9c4..284e1f67 100644 --- a/internal/os/system/api.go +++ b/internal/os/system/api.go @@ -17,7 +17,7 @@ func New() APIImplementor { return APIImplementor{} } -func (APIImplementor) GetSerialNumber() (string, error) { +func (APIImplementor) GetBIOSSerialNumber() (string, error) { // Taken from Kubernetes vSphere cloud provider // https://github.com/kubernetes/kubernetes/blob/103e926604de6f79161b78af3e792d0ed282bc06/staging/src/k8s.io/legacy-cloud-providers/vsphere/vsphere_util_windows.go#L28 result, err := exec.Command("wmic", "bios", "get", "serialnumber").Output() diff --git a/internal/server/system/internal/types.go b/internal/server/system/internal/types.go index b343666d..a08b3fb9 100644 --- a/internal/server/system/internal/types.go +++ b/internal/server/system/internal/types.go @@ -1,8 +1,8 @@ package internal -type GetSerialNumberRequest struct { +type GetBIOSSerialNumberRequest struct { } -type GetSerialNumberResponse struct { +type GetBIOSSerialNumberResponse struct { SerialNumber string } diff --git a/internal/server/system/internal/types_generated.go b/internal/server/system/internal/types_generated.go index 5d0ad07a..b029dbc9 100644 --- a/internal/server/system/internal/types_generated.go +++ b/internal/server/system/internal/types_generated.go @@ -15,5 +15,5 @@ type VersionedAPI interface { // All the functions this group's server needs to define. type ServerInterface interface { - GetSerialNumber(context.Context, *GetSerialNumberRequest, apiversion.Version) (*GetSerialNumberResponse, error) + GetBIOSSerialNumber(context.Context, *GetBIOSSerialNumberRequest, apiversion.Version) (*GetBIOSSerialNumberResponse, error) } diff --git a/internal/server/system/internal/v1alpha1/conversion_generated.go b/internal/server/system/internal/v1alpha1/conversion_generated.go index 2b7775aa..c92883bb 100644 --- a/internal/server/system/internal/v1alpha1/conversion_generated.go +++ b/internal/server/system/internal/v1alpha1/conversion_generated.go @@ -7,40 +7,40 @@ import ( internal "github.com/kubernetes-csi/csi-proxy/internal/server/system/internal" ) -func autoConvert_v1alpha1_GetSerialNumberRequest_To_internal_GetSerialNumberRequest(in *v1alpha1.GetSerialNumberRequest, out *internal.GetSerialNumberRequest) error { +func autoConvert_v1alpha1_GetBIOSSerialNumberRequest_To_internal_GetBIOSSerialNumberRequest(in *v1alpha1.GetBIOSSerialNumberRequest, out *internal.GetBIOSSerialNumberRequest) error { return nil } -// Convert_v1alpha1_GetSerialNumberRequest_To_internal_GetSerialNumberRequest is an autogenerated conversion function. -func Convert_v1alpha1_GetSerialNumberRequest_To_internal_GetSerialNumberRequest(in *v1alpha1.GetSerialNumberRequest, out *internal.GetSerialNumberRequest) error { - return autoConvert_v1alpha1_GetSerialNumberRequest_To_internal_GetSerialNumberRequest(in, out) +// Convert_v1alpha1_GetBIOSSerialNumberRequest_To_internal_GetBIOSSerialNumberRequest is an autogenerated conversion function. +func Convert_v1alpha1_GetBIOSSerialNumberRequest_To_internal_GetBIOSSerialNumberRequest(in *v1alpha1.GetBIOSSerialNumberRequest, out *internal.GetBIOSSerialNumberRequest) error { + return autoConvert_v1alpha1_GetBIOSSerialNumberRequest_To_internal_GetBIOSSerialNumberRequest(in, out) } -func autoConvert_internal_GetSerialNumberRequest_To_v1alpha1_GetSerialNumberRequest(in *internal.GetSerialNumberRequest, out *v1alpha1.GetSerialNumberRequest) error { +func autoConvert_internal_GetBIOSSerialNumberRequest_To_v1alpha1_GetBIOSSerialNumberRequest(in *internal.GetBIOSSerialNumberRequest, out *v1alpha1.GetBIOSSerialNumberRequest) error { return nil } -// Convert_internal_GetSerialNumberRequest_To_v1alpha1_GetSerialNumberRequest is an autogenerated conversion function. -func Convert_internal_GetSerialNumberRequest_To_v1alpha1_GetSerialNumberRequest(in *internal.GetSerialNumberRequest, out *v1alpha1.GetSerialNumberRequest) error { - return autoConvert_internal_GetSerialNumberRequest_To_v1alpha1_GetSerialNumberRequest(in, out) +// Convert_internal_GetBIOSSerialNumberRequest_To_v1alpha1_GetBIOSSerialNumberRequest is an autogenerated conversion function. +func Convert_internal_GetBIOSSerialNumberRequest_To_v1alpha1_GetBIOSSerialNumberRequest(in *internal.GetBIOSSerialNumberRequest, out *v1alpha1.GetBIOSSerialNumberRequest) error { + return autoConvert_internal_GetBIOSSerialNumberRequest_To_v1alpha1_GetBIOSSerialNumberRequest(in, out) } -func autoConvert_v1alpha1_GetSerialNumberResponse_To_internal_GetSerialNumberResponse(in *v1alpha1.GetSerialNumberResponse, out *internal.GetSerialNumberResponse) error { +func autoConvert_v1alpha1_GetBIOSSerialNumberResponse_To_internal_GetBIOSSerialNumberResponse(in *v1alpha1.GetBIOSSerialNumberResponse, out *internal.GetBIOSSerialNumberResponse) error { out.SerialNumber = in.SerialNumber return nil } -// Convert_v1alpha1_GetSerialNumberResponse_To_internal_GetSerialNumberResponse is an autogenerated conversion function. -func Convert_v1alpha1_GetSerialNumberResponse_To_internal_GetSerialNumberResponse(in *v1alpha1.GetSerialNumberResponse, out *internal.GetSerialNumberResponse) error { - return autoConvert_v1alpha1_GetSerialNumberResponse_To_internal_GetSerialNumberResponse(in, out) +// Convert_v1alpha1_GetBIOSSerialNumberResponse_To_internal_GetBIOSSerialNumberResponse is an autogenerated conversion function. +func Convert_v1alpha1_GetBIOSSerialNumberResponse_To_internal_GetBIOSSerialNumberResponse(in *v1alpha1.GetBIOSSerialNumberResponse, out *internal.GetBIOSSerialNumberResponse) error { + return autoConvert_v1alpha1_GetBIOSSerialNumberResponse_To_internal_GetBIOSSerialNumberResponse(in, out) } -func autoConvert_internal_GetSerialNumberResponse_To_v1alpha1_GetSerialNumberResponse(in *internal.GetSerialNumberResponse, out *v1alpha1.GetSerialNumberResponse) error { +func autoConvert_internal_GetBIOSSerialNumberResponse_To_v1alpha1_GetBIOSSerialNumberResponse(in *internal.GetBIOSSerialNumberResponse, out *v1alpha1.GetBIOSSerialNumberResponse) error { out.SerialNumber = in.SerialNumber return nil } -// Convert_internal_GetSerialNumberResponse_To_v1alpha1_GetSerialNumberResponse is an autogenerated conversion function. -func Convert_internal_GetSerialNumberResponse_To_v1alpha1_GetSerialNumberResponse(in *internal.GetSerialNumberResponse, out *v1alpha1.GetSerialNumberResponse) error { - return autoConvert_internal_GetSerialNumberResponse_To_v1alpha1_GetSerialNumberResponse(in, out) +// Convert_internal_GetBIOSSerialNumberResponse_To_v1alpha1_GetBIOSSerialNumberResponse is an autogenerated conversion function. +func Convert_internal_GetBIOSSerialNumberResponse_To_v1alpha1_GetBIOSSerialNumberResponse(in *internal.GetBIOSSerialNumberResponse, out *v1alpha1.GetBIOSSerialNumberResponse) error { + return autoConvert_internal_GetBIOSSerialNumberResponse_To_v1alpha1_GetBIOSSerialNumberResponse(in, out) } diff --git a/internal/server/system/internal/v1alpha1/server_generated.go b/internal/server/system/internal/v1alpha1/server_generated.go index 6d754155..d4b75a34 100644 --- a/internal/server/system/internal/v1alpha1/server_generated.go +++ b/internal/server/system/internal/v1alpha1/server_generated.go @@ -27,19 +27,19 @@ func (s *versionedAPI) Register(grpcServer *grpc.Server) { v1alpha1.RegisterSystemServer(grpcServer, s) } -func (s *versionedAPI) GetSerialNumber(context context.Context, versionedRequest *v1alpha1.GetSerialNumberRequest) (*v1alpha1.GetSerialNumberResponse, error) { - request := &internal.GetSerialNumberRequest{} - if err := Convert_v1alpha1_GetSerialNumberRequest_To_internal_GetSerialNumberRequest(versionedRequest, request); err != nil { +func (s *versionedAPI) GetBIOSSerialNumber(context context.Context, versionedRequest *v1alpha1.GetBIOSSerialNumberRequest) (*v1alpha1.GetBIOSSerialNumberResponse, error) { + request := &internal.GetBIOSSerialNumberRequest{} + if err := Convert_v1alpha1_GetBIOSSerialNumberRequest_To_internal_GetBIOSSerialNumberRequest(versionedRequest, request); err != nil { return nil, err } - response, err := s.apiGroupServer.GetSerialNumber(context, request, version) + response, err := s.apiGroupServer.GetBIOSSerialNumber(context, request, version) if err != nil { return nil, err } - versionedResponse := &v1alpha1.GetSerialNumberResponse{} - if err := Convert_internal_GetSerialNumberResponse_To_v1alpha1_GetSerialNumberResponse(response, versionedResponse); err != nil { + versionedResponse := &v1alpha1.GetBIOSSerialNumberResponse{} + if err := Convert_internal_GetBIOSSerialNumberResponse_To_v1alpha1_GetBIOSSerialNumberResponse(response, versionedResponse); err != nil { return nil, err } diff --git a/internal/server/system/server.go b/internal/server/system/server.go index 05c24b1d..964b3734 100644 --- a/internal/server/system/server.go +++ b/internal/server/system/server.go @@ -13,7 +13,7 @@ type Server struct { } type API interface { - GetSerialNumber() (string, error) + GetBIOSSerialNumber() (string, error) } func NewServer(hostAPI API) (*Server, error) { @@ -22,12 +22,12 @@ func NewServer(hostAPI API) (*Server, error) { }, nil } -func (s *Server) GetSerialNumber(context context.Context, request *internal.GetSerialNumberRequest, version apiversion.Version) (*internal.GetSerialNumberResponse, error) { - klog.V(4).Infof("calling GetSerialNumber") - response := &internal.GetSerialNumberResponse{} - serialNumber, err := s.hostAPI.GetSerialNumber() +func (s *Server) GetBIOSSerialNumber(context context.Context, request *internal.GetBIOSSerialNumberRequest, version apiversion.Version) (*internal.GetBIOSSerialNumberResponse, error) { + klog.V(4).Infof("calling GetBIOSSerialNumber") + response := &internal.GetBIOSSerialNumberResponse{} + serialNumber, err := s.hostAPI.GetBIOSSerialNumber() if err != nil { - klog.Errorf("failed GetSerialNumber: %v", err) + klog.Errorf("failed GetBIOSSerialNumber: %v", err) return response, err }