# NodeGrantService
> 节点认证信息管理服务

---

## countAllEnabledNodeGrants
> 计算认证的数量

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeGrantService/countAllEnabledNodeGrants`
- RPC：`rpc countAllEnabledNodeGrants (CountAllEnabledNodeGrantsRequest) returns (RPCCountResponse);`

**请求对象 (`CountAllEnabledNodeGrantsRequest`)**

```json
{
  "keyword": "string // 关键词"
}
```

**响应对象 (`RPCCountResponse`)**

```json
{
  "count": "int64 // 数量"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/NodeGrantService/countAllEnabledNodeGrants" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## createNodeGrant
> 创建认证

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeGrantService/createNodeGrant`
- RPC：`rpc createNodeGrant (CreateNodeGrantRequest) returns (CreateNodeGrantResponse);`

**请求对象 (`CreateNodeGrantRequest`)**

```json
{
  "name": "string // 名称",
  "method": "string",
  "username": "string",
  "password": "string",
  "privateKey": "string",
  "passphrase": "string",
  "description": "string // 描述（备注）",
  "nodeId": "int64 // 节点ID",
  "su": "bool"
}
```

**响应对象 (`CreateNodeGrantResponse`)**

```json
{
  "nodeGrantId": "int64"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/NodeGrantService/createNodeGrant" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## disableNodeGrant
> 禁用认证

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeGrantService/disableNodeGrant`
- RPC：`rpc disableNodeGrant (DisableNodeGrantRequest) returns (DisableNodeGrantResponse);`

**请求对象 (`DisableNodeGrantRequest`)**

```json
{
  "nodeGrantId": "int64"
}
```

**响应对象 (`DisableNodeGrantResponse`)**

```json
{}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/NodeGrantService/disableNodeGrant" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## findAllEnabledNodeGrants
> 列出所有认证

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeGrantService/findAllEnabledNodeGrants`
- RPC：`rpc findAllEnabledNodeGrants (FindAllEnabledNodeGrantsRequest) returns (FindAllEnabledNodeGrantsResponse);`

**请求对象 (`FindAllEnabledNodeGrantsRequest`)**

```json
{}
```

**响应对象 (`FindAllEnabledNodeGrantsResponse`)**

```json
{
  "nodeGrants": "[]NodeGrant"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/NodeGrantService/findAllEnabledNodeGrants" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## findEnabledNodeGrant
> 获取单个认证信息

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeGrantService/findEnabledNodeGrant`
- RPC：`rpc findEnabledNodeGrant (FindEnabledNodeGrantRequest) returns (FindEnabledNodeGrantResponse);`

**请求对象 (`FindEnabledNodeGrantRequest`)**

```json
{
  "nodeGrantId": "int64"
}
```

**响应对象 (`FindEnabledNodeGrantResponse`)**

```json
{
  "nodeGrant": "NodeGrant"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/NodeGrantService/findEnabledNodeGrant" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## findSuggestNodeGrants
> 查找集群推荐的认证

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeGrantService/findSuggestNodeGrants`
- RPC：`rpc findSuggestNodeGrants(FindSuggestNodeGrantsRequest) returns (FindSuggestNodeGrantsResponse);`

**请求对象 (`FindSuggestNodeGrantsRequest`)**

```json
{
  "nodeClusterId": "int64 // 边缘节点集群",
  "nsClusterId": "int64 // NS节点集群"
}
```

**响应对象 (`FindSuggestNodeGrantsResponse`)**

```json
{
  "nodeGrants": "[]NodeGrant"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/NodeGrantService/findSuggestNodeGrants" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## listEnabledNodeGrants
> 列出单页认证

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeGrantService/listEnabledNodeGrants`
- RPC：`rpc listEnabledNodeGrants (ListEnabledNodeGrantsRequest) returns (ListEnabledNodeGrantsResponse);`

**请求对象 (`ListEnabledNodeGrantsRequest`)**

```json
{
  "keyword": "string // 关键词",
  "offset": "int64 // 读取位置",
  "size": "int64 // 数量，通常不能小于0"
}
```

**响应对象 (`ListEnabledNodeGrantsResponse`)**

```json
{
  "nodeGrants": "[]NodeGrant"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/NodeGrantService/listEnabledNodeGrants" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## testNodeGrant
> 测试连接

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeGrantService/testNodeGrant`
- RPC：`rpc testNodeGrant (TestNodeGrantRequest) returns (TestNodeGrantResponse);`

**请求对象 (`TestNodeGrantRequest`)**

```json
{
  "nodeGrantId": "int64",
  "host": "string",
  "port": "int32"
}
```

**响应对象 (`TestNodeGrantResponse`)**

```json
{
  "isOk": "bool",
  "error": "string"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/NodeGrantService/testNodeGrant" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## updateNodeGrant
> 修改认证

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeGrantService/updateNodeGrant`
- RPC：`rpc updateNodeGrant (UpdateNodeGrantRequest) returns (RPCSuccess);`

**请求对象 (`UpdateNodeGrantRequest`)**

```json
{
  "nodeGrantId": "int64",
  "name": "string // 名称",
  "method": "string",
  "username": "string",
  "password": "string",
  "privateKey": "string",
  "passphrase": "string",
  "description": "string // 描述（备注）",
  "nodeId": "int64 // 节点ID",
  "su": "bool"
}
```

**响应对象 (`RPCSuccess`)**

```json
{}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/NodeGrantService/updateNodeGrant" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---
