# 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" \
  http://{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" \
  http://{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
}

# New Gateway Cluster

# Description

New 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" \
  http://{admin-site}/admin-api/gateway
  -d '{"name": "gateway-name", "partition": 1}'
# Response example
Status: 200 OK
{"data":{"id":61},"status":0}

# Update gateway cluster information

# Description

Update information for a given gateway cluster

# Uri
POST /admin-api/gateway/{gateway_id}
# Json body parameters
{
    "partition":1,    // partition id
    "location":{      // location information
        "province":"Loopback Address",
        "isp":"",
        "country":"AF"
    },
    "id":3,           // gateway cluster id
    "nodes":[         // node information
        {
            "config":{
                "enable_qat":false,     // enable intel qat device
                "error_log_level":"default",   // log level
                "proxy_bind_local_ip_list": ["192.168.122.164", "192.168.50.243"],   // upstream forwarding of the bound local ip
                "listen_bind_local_ip_list": ["192.168.122.164", "192.168.50.243"]   // downstream listening to the bound local ip
            },
            "_modified_unix":1615258796.6619,
            "name":"centos8",
            "_created_unix":1615258796.6241,
            "version":210,
            "external_ip":"127.0.0.1",         // public ip
            "internal_ip":"192.168.122.164",   // internal ip
            "id":4,       // node id
            "status":1,   // 1: Enable, 2: Disabled DNS 3: Offline
            "hardware_id":"d593e4c8bfff4a303e75fac1de7b6e69",
            "online_status":true,   // is the node online
            "sync_status_utime":0,
            "serial":"214994338",
            "gatewayName":"server",
            "external_ipv6":null      // public ipv6
        }
    ],
    "_created_unix":1615258791.9496,
    "name":"server",
    "_modified_unix":1615258796.5665,
    "syncStatus":"1 (100%)",
    "partitionLabel":"default",
    "rowspan":1,
    "node":{
        "config":{
            "enable_qat":false
        },
        "_modified_unix":1615258796.6619,
        "name":"centos8",
        "_created_unix":1615258796.6241,
        "version":210,
        "external_ip":"127.0.0.1",
        "internal_ip":"192.168.122.164",
        "id":4,
        "status":1,
        "hardware_id":"d593e4c8bfff4a303e75fac1de7b6e69",
        "online_status":true,
        "sync_status_utime":0,
        "serial":"214994338",
        "gatewayName":"server"
    },
    "tag":[

    ],
    "bandwidth":null,
    "bandwidth_unit":null
}
# Request example
# Shell
curl 'http://{admin-site}/admin-api/gateway' \
  -X 'PUT' \
  --data-raw '{"partition":1,"location":{"province":"Loopback Address","isp":"","country":"AF"},"id":3,"nodes":[{"config":{"enable_qat":false,"error_log_level":"default"},"_modified_unix":1615258796.6619,"name":"centos8","_created_unix":1615258796.6241,"version":210,"external_ip":"127.0.0.1","internal_ip":"192.168.122.164","id":4,"status":0,"hardware_id":"d593e4c8bfff4a303e75fac1de7b6e69","online_status":true,"sync_status_utime":0,"serial":"214994338","gatewayName":"server","external_ipv6":null}],"_created_unix":1615258791.9496,"name":"server","_modified_unix":1615258796.5665,"syncStatus":"1 (100%)","partitionLabel":"default","rowspan":1,"node":{"config":{"enable_qat":false},"_modified_unix":1615258796.6619,"name":"centos8","_created_unix":1615258796.6241,"version":210,"external_ip":"127.0.0.1","internal_ip":"192.168.122.164","id":4,"status":1,"hardware_id":"d593e4c8bfff4a303e75fac1de7b6e69","online_status":true,"sync_status_utime":0,"serial":"214994338","gatewayName":"server"},"tag":[],"bandwidth":null,"bandwidth_unit":null}'
# Response example
Status: 200 OK

# 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" \
  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/"}'
# 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" \
  http://{admin-site}/admin-api/gateway/1/nodes/1
# Response example
Status: 200 OK
{"status":0}