版本 2.4.8 · 最新
IP 池 ip-pools
管理员维护的 IP 池及池内 IP;池按区域归属,名称全平台唯一。
点击任一接口,右侧显示对应的调用示例。
IP 产品线鉴权: 仅管理员12 个接口
鉴权
请求头带 X-API-Key(在「API 密钥」页开通,密钥只在开通时显示一次);也可用登录得到的 Authorization: Bearer 令牌。
X-API-Key
鉴权失败回 401;无权回 403(code 为 insufficient_scope 等)。
约定
分页参数 page(从 1 起)、page_size;排序 sort=字段 或 -字段。
时间一律 RFC 3339(UTC);金额单位为分。
写操作成功回 200/201/204;重复提交按资源唯一键回 409。
GET
/api/v2/ip-pools列出 IP 池
鉴权: 仅管理员
查询参数
| 字段 | 类型 | 说明 |
|---|---|---|
page | integer | 页码,从 1 开始。 |
page_size | integer | 每页条数。 |
sort | string | 排序字段,逗号分隔,前缀 `-` 表示降序,如 `-created_at,id`。 |
region_id | integer | 按区域过滤。 |
POST
/api/v2/ip-pools创建 IP 池
鉴权: 仅管理员
请求体 application/json
| 字段 | 类型 | 说明 |
|---|---|---|
des | string | 备注说明 |
name必填 | string | 名称 |
region_id必填 | integer | 区域 ID |
GET
/api/v2/ip-pools/candidatesIP 池候选节点 IP
鉴权: 仅管理员
查询参数
| 字段 | 类型 | 说明 |
|---|---|---|
region_id必填 | integer | 区域 ID。 |
GET
/api/v2/ip-pools/{id}获取 IP 池
鉴权: 仅管理员
PUT
/api/v2/ip-pools/{id}修改 IP 池
鉴权: 仅管理员
请求体 application/json
| 字段 | 类型 | 说明 |
|---|---|---|
des | string | 备注说明 |
name必填 | string | 名称 |
region_id必填 | integer | 区域 ID |
DELETE
/api/v2/ip-pools/{id}删除 IP 池
鉴权: 仅管理员
GET
/api/v2/ip-pools/{id}/refsIP 池引用站点
鉴权: 仅管理员
查询参数
| 字段 | 类型 | 说明 |
|---|---|---|
ip_id | integer | 只看这个池内 IP。 |
limit | integer | 每个 IP 最多列几个站点。 |
GET
/api/v2/ip-pools/{pool_id}/ips列出池内 IP
鉴权: 仅管理员
查询参数
| 字段 | 类型 | 说明 |
|---|---|---|
page | integer | 页码,从 1 开始。 |
page_size | integer | 每页条数。 |
sort | string | 排序字段,逗号分隔,前缀 `-` 表示降序,如 `-created_at,id`。 |
POST
/api/v2/ip-pools/{pool_id}/ipsIP 入池
鉴权: 仅管理员
请求体 application/json
| 字段 | 类型 | 说明 |
|---|---|---|
bind_addr | string | 节点上实际监听的本机地址(NAT 场景);null = 用 ip。 |
node_id必填 | integer | 节点 ID |
PUT
/api/v2/ip-pools/{pool_id}/ips/{id}修改池内 IP
鉴权: 仅管理员
请求体 application/json
| 字段 | 类型 | 说明 |
|---|---|---|
bind_addr | string | 节点上实际监听的本机地址(NAT 场景);null = 用 ip。 |
enabled | boolean | 是否启用 |
POST
/api/v2/ip-pools/{pool_id}/ips/{id}/issue-cert签发池内 IP 的平台证书
鉴权: 仅管理员
请求体 application/json
| 字段 | 类型 | 说明 |
|---|---|---|
confirm | boolean | 已有有效证书时确认重签。 |
IP 池对象
| 字段 | 类型 | 说明 |
|---|---|---|
bind_addr | string | 节点上实际监听的本机地址(NAT 场景);null = 用 ip。 |
cert | IpCertState | 平台 IP 证书状态。 |
confirm | boolean | 已有有效证书时确认重签。 |
created_at | string | 创建时间 |
des | string | 备注说明 |
enabled | boolean | 是否启用 |
hints | string[] | 提示(如节点没上报网卡地址,入池未核对)。 |
id | integer | 记录 ID |
ip | string | IP 地址。 |
ip_count | integer | 池内 IP 数。 |
ips | object[] | 有引用的池内 IP 及其引用站点。 |
items | IpCandidate[] | 本页条目 |
name | string | 名称 |
node_id | integer | 节点 ID |
node_name | string | 所属节点名称。 |
node_state | IpNodeState | 持有主节点状态:停用 disabled;否则最近 2 分钟有心跳 online,没有 offline。 |
pool_id | integer | 所属 IP 池 ID。 |
region_id | integer | 区域 ID |
region_name | string | 区域名称。 |
site_count | integer | 引用池内 IP 的 IP 站点数(按站点去重)。 |
updated_at | string | 更新时间 |
返回与错误
成功直接回资源 JSON(HTTP 2xx);失败回 application/problem+json(code、detail,校验失败带 errors);列表为 items + total。
成功
{
"id": 1,
"name": "example"
}列表
{
"items": [
{
"id": 1
}
],
"page": 1,
"page_size": 20,
"total": 1
}失败
{
"code": "validation_failed",
"detail": "请求参数不合法",
"errors": [
{
"code": "required",
"field": "/name",
"message": "name 必填"
}
],
"request_id": "0123456789abcdef",
"status": 422,
"title": "Unprocessable Entity",
"type": "about:blank"
}