mirror of
				https://github.com/TeaOSLab/EdgeCommon.git
				synced 2025-11-04 05:00:24 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			165 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			Protocol Buffer
		
	
	
	
	
	
			
		
		
	
	
			165 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			Protocol Buffer
		
	
	
	
	
	
syntax = "proto3";
 | 
						||
option go_package = "./pb";
 | 
						||
 | 
						||
package pb;
 | 
						||
import "models/model_api_node.proto";
 | 
						||
import "models/rpc_messages.proto";
 | 
						||
 | 
						||
// API节点服务
 | 
						||
service APINodeService {
 | 
						||
	// 创建API节点
 | 
						||
	rpc createAPINode (CreateAPINodeRequest) returns (CreateAPINodeResponse);
 | 
						||
 | 
						||
	// 修改API节点
 | 
						||
	rpc updateAPINode (UpdateAPINodeRequest) returns (RPCSuccess);
 | 
						||
 | 
						||
	// 删除API节点
 | 
						||
	rpc deleteAPINode (DeleteAPINodeRequest) returns (RPCSuccess);
 | 
						||
 | 
						||
	// 列出所有可用API节点
 | 
						||
	rpc findAllEnabledAPINodes (FindAllEnabledAPINodesRequest) returns (FindAllEnabledAPINodesResponse);
 | 
						||
 | 
						||
	// 计算API节点数量
 | 
						||
	rpc countAllEnabledAPINodes (CountAllEnabledAPINodesRequest) returns (RPCCountResponse);
 | 
						||
 | 
						||
	// 计算启用的API节点数量
 | 
						||
	rpc countAllEnabledAndOnAPINodes (CountAllEnabledAndOnAPINodesRequest) returns (RPCCountResponse);
 | 
						||
 | 
						||
	// 列出单页的API节点
 | 
						||
	rpc listEnabledAPINodes (ListEnabledAPINodesRequest) returns (ListEnabledAPINodesResponse);
 | 
						||
 | 
						||
	// 根据ID查找节点
 | 
						||
	rpc findEnabledAPINode (FindEnabledAPINodeRequest) returns (FindEnabledAPINodeResponse);
 | 
						||
 | 
						||
	// 获取当前API节点的版本
 | 
						||
	rpc findCurrentAPINodeVersion (FindCurrentAPINodeVersionRequest) returns (FindCurrentAPINodeVersionResponse);
 | 
						||
 | 
						||
	// 获取当前API节点的信息
 | 
						||
	rpc findCurrentAPINode(FindCurrentAPINodeRequest) returns (FindCurrentAPINodeResponse);
 | 
						||
 | 
						||
	// 计算使用某个SSL证书的API节点数量
 | 
						||
	rpc countAllEnabledAPINodesWithSSLCertId (CountAllEnabledAPINodesWithSSLCertIdRequest) returns (RPCCountResponse);
 | 
						||
 | 
						||
	// 修改调试模式状态
 | 
						||
	rpc debugAPINode(DebugAPINodeRequest) returns (RPCSuccess);
 | 
						||
 | 
						||
	// 上传新版API节点文件
 | 
						||
	rpc uploadAPINodeFile(UploadAPINodeFileRequest) returns (UploadAPINodeFileResponse);
 | 
						||
}
 | 
						||
 | 
						||
// 创建API节点
 | 
						||
message CreateAPINodeRequest {
 | 
						||
	string name = 1;
 | 
						||
	string description = 2;
 | 
						||
	bytes httpJSON = 3;
 | 
						||
	bytes httpsJSON = 4;
 | 
						||
	bytes accessAddrsJSON = 5;
 | 
						||
	bool isOn = 6;
 | 
						||
	bool restIsOn = 7;
 | 
						||
	bytes restHTTPJSON = 8;
 | 
						||
	bytes restHTTPSJSON = 9;
 | 
						||
}
 | 
						||
 | 
						||
message CreateAPINodeResponse {
 | 
						||
	int64 apiNodeId = 1;
 | 
						||
}
 | 
						||
 | 
						||
// 修改API节点
 | 
						||
