應用級 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}