閘道器叢集

獲取候選節點列表

簡介

獲取等待加入閘道器叢集的節點列表

URI

GET /admin-api/nodecandidate/list

請求示例

Shell

curl \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://{admin-site}/admin-api/nodecandidate/list

響應示例

Status: 200 OK
{
    "time": 1614768787,
    "data": {
        "data": [
            {
                "internal_ip": "127.0.0.1",
                "mac_address": "06:86:ce:06:75:a6",
                "_created_unix": "2021-03-03 18:50:16.976704",
                "created_unix": 1614768616.9767,
                "hardware_id": "6b632692eb1f46bd0b8067f6ae9xxxxx",
                "csr": "-----BEGIN NEW CERTIFICATE REQUEST-----\n...\n-----END NEW CERTIFICATE REQUEST-----\n",
                "hostname": "localhost\n",
                "external_ip": "127.0.0.1",
                "os": "Linux\n3.10.0-1062.12.1.el7.x86_64\n",
                "external_ipv6": "",
                "client_city": "HK/"
            }
        ],
        "meta": {
            "count": 1
        }
    },
    "status": 0
}

獲取閘道器叢集列表

簡介

獲取閘道器叢集列表

URI

GET /admin-api/gateway

URI引數

  • detail

    type: integer

    required: no

    description: Are detailed results required (default 0)

  • page

    type: integer

    required: no

    description: Results page (default 1)

  • page_size

    type: integer

    required: no

    description: Results page size (default 20)

請求示例

Shell

curl \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://{admin-site}/admin-api/gateway?detail=1&page_size=100&page=1

響應示例

Status: 200 OK
{
    "data": {
        "data": [
            {
                "is_gray_partition": false,
                "id": 1, // gateway id
                "_modified_unix": 1612133743.1943,
                "nodes": [
                    {
                        "internal_ip": "127.0.0.1",
                        "id": 59, // node id
                        "online_status": true,
                        "_modified_unix": 1612136932.8338,
                        "name": "localhost",
                        "config": {
                            "error_log_level": "default",
                            "proxy_bind_local_ip_list": ["192.168.122.164", "192.168.50.243"],
                            "listen_bind_local_ip_list": ["192.168.122.164", "192.168.50.243"]
                        },
                        "serial": "3049245148",
                        "_created_unix": 1571733586.0325,
                        "sync_status_utime": 1614765663,
                        "hardware_id": "43ac1f19cf445cea5235a536e43xxxxx",
                        "version": 501,
                        "is_healthy": true,
                        "external_ip": "127.0.0.1",
                        "status": 1
                    }
                ],
                "partition": 1,
                "tag": [
                    2
                ],
                "name": "hk",
                "_created_unix": 1506091343.5212,
                "location": {
                    "country": "CN",
                    "isp": "BGP",
                    "province": "Hongkong",
                    "latitude": 30.252501,
                    "continent": "AS",
                    "longitude": 120.165024
                }
            }
        ],
        "meta": {
            "count": 11
        }
    },
    "status": 0
}

新建閘道器叢集

簡介

新建閘道器叢集

URI

POST /admin-api/gateway

JSON body 引數

{
    "name": "gateway-name", // gateway name
    "partition": 1, // partition id
}

請求示例

Shell

curl \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://{admin-site}/admin-api/gateway
  -d '{"name": "gateway-name", "partition": 1}'

響應示例

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

批准候選節點加入閘道器叢集

簡介

批准候選節點加入閘道器叢集

URI

POST /admin-api/nodecandidate/approve

JSON body 引數

    {
        "cluster": 1, // gateway id
        "status": 1, // 1: Enable, 2: Disabled DNS 3: Offline
        "internal_ip": "127.0.0.1",
        "mac_address": "06:86:ce:06:75:a6",
        "_created_unix": "2021-03-03 18:50:16.976704",
        "created_unix": 1614768616.9767,
        "hardware_id": "6b632692eb1f46bd0b8067f6ae9xxxxx",
        "csr": "-----BEGIN NEW CERTIFICATE REQUEST-----\n...\n-----END NEW CERTIFICATE REQUEST-----\n",
        "hostname": "localhost\n",
        "external_ip": "127.0.0.1",
        "os": "Linux\n3.10.0-1062.12.1.el7.x86_64\n",
        "external_ipv6": "",
        "client_city": "HK/"
    }

請求示例

Shell

curl \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://{admin-site}/admin-api/nodecandidate/approve \
  -d '{"cluster": 1, "status": 1, "internal_ip":"127.0.0.1","mac_address":"06:86:ce:06:75:a6","_created_unix":"2021-03-03 18:50:16.976704","created_unix":1614768616.9767,"hardware_id":"6b632692eb1f46bd0b8067f6ae9xxxxx","csr":"-----BEGIN NEW CERTIFICATE REQUEST-----\n...\n-----END NEW CERTIFICATE REQUEST-----\n","hostname":"localhost\n","external_ip":"127.0.0.1","os":"Linux\n3.10.0-1062.12.1.el7.x86_64\n","external_ipv6":"","client_city":"HK/"}'

響應示例

Status: 200 OK

{"time":1614782044,"status":0}

移除閘道器叢集中的節點

簡介

移除閘道器叢集中的節點

URI

DELETE /admin-api/gateway/{gateway_id}/nodes/{node_id}

請求示例

Shell

curl -X DELETE
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://{admin-site}/admin-api/gateway/1/nodes/1

響應示例

Status: 200 OK
{"status":0}

獲取閘道器叢集標籤

簡介

獲取閘道器叢集標籤

URI

GET /admin-api/gatewaytag

請求示例

Shell

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

響應示例

Status: 200 OK
{
    "data": [
        {
            "name": "ZBCySv",
            "id": 1
        },
        {
            "name": "QXnfet",
            "id": 2
        },
        {
            "name": "test-tag1",
            "id": 3
        },
        {
            "name": "tag2",
            "id": 4
        },
        {
            "name": "omZyRp",
            "id": 5
        },
        {
            "name": "nameserver",
            "id": 6
        },
        {
            "name": "122",
            "id": 7
        }
    ],
    "status": 0
}

獲取閘道器叢集標籤名字

簡介

透過閘道器叢集標籤 ID 獲取名字

URI

GET /admin-api/gatewaytag/{tag_id}

請求示例

Shell

curl \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://{admin-site}/admin-api/gatewaytag/6

響應示例

Status: 200 OK
{
    "data": {
        "name": "nameserver",
        "id": 6
    },
    "status": 0
}