Creating & Configuring an Edge Service through the Public API

How to use the REST OpenAPI to create & configure an Edge Service on the command-line.

The first step is to make sure you have the sufficient API credentials: you should start by creating a new API Client ID and use it through the built-in Swagger UI to fetch back the authentication token to use in your scripted request.

In order to follow this guide, you will also need to download a generic Edge Service (ES) disk image corresponding to the target virtualization environment.

Once the image is downloaded you can start the VM to which this disk image is attached. Please ensure the VM respects the minimal requirements.

Creating the ES through curl

Once the machine is up and running, the first step would be to request a configuration for this newly booted, yet unconfigured, ES.

This can be done easily by issuing the following curl POST to the ES creation endpoint in the API, by using your authentication token.

This example requests a configuration URL for a Generic Post-Configured Edge Service.

curl -X POST "https://<YOUR_INSTANCE>.wardenscanner.com/api/v2/edge-services" -H "accept: application/json" -H "authorization: Bearer <YOUR_TOKEN>" -H "Content-Type: application/json" -d "{ \"kind\": \"edgeService\", \"label\": \"<YOUR_EDGE_SERVICE_NAME>\"}"

This request should return a code 200 and give you a new Edge Service identifier in its response, which we will use later to get the configuration URL.

{
"id": "00",
"identifier": "<YOUR_EDGE_SERVICE_IDENTIFIER>",
"isConnected": false,
"kind": "edgeService",
"label": "<YOUR_EDGE_SERVICE_NAME>",
"networkConfiguration": {
"dns": [],
"useDhcp": true
},
"platform": "agnostic"
}

Configuration creation can take a few minutes to be done. A short waiting period should be respected before trying to fetch back the configuration URL.

Once the configuration URL has been created, it can be fetched back by issuing the following GET request to list all the Edge Services and find the configuration URL of the Edge Service identifier associated to the one you just created:

curl -X GET "https://<YOUR_INSTANCE>.wardenscanner.com/api/v2/edge-services" -H "accept: application/json" -H "authorization: Bearer <YOUR_TOKEN>"
{
"currentItemCount": 1,
"items": [
{
"configureUrl": "<CONFIGURATION_URL>",
"description": "",
"id": "00",
"identifier": "<EDGE_SERVICE_IDENTIFIER>",
"isConnected": false,
"kind": "edgeService",
"label": "<YOUR_EDGE_SERVICE_NAME>",
"networkConfiguration": {
"dns": [],
"useDhcp": true
},
"platform": "agnostic",
"port": <EDGE_SERVICE_UDP_PORT>
}
]
}

Configuring the ES through curl

Once you have installed the Edge Service on your network where it needs to be, with the configuration URL on hand, you can now do a simple curl call on your local network where the unconfigured ES is running and exposing a temporary Web interface to finalize the configuration:

Configure the network

The first step to finalize the ES configuration is to setup the desired networking options.

If you want to leave the Edge Service with a DHCP-assigned IP,  this step can be omitted.

In order to change the DHCP to a static IP,  this can be achieved through the following request.

curl http://<LOCAL_IP_OF_THE_EDGE_SERVICE>/net-config -F static_ip=<LOCAL_STATIC_IP>&netmask=<LOCAL_NETMASK>&gateway=<LOCAL_GATEWAY>&dns_servers=<DNS_SERVER_1>%2C<DNS_SERVER_2>

Configure the unique keys

In order to configure your Edge Service unicity and link it to your Delve instance, you can simply execute the following request to send the configuration URL to the temporary Web interface.

curl http://<LOCAL_IP_OF_THE_EDGE_SERVICE>/client-keys -F client_keys_url=<CONFIGURATION_URL>

Restart the machine

The last step would be to restart the machine to make sure it picks up the new networking setup that you might have changed.