message UpdateAPINodeRequest {
 | 
						||
	int64 apiNodeId = 1;
 | 
						||
	string name = 2;
 | 
						||
	string description = 3;
 | 
						||
	bytes httpJSON = 4;
 | 
						||
	bytes httpsJSON = 5;
 | 
						||
	bytes accessAddrsJSON = 6;
 | 
						||
	bool isOn = 7;
 | 
						||
	bool restIsOn = 8;
 | 
						||
	bytes restHTTPJSON = 9;
 | 
						||
	bytes restHTTPSJSON = 10;
 | 
						||
	bool isPrimary = 11;
 | 
						||
}
 | 
						||
 | 
						||
// 删除API节点
 | 
						||
message DeleteAPINodeRequest {
 | 
						||
	int64 apiNodeId = 1;
 | 
						||
}
 | 
						||
 | 
						||
// 列出所有可用API节点
 | 
						||
message FindAllEnabledAPINodesRequest {
 | 
						||
 | 
						||
}
 | 
						||
 | 
						||
message FindAllEnabledAPINodesResponse {
 | 
						||
	repeated APINode apiNodes = 1;
 | 
						||
}
 | 
						||
 | 
						||
// 计算API节点数量
 | 
						||
message CountAllEnabledAPINodesRequest {
 | 
						||
 | 
						||
}
 | 
						||
 | 
						||
// 计算启用的API节点数量
 | 
						||
message CountAllEnabledAndOnAPINodesRequest {
 | 
						||
 | 
						||
}
 | 
						||
 | 
						||
// 列出单页的API节点
 | 
						||
message ListEnabledAPINodesRequest {
 | 
						||
	int64 offset = 1;
 | 
						||
	int64 size = 2;
 | 
						||
}
 | 
						||
 | 
						||
message ListEnabledAPINodesResponse {
 | 
						||
	repeated APINode apiNodes = 1;
 | 
						||
}
 | 
						||
 | 
						||
// 根据ID查找节点
 | 
						||
message FindEnabledAPINodeRequest {
 | 
						||
	int64 apiNodeId = 1;
 | 
						||
}
 | 
						||
 | 
						||
message FindEnabledAPINodeResponse {
 | 
						||
	APINode apiNode = 1;
 | 
						||
}
 | 
						||
 | 
						||
// 获取当前API节点的版本
 | 
						||
message FindCurrentAPINodeVersionRequest {
 | 
						||
 | 
						||
}
 | 
						||
 | 
						||
message FindCurrentAPINodeVersionResponse {
 | 
						||
	string version = 1; // 版本号
 | 
						||
	string os = 2; // 系统代号,比如linux
 | 
						||
	string arch = 3; // 架构
 | 
						||
}
 | 
						||
 | 
						||
// 获取当前API节点的信息
 | 
						||
message FindCurrentAPINodeRequest {
 | 
						||
}
 | 
						||
 | 
						||
message FindCurrentAPINodeResponse {
 | 
						||
	APINode apiNode = 1;
 | 
						||
}
 | 
						||
 | 
						||
// 计算使用某个SSL证书的API节点数量
 | 
						||
message CountAllEnabledAPINodesWithSSLCertIdRequest {
 | 
						||
	int64 sslCertId = 1;
 | 
						||
}
 | 
						||
 | 
						||
// 修改调试模式状态
 | 
						||
message DebugAPINodeRequest {
 | 
						||
	bool debug = 1;
 | 
						||
}
 | 
						||
 | 
						||
// 上传新版API节点文件
 | 
						||
message UploadAPINodeFileRequest {
 | 
						||
	string filename = 1; // 文件名
 | 
						||
	string sum = 2; // 整个文件的SUM值
 | 
						||
	bytes chunkData = 3; // 片段数据
 | 
						||
	bool isFirstChunk = 4; // 是否为第一个片段
 | 
						||
	bool isLastChunk = 5; // 是否为最后一个片段
 | 
						||
}
 | 
						||
 | 
						||
message UploadAPINodeFileResponse {
 | 
						||
 | 
						||
} |