From bc0d5094a31f2ff008a2be47b6c980c85ae5a81c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Wed, 29 Jul 2020 19:34:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=B6=E6=AE=B5=E6=80=A7=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 2 +- go.sum | 7 +- internal/configs/nodes/node_config.go | 6 + internal/configs/nodes/server_config.go | 13 + internal/const/const.go | 2 +- internal/rpc/admin/service.pb.go | 881 ----------- internal/rpc/pb/model_node.pb.go | 170 +++ internal/rpc/pb/model_node_cluster.pb.go | 165 +++ internal/rpc/pb/model_node_grant.pb.go | 223 +++ internal/rpc/pb/model_server.pb.go | 201 +++ internal/rpc/pb/service_admin.pb.go | 883 ++++++++++++ internal/rpc/pb/service_node.pb.go | 662 +++++++++ internal/rpc/pb/service_node_cluster.pb.go | 304 ++++ internal/rpc/pb/service_node_grant.pb.go | 1283 +++++++++++++++++ internal/rpc/pb/service_server.pb.go | 706 +++++++++ .../service_admin.proto} | 23 +- internal/rpc/protos/service_node.proto | 45 + .../rpc/protos/service_node_cluster.proto | 18 + internal/rpc/protos/service_node_grant.proto | 93 ++ internal/rpc/protos/service_server.proto | 50 + internal/rpc/rpc_client.go | 65 +- internal/rpc/rpc_client_test.go | 4 +- internal/web/actions/actionutils/page.go | 38 +- .../web/actions/actionutils/parent_action.go | 36 +- internal/web/actions/default/index/index.go | 10 +- internal/web/actions/default/nodes/create.go | 27 +- .../actions/default/nodes/grants/create.go | 66 + .../actions/default/nodes/grants/delete.go | 22 + .../web/actions/default/nodes/grants/grant.go | 47 + .../default/nodes/grants/grantutils/utils.go | 27 + .../web/actions/default/nodes/grants/index.go | 49 + .../actions/default/nodes/grants/update.go | 98 ++ internal/web/actions/default/nodes/helper.go | 12 +- internal/web/actions/default/nodes/index.go | 34 +- internal/web/actions/default/nodes/init.go | 8 + .../web/actions/default/servers/create.go | 98 ++ .../web/actions/default/servers/helper.go | 4 +- internal/web/actions/default/servers/index.go | 49 +- internal/web/actions/default/servers/init.go | 1 + internal/web/helpers/user_must_auth.go | 10 +- web/public/js/components/common/first-menu.js | 2 +- web/views/@default/nodes/create.html | 2 +- web/views/@default/nodes/create.js | 3 + web/views/@default/nodes/grants/@menu.html | 4 + web/views/@default/nodes/grants/create.html | 58 + web/views/@default/nodes/grants/create.js | 5 + web/views/@default/nodes/grants/grant.html | 58 + web/views/@default/nodes/grants/index.html | 25 + web/views/@default/nodes/grants/index.js | 11 + web/views/@default/nodes/grants/update.html | 64 + web/views/@default/nodes/grants/update.js | 5 + web/views/@default/nodes/index.html | 28 +- web/views/@default/servers/@menu.html | 4 +- web/views/@default/servers/create.html | 22 + web/views/@default/servers/create.js | 3 + web/views/@default/servers/index.html | 22 + 56 files changed, 5799 insertions(+), 959 deletions(-) create mode 100644 internal/configs/nodes/node_config.go create mode 100644 internal/configs/nodes/server_config.go delete mode 100644 internal/rpc/admin/service.pb.go create mode 100644 internal/rpc/pb/model_node.pb.go create mode 100644 internal/rpc/pb/model_node_cluster.pb.go create mode 100644 internal/rpc/pb/model_node_grant.pb.go create mode 100644 internal/rpc/pb/model_server.pb.go create mode 100644 internal/rpc/pb/service_admin.pb.go create mode 100644 internal/rpc/pb/service_node.pb.go create mode 100644 internal/rpc/pb/service_node_cluster.pb.go create mode 100644 internal/rpc/pb/service_node_grant.pb.go create mode 100644 internal/rpc/pb/service_server.pb.go rename internal/rpc/{admin/service.proto => protos/service_admin.proto} (69%) create mode 100644 internal/rpc/protos/service_node.proto create mode 100644 internal/rpc/protos/service_node_cluster.proto create mode 100644 internal/rpc/protos/service_node_grant.proto create mode 100644 internal/rpc/protos/service_server.proto create mode 100644 internal/web/actions/default/nodes/grants/create.go create mode 100644 internal/web/actions/default/nodes/grants/delete.go create mode 100644 internal/web/actions/default/nodes/grants/grant.go create mode 100644 internal/web/actions/default/nodes/grants/grantutils/utils.go create mode 100644 internal/web/actions/default/nodes/grants/index.go create mode 100644 internal/web/actions/default/nodes/grants/update.go create mode 100644 internal/web/actions/default/servers/create.go create mode 100644 web/views/@default/nodes/create.js create mode 100644 web/views/@default/nodes/grants/@menu.html create mode 100644 web/views/@default/nodes/grants/create.html create mode 100644 web/views/@default/nodes/grants/create.js create mode 100644 web/views/@default/nodes/grants/grant.html create mode 100644 web/views/@default/nodes/grants/index.html create mode 100644 web/views/@default/nodes/grants/index.js create mode 100644 web/views/@default/nodes/grants/update.html create mode 100644 web/views/@default/nodes/grants/update.js create mode 100644 web/views/@default/servers/create.html create mode 100644 web/views/@default/servers/create.js diff --git a/go.mod b/go.mod index c75c2661..570be48f 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.14 require ( github.com/go-yaml/yaml v2.1.0+incompatible github.com/golang/protobuf v1.4.2 - github.com/iwind/TeaGo v0.0.0-20200722034406-6bf13920e40d + github.com/iwind/TeaGo v0.0.0-20200723131229-30dff10543ad google.golang.org/grpc v1.30.0 google.golang.org/protobuf v1.23.0 ) diff --git a/go.sum b/go.sum index 854c2f60..21551b18 100644 --- a/go.sum +++ b/go.sum @@ -31,8 +31,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/iwind/TeaGo v0.0.0-20200722034406-6bf13920e40d h1:W//0gTbKQ44b3gHNz1/fMiKEu+mM5t5O3py4kJscSa0= -github.com/iwind/TeaGo v0.0.0-20200722034406-6bf13920e40d/go.mod h1:zjM7k+b+Jthhf0T0fKwuF0iy4TWb5SsU1gmKR2l+OmE= +github.com/iwind/TeaGo v0.0.0-20200723131229-30dff10543ad h1:EVwLRNPYoCNCinN/J9FylGBpKdCilvzUFykKtQABfNA= +github.com/iwind/TeaGo v0.0.0-20200723131229-30dff10543ad/go.mod h1:zjM7k+b+Jthhf0T0fKwuF0iy4TWb5SsU1gmKR2l+OmE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -56,6 +56,7 @@ golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7 h1:AeiKBIuRw3UomYXSbLy0Mc2dDLfdtbT/IVn4keq83P0= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= @@ -65,6 +66,7 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -72,6 +74,7 @@ golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 h1:DYfZAGf2WMFjMxbgTjaC+2HC7NkNAQs+6Q8b9WEB/F4= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= diff --git a/internal/configs/nodes/node_config.go b/internal/configs/nodes/node_config.go new file mode 100644 index 00000000..0818bcf1 --- /dev/null +++ b/internal/configs/nodes/node_config.go @@ -0,0 +1,6 @@ +package nodes + +type NodeConfig struct { + Id string `json:"id" yaml:"id"` + Secret string `json:"secret" yaml:"secret"` +} diff --git a/internal/configs/nodes/server_config.go b/internal/configs/nodes/server_config.go new file mode 100644 index 00000000..156724c4 --- /dev/null +++ b/internal/configs/nodes/server_config.go @@ -0,0 +1,13 @@ +package nodes + +import "encoding/json" + +type ServerConfig struct { + Id string `json:"id" yaml:"id"` + IsOn bool `json:"isOn" yaml:"isOn"` + Name string `json:"name" yaml:"name"` +} + +func (this *ServerConfig) AsJSON() ([]byte, error) { + return json.Marshal(this) +} diff --git a/internal/const/const.go b/internal/const/const.go index 30f92183..50e8cb2f 100644 --- a/internal/const/const.go +++ b/internal/const/const.go @@ -12,5 +12,5 @@ const ( EncryptKey = "8f983f4d69b83aaa0d74b21a212f6967" EncryptMethod = "aes-256-cfb" - ErrServer = "服务器出了点小问题,请稍后重试" + ErrServer = "服务器出了点小问题,请联系技术人员处理。" ) diff --git a/internal/rpc/admin/service.pb.go b/internal/rpc/admin/service.pb.go deleted file mode 100644 index 60aa673e..00000000 --- a/internal/rpc/admin/service.pb.go +++ /dev/null @@ -1,881 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.25.0 -// protoc v3.12.3 -// source: admin/service.proto - -package admin - -import ( - context "context" - 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" -) - -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 LoginRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` - Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` -} - -func (x *LoginRequest) Reset() { - *x = LoginRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_service_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LoginRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LoginRequest) ProtoMessage() {} - -func (x *LoginRequest) ProtoReflect() protoreflect.Message { - mi := &file_admin_service_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 LoginRequest.ProtoReflect.Descriptor instead. -func (*LoginRequest) Descriptor() ([]byte, []int) { - return file_admin_service_proto_rawDescGZIP(), []int{0} -} - -func (x *LoginRequest) GetUsername() string { - if x != nil { - return x.Username - } - return "" -} - -func (x *LoginRequest) GetPassword() string { - if x != nil { - return x.Password - } - return "" -} - -type LoginResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdminId int64 `protobuf:"varint,1,opt,name=adminId,proto3" json:"adminId,omitempty"` - IsOk bool `protobuf:"varint,2,opt,name=isOk,proto3" json:"isOk,omitempty"` - Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` -} - -func (x *LoginResponse) Reset() { - *x = LoginResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_service_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LoginResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LoginResponse) ProtoMessage() {} - -func (x *LoginResponse) ProtoReflect() protoreflect.Message { - mi := &file_admin_service_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 LoginResponse.ProtoReflect.Descriptor instead. -func (*LoginResponse) Descriptor() ([]byte, []int) { - return file_admin_service_proto_rawDescGZIP(), []int{1} -} - -func (x *LoginResponse) GetAdminId() int64 { - if x != nil { - return x.AdminId - } - return 0 -} - -func (x *LoginResponse) GetIsOk() bool { - if x != nil { - return x.IsOk - } - return false -} - -func (x *LoginResponse) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -type CreateLogRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Level string `protobuf:"bytes,1,opt,name=level,proto3" json:"level,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Action string `protobuf:"bytes,3,opt,name=action,proto3" json:"action,omitempty"` - Ip string `protobuf:"bytes,4,opt,name=ip,proto3" json:"ip,omitempty"` -} - -func (x *CreateLogRequest) Reset() { - *x = CreateLogRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_service_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CreateLogRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateLogRequest) ProtoMessage() {} - -func (x *CreateLogRequest) ProtoReflect() protoreflect.Message { - mi := &file_admin_service_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 CreateLogRequest.ProtoReflect.Descriptor instead. -func (*CreateLogRequest) Descriptor() ([]byte, []int) { - return file_admin_service_proto_rawDescGZIP(), []int{2} -} - -func (x *CreateLogRequest) GetLevel() string { - if x != nil { - return x.Level - } - return "" -} - -func (x *CreateLogRequest) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *CreateLogRequest) GetAction() string { - if x != nil { - return x.Action - } - return "" -} - -func (x *CreateLogRequest) GetIp() string { - if x != nil { - return x.Ip - } - return "" -} - -type CreateLogResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - IsOk bool `protobuf:"varint,1,opt,name=isOk,proto3" json:"isOk,omitempty"` -} - -func (x *CreateLogResponse) Reset() { - *x = CreateLogResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_service_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CreateLogResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateLogResponse) ProtoMessage() {} - -func (x *CreateLogResponse) ProtoReflect() protoreflect.Message { - mi := &file_admin_service_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 CreateLogResponse.ProtoReflect.Descriptor instead. -func (*CreateLogResponse) Descriptor() ([]byte, []int) { - return file_admin_service_proto_rawDescGZIP(), []int{3} -} - -func (x *CreateLogResponse) GetIsOk() bool { - if x != nil { - return x.IsOk - } - return false -} - -type CheckAdminExistsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdminId int64 `protobuf:"varint,1,opt,name=adminId,proto3" json:"adminId,omitempty"` -} - -func (x *CheckAdminExistsRequest) Reset() { - *x = CheckAdminExistsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_service_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CheckAdminExistsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CheckAdminExistsRequest) ProtoMessage() {} - -func (x *CheckAdminExistsRequest) ProtoReflect() protoreflect.Message { - mi := &file_admin_service_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 CheckAdminExistsRequest.ProtoReflect.Descriptor instead. -func (*CheckAdminExistsRequest) Descriptor() ([]byte, []int) { - return file_admin_service_proto_rawDescGZIP(), []int{4} -} - -func (x *CheckAdminExistsRequest) GetAdminId() int64 { - if x != nil { - return x.AdminId - } - return 0 -} - -type CheckAdminExistsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - IsOk bool `protobuf:"varint,1,opt,name=isOk,proto3" json:"isOk,omitempty"` - Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` -} - -func (x *CheckAdminExistsResponse) Reset() { - *x = CheckAdminExistsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_service_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CheckAdminExistsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CheckAdminExistsResponse) ProtoMessage() {} - -func (x *CheckAdminExistsResponse) ProtoReflect() protoreflect.Message { - mi := &file_admin_service_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 CheckAdminExistsResponse.ProtoReflect.Descriptor instead. -func (*CheckAdminExistsResponse) Descriptor() ([]byte, []int) { - return file_admin_service_proto_rawDescGZIP(), []int{5} -} - -func (x *CheckAdminExistsResponse) GetIsOk() bool { - if x != nil { - return x.IsOk - } - return false -} - -func (x *CheckAdminExistsResponse) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -type FindAdminNameRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdminId int64 `protobuf:"varint,1,opt,name=adminId,proto3" json:"adminId,omitempty"` -} - -func (x *FindAdminNameRequest) Reset() { - *x = FindAdminNameRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_service_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FindAdminNameRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FindAdminNameRequest) ProtoMessage() {} - -func (x *FindAdminNameRequest) ProtoReflect() protoreflect.Message { - mi := &file_admin_service_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 FindAdminNameRequest.ProtoReflect.Descriptor instead. -func (*FindAdminNameRequest) Descriptor() ([]byte, []int) { - return file_admin_service_proto_rawDescGZIP(), []int{6} -} - -func (x *FindAdminNameRequest) GetAdminId() int64 { - if x != nil { - return x.AdminId - } - return 0 -} - -type FindAdminNameResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Fullname string `protobuf:"bytes,1,opt,name=fullname,proto3" json:"fullname,omitempty"` -} - -func (x *FindAdminNameResponse) Reset() { - *x = FindAdminNameResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_service_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FindAdminNameResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FindAdminNameResponse) ProtoMessage() {} - -func (x *FindAdminNameResponse) ProtoReflect() protoreflect.Message { - mi := &file_admin_service_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 FindAdminNameResponse.ProtoReflect.Descriptor instead. -func (*FindAdminNameResponse) Descriptor() ([]byte, []int) { - return file_admin_service_proto_rawDescGZIP(), []int{7} -} - -func (x *FindAdminNameResponse) GetFullname() string { - if x != nil { - return x.Fullname - } - return "" -} - -var File_admin_service_proto protoreflect.FileDescriptor - -var file_admin_service_proto_rawDesc = []byte{ - 0x0a, 0x13, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x22, 0x46, 0x0a, 0x0c, - 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, - 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, - 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, - 0x77, 0x6f, 0x72, 0x64, 0x22, 0x57, 0x0a, 0x0d, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64, 0x12, - 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, - 0x73, 0x4f, 0x6b, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x72, 0x0a, - 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, - 0x70, 0x22, 0x27, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x22, 0x33, 0x0a, 0x17, 0x43, 0x68, - 0x65, 0x63, 0x6b, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64, 0x22, - 0x48, 0x0a, 0x18, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x69, - 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, - 0x73, 0x4f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x12, - 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x30, 0x0a, 0x14, 0x46, 0x69, 0x6e, - 0x64, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64, 0x22, 0x33, 0x0a, 0x15, 0x46, - 0x69, 0x6e, 0x64, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x6e, 0x61, 0x6d, 0x65, - 0x32, 0xaa, 0x02, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x34, 0x0a, 0x05, - 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x13, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x4c, 0x6f, - 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x61, 0x64, 0x6d, - 0x69, 0x6e, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x40, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x12, - 0x17, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4c, 0x6f, - 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, - 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x12, 0x55, 0x0a, 0x10, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x64, 0x6d, - 0x69, 0x6e, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x12, 0x1e, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, - 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x69, 0x73, 0x74, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, - 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x69, 0x73, 0x74, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x50, 0x0a, 0x11, 0x66, - 0x69, 0x6e, 0x64, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x46, 0x75, 0x6c, 0x6c, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x1b, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x6d, - 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, - 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4e, - 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x09, 0x5a, - 0x07, 0x2e, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_admin_service_proto_rawDescOnce sync.Once - file_admin_service_proto_rawDescData = file_admin_service_proto_rawDesc -) - -func file_admin_service_proto_rawDescGZIP() []byte { - file_admin_service_proto_rawDescOnce.Do(func() { - file_admin_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_admin_service_proto_rawDescData) - }) - return file_admin_service_proto_rawDescData -} - -var file_admin_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_admin_service_proto_goTypes = []interface{}{ - (*LoginRequest)(nil), // 0: admin.LoginRequest - (*LoginResponse)(nil), // 1: admin.LoginResponse - (*CreateLogRequest)(nil), // 2: admin.CreateLogRequest - (*CreateLogResponse)(nil), // 3: admin.CreateLogResponse - (*CheckAdminExistsRequest)(nil), // 4: admin.CheckAdminExistsRequest - (*CheckAdminExistsResponse)(nil), // 5: admin.CheckAdminExistsResponse - (*FindAdminNameRequest)(nil), // 6: admin.FindAdminNameRequest - (*FindAdminNameResponse)(nil), // 7: admin.FindAdminNameResponse -} -var file_admin_service_proto_depIdxs = []int32{ - 0, // 0: admin.Service.login:input_type -> admin.LoginRequest - 2, // 1: admin.Service.createLog:input_type -> admin.CreateLogRequest - 4, // 2: admin.Service.checkAdminExists:input_type -> admin.CheckAdminExistsRequest - 6, // 3: admin.Service.findAdminFullname:input_type -> admin.FindAdminNameRequest - 1, // 4: admin.Service.login:output_type -> admin.LoginResponse - 3, // 5: admin.Service.createLog:output_type -> admin.CreateLogResponse - 5, // 6: admin.Service.checkAdminExists:output_type -> admin.CheckAdminExistsResponse - 7, // 7: admin.Service.findAdminFullname:output_type -> admin.FindAdminNameResponse - 4, // [4:8] is the sub-list for method output_type - 0, // [0:4] 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() { file_admin_service_proto_init() } -func file_admin_service_proto_init() { - if File_admin_service_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_admin_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LoginRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LoginResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateLogRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateLogResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CheckAdminExistsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CheckAdminExistsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FindAdminNameRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FindAdminNameResponse); 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_admin_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 8, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_admin_service_proto_goTypes, - DependencyIndexes: file_admin_service_proto_depIdxs, - MessageInfos: file_admin_service_proto_msgTypes, - }.Build() - File_admin_service_proto = out.File - file_admin_service_proto_rawDesc = nil - file_admin_service_proto_goTypes = nil - file_admin_service_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// 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 - -// ServiceClient is the client API for Service service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ServiceClient interface { - // 登录 - Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error) - // 创建操作日志 - CreateLog(ctx context.Context, in *CreateLogRequest, opts ...grpc.CallOption) (*CreateLogResponse, error) - // 检查管理员是否存在 - CheckAdminExists(ctx context.Context, in *CheckAdminExistsRequest, opts ...grpc.CallOption) (*CheckAdminExistsResponse, error) - // 获取管理员名称 - FindAdminFullname(ctx context.Context, in *FindAdminNameRequest, opts ...grpc.CallOption) (*FindAdminNameResponse, error) -} - -type serviceClient struct { - cc grpc.ClientConnInterface -} - -func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient { - return &serviceClient{cc} -} - -func (c *serviceClient) Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error) { - out := new(LoginResponse) - err := c.cc.Invoke(ctx, "/admin.Service/login", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) CreateLog(ctx context.Context, in *CreateLogRequest, opts ...grpc.CallOption) (*CreateLogResponse, error) { - out := new(CreateLogResponse) - err := c.cc.Invoke(ctx, "/admin.Service/createLog", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) CheckAdminExists(ctx context.Context, in *CheckAdminExistsRequest, opts ...grpc.CallOption) (*CheckAdminExistsResponse, error) { - out := new(CheckAdminExistsResponse) - err := c.cc.Invoke(ctx, "/admin.Service/checkAdminExists", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) FindAdminFullname(ctx context.Context, in *FindAdminNameRequest, opts ...grpc.CallOption) (*FindAdminNameResponse, error) { - out := new(FindAdminNameResponse) - err := c.cc.Invoke(ctx, "/admin.Service/findAdminFullname", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ServiceServer is the server API for Service service. -type ServiceServer interface { - // 登录 - Login(context.Context, *LoginRequest) (*LoginResponse, error) - // 创建操作日志 - CreateLog(context.Context, *CreateLogRequest) (*CreateLogResponse, error) - // 检查管理员是否存在 - CheckAdminExists(context.Context, *CheckAdminExistsRequest) (*CheckAdminExistsResponse, error) - // 获取管理员名称 - FindAdminFullname(context.Context, *FindAdminNameRequest) (*FindAdminNameResponse, error) -} - -// UnimplementedServiceServer can be embedded to have forward compatible implementations. -type UnimplementedServiceServer struct { -} - -func (*UnimplementedServiceServer) Login(context.Context, *LoginRequest) (*LoginResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Login not implemented") -} -func (*UnimplementedServiceServer) CreateLog(context.Context, *CreateLogRequest) (*CreateLogResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateLog not implemented") -} -func (*UnimplementedServiceServer) CheckAdminExists(context.Context, *CheckAdminExistsRequest) (*CheckAdminExistsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CheckAdminExists not implemented") -} -func (*UnimplementedServiceServer) FindAdminFullname(context.Context, *FindAdminNameRequest) (*FindAdminNameResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FindAdminFullname not implemented") -} - -func RegisterServiceServer(s *grpc.Server, srv ServiceServer) { - s.RegisterService(&_Service_serviceDesc, srv) -} - -func _Service_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LoginRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).Login(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/admin.Service/Login", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).Login(ctx, req.(*LoginRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_CreateLog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateLogRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).CreateLog(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/admin.Service/CreateLog", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).CreateLog(ctx, req.(*CreateLogRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_CheckAdminExists_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CheckAdminExistsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).CheckAdminExists(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/admin.Service/CheckAdminExists", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).CheckAdminExists(ctx, req.(*CheckAdminExistsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_FindAdminFullname_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FindAdminNameRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).FindAdminFullname(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/admin.Service/FindAdminFullname", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).FindAdminFullname(ctx, req.(*FindAdminNameRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Service_serviceDesc = grpc.ServiceDesc{ - ServiceName: "admin.Service", - HandlerType: (*ServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "login", - Handler: _Service_Login_Handler, - }, - { - MethodName: "createLog", - Handler: _Service_CreateLog_Handler, - }, - { - MethodName: "checkAdminExists", - Handler: _Service_CheckAdminExists_Handler, - }, - { - MethodName: "findAdminFullname", - Handler: _Service_FindAdminFullname_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "admin/service.proto", -} diff --git a/internal/rpc/pb/model_node.pb.go b/internal/rpc/pb/model_node.pb.go new file mode 100644 index 00000000..e599d7d9 --- /dev/null +++ b/internal/rpc/pb/model_node.pb.go @@ -0,0 +1,170 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: model_node.proto + +package pb + +import ( + proto "github.com/golang/protobuf/proto" + 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 Node struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Cluster *NodeCluster `protobuf:"bytes,32,opt,name=cluster,proto3" json:"cluster,omitempty"` +} + +func (x *Node) Reset() { + *x = Node{} + if protoimpl.UnsafeEnabled { + mi := &file_model_node_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Node) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Node) ProtoMessage() {} + +func (x *Node) ProtoReflect() protoreflect.Message { + mi := &file_model_node_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 Node.ProtoReflect.Descriptor instead. +func (*Node) Descriptor() ([]byte, []int) { + return file_model_node_proto_rawDescGZIP(), []int{0} +} + +func (x *Node) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Node) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Node) GetCluster() *NodeCluster { + if x != nil { + return x.Cluster + } + return nil +} + +var File_model_node_proto protoreflect.FileDescriptor + +var file_model_node_proto_rawDesc = []byte{ + 0x0a, 0x10, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x18, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, + 0x64, 0x65, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x55, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x07, + 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x20, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, + 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x07, + 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_model_node_proto_rawDescOnce sync.Once + file_model_node_proto_rawDescData = file_model_node_proto_rawDesc +) + +func file_model_node_proto_rawDescGZIP() []byte { + file_model_node_proto_rawDescOnce.Do(func() { + file_model_node_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_node_proto_rawDescData) + }) + return file_model_node_proto_rawDescData +} + +var file_model_node_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_model_node_proto_goTypes = []interface{}{ + (*Node)(nil), // 0: pb.Node + (*NodeCluster)(nil), // 1: pb.NodeCluster +} +var file_model_node_proto_depIdxs = []int32{ + 1, // 0: pb.Node.cluster:type_name -> pb.NodeCluster + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_model_node_proto_init() } +func file_model_node_proto_init() { + if File_model_node_proto != nil { + return + } + file_model_node_cluster_proto_init() + if !protoimpl.UnsafeEnabled { + file_model_node_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Node); 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_model_node_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_model_node_proto_goTypes, + DependencyIndexes: file_model_node_proto_depIdxs, + MessageInfos: file_model_node_proto_msgTypes, + }.Build() + File_model_node_proto = out.File + file_model_node_proto_rawDesc = nil + file_model_node_proto_goTypes = nil + file_model_node_proto_depIdxs = nil +} diff --git a/internal/rpc/pb/model_node_cluster.pb.go b/internal/rpc/pb/model_node_cluster.pb.go new file mode 100644 index 00000000..c71f5191 --- /dev/null +++ b/internal/rpc/pb/model_node_cluster.pb.go @@ -0,0 +1,165 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: model_node_cluster.proto + +package pb + +import ( + proto "github.com/golang/protobuf/proto" + 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 NodeCluster struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + CreatedAt int64 `protobuf:"varint,3,opt,name=createdAt,proto3" json:"createdAt,omitempty"` +} + +func (x *NodeCluster) Reset() { + *x = NodeCluster{} + if protoimpl.UnsafeEnabled { + mi := &file_model_node_cluster_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NodeCluster) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeCluster) ProtoMessage() {} + +func (x *NodeCluster) ProtoReflect() protoreflect.Message { + mi := &file_model_node_cluster_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 NodeCluster.ProtoReflect.Descriptor instead. +func (*NodeCluster) Descriptor() ([]byte, []int) { + return file_model_node_cluster_proto_rawDescGZIP(), []int{0} +} + +func (x *NodeCluster) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *NodeCluster) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NodeCluster) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +var File_model_node_cluster_proto protoreflect.FileDescriptor + +var file_model_node_cluster_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x63, 0x6c, 0x75, + 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x4f, + 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x42, + 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_model_node_cluster_proto_rawDescOnce sync.Once + file_model_node_cluster_proto_rawDescData = file_model_node_cluster_proto_rawDesc +) + +func file_model_node_cluster_proto_rawDescGZIP() []byte { + file_model_node_cluster_proto_rawDescOnce.Do(func() { + file_model_node_cluster_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_node_cluster_proto_rawDescData) + }) + return file_model_node_cluster_proto_rawDescData +} + +var file_model_node_cluster_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_model_node_cluster_proto_goTypes = []interface{}{ + (*NodeCluster)(nil), // 0: pb.NodeCluster +} +var file_model_node_cluster_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] 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() { file_model_node_cluster_proto_init() } +func file_model_node_cluster_proto_init() { + if File_model_node_cluster_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_model_node_cluster_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NodeCluster); 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_model_node_cluster_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_model_node_cluster_proto_goTypes, + DependencyIndexes: file_model_node_cluster_proto_depIdxs, + MessageInfos: file_model_node_cluster_proto_msgTypes, + }.Build() + File_model_node_cluster_proto = out.File + file_model_node_cluster_proto_rawDesc = nil + file_model_node_cluster_proto_goTypes = nil + file_model_node_cluster_proto_depIdxs = nil +} diff --git a/internal/rpc/pb/model_node_grant.pb.go b/internal/rpc/pb/model_node_grant.pb.go new file mode 100644 index 00000000..cb227aab --- /dev/null +++ b/internal/rpc/pb/model_node_grant.pb.go @@ -0,0 +1,223 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: model_node_grant.proto + +package pb + +import ( + proto "github.com/golang/protobuf/proto" + 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 NodeGrant struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Method string `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"` + Username string `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"` + Password string `protobuf:"bytes,5,opt,name=password,proto3" json:"password,omitempty"` + Su bool `protobuf:"varint,6,opt,name=su,proto3" json:"su,omitempty"` + PrivateKey string `protobuf:"bytes,7,opt,name=privateKey,proto3" json:"privateKey,omitempty"` + Description string `protobuf:"bytes,8,opt,name=description,proto3" json:"description,omitempty"` + NodeId int64 `protobuf:"varint,9,opt,name=nodeId,proto3" json:"nodeId,omitempty"` +} + +func (x *NodeGrant) Reset() { + *x = NodeGrant{} + if protoimpl.UnsafeEnabled { + mi := &file_model_node_grant_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NodeGrant) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeGrant) ProtoMessage() {} + +func (x *NodeGrant) ProtoReflect() protoreflect.Message { + mi := &file_model_node_grant_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 NodeGrant.ProtoReflect.Descriptor instead. +func (*NodeGrant) Descriptor() ([]byte, []int) { + return file_model_node_grant_proto_rawDescGZIP(), []int{0} +} + +func (x *NodeGrant) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *NodeGrant) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NodeGrant) GetMethod() string { + if x != nil { + return x.Method + } + return "" +} + +func (x *NodeGrant) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *NodeGrant) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *NodeGrant) GetSu() bool { + if x != nil { + return x.Su + } + return false +} + +func (x *NodeGrant) GetPrivateKey() string { + if x != nil { + return x.PrivateKey + } + return "" +} + +func (x *NodeGrant) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *NodeGrant) GetNodeId() int64 { + if x != nil { + return x.NodeId + } + return 0 +} + +var File_model_node_grant_proto protoreflect.FileDescriptor + +var file_model_node_grant_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x67, 0x72, 0x61, + 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xe9, 0x01, 0x0a, + 0x09, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x0e, + 0x0a, 0x02, 0x73, 0x75, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x73, 0x75, 0x12, 0x1e, + 0x0a, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x20, + 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_model_node_grant_proto_rawDescOnce sync.Once + file_model_node_grant_proto_rawDescData = file_model_node_grant_proto_rawDesc +) + +func file_model_node_grant_proto_rawDescGZIP() []byte { + file_model_node_grant_proto_rawDescOnce.Do(func() { + file_model_node_grant_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_node_grant_proto_rawDescData) + }) + return file_model_node_grant_proto_rawDescData +} + +var file_model_node_grant_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_model_node_grant_proto_goTypes = []interface{}{ + (*NodeGrant)(nil), // 0: pb.NodeGrant +} +var file_model_node_grant_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] 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() { file_model_node_grant_proto_init() } +func file_model_node_grant_proto_init() { + if File_model_node_grant_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_model_node_grant_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NodeGrant); 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_model_node_grant_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_model_node_grant_proto_goTypes, + DependencyIndexes: file_model_node_grant_proto_depIdxs, + MessageInfos: file_model_node_grant_proto_msgTypes, + }.Build() + File_model_node_grant_proto = out.File + file_model_node_grant_proto_rawDesc = nil + file_model_node_grant_proto_goTypes = nil + file_model_node_grant_proto_depIdxs = nil +} diff --git a/internal/rpc/pb/model_server.pb.go b/internal/rpc/pb/model_server.pb.go new file mode 100644 index 00000000..5bf1f640 --- /dev/null +++ b/internal/rpc/pb/model_server.pb.go @@ -0,0 +1,201 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: model_server.proto + +package pb + +import ( + proto "github.com/golang/protobuf/proto" + 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 Server struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Config []byte `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` + IncludeNodes []byte `protobuf:"bytes,3,opt,name=includeNodes,proto3" json:"includeNodes,omitempty"` + ExcludeNodes []byte `protobuf:"bytes,4,opt,name=excludeNodes,proto3" json:"excludeNodes,omitempty"` + CreatedAt int64 `protobuf:"varint,5,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + Cluster *NodeCluster `protobuf:"bytes,6,opt,name=cluster,proto3" json:"cluster,omitempty"` +} + +func (x *Server) Reset() { + *x = Server{} + if protoimpl.UnsafeEnabled { + mi := &file_model_server_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Server) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Server) ProtoMessage() {} + +func (x *Server) ProtoReflect() protoreflect.Message { + mi := &file_model_server_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 Server.ProtoReflect.Descriptor instead. +func (*Server) Descriptor() ([]byte, []int) { + return file_model_server_proto_rawDescGZIP(), []int{0} +} + +func (x *Server) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Server) GetConfig() []byte { + if x != nil { + return x.Config + } + return nil +} + +func (x *Server) GetIncludeNodes() []byte { + if x != nil { + return x.IncludeNodes + } + return nil +} + +func (x *Server) GetExcludeNodes() []byte { + if x != nil { + return x.ExcludeNodes + } + return nil +} + +func (x *Server) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *Server) GetCluster() *NodeCluster { + if x != nil { + return x.Cluster + } + return nil +} + +var File_model_server_proto protoreflect.FileDescriptor + +var file_model_server_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x18, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, + 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xc1, 0x01, 0x0a, 0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, + 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, + 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x69, 0x6e, 0x63, + 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x65, 0x78, 0x63, + 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x0c, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1c, 0x0a, + 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x63, + 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, + 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x07, 0x63, + 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_model_server_proto_rawDescOnce sync.Once + file_model_server_proto_rawDescData = file_model_server_proto_rawDesc +) + +func file_model_server_proto_rawDescGZIP() []byte { + file_model_server_proto_rawDescOnce.Do(func() { + file_model_server_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_server_proto_rawDescData) + }) + return file_model_server_proto_rawDescData +} + +var file_model_server_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_model_server_proto_goTypes = []interface{}{ + (*Server)(nil), // 0: pb.Server + (*NodeCluster)(nil), // 1: pb.NodeCluster +} +var file_model_server_proto_depIdxs = []int32{ + 1, // 0: pb.Server.cluster:type_name -> pb.NodeCluster + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_model_server_proto_init() } +func file_model_server_proto_init() { + if File_model_server_proto != nil { + return + } + file_model_node_cluster_proto_init() + if !protoimpl.UnsafeEnabled { + file_model_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Server); 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_model_server_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_model_server_proto_goTypes, + DependencyIndexes: file_model_server_proto_depIdxs, + MessageInfos: file_model_server_proto_msgTypes, + }.Build() + File_model_server_proto = out.File + file_model_server_proto_rawDesc = nil + file_model_server_proto_goTypes = nil + file_model_server_proto_depIdxs = nil +} diff --git a/internal/rpc/pb/service_admin.pb.go b/internal/rpc/pb/service_admin.pb.go new file mode 100644 index 00000000..ba7ec823 --- /dev/null +++ b/internal/rpc/pb/service_admin.pb.go @@ -0,0 +1,883 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: service_admin.proto + +package pb + +import ( + context "context" + 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" +) + +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 LoginAdminRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` +} + +func (x *LoginAdminRequest) Reset() { + *x = LoginAdminRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_admin_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LoginAdminRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginAdminRequest) ProtoMessage() {} + +func (x *LoginAdminRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_admin_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 LoginAdminRequest.ProtoReflect.Descriptor instead. +func (*LoginAdminRequest) Descriptor() ([]byte, []int) { + return file_service_admin_proto_rawDescGZIP(), []int{0} +} + +func (x *LoginAdminRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *LoginAdminRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type LoginAdminResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AdminId int64 `protobuf:"varint,1,opt,name=adminId,proto3" json:"adminId,omitempty"` + IsOk bool `protobuf:"varint,2,opt,name=isOk,proto3" json:"isOk,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *LoginAdminResponse) Reset() { + *x = LoginAdminResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_admin_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LoginAdminResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginAdminResponse) ProtoMessage() {} + +func (x *LoginAdminResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_admin_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 LoginAdminResponse.ProtoReflect.Descriptor instead. +func (*LoginAdminResponse) Descriptor() ([]byte, []int) { + return file_service_admin_proto_rawDescGZIP(), []int{1} +} + +func (x *LoginAdminResponse) GetAdminId() int64 { + if x != nil { + return x.AdminId + } + return 0 +} + +func (x *LoginAdminResponse) GetIsOk() bool { + if x != nil { + return x.IsOk + } + return false +} + +func (x *LoginAdminResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type CreateAdminLogRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Level string `protobuf:"bytes,1,opt,name=level,proto3" json:"level,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + Action string `protobuf:"bytes,3,opt,name=action,proto3" json:"action,omitempty"` + Ip string `protobuf:"bytes,4,opt,name=ip,proto3" json:"ip,omitempty"` +} + +func (x *CreateAdminLogRequest) Reset() { + *x = CreateAdminLogRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_admin_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateAdminLogRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateAdminLogRequest) ProtoMessage() {} + +func (x *CreateAdminLogRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_admin_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 CreateAdminLogRequest.ProtoReflect.Descriptor instead. +func (*CreateAdminLogRequest) Descriptor() ([]byte, []int) { + return file_service_admin_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateAdminLogRequest) GetLevel() string { + if x != nil { + return x.Level + } + return "" +} + +func (x *CreateAdminLogRequest) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *CreateAdminLogRequest) GetAction() string { + if x != nil { + return x.Action + } + return "" +} + +func (x *CreateAdminLogRequest) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +type CreateAdminLogResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IsOk bool `protobuf:"varint,1,opt,name=isOk,proto3" json:"isOk,omitempty"` +} + +func (x *CreateAdminLogResponse) Reset() { + *x = CreateAdminLogResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_admin_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateAdminLogResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateAdminLogResponse) ProtoMessage() {} + +func (x *CreateAdminLogResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_admin_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 CreateAdminLogResponse.ProtoReflect.Descriptor instead. +func (*CreateAdminLogResponse) Descriptor() ([]byte, []int) { + return file_service_admin_proto_rawDescGZIP(), []int{3} +} + +func (x *CreateAdminLogResponse) GetIsOk() bool { + if x != nil { + return x.IsOk + } + return false +} + +type CheckAdminExistsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AdminId int64 `protobuf:"varint,1,opt,name=adminId,proto3" json:"adminId,omitempty"` +} + +func (x *CheckAdminExistsRequest) Reset() { + *x = CheckAdminExistsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_admin_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CheckAdminExistsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CheckAdminExistsRequest) ProtoMessage() {} + +func (x *CheckAdminExistsRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_admin_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 CheckAdminExistsRequest.ProtoReflect.Descriptor instead. +func (*CheckAdminExistsRequest) Descriptor() ([]byte, []int) { + return file_service_admin_proto_rawDescGZIP(), []int{4} +} + +func (x *CheckAdminExistsRequest) GetAdminId() int64 { + if x != nil { + return x.AdminId + } + return 0 +} + +type CheckAdminExistsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IsOk bool `protobuf:"varint,1,opt,name=isOk,proto3" json:"isOk,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *CheckAdminExistsResponse) Reset() { + *x = CheckAdminExistsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_admin_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CheckAdminExistsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CheckAdminExistsResponse) ProtoMessage() {} + +func (x *CheckAdminExistsResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_admin_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 CheckAdminExistsResponse.ProtoReflect.Descriptor instead. +func (*CheckAdminExistsResponse) Descriptor() ([]byte, []int) { + return file_service_admin_proto_rawDescGZIP(), []int{5} +} + +func (x *CheckAdminExistsResponse) GetIsOk() bool { + if x != nil { + return x.IsOk + } + return false +} + +func (x *CheckAdminExistsResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type FindAdminNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AdminId int64 `protobuf:"varint,1,opt,name=adminId,proto3" json:"adminId,omitempty"` +} + +func (x *FindAdminNameRequest) Reset() { + *x = FindAdminNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_admin_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindAdminNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindAdminNameRequest) ProtoMessage() {} + +func (x *FindAdminNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_admin_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 FindAdminNameRequest.ProtoReflect.Descriptor instead. +func (*FindAdminNameRequest) Descriptor() ([]byte, []int) { + return file_service_admin_proto_rawDescGZIP(), []int{6} +} + +func (x *FindAdminNameRequest) GetAdminId() int64 { + if x != nil { + return x.AdminId + } + return 0 +} + +type FindAdminNameResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Fullname string `protobuf:"bytes,1,opt,name=fullname,proto3" json:"fullname,omitempty"` +} + +func (x *FindAdminNameResponse) Reset() { + *x = FindAdminNameResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_admin_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindAdminNameResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindAdminNameResponse) ProtoMessage() {} + +func (x *FindAdminNameResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_admin_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 FindAdminNameResponse.ProtoReflect.Descriptor instead. +func (*FindAdminNameResponse) Descriptor() ([]byte, []int) { + return file_service_admin_proto_rawDescGZIP(), []int{7} +} + +func (x *FindAdminNameResponse) GetFullname() string { + if x != nil { + return x.Fullname + } + return "" +} + +var File_service_admin_proto protoreflect.FileDescriptor + +var file_service_admin_proto_rawDesc = []byte{ + 0x0a, 0x13, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x4b, 0x0a, 0x11, 0x4c, 0x6f, 0x67, + 0x69, 0x6e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, + 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x5c, 0x0a, 0x12, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x41, + 0x64, 0x6d, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x61, + 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x22, 0x77, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x64, + 0x6d, 0x69, 0x6e, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, + 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x65, + 0x76, 0x65, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x22, 0x2c, 0x0a, + 0x16, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4c, 0x6f, 0x67, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x22, 0x33, 0x0a, 0x17, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64, + 0x22, 0x48, 0x0a, 0x18, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, + 0x69, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, + 0x69, 0x73, 0x4f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6b, + 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x30, 0x0a, 0x14, 0x46, 0x69, + 0x6e, 0x64, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64, 0x22, 0x33, 0x0a, 0x15, + 0x46, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x6e, 0x61, 0x6d, + 0x65, 0x32, 0xb5, 0x02, 0x0a, 0x0c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x41, 0x64, 0x6d, 0x69, 0x6e, + 0x12, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x41, 0x64, 0x6d, 0x69, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x67, + 0x69, 0x6e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x49, 0x0a, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x64, 0x6d, 0x69, 0x6e, + 0x4c, 0x6f, 0x67, 0x12, 0x19, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, + 0x64, 0x6d, 0x69, 0x6e, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, + 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4c, + 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4f, 0x0a, 0x10, + 0x63, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, + 0x12, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x64, 0x6d, 0x69, 0x6e, + 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, + 0x70, 0x62, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x69, + 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4a, 0x0a, + 0x11, 0x66, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x46, 0x75, 0x6c, 0x6c, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x6d, 0x69, + 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, + 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_service_admin_proto_rawDescOnce sync.Once + file_service_admin_proto_rawDescData = file_service_admin_proto_rawDesc +) + +func file_service_admin_proto_rawDescGZIP() []byte { + file_service_admin_proto_rawDescOnce.Do(func() { + file_service_admin_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_admin_proto_rawDescData) + }) + return file_service_admin_proto_rawDescData +} + +var file_service_admin_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_service_admin_proto_goTypes = []interface{}{ + (*LoginAdminRequest)(nil), // 0: pb.LoginAdminRequest + (*LoginAdminResponse)(nil), // 1: pb.LoginAdminResponse + (*CreateAdminLogRequest)(nil), // 2: pb.CreateAdminLogRequest + (*CreateAdminLogResponse)(nil), // 3: pb.CreateAdminLogResponse + (*CheckAdminExistsRequest)(nil), // 4: pb.CheckAdminExistsRequest + (*CheckAdminExistsResponse)(nil), // 5: pb.CheckAdminExistsResponse + (*FindAdminNameRequest)(nil), // 6: pb.FindAdminNameRequest + (*FindAdminNameResponse)(nil), // 7: pb.FindAdminNameResponse +} +var file_service_admin_proto_depIdxs = []int32{ + 0, // 0: pb.AdminService.loginAdmin:input_type -> pb.LoginAdminRequest + 2, // 1: pb.AdminService.createAdminLog:input_type -> pb.CreateAdminLogRequest + 4, // 2: pb.AdminService.checkAdminExists:input_type -> pb.CheckAdminExistsRequest + 6, // 3: pb.AdminService.findAdminFullname:input_type -> pb.FindAdminNameRequest + 1, // 4: pb.AdminService.loginAdmin:output_type -> pb.LoginAdminResponse + 3, // 5: pb.AdminService.createAdminLog:output_type -> pb.CreateAdminLogResponse + 5, // 6: pb.AdminService.checkAdminExists:output_type -> pb.CheckAdminExistsResponse + 7, // 7: pb.AdminService.findAdminFullname:output_type -> pb.FindAdminNameResponse + 4, // [4:8] is the sub-list for method output_type + 0, // [0:4] 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() { file_service_admin_proto_init() } +func file_service_admin_proto_init() { + if File_service_admin_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_service_admin_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LoginAdminRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_admin_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LoginAdminResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_admin_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateAdminLogRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_admin_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateAdminLogResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_admin_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CheckAdminExistsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_admin_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CheckAdminExistsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_admin_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindAdminNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_admin_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindAdminNameResponse); 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_service_admin_proto_rawDesc, + NumEnums: 0, + NumMessages: 8, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_admin_proto_goTypes, + DependencyIndexes: file_service_admin_proto_depIdxs, + MessageInfos: file_service_admin_proto_msgTypes, + }.Build() + File_service_admin_proto = out.File + file_service_admin_proto_rawDesc = nil + file_service_admin_proto_goTypes = nil + file_service_admin_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// 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 + +// AdminServiceClient is the client API for AdminService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type AdminServiceClient interface { + // 登录 + LoginAdmin(ctx context.Context, in *LoginAdminRequest, opts ...grpc.CallOption) (*LoginAdminResponse, error) + // 创建操作日志 + CreateAdminLog(ctx context.Context, in *CreateAdminLogRequest, opts ...grpc.CallOption) (*CreateAdminLogResponse, error) + // 检查管理员是否存在 + CheckAdminExists(ctx context.Context, in *CheckAdminExistsRequest, opts ...grpc.CallOption) (*CheckAdminExistsResponse, error) + // 获取管理员名称 + FindAdminFullname(ctx context.Context, in *FindAdminNameRequest, opts ...grpc.CallOption) (*FindAdminNameResponse, error) +} + +type adminServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewAdminServiceClient(cc grpc.ClientConnInterface) AdminServiceClient { + return &adminServiceClient{cc} +} + +func (c *adminServiceClient) LoginAdmin(ctx context.Context, in *LoginAdminRequest, opts ...grpc.CallOption) (*LoginAdminResponse, error) { + out := new(LoginAdminResponse) + err := c.cc.Invoke(ctx, "/pb.AdminService/loginAdmin", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *adminServiceClient) CreateAdminLog(ctx context.Context, in *CreateAdminLogRequest, opts ...grpc.CallOption) (*CreateAdminLogResponse, error) { + out := new(CreateAdminLogResponse) + err := c.cc.Invoke(ctx, "/pb.AdminService/createAdminLog", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *adminServiceClient) CheckAdminExists(ctx context.Context, in *CheckAdminExistsRequest, opts ...grpc.CallOption) (*CheckAdminExistsResponse, error) { + out := new(CheckAdminExistsResponse) + err := c.cc.Invoke(ctx, "/pb.AdminService/checkAdminExists", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *adminServiceClient) FindAdminFullname(ctx context.Context, in *FindAdminNameRequest, opts ...grpc.CallOption) (*FindAdminNameResponse, error) { + out := new(FindAdminNameResponse) + err := c.cc.Invoke(ctx, "/pb.AdminService/findAdminFullname", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AdminServiceServer is the server API for AdminService service. +type AdminServiceServer interface { + // 登录 + LoginAdmin(context.Context, *LoginAdminRequest) (*LoginAdminResponse, error) + // 创建操作日志 + CreateAdminLog(context.Context, *CreateAdminLogRequest) (*CreateAdminLogResponse, error) + // 检查管理员是否存在 + CheckAdminExists(context.Context, *CheckAdminExistsRequest) (*CheckAdminExistsResponse, error) + // 获取管理员名称 + FindAdminFullname(context.Context, *FindAdminNameRequest) (*FindAdminNameResponse, error) +} + +// UnimplementedAdminServiceServer can be embedded to have forward compatible implementations. +type UnimplementedAdminServiceServer struct { +} + +func (*UnimplementedAdminServiceServer) LoginAdmin(context.Context, *LoginAdminRequest) (*LoginAdminResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LoginAdmin not implemented") +} +func (*UnimplementedAdminServiceServer) CreateAdminLog(context.Context, *CreateAdminLogRequest) (*CreateAdminLogResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateAdminLog not implemented") +} +func (*UnimplementedAdminServiceServer) CheckAdminExists(context.Context, *CheckAdminExistsRequest) (*CheckAdminExistsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CheckAdminExists not implemented") +} +func (*UnimplementedAdminServiceServer) FindAdminFullname(context.Context, *FindAdminNameRequest) (*FindAdminNameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FindAdminFullname not implemented") +} + +func RegisterAdminServiceServer(s *grpc.Server, srv AdminServiceServer) { + s.RegisterService(&_AdminService_serviceDesc, srv) +} + +func _AdminService_LoginAdmin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LoginAdminRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AdminServiceServer).LoginAdmin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.AdminService/LoginAdmin", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AdminServiceServer).LoginAdmin(ctx, req.(*LoginAdminRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AdminService_CreateAdminLog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateAdminLogRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AdminServiceServer).CreateAdminLog(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.AdminService/CreateAdminLog", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AdminServiceServer).CreateAdminLog(ctx, req.(*CreateAdminLogRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AdminService_CheckAdminExists_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CheckAdminExistsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AdminServiceServer).CheckAdminExists(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.AdminService/CheckAdminExists", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AdminServiceServer).CheckAdminExists(ctx, req.(*CheckAdminExistsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AdminService_FindAdminFullname_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FindAdminNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AdminServiceServer).FindAdminFullname(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.AdminService/FindAdminFullname", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AdminServiceServer).FindAdminFullname(ctx, req.(*FindAdminNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _AdminService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pb.AdminService", + HandlerType: (*AdminServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "loginAdmin", + Handler: _AdminService_LoginAdmin_Handler, + }, + { + MethodName: "createAdminLog", + Handler: _AdminService_CreateAdminLog_Handler, + }, + { + MethodName: "checkAdminExists", + Handler: _AdminService_CheckAdminExists_Handler, + }, + { + MethodName: "findAdminFullname", + Handler: _AdminService_FindAdminFullname_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "service_admin.proto", +} diff --git a/internal/rpc/pb/service_node.pb.go b/internal/rpc/pb/service_node.pb.go new file mode 100644 index 00000000..6a049087 --- /dev/null +++ b/internal/rpc/pb/service_node.pb.go @@ -0,0 +1,662 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: service_node.proto + +package pb + +import ( + context "context" + 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" +) + +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 CreateNodeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + ClusterId int64 `protobuf:"varint,2,opt,name=clusterId,proto3" json:"clusterId,omitempty"` +} + +func (x *CreateNodeRequest) Reset() { + *x = CreateNodeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateNodeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateNodeRequest) ProtoMessage() {} + +func (x *CreateNodeRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_node_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 CreateNodeRequest.ProtoReflect.Descriptor instead. +func (*CreateNodeRequest) Descriptor() ([]byte, []int) { + return file_service_node_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateNodeRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateNodeRequest) GetClusterId() int64 { + if x != nil { + return x.ClusterId + } + return 0 +} + +type CreateNodeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeId int64 `protobuf:"varint,1,opt,name=nodeId,proto3" json:"nodeId,omitempty"` +} + +func (x *CreateNodeResponse) Reset() { + *x = CreateNodeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateNodeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateNodeResponse) ProtoMessage() {} + +func (x *CreateNodeResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_node_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 CreateNodeResponse.ProtoReflect.Descriptor instead. +func (*CreateNodeResponse) Descriptor() ([]byte, []int) { + return file_service_node_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateNodeResponse) GetNodeId() int64 { + if x != nil { + return x.NodeId + } + return 0 +} + +// 节点数量 +type CountAllEnabledNodesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *CountAllEnabledNodesRequest) Reset() { + *x = CountAllEnabledNodesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CountAllEnabledNodesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CountAllEnabledNodesRequest) ProtoMessage() {} + +func (x *CountAllEnabledNodesRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_node_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 CountAllEnabledNodesRequest.ProtoReflect.Descriptor instead. +func (*CountAllEnabledNodesRequest) Descriptor() ([]byte, []int) { + return file_service_node_proto_rawDescGZIP(), []int{2} +} + +type CountAllEnabledNodesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Count int64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` +} + +func (x *CountAllEnabledNodesResponse) Reset() { + *x = CountAllEnabledNodesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CountAllEnabledNodesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CountAllEnabledNodesResponse) ProtoMessage() {} + +func (x *CountAllEnabledNodesResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_node_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 CountAllEnabledNodesResponse.ProtoReflect.Descriptor instead. +func (*CountAllEnabledNodesResponse) Descriptor() ([]byte, []int) { + return file_service_node_proto_rawDescGZIP(), []int{3} +} + +func (x *CountAllEnabledNodesResponse) GetCount() int64 { + if x != nil { + return x.Count + } + return 0 +} + +// 列出单页节点 +type ListEnabledNodesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` + Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` +} + +func (x *ListEnabledNodesRequest) Reset() { + *x = ListEnabledNodesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListEnabledNodesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListEnabledNodesRequest) ProtoMessage() {} + +func (x *ListEnabledNodesRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_node_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 ListEnabledNodesRequest.ProtoReflect.Descriptor instead. +func (*ListEnabledNodesRequest) Descriptor() ([]byte, []int) { + return file_service_node_proto_rawDescGZIP(), []int{4} +} + +func (x *ListEnabledNodesRequest) GetOffset() int64 { + if x != nil { + return x.Offset + } + return 0 +} + +func (x *ListEnabledNodesRequest) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +type ListEnabledNodesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Nodes []*Node `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"` +} + +func (x *ListEnabledNodesResponse) Reset() { + *x = ListEnabledNodesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListEnabledNodesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListEnabledNodesResponse) ProtoMessage() {} + +func (x *ListEnabledNodesResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_node_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 ListEnabledNodesResponse.ProtoReflect.Descriptor instead. +func (*ListEnabledNodesResponse) Descriptor() ([]byte, []int) { + return file_service_node_proto_rawDescGZIP(), []int{5} +} + +func (x *ListEnabledNodesResponse) GetNodes() []*Node { + if x != nil { + return x.Nodes + } + return nil +} + +var File_service_node_proto protoreflect.FileDescriptor + +var file_service_node_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x10, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, + 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x45, 0x0a, 0x11, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, + 0x64, 0x22, 0x2c, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x22, + 0x1d, 0x0a, 0x1b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x34, + 0x0a, 0x1c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, + 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x45, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, + 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x3a, 0x0a, 0x18, 0x4c, + 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, + 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x32, 0xf4, 0x01, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, + 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x14, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, + 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1f, 0x2e, 0x70, + 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, + 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x4d, 0x0a, 0x10, 0x6c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, + 0x64, 0x65, 0x73, 0x12, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, + 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x06, + 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_service_node_proto_rawDescOnce sync.Once + file_service_node_proto_rawDescData = file_service_node_proto_rawDesc +) + +func file_service_node_proto_rawDescGZIP() []byte { + file_service_node_proto_rawDescOnce.Do(func() { + file_service_node_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_node_proto_rawDescData) + }) + return file_service_node_proto_rawDescData +} + +var file_service_node_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_service_node_proto_goTypes = []interface{}{ + (*CreateNodeRequest)(nil), // 0: pb.CreateNodeRequest + (*CreateNodeResponse)(nil), // 1: pb.CreateNodeResponse + (*CountAllEnabledNodesRequest)(nil), // 2: pb.CountAllEnabledNodesRequest + (*CountAllEnabledNodesResponse)(nil), // 3: pb.CountAllEnabledNodesResponse + (*ListEnabledNodesRequest)(nil), // 4: pb.ListEnabledNodesRequest + (*ListEnabledNodesResponse)(nil), // 5: pb.ListEnabledNodesResponse + (*Node)(nil), // 6: pb.Node +} +var file_service_node_proto_depIdxs = []int32{ + 6, // 0: pb.ListEnabledNodesResponse.nodes:type_name -> pb.Node + 0, // 1: pb.NodeService.createNode:input_type -> pb.CreateNodeRequest + 2, // 2: pb.NodeService.countAllEnabledNodes:input_type -> pb.CountAllEnabledNodesRequest + 4, // 3: pb.NodeService.listEnabledNodes:input_type -> pb.ListEnabledNodesRequest + 1, // 4: pb.NodeService.createNode:output_type -> pb.CreateNodeResponse + 3, // 5: pb.NodeService.countAllEnabledNodes:output_type -> pb.CountAllEnabledNodesResponse + 5, // 6: pb.NodeService.listEnabledNodes:output_type -> pb.ListEnabledNodesResponse + 4, // [4:7] is the sub-list for method output_type + 1, // [1:4] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_service_node_proto_init() } +func file_service_node_proto_init() { + if File_service_node_proto != nil { + return + } + file_model_node_proto_init() + if !protoimpl.UnsafeEnabled { + file_service_node_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateNodeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateNodeResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CountAllEnabledNodesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CountAllEnabledNodesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListEnabledNodesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListEnabledNodesResponse); 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_service_node_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_node_proto_goTypes, + DependencyIndexes: file_service_node_proto_depIdxs, + MessageInfos: file_service_node_proto_msgTypes, + }.Build() + File_service_node_proto = out.File + file_service_node_proto_rawDesc = nil + file_service_node_proto_goTypes = nil + file_service_node_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// 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 + +// NodeServiceClient is the client API for NodeService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type NodeServiceClient interface { + // 创建节点 + CreateNode(ctx context.Context, in *CreateNodeRequest, opts ...grpc.CallOption) (*CreateNodeResponse, error) + // 节点数量 + CountAllEnabledNodes(ctx context.Context, in *CountAllEnabledNodesRequest, opts ...grpc.CallOption) (*CountAllEnabledNodesResponse, error) + // 列出单页节点 + ListEnabledNodes(ctx context.Context, in *ListEnabledNodesRequest, opts ...grpc.CallOption) (*ListEnabledNodesResponse, error) +} + +type nodeServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewNodeServiceClient(cc grpc.ClientConnInterface) NodeServiceClient { + return &nodeServiceClient{cc} +} + +func (c *nodeServiceClient) CreateNode(ctx context.Context, in *CreateNodeRequest, opts ...grpc.CallOption) (*CreateNodeResponse, error) { + out := new(CreateNodeResponse) + err := c.cc.Invoke(ctx, "/pb.NodeService/createNode", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nodeServiceClient) CountAllEnabledNodes(ctx context.Context, in *CountAllEnabledNodesRequest, opts ...grpc.CallOption) (*CountAllEnabledNodesResponse, error) { + out := new(CountAllEnabledNodesResponse) + err := c.cc.Invoke(ctx, "/pb.NodeService/countAllEnabledNodes", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nodeServiceClient) ListEnabledNodes(ctx context.Context, in *ListEnabledNodesRequest, opts ...grpc.CallOption) (*ListEnabledNodesResponse, error) { + out := new(ListEnabledNodesResponse) + err := c.cc.Invoke(ctx, "/pb.NodeService/listEnabledNodes", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// NodeServiceServer is the server API for NodeService service. +type NodeServiceServer interface { + // 创建节点 + CreateNode(context.Context, *CreateNodeRequest) (*CreateNodeResponse, error) + // 节点数量 + CountAllEnabledNodes(context.Context, *CountAllEnabledNodesRequest) (*CountAllEnabledNodesResponse, error) + // 列出单页节点 + ListEnabledNodes(context.Context, *ListEnabledNodesRequest) (*ListEnabledNodesResponse, error) +} + +// UnimplementedNodeServiceServer can be embedded to have forward compatible implementations. +type UnimplementedNodeServiceServer struct { +} + +func (*UnimplementedNodeServiceServer) CreateNode(context.Context, *CreateNodeRequest) (*CreateNodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateNode not implemented") +} +func (*UnimplementedNodeServiceServer) CountAllEnabledNodes(context.Context, *CountAllEnabledNodesRequest) (*CountAllEnabledNodesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CountAllEnabledNodes not implemented") +} +func (*UnimplementedNodeServiceServer) ListEnabledNodes(context.Context, *ListEnabledNodesRequest) (*ListEnabledNodesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListEnabledNodes not implemented") +} + +func RegisterNodeServiceServer(s *grpc.Server, srv NodeServiceServer) { + s.RegisterService(&_NodeService_serviceDesc, srv) +} + +func _NodeService_CreateNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateNodeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NodeServiceServer).CreateNode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NodeService/CreateNode", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NodeServiceServer).CreateNode(ctx, req.(*CreateNodeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NodeService_CountAllEnabledNodes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CountAllEnabledNodesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NodeServiceServer).CountAllEnabledNodes(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NodeService/CountAllEnabledNodes", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NodeServiceServer).CountAllEnabledNodes(ctx, req.(*CountAllEnabledNodesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NodeService_ListEnabledNodes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListEnabledNodesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NodeServiceServer).ListEnabledNodes(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NodeService/ListEnabledNodes", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NodeServiceServer).ListEnabledNodes(ctx, req.(*ListEnabledNodesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _NodeService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pb.NodeService", + HandlerType: (*NodeServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "createNode", + Handler: _NodeService_CreateNode_Handler, + }, + { + MethodName: "countAllEnabledNodes", + Handler: _NodeService_CountAllEnabledNodes_Handler, + }, + { + MethodName: "listEnabledNodes", + Handler: _NodeService_ListEnabledNodes_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "service_node.proto", +} diff --git a/internal/rpc/pb/service_node_cluster.pb.go b/internal/rpc/pb/service_node_cluster.pb.go new file mode 100644 index 00000000..011cd6e2 --- /dev/null +++ b/internal/rpc/pb/service_node_cluster.pb.go @@ -0,0 +1,304 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: service_node_cluster.proto + +package pb + +import ( + context "context" + 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" +) + +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 FindAllEnabledNodeClustersRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *FindAllEnabledNodeClustersRequest) Reset() { + *x = FindAllEnabledNodeClustersRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_cluster_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindAllEnabledNodeClustersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindAllEnabledNodeClustersRequest) ProtoMessage() {} + +func (x *FindAllEnabledNodeClustersRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_node_cluster_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 FindAllEnabledNodeClustersRequest.ProtoReflect.Descriptor instead. +func (*FindAllEnabledNodeClustersRequest) Descriptor() ([]byte, []int) { + return file_service_node_cluster_proto_rawDescGZIP(), []int{0} +} + +type FindAllEnabledNodeClustersResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Clusters []*NodeCluster `protobuf:"bytes,1,rep,name=clusters,proto3" json:"clusters,omitempty"` +} + +func (x *FindAllEnabledNodeClustersResponse) Reset() { + *x = FindAllEnabledNodeClustersResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_cluster_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindAllEnabledNodeClustersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindAllEnabledNodeClustersResponse) ProtoMessage() {} + +func (x *FindAllEnabledNodeClustersResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_node_cluster_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 FindAllEnabledNodeClustersResponse.ProtoReflect.Descriptor instead. +func (*FindAllEnabledNodeClustersResponse) Descriptor() ([]byte, []int) { + return file_service_node_cluster_proto_rawDescGZIP(), []int{1} +} + +func (x *FindAllEnabledNodeClustersResponse) GetClusters() []*NodeCluster { + if x != nil { + return x.Clusters + } + return nil +} + +var File_service_node_cluster_proto protoreflect.FileDescriptor + +var file_service_node_cluster_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x63, + 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, + 0x1a, 0x18, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x63, 0x6c, 0x75, + 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x23, 0x0a, 0x21, 0x46, 0x69, + 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, + 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, + 0x51, 0x0a, 0x22, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, + 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x08, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, + 0x72, 0x73, 0x32, 0x7d, 0x0a, 0x12, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, + 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x67, 0x0a, 0x16, 0x66, 0x69, 0x6e, 0x64, + 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, + 0x72, 0x73, 0x12, 0x25, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, + 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x70, 0x62, 0x2e, 0x46, + 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, + 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_service_node_cluster_proto_rawDescOnce sync.Once + file_service_node_cluster_proto_rawDescData = file_service_node_cluster_proto_rawDesc +) + +func file_service_node_cluster_proto_rawDescGZIP() []byte { + file_service_node_cluster_proto_rawDescOnce.Do(func() { + file_service_node_cluster_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_node_cluster_proto_rawDescData) + }) + return file_service_node_cluster_proto_rawDescData +} + +var file_service_node_cluster_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_service_node_cluster_proto_goTypes = []interface{}{ + (*FindAllEnabledNodeClustersRequest)(nil), // 0: pb.FindAllEnabledNodeClustersRequest + (*FindAllEnabledNodeClustersResponse)(nil), // 1: pb.FindAllEnabledNodeClustersResponse + (*NodeCluster)(nil), // 2: pb.NodeCluster +} +var file_service_node_cluster_proto_depIdxs = []int32{ + 2, // 0: pb.FindAllEnabledNodeClustersResponse.clusters:type_name -> pb.NodeCluster + 0, // 1: pb.NodeClusterService.findAllEnabledClusters:input_type -> pb.FindAllEnabledNodeClustersRequest + 1, // 2: pb.NodeClusterService.findAllEnabledClusters:output_type -> pb.FindAllEnabledNodeClustersResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_service_node_cluster_proto_init() } +func file_service_node_cluster_proto_init() { + if File_service_node_cluster_proto != nil { + return + } + file_model_node_cluster_proto_init() + if !protoimpl.UnsafeEnabled { + file_service_node_cluster_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindAllEnabledNodeClustersRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_cluster_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindAllEnabledNodeClustersResponse); 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_service_node_cluster_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_node_cluster_proto_goTypes, + DependencyIndexes: file_service_node_cluster_proto_depIdxs, + MessageInfos: file_service_node_cluster_proto_msgTypes, + }.Build() + File_service_node_cluster_proto = out.File + file_service_node_cluster_proto_rawDesc = nil + file_service_node_cluster_proto_goTypes = nil + file_service_node_cluster_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// 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 + +// NodeClusterServiceClient is the client API for NodeClusterService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type NodeClusterServiceClient interface { + // 获取所有集群的信息 + FindAllEnabledClusters(ctx context.Context, in *FindAllEnabledNodeClustersRequest, opts ...grpc.CallOption) (*FindAllEnabledNodeClustersResponse, error) +} + +type nodeClusterServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewNodeClusterServiceClient(cc grpc.ClientConnInterface) NodeClusterServiceClient { + return &nodeClusterServiceClient{cc} +} + +func (c *nodeClusterServiceClient) FindAllEnabledClusters(ctx context.Context, in *FindAllEnabledNodeClustersRequest, opts ...grpc.CallOption) (*FindAllEnabledNodeClustersResponse, error) { + out := new(FindAllEnabledNodeClustersResponse) + err := c.cc.Invoke(ctx, "/pb.NodeClusterService/findAllEnabledClusters", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// NodeClusterServiceServer is the server API for NodeClusterService service. +type NodeClusterServiceServer interface { + // 获取所有集群的信息 + FindAllEnabledClusters(context.Context, *FindAllEnabledNodeClustersRequest) (*FindAllEnabledNodeClustersResponse, error) +} + +// UnimplementedNodeClusterServiceServer can be embedded to have forward compatible implementations. +type UnimplementedNodeClusterServiceServer struct { +} + +func (*UnimplementedNodeClusterServiceServer) FindAllEnabledClusters(context.Context, *FindAllEnabledNodeClustersRequest) (*FindAllEnabledNodeClustersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FindAllEnabledClusters not implemented") +} + +func RegisterNodeClusterServiceServer(s *grpc.Server, srv NodeClusterServiceServer) { + s.RegisterService(&_NodeClusterService_serviceDesc, srv) +} + +func _NodeClusterService_FindAllEnabledClusters_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FindAllEnabledNodeClustersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NodeClusterServiceServer).FindAllEnabledClusters(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NodeClusterService/FindAllEnabledClusters", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NodeClusterServiceServer).FindAllEnabledClusters(ctx, req.(*FindAllEnabledNodeClustersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _NodeClusterService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pb.NodeClusterService", + HandlerType: (*NodeClusterServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "findAllEnabledClusters", + Handler: _NodeClusterService_FindAllEnabledClusters_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "service_node_cluster.proto", +} diff --git a/internal/rpc/pb/service_node_grant.pb.go b/internal/rpc/pb/service_node_grant.pb.go new file mode 100644 index 00000000..e3c67b29 --- /dev/null +++ b/internal/rpc/pb/service_node_grant.pb.go @@ -0,0 +1,1283 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: service_node_grant.proto + +package pb + +import ( + context "context" + 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" +) + +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 CreateNodeGrantRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"` + Username string `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"` + Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"` + PrivateKey string `protobuf:"bytes,5,opt,name=privateKey,proto3" json:"privateKey,omitempty"` + Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` + NodeId int64 `protobuf:"varint,7,opt,name=nodeId,proto3" json:"nodeId,omitempty"` +} + +func (x *CreateNodeGrantRequest) Reset() { + *x = CreateNodeGrantRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_grant_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateNodeGrantRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateNodeGrantRequest) ProtoMessage() {} + +func (x *CreateNodeGrantRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_node_grant_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 CreateNodeGrantRequest.ProtoReflect.Descriptor instead. +func (*CreateNodeGrantRequest) Descriptor() ([]byte, []int) { + return file_service_node_grant_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateNodeGrantRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateNodeGrantRequest) GetMethod() string { + if x != nil { + return x.Method + } + return "" +} + +func (x *CreateNodeGrantRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *CreateNodeGrantRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *CreateNodeGrantRequest) GetPrivateKey() string { + if x != nil { + return x.PrivateKey + } + return "" +} + +func (x *CreateNodeGrantRequest) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *CreateNodeGrantRequest) GetNodeId() int64 { + if x != nil { + return x.NodeId + } + return 0 +} + +type CreateNodeGrantResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + GrantId int64 `protobuf:"varint,1,opt,name=grantId,proto3" json:"grantId,omitempty"` +} + +func (x *CreateNodeGrantResponse) Reset() { + *x = CreateNodeGrantResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_grant_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateNodeGrantResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateNodeGrantResponse) ProtoMessage() {} + +func (x *CreateNodeGrantResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_node_grant_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 CreateNodeGrantResponse.ProtoReflect.Descriptor instead. +func (*CreateNodeGrantResponse) Descriptor() ([]byte, []int) { + return file_service_node_grant_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateNodeGrantResponse) GetGrantId() int64 { + if x != nil { + return x.GrantId + } + return 0 +} + +// 修改节点认证 +type UpdateNodeGrantRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + GrantId int64 `protobuf:"varint,8,opt,name=grantId,proto3" json:"grantId,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"` + Username string `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"` + Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"` + PrivateKey string `protobuf:"bytes,5,opt,name=privateKey,proto3" json:"privateKey,omitempty"` + Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` + NodeId int64 `protobuf:"varint,7,opt,name=nodeId,proto3" json:"nodeId,omitempty"` +} + +func (x *UpdateNodeGrantRequest) Reset() { + *x = UpdateNodeGrantRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_grant_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateNodeGrantRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateNodeGrantRequest) ProtoMessage() {} + +func (x *UpdateNodeGrantRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_node_grant_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 UpdateNodeGrantRequest.ProtoReflect.Descriptor instead. +func (*UpdateNodeGrantRequest) Descriptor() ([]byte, []int) { + return file_service_node_grant_proto_rawDescGZIP(), []int{2} +} + +func (x *UpdateNodeGrantRequest) GetGrantId() int64 { + if x != nil { + return x.GrantId + } + return 0 +} + +func (x *UpdateNodeGrantRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UpdateNodeGrantRequest) GetMethod() string { + if x != nil { + return x.Method + } + return "" +} + +func (x *UpdateNodeGrantRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *UpdateNodeGrantRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *UpdateNodeGrantRequest) GetPrivateKey() string { + if x != nil { + return x.PrivateKey + } + return "" +} + +func (x *UpdateNodeGrantRequest) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *UpdateNodeGrantRequest) GetNodeId() int64 { + if x != nil { + return x.NodeId + } + return 0 +} + +type UpdateNodeGrantResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateNodeGrantResponse) Reset() { + *x = UpdateNodeGrantResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_grant_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateNodeGrantResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateNodeGrantResponse) ProtoMessage() {} + +func (x *UpdateNodeGrantResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_node_grant_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 UpdateNodeGrantResponse.ProtoReflect.Descriptor instead. +func (*UpdateNodeGrantResponse) Descriptor() ([]byte, []int) { + return file_service_node_grant_proto_rawDescGZIP(), []int{3} +} + +// 禁用节点认证 +type DisableNodeGrantRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + GrantId int64 `protobuf:"varint,1,opt,name=grantId,proto3" json:"grantId,omitempty"` +} + +func (x *DisableNodeGrantRequest) Reset() { + *x = DisableNodeGrantRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_grant_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DisableNodeGrantRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DisableNodeGrantRequest) ProtoMessage() {} + +func (x *DisableNodeGrantRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_node_grant_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 DisableNodeGrantRequest.ProtoReflect.Descriptor instead. +func (*DisableNodeGrantRequest) Descriptor() ([]byte, []int) { + return file_service_node_grant_proto_rawDescGZIP(), []int{4} +} + +func (x *DisableNodeGrantRequest) GetGrantId() int64 { + if x != nil { + return x.GrantId + } + return 0 +} + +type DisableNodeGrantResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DisableNodeGrantResponse) Reset() { + *x = DisableNodeGrantResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_grant_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DisableNodeGrantResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DisableNodeGrantResponse) ProtoMessage() {} + +func (x *DisableNodeGrantResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_node_grant_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 DisableNodeGrantResponse.ProtoReflect.Descriptor instead. +func (*DisableNodeGrantResponse) Descriptor() ([]byte, []int) { + return file_service_node_grant_proto_rawDescGZIP(), []int{5} +} + +// 计算节点认证数量 +type CountAllEnabledNodeGrantsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *CountAllEnabledNodeGrantsRequest) Reset() { + *x = CountAllEnabledNodeGrantsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_grant_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CountAllEnabledNodeGrantsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CountAllEnabledNodeGrantsRequest) ProtoMessage() {} + +func (x *CountAllEnabledNodeGrantsRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_node_grant_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 CountAllEnabledNodeGrantsRequest.ProtoReflect.Descriptor instead. +func (*CountAllEnabledNodeGrantsRequest) Descriptor() ([]byte, []int) { + return file_service_node_grant_proto_rawDescGZIP(), []int{6} +} + +type CountAllEnabledNodeGrantsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Count int64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` +} + +func (x *CountAllEnabledNodeGrantsResponse) Reset() { + *x = CountAllEnabledNodeGrantsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_grant_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CountAllEnabledNodeGrantsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CountAllEnabledNodeGrantsResponse) ProtoMessage() {} + +func (x *CountAllEnabledNodeGrantsResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_node_grant_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 CountAllEnabledNodeGrantsResponse.ProtoReflect.Descriptor instead. +func (*CountAllEnabledNodeGrantsResponse) Descriptor() ([]byte, []int) { + return file_service_node_grant_proto_rawDescGZIP(), []int{7} +} + +func (x *CountAllEnabledNodeGrantsResponse) GetCount() int64 { + if x != nil { + return x.Count + } + return 0 +} + +// 列出所有认证 +type ListEnabledNodeGrantsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` + Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` +} + +func (x *ListEnabledNodeGrantsRequest) Reset() { + *x = ListEnabledNodeGrantsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_grant_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListEnabledNodeGrantsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListEnabledNodeGrantsRequest) ProtoMessage() {} + +func (x *ListEnabledNodeGrantsRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_node_grant_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 ListEnabledNodeGrantsRequest.ProtoReflect.Descriptor instead. +func (*ListEnabledNodeGrantsRequest) Descriptor() ([]byte, []int) { + return file_service_node_grant_proto_rawDescGZIP(), []int{8} +} + +func (x *ListEnabledNodeGrantsRequest) GetOffset() int64 { + if x != nil { + return x.Offset + } + return 0 +} + +func (x *ListEnabledNodeGrantsRequest) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +type ListEnabledNodeGrantsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Grants []*NodeGrant `protobuf:"bytes,1,rep,name=grants,proto3" json:"grants,omitempty"` +} + +func (x *ListEnabledNodeGrantsResponse) Reset() { + *x = ListEnabledNodeGrantsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_grant_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListEnabledNodeGrantsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListEnabledNodeGrantsResponse) ProtoMessage() {} + +func (x *ListEnabledNodeGrantsResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_node_grant_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 ListEnabledNodeGrantsResponse.ProtoReflect.Descriptor instead. +func (*ListEnabledNodeGrantsResponse) Descriptor() ([]byte, []int) { + return file_service_node_grant_proto_rawDescGZIP(), []int{9} +} + +func (x *ListEnabledNodeGrantsResponse) GetGrants() []*NodeGrant { + if x != nil { + return x.Grants + } + return nil +} + +// 获取认证信息 +type FindEnabledGrantRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + GrantId int64 `protobuf:"varint,1,opt,name=grantId,proto3" json:"grantId,omitempty"` +} + +func (x *FindEnabledGrantRequest) Reset() { + *x = FindEnabledGrantRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_grant_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindEnabledGrantRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindEnabledGrantRequest) ProtoMessage() {} + +func (x *FindEnabledGrantRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_node_grant_proto_msgTypes[10] + 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 FindEnabledGrantRequest.ProtoReflect.Descriptor instead. +func (*FindEnabledGrantRequest) Descriptor() ([]byte, []int) { + return file_service_node_grant_proto_rawDescGZIP(), []int{10} +} + +func (x *FindEnabledGrantRequest) GetGrantId() int64 { + if x != nil { + return x.GrantId + } + return 0 +} + +type FindEnabledGrantResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Grant *NodeGrant `protobuf:"bytes,1,opt,name=grant,proto3" json:"grant,omitempty"` +} + +func (x *FindEnabledGrantResponse) Reset() { + *x = FindEnabledGrantResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_grant_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindEnabledGrantResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindEnabledGrantResponse) ProtoMessage() {} + +func (x *FindEnabledGrantResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_node_grant_proto_msgTypes[11] + 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 FindEnabledGrantResponse.ProtoReflect.Descriptor instead. +func (*FindEnabledGrantResponse) Descriptor() ([]byte, []int) { + return file_service_node_grant_proto_rawDescGZIP(), []int{11} +} + +func (x *FindEnabledGrantResponse) GetGrant() *NodeGrant { + if x != nil { + return x.Grant + } + return nil +} + +var File_service_node_grant_proto protoreflect.FileDescriptor + +var file_service_node_grant_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x67, + 0x72, 0x61, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x16, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x67, 0x72, 0x61, 0x6e, 0x74, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd6, 0x01, 0x0a, 0x16, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x1a, 0x0a, + 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, + 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, + 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x4b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, + 0x74, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, + 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x22, + 0x33, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x61, + 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, + 0x61, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x67, 0x72, 0x61, + 0x6e, 0x74, 0x49, 0x64, 0x22, 0xf0, 0x01, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, + 0x6f, 0x64, 0x65, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x18, 0x0a, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, + 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1e, 0x0a, + 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x20, 0x0a, + 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x22, 0x19, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x33, 0x0a, 0x17, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x6f, 0x64, + 0x65, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, + 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, + 0x67, 0x72, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x1a, 0x0a, 0x18, 0x44, 0x69, 0x73, 0x61, 0x62, + 0x6c, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x22, 0x0a, 0x20, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x39, 0x0a, 0x21, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, + 0x61, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x22, 0x4a, 0x0a, 0x1c, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, + 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x46, + 0x0a, 0x1d, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, + 0x65, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x25, 0x0a, 0x06, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, 0x06, + 0x67, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x22, 0x33, 0x0a, 0x17, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x64, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x3f, 0x0a, 0x18, 0x46, + 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x67, 0x72, 0x61, 0x6e, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, + 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, 0x05, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x32, 0x90, 0x04, 0x0a, + 0x10, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x4a, 0x0a, 0x0f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x47, + 0x72, 0x61, 0x6e, 0x74, 0x12, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, + 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, + 0x0f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x61, 0x6e, 0x74, + 0x12, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, + 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, + 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x61, 0x6e, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x10, 0x64, 0x69, 0x73, + 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x12, 0x1b, 0x2e, + 0x70, 0x62, 0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, + 0x61, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x62, 0x2e, + 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x61, 0x6e, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x68, 0x0a, 0x19, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x47, + 0x72, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x24, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, + 0x61, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x62, + 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, + 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x20, 0x2e, 0x70, 0x62, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, + 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, + 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, + 0x64, 0x65, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x4d, 0x0a, 0x10, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x47, + 0x72, 0x61, 0x6e, 0x74, 0x12, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x64, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x64, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, + 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_service_node_grant_proto_rawDescOnce sync.Once + file_service_node_grant_proto_rawDescData = file_service_node_grant_proto_rawDesc +) + +func file_service_node_grant_proto_rawDescGZIP() []byte { + file_service_node_grant_proto_rawDescOnce.Do(func() { + file_service_node_grant_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_node_grant_proto_rawDescData) + }) + return file_service_node_grant_proto_rawDescData +} + +var file_service_node_grant_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_service_node_grant_proto_goTypes = []interface{}{ + (*CreateNodeGrantRequest)(nil), // 0: pb.CreateNodeGrantRequest + (*CreateNodeGrantResponse)(nil), // 1: pb.CreateNodeGrantResponse + (*UpdateNodeGrantRequest)(nil), // 2: pb.UpdateNodeGrantRequest + (*UpdateNodeGrantResponse)(nil), // 3: pb.UpdateNodeGrantResponse + (*DisableNodeGrantRequest)(nil), // 4: pb.DisableNodeGrantRequest + (*DisableNodeGrantResponse)(nil), // 5: pb.DisableNodeGrantResponse + (*CountAllEnabledNodeGrantsRequest)(nil), // 6: pb.CountAllEnabledNodeGrantsRequest + (*CountAllEnabledNodeGrantsResponse)(nil), // 7: pb.CountAllEnabledNodeGrantsResponse + (*ListEnabledNodeGrantsRequest)(nil), // 8: pb.ListEnabledNodeGrantsRequest + (*ListEnabledNodeGrantsResponse)(nil), // 9: pb.ListEnabledNodeGrantsResponse + (*FindEnabledGrantRequest)(nil), // 10: pb.FindEnabledGrantRequest + (*FindEnabledGrantResponse)(nil), // 11: pb.FindEnabledGrantResponse + (*NodeGrant)(nil), // 12: pb.NodeGrant +} +var file_service_node_grant_proto_depIdxs = []int32{ + 12, // 0: pb.ListEnabledNodeGrantsResponse.grants:type_name -> pb.NodeGrant + 12, // 1: pb.FindEnabledGrantResponse.grant:type_name -> pb.NodeGrant + 0, // 2: pb.NodeGrantService.createNodeGrant:input_type -> pb.CreateNodeGrantRequest + 2, // 3: pb.NodeGrantService.updateNodeGrant:input_type -> pb.UpdateNodeGrantRequest + 4, // 4: pb.NodeGrantService.disableNodeGrant:input_type -> pb.DisableNodeGrantRequest + 6, // 5: pb.NodeGrantService.countAllEnabledNodeGrants:input_type -> pb.CountAllEnabledNodeGrantsRequest + 8, // 6: pb.NodeGrantService.ListEnabledNodeGrants:input_type -> pb.ListEnabledNodeGrantsRequest + 10, // 7: pb.NodeGrantService.FindEnabledGrant:input_type -> pb.FindEnabledGrantRequest + 1, // 8: pb.NodeGrantService.createNodeGrant:output_type -> pb.CreateNodeGrantResponse + 3, // 9: pb.NodeGrantService.updateNodeGrant:output_type -> pb.UpdateNodeGrantResponse + 5, // 10: pb.NodeGrantService.disableNodeGrant:output_type -> pb.DisableNodeGrantResponse + 7, // 11: pb.NodeGrantService.countAllEnabledNodeGrants:output_type -> pb.CountAllEnabledNodeGrantsResponse + 9, // 12: pb.NodeGrantService.ListEnabledNodeGrants:output_type -> pb.ListEnabledNodeGrantsResponse + 11, // 13: pb.NodeGrantService.FindEnabledGrant:output_type -> pb.FindEnabledGrantResponse + 8, // [8:14] is the sub-list for method output_type + 2, // [2:8] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_service_node_grant_proto_init() } +func file_service_node_grant_proto_init() { + if File_service_node_grant_proto != nil { + return + } + file_model_node_grant_proto_init() + if !protoimpl.UnsafeEnabled { + file_service_node_grant_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateNodeGrantRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_grant_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateNodeGrantResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_grant_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateNodeGrantRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_grant_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateNodeGrantResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_grant_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DisableNodeGrantRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_grant_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DisableNodeGrantResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_grant_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CountAllEnabledNodeGrantsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_grant_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CountAllEnabledNodeGrantsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_grant_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListEnabledNodeGrantsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_grant_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListEnabledNodeGrantsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_grant_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindEnabledGrantRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_grant_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindEnabledGrantResponse); 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_service_node_grant_proto_rawDesc, + NumEnums: 0, + NumMessages: 12, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_node_grant_proto_goTypes, + DependencyIndexes: file_service_node_grant_proto_depIdxs, + MessageInfos: file_service_node_grant_proto_msgTypes, + }.Build() + File_service_node_grant_proto = out.File + file_service_node_grant_proto_rawDesc = nil + file_service_node_grant_proto_goTypes = nil + file_service_node_grant_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// 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 + +// NodeGrantServiceClient is the client API for NodeGrantService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type NodeGrantServiceClient interface { + // 创建认证 + CreateNodeGrant(ctx context.Context, in *CreateNodeGrantRequest, opts ...grpc.CallOption) (*CreateNodeGrantResponse, error) + // 修改认证 + UpdateNodeGrant(ctx context.Context, in *UpdateNodeGrantRequest, opts ...grpc.CallOption) (*UpdateNodeGrantResponse, error) + // 禁用认证 + DisableNodeGrant(ctx context.Context, in *DisableNodeGrantRequest, opts ...grpc.CallOption) (*DisableNodeGrantResponse, error) + // 计算认证的数量 + CountAllEnabledNodeGrants(ctx context.Context, in *CountAllEnabledNodeGrantsRequest, opts ...grpc.CallOption) (*CountAllEnabledNodeGrantsResponse, error) + // 列出所有认证 + ListEnabledNodeGrants(ctx context.Context, in *ListEnabledNodeGrantsRequest, opts ...grpc.CallOption) (*ListEnabledNodeGrantsResponse, error) + // 获取认证信息 + FindEnabledGrant(ctx context.Context, in *FindEnabledGrantRequest, opts ...grpc.CallOption) (*FindEnabledGrantResponse, error) +} + +type nodeGrantServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewNodeGrantServiceClient(cc grpc.ClientConnInterface) NodeGrantServiceClient { + return &nodeGrantServiceClient{cc} +} + +func (c *nodeGrantServiceClient) CreateNodeGrant(ctx context.Context, in *CreateNodeGrantRequest, opts ...grpc.CallOption) (*CreateNodeGrantResponse, error) { + out := new(CreateNodeGrantResponse) + err := c.cc.Invoke(ctx, "/pb.NodeGrantService/createNodeGrant", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nodeGrantServiceClient) UpdateNodeGrant(ctx context.Context, in *UpdateNodeGrantRequest, opts ...grpc.CallOption) (*UpdateNodeGrantResponse, error) { + out := new(UpdateNodeGrantResponse) + err := c.cc.Invoke(ctx, "/pb.NodeGrantService/updateNodeGrant", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nodeGrantServiceClient) DisableNodeGrant(ctx context.Context, in *DisableNodeGrantRequest, opts ...grpc.CallOption) (*DisableNodeGrantResponse, error) { + out := new(DisableNodeGrantResponse) + err := c.cc.Invoke(ctx, "/pb.NodeGrantService/disableNodeGrant", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nodeGrantServiceClient) CountAllEnabledNodeGrants(ctx context.Context, in *CountAllEnabledNodeGrantsRequest, opts ...grpc.CallOption) (*CountAllEnabledNodeGrantsResponse, error) { + out := new(CountAllEnabledNodeGrantsResponse) + err := c.cc.Invoke(ctx, "/pb.NodeGrantService/countAllEnabledNodeGrants", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nodeGrantServiceClient) ListEnabledNodeGrants(ctx context.Context, in *ListEnabledNodeGrantsRequest, opts ...grpc.CallOption) (*ListEnabledNodeGrantsResponse, error) { + out := new(ListEnabledNodeGrantsResponse) + err := c.cc.Invoke(ctx, "/pb.NodeGrantService/ListEnabledNodeGrants", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nodeGrantServiceClient) FindEnabledGrant(ctx context.Context, in *FindEnabledGrantRequest, opts ...grpc.CallOption) (*FindEnabledGrantResponse, error) { + out := new(FindEnabledGrantResponse) + err := c.cc.Invoke(ctx, "/pb.NodeGrantService/FindEnabledGrant", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// NodeGrantServiceServer is the server API for NodeGrantService service. +type NodeGrantServiceServer interface { + // 创建认证 + CreateNodeGrant(context.Context, *CreateNodeGrantRequest) (*CreateNodeGrantResponse, error) + // 修改认证 + UpdateNodeGrant(context.Context, *UpdateNodeGrantRequest) (*UpdateNodeGrantResponse, error) + // 禁用认证 + DisableNodeGrant(context.Context, *DisableNodeGrantRequest) (*DisableNodeGrantResponse, error) + // 计算认证的数量 + CountAllEnabledNodeGrants(context.Context, *CountAllEnabledNodeGrantsRequest) (*CountAllEnabledNodeGrantsResponse, error) + // 列出所有认证 + ListEnabledNodeGrants(context.Context, *ListEnabledNodeGrantsRequest) (*ListEnabledNodeGrantsResponse, error) + // 获取认证信息 + FindEnabledGrant(context.Context, *FindEnabledGrantRequest) (*FindEnabledGrantResponse, error) +} + +// UnimplementedNodeGrantServiceServer can be embedded to have forward compatible implementations. +type UnimplementedNodeGrantServiceServer struct { +} + +func (*UnimplementedNodeGrantServiceServer) CreateNodeGrant(context.Context, *CreateNodeGrantRequest) (*CreateNodeGrantResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateNodeGrant not implemented") +} +func (*UnimplementedNodeGrantServiceServer) UpdateNodeGrant(context.Context, *UpdateNodeGrantRequest) (*UpdateNodeGrantResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateNodeGrant not implemented") +} +func (*UnimplementedNodeGrantServiceServer) DisableNodeGrant(context.Context, *DisableNodeGrantRequest) (*DisableNodeGrantResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DisableNodeGrant not implemented") +} +func (*UnimplementedNodeGrantServiceServer) CountAllEnabledNodeGrants(context.Context, *CountAllEnabledNodeGrantsRequest) (*CountAllEnabledNodeGrantsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CountAllEnabledNodeGrants not implemented") +} +func (*UnimplementedNodeGrantServiceServer) ListEnabledNodeGrants(context.Context, *ListEnabledNodeGrantsRequest) (*ListEnabledNodeGrantsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListEnabledNodeGrants not implemented") +} +func (*UnimplementedNodeGrantServiceServer) FindEnabledGrant(context.Context, *FindEnabledGrantRequest) (*FindEnabledGrantResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FindEnabledGrant not implemented") +} + +func RegisterNodeGrantServiceServer(s *grpc.Server, srv NodeGrantServiceServer) { + s.RegisterService(&_NodeGrantService_serviceDesc, srv) +} + +func _NodeGrantService_CreateNodeGrant_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateNodeGrantRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NodeGrantServiceServer).CreateNodeGrant(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NodeGrantService/CreateNodeGrant", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NodeGrantServiceServer).CreateNodeGrant(ctx, req.(*CreateNodeGrantRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NodeGrantService_UpdateNodeGrant_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateNodeGrantRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NodeGrantServiceServer).UpdateNodeGrant(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NodeGrantService/UpdateNodeGrant", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NodeGrantServiceServer).UpdateNodeGrant(ctx, req.(*UpdateNodeGrantRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NodeGrantService_DisableNodeGrant_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DisableNodeGrantRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NodeGrantServiceServer).DisableNodeGrant(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NodeGrantService/DisableNodeGrant", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NodeGrantServiceServer).DisableNodeGrant(ctx, req.(*DisableNodeGrantRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NodeGrantService_CountAllEnabledNodeGrants_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CountAllEnabledNodeGrantsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NodeGrantServiceServer).CountAllEnabledNodeGrants(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NodeGrantService/CountAllEnabledNodeGrants", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NodeGrantServiceServer).CountAllEnabledNodeGrants(ctx, req.(*CountAllEnabledNodeGrantsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NodeGrantService_ListEnabledNodeGrants_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListEnabledNodeGrantsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NodeGrantServiceServer).ListEnabledNodeGrants(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NodeGrantService/ListEnabledNodeGrants", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NodeGrantServiceServer).ListEnabledNodeGrants(ctx, req.(*ListEnabledNodeGrantsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NodeGrantService_FindEnabledGrant_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FindEnabledGrantRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NodeGrantServiceServer).FindEnabledGrant(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NodeGrantService/FindEnabledGrant", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NodeGrantServiceServer).FindEnabledGrant(ctx, req.(*FindEnabledGrantRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _NodeGrantService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pb.NodeGrantService", + HandlerType: (*NodeGrantServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "createNodeGrant", + Handler: _NodeGrantService_CreateNodeGrant_Handler, + }, + { + MethodName: "updateNodeGrant", + Handler: _NodeGrantService_UpdateNodeGrant_Handler, + }, + { + MethodName: "disableNodeGrant", + Handler: _NodeGrantService_DisableNodeGrant_Handler, + }, + { + MethodName: "countAllEnabledNodeGrants", + Handler: _NodeGrantService_CountAllEnabledNodeGrants_Handler, + }, + { + MethodName: "ListEnabledNodeGrants", + Handler: _NodeGrantService_ListEnabledNodeGrants_Handler, + }, + { + MethodName: "FindEnabledGrant", + Handler: _NodeGrantService_FindEnabledGrant_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "service_node_grant.proto", +} diff --git a/internal/rpc/pb/service_server.pb.go b/internal/rpc/pb/service_server.pb.go new file mode 100644 index 00000000..a0ac0f82 --- /dev/null +++ b/internal/rpc/pb/service_server.pb.go @@ -0,0 +1,706 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: service_server.proto + +package pb + +import ( + context "context" + 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" +) + +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 CreateServerRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"` + AdminId int64 `protobuf:"varint,2,opt,name=adminId,proto3" json:"adminId,omitempty"` + ClusterId int64 `protobuf:"varint,6,opt,name=clusterId,proto3" json:"clusterId,omitempty"` + Config []byte `protobuf:"bytes,3,opt,name=config,proto3" json:"config,omitempty"` + IncludeNodesJSON []byte `protobuf:"bytes,4,opt,name=includeNodesJSON,proto3" json:"includeNodesJSON,omitempty"` + ExcludeNodesJSON []byte `protobuf:"bytes,5,opt,name=excludeNodesJSON,proto3" json:"excludeNodesJSON,omitempty"` +} + +func (x *CreateServerRequest) Reset() { + *x = CreateServerRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_server_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateServerRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateServerRequest) ProtoMessage() {} + +func (x *CreateServerRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_server_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 CreateServerRequest.ProtoReflect.Descriptor instead. +func (*CreateServerRequest) Descriptor() ([]byte, []int) { + return file_service_server_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateServerRequest) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *CreateServerRequest) GetAdminId() int64 { + if x != nil { + return x.AdminId + } + return 0 +} + +func (x *CreateServerRequest) GetClusterId() int64 { + if x != nil { + return x.ClusterId + } + return 0 +} + +func (x *CreateServerRequest) GetConfig() []byte { + if x != nil { + return x.Config + } + return nil +} + +func (x *CreateServerRequest) GetIncludeNodesJSON() []byte { + if x != nil { + return x.IncludeNodesJSON + } + return nil +} + +func (x *CreateServerRequest) GetExcludeNodesJSON() []byte { + if x != nil { + return x.ExcludeNodesJSON + } + return nil +} + +type CreateServerResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServerId int64 `protobuf:"varint,1,opt,name=serverId,proto3" json:"serverId,omitempty"` +} + +func (x *CreateServerResponse) Reset() { + *x = CreateServerResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_server_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateServerResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateServerResponse) ProtoMessage() {} + +func (x *CreateServerResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_server_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 CreateServerResponse.ProtoReflect.Descriptor instead. +func (*CreateServerResponse) Descriptor() ([]byte, []int) { + return file_service_server_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateServerResponse) GetServerId() int64 { + if x != nil { + return x.ServerId + } + return 0 +} + +// 计算服务数量 +type CountAllEnabledServersRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *CountAllEnabledServersRequest) Reset() { + *x = CountAllEnabledServersRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_server_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CountAllEnabledServersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CountAllEnabledServersRequest) ProtoMessage() {} + +func (x *CountAllEnabledServersRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_server_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 CountAllEnabledServersRequest.ProtoReflect.Descriptor instead. +func (*CountAllEnabledServersRequest) Descriptor() ([]byte, []int) { + return file_service_server_proto_rawDescGZIP(), []int{2} +} + +type CountAllEnabledServersResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Count int64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` +} + +func (x *CountAllEnabledServersResponse) Reset() { + *x = CountAllEnabledServersResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_server_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CountAllEnabledServersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CountAllEnabledServersResponse) ProtoMessage() {} + +func (x *CountAllEnabledServersResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_server_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 CountAllEnabledServersResponse.ProtoReflect.Descriptor instead. +func (*CountAllEnabledServersResponse) Descriptor() ([]byte, []int) { + return file_service_server_proto_rawDescGZIP(), []int{3} +} + +func (x *CountAllEnabledServersResponse) GetCount() int64 { + if x != nil { + return x.Count + } + return 0 +} + +// 列出单页服务 +type ListEnabledServersRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` + Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` +} + +func (x *ListEnabledServersRequest) Reset() { + *x = ListEnabledServersRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_server_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListEnabledServersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListEnabledServersRequest) ProtoMessage() {} + +func (x *ListEnabledServersRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_server_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 ListEnabledServersRequest.ProtoReflect.Descriptor instead. +func (*ListEnabledServersRequest) Descriptor() ([]byte, []int) { + return file_service_server_proto_rawDescGZIP(), []int{4} +} + +func (x *ListEnabledServersRequest) GetOffset() int64 { + if x != nil { + return x.Offset + } + return 0 +} + +func (x *ListEnabledServersRequest) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +type ListEnabledServersResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Servers []*Server `protobuf:"bytes,1,rep,name=servers,proto3" json:"servers,omitempty"` +} + +func (x *ListEnabledServersResponse) Reset() { + *x = ListEnabledServersResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_server_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListEnabledServersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListEnabledServersResponse) ProtoMessage() {} + +func (x *ListEnabledServersResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_server_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 ListEnabledServersResponse.ProtoReflect.Descriptor instead. +func (*ListEnabledServersResponse) Descriptor() ([]byte, []int) { + return file_service_server_proto_rawDescGZIP(), []int{5} +} + +func (x *ListEnabledServersResponse) GetServers() []*Server { + if x != nil { + return x.Servers + } + return nil +} + +var File_service_server_proto protoreflect.FileDescriptor + +var file_service_server_proto_rawDesc = []byte{ + 0x0a, 0x14, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x12, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd5, + 0x01, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, + 0x0a, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6c, 0x75, 0x73, + 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x6c, 0x75, + 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2a, + 0x0a, 0x10, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x4a, 0x53, + 0x4f, 0x4e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, + 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x2a, 0x0a, 0x10, 0x65, 0x78, + 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64, + 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x32, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, + 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x22, 0x1f, 0x0a, 0x1d, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x36, 0x0a, 0x1e, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x22, 0x47, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x42, 0x0a, 0x1a, + 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x07, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, + 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, + 0x32, 0x88, 0x02, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x41, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x62, + 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x16, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, + 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, + 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, + 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, + 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x12, 0x6c, 0x69, 0x73, 0x74, 0x45, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x1d, 0x2e, 0x70, + 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x62, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, + 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_service_server_proto_rawDescOnce sync.Once + file_service_server_proto_rawDescData = file_service_server_proto_rawDesc +) + +func file_service_server_proto_rawDescGZIP() []byte { + file_service_server_proto_rawDescOnce.Do(func() { + file_service_server_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_server_proto_rawDescData) + }) + return file_service_server_proto_rawDescData +} + +var file_service_server_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_service_server_proto_goTypes = []interface{}{ + (*CreateServerRequest)(nil), // 0: pb.CreateServerRequest + (*CreateServerResponse)(nil), // 1: pb.CreateServerResponse + (*CountAllEnabledServersRequest)(nil), // 2: pb.CountAllEnabledServersRequest + (*CountAllEnabledServersResponse)(nil), // 3: pb.CountAllEnabledServersResponse + (*ListEnabledServersRequest)(nil), // 4: pb.ListEnabledServersRequest + (*ListEnabledServersResponse)(nil), // 5: pb.ListEnabledServersResponse + (*Server)(nil), // 6: pb.Server +} +var file_service_server_proto_depIdxs = []int32{ + 6, // 0: pb.ListEnabledServersResponse.servers:type_name -> pb.Server + 0, // 1: pb.ServerService.createServer:input_type -> pb.CreateServerRequest + 2, // 2: pb.ServerService.countAllEnabledServers:input_type -> pb.CountAllEnabledServersRequest + 4, // 3: pb.ServerService.listEnabledServers:input_type -> pb.ListEnabledServersRequest + 1, // 4: pb.ServerService.createServer:output_type -> pb.CreateServerResponse + 3, // 5: pb.ServerService.countAllEnabledServers:output_type -> pb.CountAllEnabledServersResponse + 5, // 6: pb.ServerService.listEnabledServers:output_type -> pb.ListEnabledServersResponse + 4, // [4:7] is the sub-list for method output_type + 1, // [1:4] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_service_server_proto_init() } +func file_service_server_proto_init() { + if File_service_server_proto != nil { + return + } + file_model_server_proto_init() + if !protoimpl.UnsafeEnabled { + file_service_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateServerRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_server_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateServerResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_server_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CountAllEnabledServersRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_server_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CountAllEnabledServersResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_server_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListEnabledServersRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_server_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListEnabledServersResponse); 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_service_server_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_server_proto_goTypes, + DependencyIndexes: file_service_server_proto_depIdxs, + MessageInfos: file_service_server_proto_msgTypes, + }.Build() + File_service_server_proto = out.File + file_service_server_proto_rawDesc = nil + file_service_server_proto_goTypes = nil + file_service_server_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// 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 + +// ServerServiceClient is the client API for ServerService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ServerServiceClient interface { + // 创建服务 + CreateServer(ctx context.Context, in *CreateServerRequest, opts ...grpc.CallOption) (*CreateServerResponse, error) + // 计算服务数量 + CountAllEnabledServers(ctx context.Context, in *CountAllEnabledServersRequest, opts ...grpc.CallOption) (*CountAllEnabledServersResponse, error) + // 列出单页服务 + ListEnabledServers(ctx context.Context, in *ListEnabledServersRequest, opts ...grpc.CallOption) (*ListEnabledServersResponse, error) +} + +type serverServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewServerServiceClient(cc grpc.ClientConnInterface) ServerServiceClient { + return &serverServiceClient{cc} +} + +func (c *serverServiceClient) CreateServer(ctx context.Context, in *CreateServerRequest, opts ...grpc.CallOption) (*CreateServerResponse, error) { + out := new(CreateServerResponse) + err := c.cc.Invoke(ctx, "/pb.ServerService/createServer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serverServiceClient) CountAllEnabledServers(ctx context.Context, in *CountAllEnabledServersRequest, opts ...grpc.CallOption) (*CountAllEnabledServersResponse, error) { + out := new(CountAllEnabledServersResponse) + err := c.cc.Invoke(ctx, "/pb.ServerService/countAllEnabledServers", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serverServiceClient) ListEnabledServers(ctx context.Context, in *ListEnabledServersRequest, opts ...grpc.CallOption) (*ListEnabledServersResponse, error) { + out := new(ListEnabledServersResponse) + err := c.cc.Invoke(ctx, "/pb.ServerService/listEnabledServers", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ServerServiceServer is the server API for ServerService service. +type ServerServiceServer interface { + // 创建服务 + CreateServer(context.Context, *CreateServerRequest) (*CreateServerResponse, error) + // 计算服务数量 + CountAllEnabledServers(context.Context, *CountAllEnabledServersRequest) (*CountAllEnabledServersResponse, error) + // 列出单页服务 + ListEnabledServers(context.Context, *ListEnabledServersRequest) (*ListEnabledServersResponse, error) +} + +// UnimplementedServerServiceServer can be embedded to have forward compatible implementations. +type UnimplementedServerServiceServer struct { +} + +func (*UnimplementedServerServiceServer) CreateServer(context.Context, *CreateServerRequest) (*CreateServerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateServer not implemented") +} +func (*UnimplementedServerServiceServer) CountAllEnabledServers(context.Context, *CountAllEnabledServersRequest) (*CountAllEnabledServersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CountAllEnabledServers not implemented") +} +func (*UnimplementedServerServiceServer) ListEnabledServers(context.Context, *ListEnabledServersRequest) (*ListEnabledServersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListEnabledServers not implemented") +} + +func RegisterServerServiceServer(s *grpc.Server, srv ServerServiceServer) { + s.RegisterService(&_ServerService_serviceDesc, srv) +} + +func _ServerService_CreateServer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateServerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServerServiceServer).CreateServer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.ServerService/CreateServer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServerServiceServer).CreateServer(ctx, req.(*CreateServerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ServerService_CountAllEnabledServers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CountAllEnabledServersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServerServiceServer).CountAllEnabledServers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.ServerService/CountAllEnabledServers", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServerServiceServer).CountAllEnabledServers(ctx, req.(*CountAllEnabledServersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ServerService_ListEnabledServers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListEnabledServersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServerServiceServer).ListEnabledServers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.ServerService/ListEnabledServers", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServerServiceServer).ListEnabledServers(ctx, req.(*ListEnabledServersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _ServerService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pb.ServerService", + HandlerType: (*ServerServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "createServer", + Handler: _ServerService_CreateServer_Handler, + }, + { + MethodName: "countAllEnabledServers", + Handler: _ServerService_CountAllEnabledServers_Handler, + }, + { + MethodName: "listEnabledServers", + Handler: _ServerService_ListEnabledServers_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "service_server.proto", +} diff --git a/internal/rpc/admin/service.proto b/internal/rpc/protos/service_admin.proto similarity index 69% rename from internal/rpc/admin/service.proto rename to internal/rpc/protos/service_admin.proto index 80ead3dd..e351d924 100644 --- a/internal/rpc/admin/service.proto +++ b/internal/rpc/protos/service_admin.proto @@ -1,47 +1,47 @@ syntax = "proto3"; -option go_package = "./admin"; +option go_package = "./pb"; -package admin; +package pb; -service Service { + +service AdminService { // 登录 - rpc login (LoginRequest) returns (LoginResponse) { + rpc loginAdmin (LoginAdminRequest) returns (LoginAdminResponse) { } // 创建操作日志 - rpc createLog (CreateLogRequest) returns (CreateLogResponse) { + rpc createAdminLog (CreateAdminLogRequest) returns (CreateAdminLogResponse) { } // 检查管理员是否存在 rpc checkAdminExists (CheckAdminExistsRequest) returns (CheckAdminExistsResponse) { - } // 获取管理员名称 rpc findAdminFullname (FindAdminNameRequest) returns (FindAdminNameResponse) { - } + } -message LoginRequest { +message LoginAdminRequest { string username = 1; string password = 2; } -message LoginResponse { +message LoginAdminResponse { int64 adminId = 1; bool isOk = 2; string message = 3; } -message CreateLogRequest { +message CreateAdminLogRequest { string level = 1; string description = 2; string action = 3; string ip = 4; } -message CreateLogResponse { +message CreateAdminLogResponse { bool isOk = 1; } @@ -62,3 +62,4 @@ message FindAdminNameRequest { message FindAdminNameResponse { string fullname = 1; } + diff --git a/internal/rpc/protos/service_node.proto b/internal/rpc/protos/service_node.proto new file mode 100644 index 00000000..26c797ab --- /dev/null +++ b/internal/rpc/protos/service_node.proto @@ -0,0 +1,45 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; +import "model_node.proto"; + +service NodeService { + // 创建节点 + rpc createNode (CreateNodeRequest) returns (CreateNodeResponse); + + // 节点数量 + rpc countAllEnabledNodes (CountAllEnabledNodesRequest) returns (CountAllEnabledNodesResponse); + + // 列出单页节点 + rpc listEnabledNodes (ListEnabledNodesRequest) returns (ListEnabledNodesResponse); +} + +// 创建节点 +message CreateNodeRequest { + string name = 1; + int64 clusterId = 2; +} + +message CreateNodeResponse { + int64 nodeId = 1; +} + +// 节点数量 +message CountAllEnabledNodesRequest { + +} + +message CountAllEnabledNodesResponse { + int64 count = 1; +} + +// 列出单页节点 +message ListEnabledNodesRequest { + int64 offset = 1; + int64 size = 2; +} + +message ListEnabledNodesResponse { + repeated Node nodes = 1; +} diff --git a/internal/rpc/protos/service_node_cluster.proto b/internal/rpc/protos/service_node_cluster.proto new file mode 100644 index 00000000..3a7fa398 --- /dev/null +++ b/internal/rpc/protos/service_node_cluster.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; +import "model_node_cluster.proto"; + +service NodeClusterService { + // 获取所有集群的信息 + rpc findAllEnabledClusters (FindAllEnabledNodeClustersRequest) returns (FindAllEnabledNodeClustersResponse); +} + +message FindAllEnabledNodeClustersRequest { + +} + +message FindAllEnabledNodeClustersResponse { + repeated NodeCluster clusters = 1; +} diff --git a/internal/rpc/protos/service_node_grant.proto b/internal/rpc/protos/service_node_grant.proto new file mode 100644 index 00000000..17214d0e --- /dev/null +++ b/internal/rpc/protos/service_node_grant.proto @@ -0,0 +1,93 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; +import "model_node_grant.proto"; + +service NodeGrantService { + // 创建认证 + rpc createNodeGrant (CreateNodeGrantRequest) returns (CreateNodeGrantResponse); + + // 修改认证 + rpc updateNodeGrant (UpdateNodeGrantRequest) returns (UpdateNodeGrantResponse); + + // 禁用认证 + rpc disableNodeGrant (DisableNodeGrantRequest) returns (DisableNodeGrantResponse); + + // 计算认证的数量 + rpc countAllEnabledNodeGrants (CountAllEnabledNodeGrantsRequest) returns (CountAllEnabledNodeGrantsResponse); + + // 列出所有认证 + rpc ListEnabledNodeGrants (ListEnabledNodeGrantsRequest) returns (ListEnabledNodeGrantsResponse); + + // 获取认证信息 + rpc FindEnabledGrant(FindEnabledGrantRequest) returns (FindEnabledGrantResponse); +} + +// 创建节点认证 +message CreateNodeGrantRequest { + string name = 1; + string method = 2; + string username = 3; + string password = 4; + string privateKey = 5; + string description = 6; + int64 nodeId = 7; +} + +message CreateNodeGrantResponse { + int64 grantId = 1; +} + +// 修改节点认证 +message UpdateNodeGrantRequest { + int64 grantId = 8; + string name = 1; + string method = 2; + string username = 3; + string password = 4; + string privateKey = 5; + string description = 6; + int64 nodeId = 7; +} + +message UpdateNodeGrantResponse { + +} + +// 禁用节点认证 +message DisableNodeGrantRequest { + int64 grantId = 1; +} + +message DisableNodeGrantResponse { + +} + +// 计算节点认证数量 +message CountAllEnabledNodeGrantsRequest { + +} + +message CountAllEnabledNodeGrantsResponse { + int64 count = 1; +} + +// 列出所有认证 +message ListEnabledNodeGrantsRequest { + int64 offset = 1; + int64 size = 2; +} + +message ListEnabledNodeGrantsResponse { + repeated NodeGrant grants = 1; +} + +// 获取认证信息 +message FindEnabledGrantRequest { + int64 grantId = 1; +} + +message FindEnabledGrantResponse { + NodeGrant grant = 1; +} \ No newline at end of file diff --git a/internal/rpc/protos/service_server.proto b/internal/rpc/protos/service_server.proto new file mode 100644 index 00000000..c4e8331e --- /dev/null +++ b/internal/rpc/protos/service_server.proto @@ -0,0 +1,50 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; +import "model_server.proto"; + +service ServerService { + // 创建服务 + rpc createServer (CreateServerRequest) returns (CreateServerResponse); + + // 计算服务数量 + rpc countAllEnabledServers (CountAllEnabledServersRequest) returns (CountAllEnabledServersResponse); + + // 列出单页服务 + rpc listEnabledServers (ListEnabledServersRequest) returns (ListEnabledServersResponse); +} + + +// 创建服务 +message CreateServerRequest { + int64 userId = 1; + int64 adminId = 2; + int64 clusterId = 6; + bytes config = 3; + bytes includeNodesJSON = 4; + bytes excludeNodesJSON = 5; +} + +message CreateServerResponse { + int64 serverId = 1; +} + +// 计算服务数量 +message CountAllEnabledServersRequest { + +} + +message CountAllEnabledServersResponse { + int64 count = 1; +} + +// 列出单页服务 +message ListEnabledServersRequest { + int64 offset = 1; + int64 size = 2; +} + +message ListEnabledServersResponse { + repeated Server servers = 1; +} diff --git a/internal/rpc/rpc_client.go b/internal/rpc/rpc_client.go index 44cac0aa..9456c13a 100644 --- a/internal/rpc/rpc_client.go +++ b/internal/rpc/rpc_client.go @@ -7,7 +7,7 @@ import ( "github.com/TeaOSLab/EdgeAdmin/internal/configs" teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/encrypt" - "github.com/TeaOSLab/EdgeAdmin/internal/rpc/admin" + "github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb" "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/rands" @@ -17,8 +17,12 @@ import ( ) type RPCClient struct { - apiConfig *configs.APIConfig - adminClients []admin.ServiceClient + apiConfig *configs.APIConfig + adminClients []pb.AdminServiceClient + nodeClients []pb.NodeServiceClient + nodeGrantClients []pb.NodeGrantServiceClient + nodeClusterClients []pb.NodeClusterServiceClient + serverClients []pb.ServerServiceClient } func NewRPCClient(apiConfig *configs.APIConfig) (*RPCClient, error) { @@ -26,7 +30,11 @@ func NewRPCClient(apiConfig *configs.APIConfig) (*RPCClient, error) { return nil, errors.New("api config should not be nil") } - adminClients := []admin.ServiceClient{} + adminClients := []pb.AdminServiceClient{} + nodeClients := []pb.NodeServiceClient{} + nodeGrantClients := []pb.NodeGrantServiceClient{} + nodeClusterClients := []pb.NodeClusterServiceClient{} + serverClients := []pb.ServerServiceClient{} conns := []*grpc.ClientConn{} for _, endpoint := range apiConfig.RPC.Endpoints { @@ -42,27 +50,64 @@ func NewRPCClient(apiConfig *configs.APIConfig) (*RPCClient, error) { // node clients for _, conn := range conns { - adminClients = append(adminClients, admin.NewServiceClient(conn)) + adminClients = append(adminClients, pb.NewAdminServiceClient(conn)) + nodeClients = append(nodeClients, pb.NewNodeServiceClient(conn)) + nodeGrantClients = append(nodeGrantClients, pb.NewNodeGrantServiceClient(conn)) + nodeClusterClients = append(nodeClusterClients, pb.NewNodeClusterServiceClient(conn)) + serverClients = append(serverClients, pb.NewServerServiceClient(conn)) } return &RPCClient{ - apiConfig: apiConfig, - adminClients: adminClients, + apiConfig: apiConfig, + adminClients: adminClients, + nodeClients: nodeClients, + nodeGrantClients: nodeGrantClients, + nodeClusterClients: nodeClusterClients, + serverClients: serverClients, }, nil } -func (this *RPCClient) AdminRPC() admin.ServiceClient { +func (this *RPCClient) AdminRPC() pb.AdminServiceClient { if len(this.adminClients) > 0 { return this.adminClients[rands.Int(0, len(this.adminClients)-1)] } return nil } -func (this *RPCClient) Context(adminId int) context.Context { +func (this *RPCClient) NodeRPC() pb.NodeServiceClient { + if len(this.nodeClients) > 0 { + return this.nodeClients[rands.Int(0, len(this.nodeClients)-1)] + } + return nil +} + +func (this *RPCClient) NodeGrantRPC() pb.NodeGrantServiceClient { + if len(this.nodeGrantClients) > 0 { + return this.nodeGrantClients[rands.Int(0, len(this.nodeGrantClients)-1)] + } + return nil +} + +func (this *RPCClient) NodeClusterRPC() pb.NodeClusterServiceClient { + if len(this.nodeClusterClients) > 0 { + return this.nodeClusterClients[rands.Int(0, len(this.nodeClusterClients)-1)] + } + return nil +} + +func (this *RPCClient) ServerRPC() pb.ServerServiceClient { + if len(this.serverClients) > 0 { + return this.serverClients[rands.Int(0, len(this.serverClients)-1)] + } + return nil +} + +func (this *RPCClient) Context(adminId int64) context.Context { ctx := context.Background() m := maps.Map{ "timestamp": time.Now().Unix(), - "adminId": adminId, + "type": "admin", + "userId": adminId, } method, err := encrypt.NewMethodInstance(teaconst.EncryptMethod, this.apiConfig.Secret, this.apiConfig.NodeId) if err != nil { diff --git a/internal/rpc/rpc_client_test.go b/internal/rpc/rpc_client_test.go index 3dee4237..46b6d3c4 100644 --- a/internal/rpc/rpc_client_test.go +++ b/internal/rpc/rpc_client_test.go @@ -2,7 +2,7 @@ package rpc import ( "github.com/TeaOSLab/EdgeAdmin/internal/configs" - "github.com/TeaOSLab/EdgeAdmin/internal/rpc/admin" + "github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb" _ "github.com/iwind/TeaGo/bootstrap" stringutil "github.com/iwind/TeaGo/utils/string" "testing" @@ -22,7 +22,7 @@ func TestRPCClient_NodeRPC(t *testing.T) { if err != nil { t.Fatal(err) } - resp, err := rpc.AdminRPC().Login(rpc.Context(0), &admin.LoginRequest{ + resp, err := rpc.AdminRPC().Login(rpc.Context(0), &pb.AdminLoginRequest{ Username: "admin", Password: stringutil.Md5("123456"), }) diff --git a/internal/web/actions/actionutils/page.go b/internal/web/actions/actionutils/page.go index f10b3de8..8011f658 100644 --- a/internal/web/actions/actionutils/page.go +++ b/internal/web/actions/actionutils/page.go @@ -1,29 +1,29 @@ package actionutils import ( + "fmt" "github.com/iwind/TeaGo/actions" "math" "net/url" - "strconv" "strings" ) type Page struct { - Offset int // 开始位置 - Size int // 每页显示数量 - Current int // 当前页码 - Max int // 最大页码 - Total int // 总数量 + Offset int64 // 开始位置 + Size int64 // 每页显示数量 + Current int64 // 当前页码 + Max int64 // 最大页码 + Total int64 // 总数量 Path string Query url.Values } -func NewActionPage(actionPtr actions.ActionWrapper, total int, size int) *Page { +func NewActionPage(actionPtr actions.ActionWrapper, total int64, size int64) *Page { action := actionPtr.Object() - currentPage := action.ParamInt("page") + currentPage := action.ParamInt64("page") - paramSize := action.ParamInt("pageSize") + paramSize := action.ParamInt64("pageSize") if paramSize > 0 { size = paramSize } @@ -52,7 +52,7 @@ func (this *Page) calculate() { } this.Offset = this.Size * (this.Current - 1) - this.Max = int(math.Ceil(float64(this.Total) / float64(this.Size))) + this.Max = int64(math.Ceil(float64(this.Total) / float64(this.Size))) } func (this *Page) AsHTML() string { @@ -86,9 +86,9 @@ func (this *Page) AsHTML() string { for i := before5; i <= after5; i++ { if i == this.Current { - result = append(result, ``+strconv.Itoa(i)+``) + result = append(result, ``+fmt.Sprintf("%d", i)+``) } else { - result = append(result, ``+strconv.Itoa(i)+``) + result = append(result, ``+fmt.Sprintf("%d", i)+``) } } @@ -132,30 +132,30 @@ func (this *Page) IsLastPage() bool { return this.Current == this.Max } -func (this *Page) composeURL(page int) string { - this.Query["page"] = []string{strconv.Itoa(page)} +func (this *Page) composeURL(page int64) string { + this.Query["page"] = []string{fmt.Sprintf("%d", page)} return this.Path + "?" + this.Query.Encode() } -func (this *Page) min(i, j int) int { +func (this *Page) min(i, j int64) int64 { if i < j { return i } return j } -func (this *Page) max(i, j int) int { +func (this *Page) max(i, j int64) int64 { if i < j { return j } return i } -func (this *Page) renderSizeOption(size int) string { - o := `` + o += `>` + fmt.Sprintf("%d", size) + `条` return o } diff --git a/internal/web/actions/actionutils/parent_action.go b/internal/web/actions/actionutils/parent_action.go index dd2383ce..00358465 100644 --- a/internal/web/actions/actionutils/parent_action.go +++ b/internal/web/actions/actionutils/parent_action.go @@ -1,19 +1,23 @@ package actionutils import ( + "context" "errors" "fmt" "github.com/TeaOSLab/EdgeAdmin/internal/oplogs" "github.com/TeaOSLab/EdgeAdmin/internal/rpc" - "github.com/TeaOSLab/EdgeAdmin/internal/rpc/admin" + "github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb" "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/iwind/TeaGo/actions" + "github.com/iwind/TeaGo/logs" "net/http" "strconv" ) type ParentAction struct { actions.ActionObject + + rpcClient *rpc.RPCClient } func (this *ParentAction) ErrorPage(err error) { @@ -39,7 +43,7 @@ func (this *ParentAction) NotFound(name string, itemId int) { this.ErrorPage(errors.New(name + " id: '" + strconv.Itoa(itemId) + "' is not found")) } -func (this *ParentAction) NewPage(total int, size ...int) *Page { +func (this *ParentAction) NewPage(total int64, size ...int64) *Page { if len(size) > 0 { return NewActionPage(this, total, size[0]) } @@ -56,8 +60,8 @@ func (this *ParentAction) SecondMenu(menuItem string) { this.Data["secondMenuItem"] = menuItem } -func (this *ParentAction) AdminId() int { - return this.Context.GetInt("adminId") +func (this *ParentAction) AdminId() int64 { + return int64(this.Context.GetInt("adminId")) } func (this *ParentAction) CreateLog(level string, description string, args ...interface{}) { @@ -66,7 +70,7 @@ func (this *ParentAction) CreateLog(level string, description string, args ...in utils.PrintError(err) return } - _, err = rpcClient.AdminRPC().CreateLog(rpcClient.Context(this.AdminId()), &admin.CreateLogRequest{ + _, err = rpcClient.AdminRPC().CreateAdminLog(rpcClient.Context(this.AdminId()), &pb.CreateAdminLogRequest{ Level: level, Description: fmt.Sprintf(description, args...), Action: this.Request.URL.Path, @@ -76,3 +80,25 @@ func (this *ParentAction) CreateLog(level string, description string, args ...in utils.PrintError(err) } } + +// 获取RPC +func (this *ParentAction) RPC() *rpc.RPCClient { + if this.rpcClient != nil { + return this.rpcClient + } + + // 所有集群 + rpcClient, err := rpc.SharedRPC() + if err != nil { + logs.Fatal(err) + return nil + } + this.rpcClient = rpcClient + + return rpcClient +} + +// 获取Context +func (this *ParentAction) AdminContext() context.Context { + return this.rpcClient.Context(this.AdminId()) +} diff --git a/internal/web/actions/default/index/index.go b/internal/web/actions/default/index/index.go index c64b093f..e83d64db 100644 --- a/internal/web/actions/default/index/index.go +++ b/internal/web/actions/default/index/index.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/TeaOSLab/EdgeAdmin/internal/oplogs" "github.com/TeaOSLab/EdgeAdmin/internal/rpc" - "github.com/TeaOSLab/EdgeAdmin/internal/rpc/admin" + "github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb" "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/helpers" @@ -77,13 +77,13 @@ func (this *IndexAction) RunPost(params struct { if err != nil { this.Fail("服务器出了点小问题:" + err.Error()) } - resp, err := rpcClient.AdminRPC().Login(rpcClient.Context(0), &admin.LoginRequest{ + resp, err := rpcClient.AdminRPC().LoginAdmin(rpcClient.Context(0), &pb.LoginAdminRequest{ Username: params.Username, Password: params.Password, }) if err != nil { - _, err = rpcClient.AdminRPC().CreateLog(rpcClient.Context(0), &admin.CreateLogRequest{ + _, err = rpcClient.AdminRPC().CreateAdminLog(rpcClient.Context(0), &pb.CreateAdminLogRequest{ Level: oplogs.LevelError, Description: "登录时发生系统错误:" + err.Error(), Action: this.Request.URL.Path, @@ -97,7 +97,7 @@ func (this *IndexAction) RunPost(params struct { } if !resp.IsOk { - _, err = rpcClient.AdminRPC().CreateLog(rpcClient.Context(0), &admin.CreateLogRequest{ + _, err = rpcClient.AdminRPC().CreateAdminLog(rpcClient.Context(0), &pb.CreateAdminLogRequest{ Level: oplogs.LevelWarn, Description: "登录失败,用户名:" + params.Username, Action: this.Request.URL.Path, @@ -114,7 +114,7 @@ func (this *IndexAction) RunPost(params struct { params.Auth.StoreAdmin(adminId, params.Remember) // 记录日志 - _, err = rpcClient.AdminRPC().CreateLog(rpcClient.Context(0), &admin.CreateLogRequest{ + _, err = rpcClient.AdminRPC().CreateAdminLog(rpcClient.Context(0), &pb.CreateAdminLogRequest{ Level: oplogs.LevelInfo, Description: "成功登录系统,用户名:" + params.Username, Action: this.Request.URL.Path, diff --git a/internal/web/actions/default/nodes/create.go b/internal/web/actions/default/nodes/create.go index 91292453..a5e6babc 100644 --- a/internal/web/actions/default/nodes/create.go +++ b/internal/web/actions/default/nodes/create.go @@ -1,8 +1,10 @@ package nodes import ( + "github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/iwind/TeaGo/actions" + "github.com/iwind/TeaGo/maps" ) type CreateAction struct { @@ -10,31 +12,34 @@ type CreateAction struct { } func (this *CreateAction) Init() { - this.Nav("", "", "create") + this.Nav("", "node", "create") } func (this *CreateAction) RunGet(params struct{}) { // 所有集群 - /**clusters, err := models.SharedNodeClusterDAO.FindAllEnableClusters() + resp, err := this.RPC().NodeClusterRPC().FindAllEnabledClusters(this.AdminContext(), &pb.FindAllEnabledNodeClustersRequest{}) + if err != nil { + this.ErrorPage(err) + } if err != nil { this.ErrorPage(err) return } clusterMaps := []maps.Map{} - for _, cluster := range clusters { + for _, cluster := range resp.Clusters { clusterMaps = append(clusterMaps, maps.Map{ "id": cluster.Id, "name": cluster.Name, }) } - this.Data["clusters"] = clusterMaps**/ + this.Data["clusters"] = clusterMaps this.Show() } func (this *CreateAction) RunPost(params struct { Name string - ClusterId int + ClusterId int64 Must *actions.Must }) { @@ -48,4 +53,16 @@ func (this *CreateAction) RunPost(params struct { } // TODO 检查SSH授权 + + // 保存 + _, err := this.RPC().NodeRPC().CreateNode(this.AdminContext(), &pb.CreateNodeRequest{ + Name: params.Name, + ClusterId: params.ClusterId, + }) + if err != nil { + this.ErrorPage(err) + return + } + + this.Success() } diff --git a/internal/web/actions/default/nodes/grants/create.go b/internal/web/actions/default/nodes/grants/create.go new file mode 100644 index 00000000..76d75cdc --- /dev/null +++ b/internal/web/actions/default/nodes/grants/create.go @@ -0,0 +1,66 @@ +package grants + +import ( + "github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/nodes/grants/grantutils" + "github.com/iwind/TeaGo/actions" +) + +type CreateAction struct { + actionutils.ParentAction +} + +func (this *CreateAction) Init() { + this.Nav("", "grant", "create") +} + +func (this *CreateAction) RunGet(params struct{}) { + this.Data["methods"] = grantutils.AllGrantMethods() + + this.Show() +} + +func (this *CreateAction) RunPost(params struct { + Name string + Method string + Username string + Password string + PrivateKey string + Description string + + Must *actions.Must +}) { + params.Must. + Field("name", params.Name). + Require("请输入名称") + + switch params.Method { + case "user": + if len(params.Username) == 0 { + this.FailField("username", "请输入SSH登录用户名") + } + case "privateKey": + if len(params.PrivateKey) == 0 { + this.FailField("privateKey", "请输入RSA私钥") + } + default: + this.Fail("请选择正确的认证方式") + } + + _, err := this.RPC().NodeGrantRPC().CreateNodeGrant(this.AdminContext(), &pb.CreateNodeGrantRequest{ + Name: params.Name, + Method: params.Method, + Username: params.Username, + Password: params.Password, + PrivateKey: params.PrivateKey, + Description: params.Description, + NodeId: 0, + }) + if err != nil { + this.ErrorPage(err) + return + } + + this.Success() +} diff --git a/internal/web/actions/default/nodes/grants/delete.go b/internal/web/actions/default/nodes/grants/delete.go new file mode 100644 index 00000000..f0610adc --- /dev/null +++ b/internal/web/actions/default/nodes/grants/delete.go @@ -0,0 +1,22 @@ +package grants + +import ( + "github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" +) + +type DeleteAction struct { + actionutils.ParentAction +} + +func (this *DeleteAction) RunPost(params struct { + GrantId int64 +}) { + _, err := this.RPC().NodeGrantRPC().DisableNodeGrant(this.AdminContext(), &pb.DisableNodeGrantRequest{GrantId: params.GrantId}) + if err != nil { + this.ErrorPage(err) + return + } + + this.Success() +} diff --git a/internal/web/actions/default/nodes/grants/grant.go b/internal/web/actions/default/nodes/grants/grant.go new file mode 100644 index 00000000..2ca5b717 --- /dev/null +++ b/internal/web/actions/default/nodes/grants/grant.go @@ -0,0 +1,47 @@ +package grants + +import ( + "github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/nodes/grants/grantutils" + "github.com/iwind/TeaGo/maps" +) + +type GrantAction struct { + actionutils.ParentAction +} + +func (this *GrantAction) Init() { + this.Nav("", "grant", "index") +} + +func (this *GrantAction) RunGet(params struct { + GrantId int64 +}) { + grantResp, err := this.RPC().NodeGrantRPC().FindEnabledGrant(this.AdminContext(), &pb.FindEnabledGrantRequest{GrantId: params.GrantId}) + if err != nil { + this.ErrorPage(err) + return + } + if grantResp.Grant == nil { + this.WriteString("can not find the grant") + return + } + + // TODO 处理节点专用的认证 + + grant := grantResp.Grant + this.Data["grant"] = maps.Map{ + "id": grant.Id, + "name": grant.Name, + "method": grant.Method, + "methodName": grantutils.FindGrantMethodName(grant.Method), + "username": grant.Username, + "password": grant.Password, + "privateKey": grant.PrivateKey, + "description": grant.Description, + "su": grant.Su, + } + + this.Show() +} diff --git a/internal/web/actions/default/nodes/grants/grantutils/utils.go b/internal/web/actions/default/nodes/grants/grantutils/utils.go new file mode 100644 index 00000000..ea229e55 --- /dev/null +++ b/internal/web/actions/default/nodes/grants/grantutils/utils.go @@ -0,0 +1,27 @@ +package grantutils + +import "github.com/iwind/TeaGo/maps" + +// 所有的认证类型 +func AllGrantMethods() []maps.Map { + return []maps.Map{ + { + "name": "用户名+密码", + "value": "user", + }, + { + "name": "私钥", + "value": "privateKey", + }, + } +} + +// 获得对应的认证类型名称 +func FindGrantMethodName(method string) string { + for _, m := range AllGrantMethods() { + if m.GetString("value") == method { + return m.GetString("name") + } + } + return "" +} diff --git a/internal/web/actions/default/nodes/grants/index.go b/internal/web/actions/default/nodes/grants/index.go new file mode 100644 index 00000000..829e029d --- /dev/null +++ b/internal/web/actions/default/nodes/grants/index.go @@ -0,0 +1,49 @@ +package grants + +import ( + "github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/nodes/grants/grantutils" + "github.com/iwind/TeaGo/maps" +) + +type IndexAction struct { + actionutils.ParentAction +} + +func (this *IndexAction) Init() { + this.Nav("", "grant", "index") +} + +func (this *IndexAction) RunGet(params struct{}) { + countResp, err := this.RPC().NodeGrantRPC().CountAllEnabledNodeGrants(this.AdminContext(), &pb.CountAllEnabledNodeGrantsRequest{}) + if err != nil { + this.ErrorPage(err) + return + } + page := this.NewPage(countResp.Count) + this.Data["page"] = page.AsHTML() + + grantsResp, err := this.RPC().NodeGrantRPC().ListEnabledNodeGrants(this.AdminContext(), &pb.ListEnabledNodeGrantsRequest{ + Offset: page.Offset, + Size: page.Size, + }) + if err != nil { + this.ErrorPage(err) + return + } + grantMaps := []maps.Map{} + for _, grant := range grantsResp.Grants { + grantMaps = append(grantMaps, maps.Map{ + "id": grant.Id, + "name": grant.Name, + "method": maps.Map{ + "type": grant.Method, + "name": grantutils.FindGrantMethodName(grant.Method), + }, + }) + } + this.Data["grants"] = grantMaps + + this.Show() +} diff --git a/internal/web/actions/default/nodes/grants/update.go b/internal/web/actions/default/nodes/grants/update.go new file mode 100644 index 00000000..98119c64 --- /dev/null +++ b/internal/web/actions/default/nodes/grants/update.go @@ -0,0 +1,98 @@ +package grants + +import ( + "github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/nodes/grants/grantutils" + "github.com/iwind/TeaGo/actions" + "github.com/iwind/TeaGo/maps" +) + +type UpdateAction struct { + actionutils.ParentAction +} + +func (this *UpdateAction) Init() { + this.Nav("", "", "") +} + +func (this *UpdateAction) RunGet(params struct { + GrantId int64 +}) { + this.Data["methods"] = grantutils.AllGrantMethods() + + grantResp, err := this.RPC().NodeGrantRPC().FindEnabledGrant(this.AdminContext(), &pb.FindEnabledGrantRequest{GrantId: params.GrantId}) + if err != nil { + this.ErrorPage(err) + return + } + if grantResp.Grant == nil { + this.WriteString("can not find the grant") + return + } + + // TODO 处理节点专用的认证 + + grant := grantResp.Grant + this.Data["grant"] = maps.Map{ + "id": grant.Id, + "name": grant.Name, + "method": grant.Method, + "methodName": grantutils.FindGrantMethodName(grant.Method), + "username": grant.Username, + "password": grant.Password, + "privateKey": grant.PrivateKey, + "description": grant.Description, + "su": grant.Su, + } + + this.Show() +} + +func (this *UpdateAction) RunPost(params struct { + GrantId int64 + Name string + Method string + Username string + Password string + PrivateKey string + Description string + + Must *actions.Must +}) { + params.Must. + Field("name", params.Name). + Require("请输入名称") + + switch params.Method { + case "user": + if len(params.Username) == 0 { + this.FailField("username", "请输入SSH登录用户名") + } + case "privateKey": + if len(params.PrivateKey) == 0 { + this.FailField("privateKey", "请输入RSA私钥") + } + default: + this.Fail("请选择正确的认证方式") + } + + // TODO 检查grantId是否存在 + + _, err := this.RPC().NodeGrantRPC().UpdateNodeGrant(this.AdminContext(), &pb.UpdateNodeGrantRequest{ + GrantId: params.GrantId, + Name: params.Name, + Method: params.Method, + Username: params.Username, + Password: params.Password, + PrivateKey: params.PrivateKey, + Description: params.Description, + NodeId: 0, + }) + if err != nil { + this.ErrorPage(err) + return + } + + this.Success() +} diff --git a/internal/web/actions/default/nodes/helper.go b/internal/web/actions/default/nodes/helper.go index e14506eb..ab6322ea 100644 --- a/internal/web/actions/default/nodes/helper.go +++ b/internal/web/actions/default/nodes/helper.go @@ -1,10 +1,20 @@ package nodes -import "github.com/iwind/TeaGo/actions" +import ( + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/iwind/TeaGo/actions" +) type Helper struct { } func (this *Helper) BeforeAction(action *actions.ActionObject) { action.Data["teaMenu"] = "nodes" + + selectedTabbar, _ := action.Data["mainTab"] + + tabbar := actionutils.NewTabbar() + tabbar.Add("节点管理", "", "/nodes", "", selectedTabbar == "node") + tabbar.Add("认证管理", "", "/nodes/grants", "", selectedTabbar == "grant") + actionutils.SetTabbar(action, tabbar) } diff --git a/internal/web/actions/default/nodes/index.go b/internal/web/actions/default/nodes/index.go index ab34031c..56430b3d 100644 --- a/internal/web/actions/default/nodes/index.go +++ b/internal/web/actions/default/nodes/index.go @@ -1,15 +1,45 @@ package nodes -import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" +import ( + "github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/iwind/TeaGo/maps" +) type IndexAction struct { actionutils.ParentAction } func (this *IndexAction) Init() { - this.Nav("", "", "index") + this.Nav("", "node", "index") } func (this *IndexAction) RunGet(params struct{}) { + countResp, err := this.RPC().NodeRPC().CountAllEnabledNodes(this.AdminContext(), &pb.CountAllEnabledNodesRequest{}) + if err != nil { + this.ErrorPage(err) + return + } + + page := this.NewPage(countResp.Count) + this.Data["page"] = page.AsHTML() + + nodesResp, err := this.RPC().NodeRPC().ListEnabledNodes(this.AdminContext(), &pb.ListEnabledNodesRequest{ + Offset: page.Offset, + Size: page.Size, + }) + nodeMaps := []maps.Map{} + for _, node := range nodesResp.Nodes { + nodeMaps = append(nodeMaps, maps.Map{ + "id": node.Id, + "name": node.Name, + "cluster": maps.Map{ + "id": node.Cluster.Id, + "name": node.Cluster.Name, + }, + }) + } + this.Data["nodes"] = nodeMaps + this.Show() } diff --git a/internal/web/actions/default/nodes/init.go b/internal/web/actions/default/nodes/init.go index b9534321..3509fd51 100644 --- a/internal/web/actions/default/nodes/init.go +++ b/internal/web/actions/default/nodes/init.go @@ -1,6 +1,7 @@ package nodes import ( + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/nodes/grants" "github.com/TeaOSLab/EdgeAdmin/internal/web/helpers" "github.com/iwind/TeaGo" ) @@ -13,6 +14,13 @@ func init() { Prefix("/nodes"). Get("", new(IndexAction)). GetPost("/create", new(CreateAction)). + + // 授权管理 + Get("/grants", new(grants.IndexAction)). + GetPost("/grants/create", new(grants.CreateAction)). + GetPost("/grants/update", new(grants.UpdateAction)). + Post("/grants/delete", new(grants.DeleteAction)). + Get("/grants/grant", new(grants.GrantAction)). EndAll() }) } diff --git a/internal/web/actions/default/servers/create.go b/internal/web/actions/default/servers/create.go new file mode 100644 index 00000000..5eda2e8d --- /dev/null +++ b/internal/web/actions/default/servers/create.go @@ -0,0 +1,98 @@ +package servers + +import ( + "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/configs/nodes" + "github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/iwind/TeaGo/actions" + "github.com/iwind/TeaGo/maps" +) + +type CreateAction struct { + actionutils.ParentAction +} + +func (this *CreateAction) Init() { + this.Nav("", "", "create") +} + +func (this *CreateAction) RunGet(params struct{}) { + // 所有集群 + resp, err := this.RPC().NodeClusterRPC().FindAllEnabledClusters(this.AdminContext(), &pb.FindAllEnabledNodeClustersRequest{}) + if err != nil { + this.ErrorPage(err) + } + if err != nil { + this.ErrorPage(err) + return + } + clusterMaps := []maps.Map{} + for _, cluster := range resp.Clusters { + clusterMaps = append(clusterMaps, maps.Map{ + "id": cluster.Id, + "name": cluster.Name, + }) + } + this.Data["clusters"] = clusterMaps + + this.Show() +} + +func (this *CreateAction) RunPost(params struct { + Name string + ClusterId int64 + + Must *actions.Must +}) { + params.Must. + Field("name", params.Name). + Require("请输入服务名称") + + if params.ClusterId <= 0 { + this.Fail("请选择部署的集群") + } + + // TODO 验证集群ID + + // 配置 + serverConfig := &nodes.ServerConfig{} + serverConfig.IsOn = true + serverConfig.Name = params.Name + serverConfigJSON, err := serverConfig.AsJSON() + if err != nil { + this.ErrorPage(err) + return + } + + // 包含条件 + includeNodes := []maps.Map{} + includeNodesJSON, err := json.Marshal(includeNodes) + if err != nil { + this.ErrorPage(err) + return + } + + // 排除条件 + excludeNodes := []maps.Map{} + excludeNodesJSON, err := json.Marshal(excludeNodes) + if err != nil { + this.ErrorPage(err) + return + } + + _, err = this.RPC().ServerRPC().CreateServer(this.AdminContext(), &pb.CreateServerRequest{ + UserId: 0, + AdminId: this.AdminId(), + ClusterId: params.ClusterId, + Config: serverConfigJSON, + IncludeNodesJSON: includeNodesJSON, + ExcludeNodesJSON: excludeNodesJSON, + }) + if err != nil { + this.ErrorPage(err) + return + } + + this.Success() +} diff --git a/internal/web/actions/default/servers/helper.go b/internal/web/actions/default/servers/helper.go index 87ab9c96..c7701074 100644 --- a/internal/web/actions/default/servers/helper.go +++ b/internal/web/actions/default/servers/helper.go @@ -1,6 +1,8 @@ package servers -import "github.com/iwind/TeaGo/actions" +import ( + "github.com/iwind/TeaGo/actions" +) type Helper struct { } diff --git a/internal/web/actions/default/servers/index.go b/internal/web/actions/default/servers/index.go index b9fe3609..1f823786 100644 --- a/internal/web/actions/default/servers/index.go +++ b/internal/web/actions/default/servers/index.go @@ -1,15 +1,60 @@ package servers -import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" +import ( + "encoding/json" + "github.com/TeaOSLab/EdgeAdmin/internal/configs/nodes" + "github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb" + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" + "github.com/iwind/TeaGo/maps" +) type IndexAction struct { actionutils.ParentAction } func (this *IndexAction) Init() { - this.Nav("", "", "") + this.Nav("", "", "index") } func (this *IndexAction) RunGet(params struct{}) { + countResp, err := this.RPC().ServerRPC().CountAllEnabledServers(this.AdminContext(), &pb.CountAllEnabledServersRequest{}) + if err != nil { + this.ErrorPage(err) + return + } + count := countResp.Count + page := this.NewPage(count) + this.Data["page"] = page.AsHTML() + + // 服务列表 + serversResp, err := this.RPC().ServerRPC().ListEnabledServers(this.AdminContext(), &pb.ListEnabledServersRequest{ + Offset: page.Offset, + Size: page.Size, + }) + if err != nil { + this.ErrorPage(err) + return + } + serverMaps := []maps.Map{} + for _, server := range serversResp.Servers { + // 服务名 + serverConfig := &nodes.ServerConfig{} + err = json.Unmarshal(server.Config, &serverConfig) + if err != nil { + this.ErrorPage(err) + return + } + + serverMaps = append(serverMaps, maps.Map{ + "id": server.Id, + "name": serverConfig.Name, + "cluster": maps.Map{ + "id": server.Cluster.Id, + "name": server.Cluster.Name, + }, + }) + } + this.Data["servers"] = serverMaps + this.Show() } diff --git a/internal/web/actions/default/servers/init.go b/internal/web/actions/default/servers/init.go index 7b0293b2..31cd872e 100644 --- a/internal/web/actions/default/servers/init.go +++ b/internal/web/actions/default/servers/init.go @@ -12,6 +12,7 @@ func init() { Helper(NewHelper()). Prefix("/servers"). Get("", new(IndexAction)). + GetPost("/create", new(CreateAction)). EndAll() }) } diff --git a/internal/web/helpers/user_must_auth.go b/internal/web/helpers/user_must_auth.go index 24be26a7..108500a4 100644 --- a/internal/web/helpers/user_must_auth.go +++ b/internal/web/helpers/user_must_auth.go @@ -3,10 +3,9 @@ package helpers import ( teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" nodes "github.com/TeaOSLab/EdgeAdmin/internal/rpc" - "github.com/TeaOSLab/EdgeAdmin/internal/rpc/admin" + "github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb" "github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/iwind/TeaGo/actions" - "github.com/iwind/TeaGo/logs" "net/http" "reflect" ) @@ -38,9 +37,10 @@ func (this *UserMustAuth) BeforeAction(actionPtr actions.ActionWrapper, paramNam return false } - rpcResp, err := rpc.AdminRPC().CheckAdminExists(rpc.Context(0), &admin.CheckAdminExistsRequest{AdminId: int64(adminId)}) + rpcResp, err := rpc.AdminRPC().CheckAdminExists(rpc.Context(0), &pb.CheckAdminExistsRequest{AdminId: int64(adminId)}) if err != nil { - logs.Error(err) + utils.PrintError(err) + actionPtr.Object().WriteString(teaconst.ErrServer) return false } @@ -80,7 +80,7 @@ func (this *UserMustAuth) BeforeAction(actionPtr actions.ActionWrapper, paramNam action.Data["teaTitle"] = teaconst.ProductNameZH action.Data["teaName"] = teaconst.ProductNameZH - resp, err := rpc.AdminRPC().FindAdminFullname(rpc.Context(0), &admin.FindAdminNameRequest{AdminId: int64(this.AdminId)}) + resp, err := rpc.AdminRPC().FindAdminFullname(rpc.Context(0), &pb.FindAdminNameRequest{AdminId: int64(this.AdminId)}) if err != nil { utils.PrintError(err) action.Data["teaUsername"] = "" diff --git a/web/public/js/components/common/first-menu.js b/web/public/js/components/common/first-menu.js index 6910c777..ebdcbc43 100644 --- a/web/public/js/components/common/first-menu.js +++ b/web/public/js/components/common/first-menu.js @@ -2,12 +2,12 @@ * 一级菜单 */ Vue.component("first-menu", { + props: [], template: ' \
\ \
\ -
\
' }); \ No newline at end of file diff --git a/web/views/@default/nodes/create.html b/web/views/@default/nodes/create.html index d0c307cd..9fc72dba 100644 --- a/web/views/@default/nodes/create.html +++ b/web/views/@default/nodes/create.html @@ -1,6 +1,6 @@ {$layout} {$template "menu"} - +
diff --git a/web/views/@default/nodes/create.js b/web/views/@default/nodes/create.js new file mode 100644 index 00000000..2682ea9d --- /dev/null +++ b/web/views/@default/nodes/create.js @@ -0,0 +1,3 @@ +Tea.context(function () { + this.success = NotifySuccess("保存成功", "/nodes"); +}); \ No newline at end of file diff --git a/web/views/@default/nodes/grants/@menu.html b/web/views/@default/nodes/grants/@menu.html new file mode 100644 index 00000000..6f8e2b18 --- /dev/null +++ b/web/views/@default/nodes/grants/@menu.html @@ -0,0 +1,4 @@ + + 认证列表 + 创建认证 + diff --git a/web/views/@default/nodes/grants/create.html b/web/views/@default/nodes/grants/create.html new file mode 100644 index 00000000..c4844902 --- /dev/null +++ b/web/views/@default/nodes/grants/create.html @@ -0,0 +1,58 @@ +{$layout} +{$template "menu"} + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
名称 * + +
认证方式 + +
SSH用户名 * + +

