# NodeThresholdService
> 节点阈值服务

---

## countAllEnabledNodeThresholds
> 计算阈值数量

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeThresholdService/countAllEnabledNodeThresholds`
- RPC：`rpc countAllEnabledNodeThresholds (CountAllEnabledNodeThresholdsRequest) returns (RPCCountResponse);`

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

```json
{
  "role": "string",
  "nodeClusterId": "int64 // 集群ID",
  "nodeId": "int64 // 节点ID"
}
```

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

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

**调用示例**

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

---

## createNodeThreshold
> 创建阈值

- 角色：`admin`, `node`
- HTTP：`POST https://backend.dooki.cloud/NodeThresholdService/createNodeThreshold`
- RPC：`rpc createNodeThreshold (CreateNodeThresholdRequest) returns (CreateNodeThresholdResponse);`

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

```json
{
  "role": "string",
  "nodeClusterId": "int64 // 集群ID",
  "nodeId": "int64 // 节点ID",
  "item": "string",
  "param": "string",
  "operator": "string",
  "valueJSON": "bytes",
  "message": "string",
  "duration": "int32",
  "durationUnit": "string",
  "sumMethod": "string",
  "notifyDuration": "int32"
}
```

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

```json
{
  "nodeThresholdId": "int64"
}
```

**调用示例**

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

---

## deleteNodeThreshold
> 删除阈值

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeThresholdService/deleteNodeThreshold`
- RPC：`rpc deleteNodeThreshold (DeleteNodeThresholdRequest) returns (RPCSuccess);`

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

```json
{
  "nodeThresholdId": "int64"
}
```

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

```json
{}
```

**调用示例**

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

---

## findAllEnabledNodeThresholds
> 查询阈值

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeThresholdService/findAllEnabledNodeThresholds`
- RPC：`rpc findAllEnabledNodeThresholds (FindAllEnabledNodeThresholdsRequest) returns (FindAllEnabledNodeThresholdsResponse);`

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

```json
{
  "role": "string",
  "nodeClusterId": "int64 // 集群ID",
  "nodeId": "int64 // 节点ID"
}
```

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

```json
{
  "nodeThresholds": "[]NodeThreshold"
}
```

**调用示例**

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

---

## findEnabledNodeThreshold
> 查询单个阈值详情

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeThresholdService/findEnabledNodeThreshold`
- RPC：`rpc findEnabledNodeThreshold (FindEnabledNodeThresholdRequest) returns (FindEnabledNodeThresholdResponse);`

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

```json
{
  "nodeThresholdId": "int64"
}
```

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

```json
{
  "nodeThreshold": "NodeThreshold"
}
```

**调用示例**

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

---

## updateNodeThreshold
> 修改阈值

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeThresholdService/updateNodeThreshold`
- RPC：`rpc updateNodeThreshold (UpdateNodeThresholdRequest) returns (RPCSuccess);`

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

```json
{
  "nodeThresholdId": "int64",
  "item": "string",
  "param": "string",
  "operator": "string",
  "valueJSON": "bytes",
  "message": "string",
  "duration": "int32",
  "durationUnit": "string",
  "sumMethod": "string",
  "isOn": "bool // 是否启用",
  "notifyDuration": "int32"
}
```

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

```json
{}
```

**调用示例**

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

---
