# ServerGroupService
> 服务分组服务

---

## createServerGroup
> 创建分组

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/ServerGroupService/createServerGroup`
- RPC：`rpc createServerGroup (CreateServerGroupRequest) returns (CreateServerGroupResponse);`

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

```json
{
  "name": "string // 名称"
}
```

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

```json
{
  "serverGroupId": "int64 // 服务分组ID（网站分组ID）"
}
```

**调用示例**

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

---

## deleteServerGroup
> 删除分组

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/ServerGroupService/deleteServerGroup`
- RPC：`rpc deleteServerGroup (DeleteServerGroupRequest) returns (RPCSuccess);`

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

```json
{
  "serverGroupId": "int64 // 服务分组ID（网站分组ID）"
}
```

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

```json
{}
```

**调用示例**

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

---

## findAllEnabledServerGroups
> 查询所有分组

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/ServerGroupService/findAllEnabledServerGroups`
- RPC：`rpc findAllEnabledServerGroups (FindAllEnabledServerGroupsRequest) returns (FindAllEnabledServerGroupsResponse);`

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

```json
{
  "userId": "int64 // 可选项，用户ID，只有管理员才可以指定用户ID"
}
```

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

```json
{
  "serverGroups": "[]ServerGroup // 分组列表"
}
```

**调用示例**

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

---

## findAndInitServerGroupHTTPReverseProxyConfig
> 查找HTTP反向代理设置

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/ServerGroupService/findAndInitServerGroupHTTPReverseProxyConfig`
- RPC：`rpc findAndInitServerGroupHTTPReverseProxyConfig (FindAndInitServerGroupHTTPReverseProxyConfigRequest) returns (FindAndInitServerGroupHTTPReverseProxyConfigResponse);`

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

```json
{
  "serverGroupId": "int64 // 服务分组ID（网站分组ID）"
}
```

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

```json
{
  "reverseProxyJSON": "bytes",
  "reverseProxyRefJSON": "bytes"
}
```

**调用示例**

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

---

## findAndInitServerGroupTCPReverseProxyConfig
> 查找TCP反向代理设置

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/ServerGroupService/findAndInitServerGroupTCPReverseProxyConfig`
- RPC：`rpc findAndInitServerGroupTCPReverseProxyConfig (FindAndInitServerGroupTCPReverseProxyConfigRequest) returns (FindAndInitServerGroupTCPReverseProxyConfigResponse);`

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

```json
{
  "serverGroupId": "int64 // 服务分组ID（网站分组ID）"
}
```

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

```json
{
  "reverseProxyJSON": "bytes",
  "reverseProxyRefJSON": "bytes"
}
```

**调用示例**

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

---

## findAndInitServerGroupUDPReverseProxyConfig
> 查找UDP反向代理设置

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/ServerGroupService/findAndInitServerGroupUDPReverseProxyConfig`
- RPC：`rpc findAndInitServerGroupUDPReverseProxyConfig (FindAndInitServerGroupUDPReverseProxyConfigRequest) returns (FindAndInitServerGroupUDPReverseProxyConfigResponse);`

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

```json
{
  "serverGroupId": "int64 // 服务分组ID（网站分组ID）"
}
```

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

```json
{
  "reverseProxyJSON": "bytes",
  "reverseProxyRefJSON": "bytes"
}
```

**调用示例**

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

---

## findAndInitServerGroupWebConfig
> 初始化Web设置

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/ServerGroupService/findAndInitServerGroupWebConfig`
- RPC：`rpc findAndInitServerGroupWebConfig (FindAndInitServerGroupWebConfigRequest) returns (FindAndInitServerGroupWebConfigResponse);`

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

```json
{
  "serverGroupId": "int64 // 服务分组ID（网站分组ID）"
}
```

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

```json
{
  "webJSON": "bytes"
}
```

**调用示例**

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

---

## findEnabledServerGroup
> 查找单个分组信息

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/ServerGroupService/findEnabledServerGroup`
- RPC：`rpc findEnabledServerGroup (FindEnabledServerGroupRequest) returns (FindEnabledServerGroupResponse);`

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

