520 lines
10 KiB
Markdown
520 lines
10 KiB
Markdown
|
|
# APINodeService
|
|||
|
|
> API节点服务
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## countAllEnabledAPINodes
|
|||
|
|
> 计算API节点数量
|
|||
|
|
|
|||
|
|
- 角色:`admin`
|
|||
|
|
- HTTP:`POST https://backend.dooki.cloud/APINodeService/countAllEnabledAPINodes`
|
|||
|
|
- RPC:`rpc countAllEnabledAPINodes (CountAllEnabledAPINodesRequest) returns (RPCCountResponse);`
|
|||
|
|
|
|||
|
|
**请求对象 (`CountAllEnabledAPINodesRequest`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**响应对象 (`RPCCountResponse`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"count": "int64 // 数量"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**调用示例**
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -X POST "https://backend.dooki.cloud/APINodeService/countAllEnabledAPINodes" \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
|||
|
|
-d '{
|
|||
|
|
...
|
|||
|
|
}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## countAllEnabledAPINodesWithSSLCertId
|
|||
|
|
> 计算使用某个SSL证书的API节点数量
|
|||
|
|
|
|||
|
|
- 角色:`admin`
|
|||
|
|
- HTTP:`POST https://backend.dooki.cloud/APINodeService/countAllEnabledAPINodesWithSSLCertId`
|
|||
|
|
- RPC:`rpc countAllEnabledAPINodesWithSSLCertId (CountAllEnabledAPINodesWithSSLCertIdRequest) returns (RPCCountResponse);`
|
|||
|
|
|
|||
|
|
**请求对象 (`CountAllEnabledAPINodesWithSSLCertIdRequest`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"sslCertId": "int64"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**响应对象 (`RPCCountResponse`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"count": "int64 // 数量"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**调用示例**
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -X POST "https://backend.dooki.cloud/APINodeService/countAllEnabledAPINodesWithSSLCertId" \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
|||
|
|
-d '{
|
|||
|
|
...
|
|||
|
|
}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## countAllEnabledAndOnAPINodes
|
|||
|
|
> 计算启用的API节点数量
|
|||
|
|
|
|||
|
|
- 角色:`admin`
|
|||
|
|
- HTTP:`POST https://backend.dooki.cloud/APINodeService/countAllEnabledAndOnAPINodes`
|
|||
|
|
- RPC:`rpc countAllEnabledAndOnAPINodes (CountAllEnabledAndOnAPINodesRequest) returns (RPCCountResponse);`
|
|||
|
|
|
|||
|
|
**请求对象 (`CountAllEnabledAndOnAPINodesRequest`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**响应对象 (`RPCCountResponse`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"count": "int64 // 数量"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**调用示例**
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -X POST "https://backend.dooki.cloud/APINodeService/countAllEnabledAndOnAPINodes" \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
|||
|
|
-d '{
|
|||
|
|
...
|
|||
|
|
}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## createAPINode
|
|||
|
|
> 创建API节点
|
|||
|
|
|
|||
|
|
- 角色:`admin`
|
|||
|
|
- HTTP:`POST https://backend.dooki.cloud/APINodeService/createAPINode`
|
|||
|
|
- RPC:`rpc createAPINode (CreateAPINodeRequest) returns (CreateAPINodeResponse);`
|
|||
|
|
|
|||
|
|
**请求对象 (`CreateAPINodeRequest`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"name": "string // API节点名称",
|
|||
|
|
"description": "string // API节点描述",
|
|||
|
|
"httpJSON": "bytes // 监听HTTP地址配置 json:http_protocol",
|
|||
|
|
"httpsJSON": "bytes // 监听HTTPS地址配置 json:https_protocol",
|
|||
|
|
"accessAddrsJSON": "bytes // 访问地址 json:network_address",
|
|||
|
|
"isOn": "bool // 是否启用当前API节点",
|
|||
|
|
"restIsOn": "bool // 是否启用API",
|
|||
|
|
"restHTTPJSON": "bytes // API地址HTTP地址配置 json:http_protocol",
|
|||
|
|
"restHTTPSJSON": "bytes // API地址HTTPS地址配置 json:https_protocol"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**响应对象 (`CreateAPINodeResponse`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"apiNodeId": "int64"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**调用示例**
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -X POST "https://backend.dooki.cloud/APINodeService/createAPINode" \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
|||
|
|
-d '{
|
|||
|
|
...
|
|||
|
|
}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## debugAPINode
|
|||
|
|
> 修改调试模式状态
|
|||
|
|
|
|||
|
|
- 角色:`admin`
|
|||
|
|
- HTTP:`POST https://backend.dooki.cloud/APINodeService/debugAPINode`
|
|||
|
|
- RPC:`rpc debugAPINode(DebugAPINodeRequest) returns (RPCSuccess);`
|
|||
|
|
|
|||
|
|
**请求对象 (`DebugAPINodeRequest`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"debug": "bool"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**响应对象 (`RPCSuccess`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**调用示例**
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -X POST "https://backend.dooki.cloud/APINodeService/debugAPINode" \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
|||
|
|
-d '{
|
|||
|
|
...
|
|||
|
|
}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## deleteAPINode
|
|||
|
|
> 删除API节点
|
|||
|
|
|
|||
|
|
- 角色:`admin`
|
|||
|
|
- HTTP:`POST https://backend.dooki.cloud/APINodeService/deleteAPINode`
|
|||
|
|
- RPC:`rpc deleteAPINode (DeleteAPINodeRequest) returns (RPCSuccess);`
|
|||
|
|
|
|||
|
|
**请求对象 (`DeleteAPINodeRequest`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"apiNodeId": "int64"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**响应对象 (`RPCSuccess`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**调用示例**
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -X POST "https://backend.dooki.cloud/APINodeService/deleteAPINode" \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
|||
|
|
-d '{
|
|||
|
|
...
|
|||
|
|
}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## findAllEnabledAPINodes
|
|||
|
|
> 列出所有可用API节点
|
|||
|
|
|
|||
|
|
- 角色:`dns`, `user`, `node`, `admin`
|
|||
|
|
- HTTP:`POST https://backend.dooki.cloud/APINodeService/findAllEnabledAPINodes`
|
|||
|
|
- RPC:`rpc findAllEnabledAPINodes (FindAllEnabledAPINodesRequest) returns (FindAllEnabledAPINodesResponse);`
|
|||
|
|
|
|||
|
|
**请求对象 (`FindAllEnabledAPINodesRequest`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**响应对象 (`FindAllEnabledAPINodesResponse`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"apiNodes": "[]APINode"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**调用示例**
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -X POST "https://backend.dooki.cloud/APINodeService/findAllEnabledAPINodes" \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
|||
|
|
-d '{
|
|||
|
|
...
|
|||
|
|
}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## findCurrentAPINode
|
|||
|
|
> 获取当前API节点的信息
|
|||
|
|
|
|||
|
|
- 角色:`admin`
|
|||
|
|
- HTTP:`POST https://backend.dooki.cloud/APINodeService/findCurrentAPINode`
|
|||
|
|
- RPC:`rpc findCurrentAPINode(FindCurrentAPINodeRequest) returns (FindCurrentAPINodeResponse);`
|
|||
|
|
|
|||
|
|
**请求对象 (`FindCurrentAPINodeRequest`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**响应对象 (`FindCurrentAPINodeResponse`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"apiNode": "APINode"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**调用示例**
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -X POST "https://backend.dooki.cloud/APINodeService/findCurrentAPINode" \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
|||
|
|
-d '{
|
|||
|
|
...
|
|||
|
|
}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## findEnabledAPINode
|
|||
|
|
> 根据ID查找节点
|
|||
|
|
|
|||
|
|
- 角色:`admin`
|
|||
|
|
- HTTP:`POST https://backend.dooki.cloud/APINodeService/findEnabledAPINode`
|
|||
|
|
- RPC:`rpc findEnabledAPINode (FindEnabledAPINodeRequest) returns (FindEnabledAPINodeResponse);`
|
|||
|
|
|
|||
|
|
**请求对象 (`FindEnabledAPINodeRequest`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"apiNodeId": "int64"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**响应对象 (`FindEnabledAPINodeResponse`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"apiNode": "APINode"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**调用示例**
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -X POST "https://backend.dooki.cloud/APINodeService/findEnabledAPINode" \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
|||
|
|
-d '{
|
|||
|
|
...
|
|||
|
|
}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## findLatestDeployFiles
|
|||
|
|
> 查找已有节点安装文件信息
|
|||
|
|
|
|||
|
|
- 角色:`admin`
|
|||
|
|
- HTTP:`POST https://backend.dooki.cloud/APINodeService/findLatestDeployFiles`
|
|||
|
|
- RPC:`rpc findLatestDeployFiles(FindLatestDeployFilesRequest) returns (FindLatestDeployFilesResponse);`
|
|||
|
|
|
|||
|
|
**请求对象 (`FindLatestDeployFilesRequest`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**响应对象 (`FindLatestDeployFilesResponse`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"nodeDeployFiles": "[]DeployFile // 边缘节点",
|
|||
|
|
"nsNodeDeployFiles": "[]DeployFile // NS节点",
|
|||
|
|
"os": "string // 操作系统代号",
|
|||
|
|
"arch": "string // 架构",
|
|||
|
|
"version": "string // 版本号"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**调用示例**
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -X POST "https://backend.dooki.cloud/APINodeService/findLatestDeployFiles" \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
|||
|
|
-d '{
|
|||
|
|
...
|
|||
|
|
}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## listEnabledAPINodes
|
|||
|
|
> 列出单页的API节点
|
|||
|
|
|
|||
|
|
- 角色:`admin`
|
|||
|
|
- HTTP:`POST https://backend.dooki.cloud/APINodeService/listEnabledAPINodes`
|
|||
|
|
- RPC:`rpc listEnabledAPINodes (ListEnabledAPINodesRequest) returns (ListEnabledAPINodesResponse);`
|
|||
|
|
|
|||
|
|
**请求对象 (`ListEnabledAPINodesRequest`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"offset": "int64 // 读取位置",
|
|||
|
|
"size": "int64 // 数量,通常不能小于0"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**响应对象 (`ListEnabledAPINodesResponse`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"apiNodes": "[]APINode"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**调用示例**
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -X POST "https://backend.dooki.cloud/APINodeService/listEnabledAPINodes" \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
|||
|
|
-d '{
|
|||
|
|
...
|
|||
|
|
}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## updateAPINode
|
|||
|
|
> 修改API节点
|
|||
|
|
|
|||
|
|
- 角色:`admin`
|
|||
|
|
- HTTP:`POST https://backend.dooki.cloud/APINodeService/updateAPINode`
|
|||
|
|
- RPC:`rpc updateAPINode (UpdateAPINodeRequest) returns (RPCSuccess);`
|
|||
|
|
|
|||
|
|
**请求对象 (`UpdateAPINodeRequest`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"apiNodeId": "int64 // API节点ID",
|
|||
|
|
"name": "string // API节点名称",
|
|||
|
|
"description": "string // API节点描述",
|
|||
|
|
"httpJSON": "bytes // 监听HTTP地址配置 json:http_protocol",
|
|||
|
|
"httpsJSON": "bytes // 监听HTTPS地址配置 json:https_protocol",
|
|||
|
|
"accessAddrsJSON": "bytes // 访问地址 json:network_address",
|
|||
|
|
"isOn": "bool // 是否启用当前API节点",
|
|||
|
|
"restIsOn": "bool // 是否启用API",
|
|||
|
|
"restHTTPJSON": "bytes // API地址HTTP地址配置 json:http_protocol",
|
|||
|
|
"restHTTPSJSON": "bytes // API地址HTTPS地址配置 json:https_protocol",
|
|||
|
|
"isPrimary": "bool // 是否为主要API节点,日常任务主要运行在主要API节点上"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**响应对象 (`RPCSuccess`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**调用示例**
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -X POST "https://backend.dooki.cloud/APINodeService/updateAPINode" \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
|||
|
|
-d '{
|
|||
|
|
...
|
|||
|
|
}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## uploadAPINodeFile
|
|||
|
|
> 上传新版API节点文件
|
|||
|
|
|
|||
|
|
- 角色:`admin`
|
|||
|
|
- HTTP:`POST https://backend.dooki.cloud/APINodeService/uploadAPINodeFile`
|
|||
|
|
- RPC:`rpc uploadAPINodeFile(UploadAPINodeFileRequest) returns (UploadAPINodeFileResponse);`
|
|||
|
|
|
|||
|
|
**请求对象 (`UploadAPINodeFileRequest`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"filename": "string // 文件名",
|
|||
|
|
"sum": "string // 整个文件的SUM值",
|
|||
|
|
"chunkData": "bytes // 片段数据",
|
|||
|
|
"isFirstChunk": "bool // 是否为第一个片段",
|
|||
|
|
"isLastChunk": "bool // 是否为最后一个片段"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**响应对象 (`UploadAPINodeFileResponse`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**调用示例**
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -X POST "https://backend.dooki.cloud/APINodeService/uploadAPINodeFile" \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
|||
|
|
-d '{
|
|||
|
|
...
|
|||
|
|
}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## uploadDeployFileToAPINode
|
|||
|
|
> 上传节点安装文件
|
|||
|
|
|
|||
|
|
- 角色:`admin`
|
|||
|
|
- HTTP:`POST https://backend.dooki.cloud/APINodeService/uploadDeployFileToAPINode`
|
|||
|
|
- RPC:`rpc uploadDeployFileToAPINode(UploadDeployFileToAPINodeRequest) returns (RPCSuccess);`
|
|||
|
|
|
|||
|
|
**请求对象 (`UploadDeployFileToAPINodeRequest`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"filename": "string // 文件名",
|
|||
|
|
"sum": "string // 整个文件的SUM值",
|
|||
|
|
"chunkData": "bytes // 片段数据",
|
|||
|
|
"isFirstChunk": "bool // 是否为第一个片段",
|
|||
|
|
"isLastChunk": "bool // 是否为最后一个片段"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**响应对象 (`RPCSuccess`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**调用示例**
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -X POST "https://backend.dooki.cloud/APINodeService/uploadDeployFileToAPINode" \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
|||
|
|
-d '{
|
|||
|
|
...
|
|||
|
|
}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|