SSH登录用户名。

+
SSH密码 +

SSH登录用户密码。

RSA私钥 * + +

用来生成登录SSH公钥的私钥

+
描述 + +
+ +
\ No newline at end of file diff --git a/web/views/@default/nodes/grants/create.js b/web/views/@default/nodes/grants/create.js new file mode 100644 index 00000000..041d242f --- /dev/null +++ b/web/views/@default/nodes/grants/create.js @@ -0,0 +1,5 @@ +Tea.context(function () { + this.method = "user"; + + this.success = NotifySuccess("保存成功", "/nodes/grants"); +}); \ No newline at end of file diff --git a/web/views/@default/nodes/grants/grant.html b/web/views/@default/nodes/grants/grant.html new file mode 100644 index 00000000..43b89879 --- /dev/null +++ b/web/views/@default/nodes/grants/grant.html @@ -0,0 +1,58 @@ +{$layout} +{$template "menu"} + + + 详情 + 修改 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
名称 + {{grant.name}} +
认证方式 + {{grant.methodName}} +
SSH用户名 + {{grant.username}} +

SSH登录用户名。

+
SSH密码{{grant.password}} +

SSH登录用户密码。

RSA私钥 + {{grant.privateKey}} +

用来生成登录SSH公钥的私钥

+
描述 + {{grant.description}} + - +
\ No newline at end of file diff --git a/web/views/@default/nodes/grants/index.html b/web/views/@default/nodes/grants/index.html new file mode 100644 index 00000000..c1b09ee5 --- /dev/null +++ b/web/views/@default/nodes/grants/index.html @@ -0,0 +1,25 @@ +{$layout} +{$template "menu"} + +
暂时还没有认证信息。
+ + + + + + + + + + + + + + + + +
ID名称类型操作
{{grant.id}}{{grant.name}}{{grant.method.name}} + 详情   删除 +
+ +
\ No newline at end of file diff --git a/web/views/@default/nodes/grants/index.js b/web/views/@default/nodes/grants/index.js new file mode 100644 index 00000000..09c59741 --- /dev/null +++ b/web/views/@default/nodes/grants/index.js @@ -0,0 +1,11 @@ +Tea.context(function () { + this.deleteGrant = function (grantId) { + teaweb.confirm("确定要删除此认证吗?", function () { + this.$post(".delete") + .params({ + "grantId": grantId + }) + .refresh(); + }); + }; +}); \ No newline at end of file diff --git a/web/views/@default/nodes/grants/update.html b/web/views/@default/nodes/grants/update.html new file mode 100644 index 00000000..f200d804 --- /dev/null +++ b/web/views/@default/nodes/grants/update.html @@ -0,0 +1,64 @@ +{$layout} +{$template "menu"} + + + 详情 + 修改 + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
名称 * + +
认证方式 + +
SSH用户名 * + +