```json
{
  "serverGroupId": "int64 // 服务分组ID（网站分组ID）"
}
```

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

```json
{
  "serverGroup": "ServerGroup"
}
```

**调用示例**

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

---

## findEnabledServerGroupConfigInfo
> 取得分组的配置概要信息

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/ServerGroupService/findEnabledServerGroupConfigInfo`
- RPC：`rpc findEnabledServerGroupConfigInfo (FindEnabledServerGroupConfigInfoRequest) returns (FindEnabledServerGroupConfigInfoResponse);`

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

```json
{
  "serverGroupId": "int64 // 服务分组ID（网站分组ID）",
  "serverId": "int64 // 服务ID（网站ID）"
}
```

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

```json
{
  "hasHTTPReverseProxy": "bool",
  "hasTCPReverseProxy": "bool",
  "hasUDPReverseProxy": "bool",
  "serverGroupId": "int64 // 服务分组ID（网站分组ID）",
  "hasRootConfig": "bool",
  "hasWAFConfig": "bool",
  "hasCacheConfig": "bool",
  "hasCharsetConfig": "bool",
  "hasStatConfig": "bool",
  "hasCompressionConfig": "bool",
  "hasOptimizationConfig": "bool",
  "hasRequestHeadersConfig": "bool",
  "hasResponseHeadersConfig": "bool",
  "hasWebsocketConfig": "bool",
  "hasWebPConfig": "bool",
  "hasAccessLogConfig": "bool",
  "hasRemoteAddrConfig": "bool",
  "hasPagesConfig": "bool",
  "hasRequestLimitConfig": "bool",
  "hasRequestScriptsConfig": "bool"
}
```

**调用示例**

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

---

## updateServerGroup
> 修改分组

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/ServerGroupService/updateServerGroup`
- RPC：`rpc updateServerGroup (UpdateServerGroupRequest) returns (RPCSuccess);`

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

```json
{
  "serverGroupId": "int64 // 服务分组ID（网站分组ID）",
  "name": "string // 名称"
}
```

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

```json
{}
```

**调用示例**

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

---

## updateServerGroupHTTPReverseProxy
> 修改分组的HTTP反向代理设置

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/ServerGroupService/updateServerGroupHTTPReverseProxy`
- RPC：`rpc updateServerGroupHTTPReverseProxy (UpdateServerGroupHTTPReverseProxyRequest) returns (RPCSuccess);`

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

```json
{
  "serverGroupId": "int64 // 服务分组ID（网站分组ID）",
  "reverseProxyJSON": "bytes"
}
```

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

```json
{}
```

**调用示例**

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

---

## updateServerGroupOrders
> 修改分组排序

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/ServerGroupService/updateServerGroupOrders`
- RPC：`rpc updateServerGroupOrders (UpdateServerGroupOrdersRequest) returns (RPCSuccess);`

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

```json
{
  "serverGroupIds": "[]int64"
}
```

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

```json
{}
```

**调用示例**

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

---

## updateServerGroupTCPReverseProxy
> 修改分组的TCP反向代理设置

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/ServerGroupService/updateServerGroupTCPReverseProxy`
- RPC：`rpc updateServerGroupTCPReverseProxy (UpdateServerGroupTCPReverseProxyRequest) returns (RPCSuccess);`

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

```json
{
  "serverGroupId": "int64 // 服务分组ID（网站分组ID）",
  "reverseProxyJSON": "bytes"
}
```

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

```json
{}
```

**调用示例**

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

---

## updateServerGroupUDPReverseProxy
> 修改分组的UDP反向代理设置

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/ServerGroupService/updateServerGroupUDPReverseProxy`
- RPC：`rpc updateServerGroupUDPReverseProxy (UpdateServerGroupUDPReverseProxyRequest) returns (RPCSuccess);`

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

```json
{
  "serverGroupId": "int64 // 服务分组ID（网站分组ID）",
  "reverseProxyJSON": "bytes"
}
```

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

```json
{}
```

**调用示例**

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

---
