Files
EdgeCommon/pkg/rpc/protos/service_ns_node.proto
2021-09-05 11:11:04 +08:00

265 lines
6.1 KiB
Protocol Buffer

syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/model_ns_node.proto";
import "models/model_node_install_status.proto";
import "models/rpc_messages.proto";
import "models/model_node_login.proto";
// 域名服务器节点服务
service NSNodeService {
// 根据集群查找所有节点
rpc findAllEnabledNSNodesWithNSClusterId (FindAllEnabledNSNodesWithNSClusterIdRequest) returns (FindAllEnabledNSNodesWithNSClusterIdResponse);
// 所有可用的节点数量
rpc countAllEnabledNSNodes (CountAllEnabledNSNodesRequest) returns (RPCCountResponse);
// 计算匹配的节点数量
rpc countAllEnabledNSNodesMatch (CountAllEnabledNSNodesMatchRequest) returns (RPCCountResponse);
// 列出单页节点
rpc listEnabledNSNodesMatch (ListEnabledNSNodesMatchRequest) returns (ListEnabledNSNodesMatchResponse);
// 计算需要升级的节点数量
rpc countAllUpgradeNSNodesWithNSClusterId (CountAllUpgradeNSNodesWithNSClusterIdRequest) returns (RPCCountResponse);
// 创建节点
rpc createNSNode (CreateNSNodeRequest) returns (CreateNSNodeResponse);
// 删除节点
rpc deleteNSNode (DeleteNSNodeRequest) returns (RPCSuccess);
// 获取单个节点信息
rpc findEnabledNSNode (FindEnabledNSNodeRequest) returns (FindEnabledNSNodeResponse);
// 修改节点
rpc updateNSNode (UpdateNSNodeRequest) returns (RPCSuccess);
// 安装节点
rpc installNSNode (InstallNSNodeRequest) returns (InstallNSNodeResponse);
// 读取节点安装状态
rpc findNSNodeInstallStatus (FindNSNodeInstallStatusRequest) returns (FindNSNodeInstallStatusResponse);
// 修改节点安装状态
rpc updateNSNodeIsInstalled (UpdateNSNodeIsInstalledRequest) returns (RPCSuccess);
// 更新节点状态
rpc updateNSNodeStatus (UpdateNSNodeStatusRequest) returns (RPCSuccess);
// 获取当前节点信息
rpc findCurrentNSNodeConfig (FindCurrentNSNodeConfigRequest) returns (FindCurrentNSNodeConfigResponse);
// 检查新版本
rpc checkNSNodeLatestVersion (CheckNSNodeLatestVersionRequest) returns (CheckNSNodeLatestVersionResponse);
// 下载最新DNS节点安装文件
rpc downloadNSNodeInstallationFile (DownloadNSNodeInstallationFileRequest) returns (DownloadNSNodeInstallationFileResponse);
// 节点stream
rpc nsNodeStream (stream NSNodeStreamMessage) returns (stream NSNodeStreamMessage);
// 向节点发送命令
rpc sendCommandToNSNode (NSNodeStreamMessage) returns (NSNodeStreamMessage);
// 更改节点连接的API节点信息
rpc updateNSNodeConnectedAPINodes (UpdateNSNodeConnectedAPINodesRequest) returns (RPCSuccess);
// 修改节点登录信息
rpc updateNSNodeLogin (UpdateNSNodeLoginRequest) returns (RPCSuccess);
// 启动节点
rpc startNSNode (StartNSNodeRequest) returns (StartNSNodeResponse);
// 停止节点
rpc stopNSNode (StopNSNodeRequest) returns (StopNSNodeResponse);
}
// 根据集群查找所有节点
message FindAllEnabledNSNodesWithNSClusterIdRequest {
int64 nsClusterId = 1;
}
message FindAllEnabledNSNodesWithNSClusterIdResponse {
repeated NSNode nsNodes = 1;
}
// 所有可用的节点数量
message CountAllEnabledNSNodesRequest {
}
// 计算匹配的节点数量
message CountAllEnabledNSNodesMatchRequest {
int64 nsClusterId = 1;
int32 installState = 2;
int32 activeState = 3;
string keyword = 4;
//int64 nodeGroupId = 5;
//int64 nodeRegionId = 6;
}
// 列出单页节点
message ListEnabledNSNodesMatchRequest {
int64 offset = 1;
int64 size = 2;
int64 nsClusterId = 3;
int32 installState = 4;
int32 activeState = 5;
string keyword = 6;
//int64 nodeGroupId = 7;
//int64 nodeRegionId = 8;
}
message ListEnabledNSNodesMatchResponse {
repeated NSNode nsNodes = 1;
}
// 计算需要升级的节点数量
message CountAllUpgradeNSNodesWithNSClusterIdRequest {
int64 nsClusterId = 1;
}
// 创建节点
message CreateNSNodeRequest {
string name = 1;
int64 nodeClusterId = 2;
NodeLogin nodeLogin = 3;
}
message CreateNSNodeResponse {
int64 nsNodeId = 1;
}
// 删除节点
message DeleteNSNodeRequest {
int64 nsNodeId = 1;
}
// 获取单个节点信息
message FindEnabledNSNodeRequest {
int64 nsNodeId = 1;
}
message FindEnabledNSNodeResponse {
NSNode nsNode = 1;
}
// 修改节点
message UpdateNSNodeRequest {
int64 nsNodeId = 1;
string name = 2;
int64 nsClusterId = 3;
NodeLogin nodeLogin = 4;
bool isOn = 6;
}
// 安装节点
message InstallNSNodeRequest {
int64 nsNodeId = 1;
}
message InstallNSNodeResponse {
}
// 读取节点安装状态
message FindNSNodeInstallStatusRequest {
int64 nsNodeId = 1;
}
message FindNSNodeInstallStatusResponse {
NodeInstallStatus installStatus = 1;
}
// 修改节点安装状态
message UpdateNSNodeIsInstalledRequest {
int64 nsNodeId = 1;
bool isInstalled = 2;
}
// 更新节点状态
message UpdateNSNodeStatusRequest {
int64 nodeId = 1;
bytes statusJSON = 2;
}
// 获取当前节点信息
message FindCurrentNSNodeConfigRequest {
}
message FindCurrentNSNodeConfigResponse {
bytes nsNodeJSON = 1;
}
// 检查新版本
message CheckNSNodeLatestVersionRequest {
string os = 1;
string arch = 2;
string currentVersion = 3;
}
message CheckNSNodeLatestVersionResponse {
bool hasNewVersion = 1;
string newVersion = 2;
}
// 下载最新DNS节点安装文件
message DownloadNSNodeInstallationFileRequest {
string os = 1;
string arch = 2;
int64 chunkOffset = 3;
}
message DownloadNSNodeInstallationFileResponse {
bytes chunkData = 1;
string sum = 2; // 文件的md5sum
int64 offset = 3;
string version = 4;
string filename = 5;
}
// 节点stream
message NSNodeStreamMessage {
int64 nsNodeId = 1;
int64 requestId = 2;
int32 timeoutSeconds = 3;
string code = 4;
bytes dataJSON = 5;
bool isOk = 6;
string message = 7;
}
// 更改节点连接的API节点信息
message UpdateNSNodeConnectedAPINodesRequest {
repeated int64 apiNodeIds = 1;
}
// 修改节点登录信息
message UpdateNSNodeLoginRequest {
int64 nsNodeId = 1;
NodeLogin nodeLogin = 2;
}
// 启动节点
message StartNSNodeRequest {
int64 nsNodeId = 1;
}
message StartNSNodeResponse {
bool isOk = 1;
string error = 2;
}
// 停止节点
message StopNSNodeRequest {
int64 nsNodeId = 1;
}
message StopNSNodeResponse {
bool isOk = 1;
string error = 2;
}