Gateways
Get a list of candidate nodes
Description
Get the list of nodes waiting to join the gateway cluster
URI
GET /admin-api/nodecandidate/list
Request example
Shell
curl \
-H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
https://{admin-site}/admin-api/nodecandidate/list
Response example
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
}
Get a list of gateway clusters
Description
Get a list of gateway clusters
URI
GET /admin-api/gateway
URI parameters
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)
Request example
Shell
curl \
-H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
https://{admin-site}/admin-api/gateway?detail=1&page_size=100&page=1
Response example
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
}
Create Gateway Cluster
Description
Create Gateway Cluster
URI
POST /admin-api/gateway
JSON body parameters
{
"name": "gateway-name", // gateway name
"partition": 1, // partition id
}
Request example
Shell
curl \
-H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
https://{admin-site}/admin-api/gateway
-d '{"name": "gateway-name", "partition": 1}'
Response example
Status: 200 OK
{"data":{"id":61},"status":0}
Approval of candidate nodes to join the gateway cluster
Description
Approval of candidate nodes to join the gateway cluster
URI
POST /admin-api/nodecandidate/approve
JSON body parameters
{
"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/"
}
Request example
Shell
curl \
-H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
https://{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/"}'
Response example
Status: 200 OK
{"time":1614782044,"status":0}
Removing nodes from a gateway cluster
Description
Removing nodes from a gateway cluster
URI
DELETE /admin-api/gateway/{gateway_id}/nodes/{node_id}
Request example
Shell
curl -X DELETE \
-H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
https://{admin-site}/admin-api/gateway/1/nodes/1
Response example
Status: 200 OK
{"status":0}
Get Gateway Tags
Description
Get all gateway tags
URI
GET /admin-api/gatewaytag
Request example
Shell
curl \
-H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
https://{admin-site}/admin-api/gatewaytag
Response example
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
}
Get Gateway Tag Name
Description
Get gateway tag name by tag id
URI
GET /admin-api/gatewaytag/{tag_id}
Request example
Shell
curl \
-H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
https://{admin-site}/admin-api/gatewaytag/6
Response example
Status: 200 OK
{
"data": {
"name": "nameserver",
"id": 6
},
"status": 0
}