SSH登录用户名。

+
SSH密码 +

SSH登录用户密码。

RSA私钥 * + +

用来生成登录SSH公钥的私钥

+
描述 + +
+ +
\ No newline at end of file diff --git a/web/views/@default/nodes/grants/update.js b/web/views/@default/nodes/grants/update.js new file mode 100644 index 00000000..ed8d21ab --- /dev/null +++ b/web/views/@default/nodes/grants/update.js @@ -0,0 +1,5 @@ +Tea.context(function () { + this.method = this.grant.method; + + this.success = NotifySuccess("保存成功", "/nodes/grants/grant?grantId=" + this.grant.id); +}); \ No newline at end of file diff --git a/web/views/@default/nodes/index.html b/web/views/@default/nodes/index.html index e0c2036b..13ccce34 100644 --- a/web/views/@default/nodes/index.html +++ b/web/views/@default/nodes/index.html @@ -1,6 +1,30 @@ {$layout} {$template "menu"} - +

暂时还没有节点。

-
\ No newline at end of file + + + + + + + + + + + + + + + + + +
ID节点名称所属集群状态操作
{{node.id}}{{node.name}}{{node.cluster.name}} + 已安装|安装中|安装错误|运行中|失去连接 + + 详情   删除 +
+ + +
\ No newline at end of file diff --git a/web/views/@default/servers/@menu.html b/web/views/@default/servers/@menu.html index 1b09565c..4ee202c8 100644 --- a/web/views/@default/servers/@menu.html +++ b/web/views/@default/servers/@menu.html @@ -1,4 +1,4 @@ - 服务列表 - 创建服务 + 服务列表 + 创建服务 \ No newline at end of file diff --git a/web/views/@default/servers/create.html b/web/views/@default/servers/create.html new file mode 100644 index 00000000..0279c514 --- /dev/null +++ b/web/views/@default/servers/create.html @@ -0,0 +1,22 @@ +{$layout} +{$template "menu"} + +
+ + + + + + + + + +
服务名称 + +
部署的集群 + +
+ +
\ No newline at end of file diff --git a/web/views/@default/servers/create.js b/web/views/@default/servers/create.js new file mode 100644 index 00000000..33eeaa09 --- /dev/null +++ b/web/views/@default/servers/create.js @@ -0,0 +1,3 @@ +Tea.context(function () { + this.success = NotifySuccess("保存成功", "/servers"); +}); \ No newline at end of file diff --git a/web/views/@default/servers/index.html b/web/views/@default/servers/index.html index 58391c71..ff82d639 100644 --- a/web/views/@default/servers/index.html +++ b/web/views/@default/servers/index.html @@ -1,3 +1,25 @@ {$layout} {$template "menu"} +

暂时还没有服务。

+ + + + + + + + + + + + + + + + +
ID服务名称部署集群操作
{{server.id}}{{server.name}}{{server.cluster.name}} + 详情   删除 +
+ +
\ No newline at end of file