应用级 IP 列表

新建应用级 IP 列表

URI

POST /admin-api/applications/{app_id}/ip_list

JSON body 参数

  • name

    type: string

    required: yes

    description: name of application IP list

  • type

    type: string

    required: yes

    description: type of application IP list, value can be ‘ipv4’ or ‘ipv6’

  • items

    type: array

    required: yes

    description: list of IP address objects

  • items.ip

    type: ip

    required: yes

    description: IP address (ipv4 or ipv6)

请求示例

Shell

curl \
  -X POST \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://admin-site/admin-api/applications/1/ip_list \
  -d '{
      "name": "ip-list-1",
      "type": "ipv4",
      "items": [
        {"ip": "127.0.0.1"},
        {"ip": "127.0.0.2/32"}
      ]
  }'

响应示例

Status: 200 OK
{ "status":0, "data": {"id": 1} }

修改应用级 IP 列表

URI

PUT /admin-api/applications/{app_id}/ip_list/{ip_list_id}

请求示例

Shell

curl \
  -X PUT \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://admin-site/admin-api/applications/1/ip_list/1 \
  -d '{
      {"items":[{"ip":"10.0.0.100"}]}
  }'

响应示例

Status: 200 OK
{ "status":0 }

追加至已存在应用级 IP 列表

URI

PUT /admin-api/app_ip_list/{app_id}/append/{ip_list_id}

请求示例

Shell

curl \
  -X PUT \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://admin-site/admin-api/app_ip_list/1/append/1 \
  -d '{
      "items":[{"ip":"10.0.0.101"}]
  }'

响应示例

Status: 200 OK
{ "status":0 }

获取应用级 IP 列表

URI

GET /admin-api/Application/{app_id}/ip_list

请求示例

Shell

curl \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://admin-site/admin-api/applications/1/ip_list

响应示例

Status: 200 OK
{
  "data": [
    {
      "id": 1,
      "items": [
        { "id": 1, "ip": "127.0.0.1" },
        { "id": 2, "ip": "127.0.0.2" }
      ],
      "name": "ip-list-1",
      "type": "ipv4"
    }
  ],
  "status": 0
}

根据 id 移除 IP 列表

URI

DELETE /admin-api/applications/{app_id}/ip_list/{ip_list_id}

请求示例

curl \
  -X DELETE \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://admin-site/admin-api/applications/1/ip_list/1

响应示例

Status: 200 OK
{"status": 0}