Networks¶
In CloudsFor you may create private networks and join your VMs to it to make connectivity among them.
List all Networks¶
To list all of the networks available on your account, send a GET request to /api/v1/networks. The response will be a JSON object with a key called networks. This will be set to an array of network objects, each of which will contain the standard network attributes:
Attribute | Type | Description |
---|---|---|
id | string | A unique string to identify a specific network. |
name | string | Name, you assigned to network |
parent_id | string | Id of parent VLAN |
tag | number | Your VLAN tag |
size | number | Number of VM’s in private network |
cURL Example:
curl -X GET -H 'Content-Type: application/json' -u 'user@example.com:password' "https://cloudsfor.com/api/v1/networks"
Request Headers:
Content-Type: application/json
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Response Headers:
content-type: application/json; charset=utf-8
status: 200 OK
Response Body:
{
"networks": [
{
"id": "11081d5dcd884cf48f73a9d0ba8be005",
"name": "test",
"parent_id": "5055efc9313843ae9f408fe179e4b332",
"tag": "999",
"size": 2
}
],
"meta": {
"total": 1
}
}
Create a new Network¶
To add a new network to your CloudsFor account, send a POST request to /api/v1/networks. Set the “name” attribute to the name you wish to use.
Name | Type | Description | Required |
---|---|---|---|
name | string | The name to give the new network in your account. | true |
The response body will be a JSON object with a key set to network. The value will be the complete generated network object. This will have the standard network attributes:
Attribute | Type | Description |
---|---|---|
id | string | A unique string to identify a specific network. |
name | string | Name, you assigned to network |
parent_id | string | Id of parent VLAN |
tag | number | Your VLAN tag |
cURL Example:
curl -X POST -H 'Content-Type: application/json' -u 'user@example.com:password' -d '{"name":"new_network"}' "https://cloudsfor.com/api/v1/networks"
Request Headers:
Content-Type: application/json
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Request Body:
{
"name": "new_network",
}
Response Headers:
content-type: application/json; charset=utf-8
status: 201 Created
Response Body:
{
"network": {
"id": "362fa657b2c0408ab53272a888887c57",
"parent_id": "c4d44450a45711e39f44001b21c6b3dc",
"tag": 119,
"name": "new_network"
}
}
Retrieve an existing Network info¶
To show information about a network, send a GET request to /v1/networks/$NETWORK_ID. The response will be a JSON object with a key called network. The value of this will be a network object which contains the standard network attributes:
Attribute | Type | Description |
---|---|---|
id | number | This is a unique identification number for the
network. This can be used to reference a specific
network.
|
name | string | This is the human-readable display name for the
given private network. This is used to easily
identify networks when they are displayed.
|
nodes | assoc array | This attribute contains the list of nodes joined to
private network in form “vm id” : “vm name”
|
cURL Example:
curl -X GET -H 'Content-Type: application/json' -u 'user@example.com:password' "https://cloudsfor.com/api/v1/network/4322cb6b25774de1ad4f9a102c7d5424"
Request Headers:
Content-Type: application/json
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Response Headers:
content-type: application/json; charset=utf-8
status: 200 OK
Response Body:
{
"network": {
"id": "4322cb6b25774de1ad4f9a102c7d5424",
"name": "test",
"nodes": [
{"id": "11081d5dcd884cf48f73a9d0ba8be005", "name": "vm1"},
{"id": "5055efc9313843ae9f408fe179e4b332", "name": "vm2"}
]
}
}
Delete network¶
To delete a private network, send a DELETE request to /api/v1/networks/$NETWORK_ID.
A 204 status will be returned, indicating that the action was successful and that the response body is empty.
cURL Example:
curl -X DELETE -H 'Content-Type: application/json' -u 'user@example.com:password' "https://cloudsfor.com/api/v1/networks/4322cb6b25774de1ad4f9a102c7d5424"
Request Headers:
Content-Type: application/json
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Response Headers:
content-type: application/octet-stream
status: 204 No Content
Network Actions¶
Network actions are tasks that can be executed on a private networks: rename and managing nodes, that conclude these networks.
Attribute | Type | Description |
---|---|---|
id | string | Network id against what action event was triggered.
|
name | string | Name of the network with given id.
|
nodes | assoc array | This attribute contains the list of nodes joined to
private network in form “vm id” : “vm name”
|
Rename network¶
To rename a network, send a POST request to /api/v1/networks/$NET_ID/actions. Set the “type” attribute to change_name and set the new name in “name” attribute.
Name | Type | Description | Required |
---|---|---|---|
type | string | Must be change_name | true |
name | string | Network name of your choise | true |
The response will be a JSON object with a key called network. The value will be a actual network properties object:
Attribute | Type | Description |
---|---|---|
id | string | Network id against what action event was triggered.
|
name | string | Name of the network with given id.
|
nodes | assoc array | This attribute contains the list of nodes joined to
private network in form “vm id” : “vm name”
|
cURL Example:
curl -X POST -H 'Content-Type: application/json' -u 'user@example.com:password' -d '{"type":"change_name","name":"new-name"}' "https://cloudsfor.com/api/v1/networks/5609f1ee1b0c4d2da622737b5ca25e6c/actions"
Request Headers:
Content-Type: application/json
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Request Body:
{
"type": "change_name",
"name": "new-name"
}
Response Headers:
content-type: application/json; charset=utf-8
status: 201 Created
Response Body:
{
"network": {
"id": "5609f1ee1b0c4d2da622737b5ca25e6c",
"name": "new-name",
"nodes": [
{"id": "26bf786c44244fadaf77d19d50335ab0", "name": "vm1"},
{"id": "82ed0abac2b84ffea59d64b3d2929b95", "name": "vm2"}
]
}
}
Managing nodes¶
To add or delete nodes, included into your private network, send send a POST request to /api/v1/networks/$NET_ID/actions. Set the “type” attribute to change_nodes and the “nodes” attribute to an array of nodes, that should be joined into a network.
Name | Type | Description | Required |
---|---|---|---|
type | string | Must be change_nodes | true |
data | array | List of nodes on network | true |
The response will be a JSON object with a key called network. The value will be a actual network properties object:
Attribute | Type | Description |
---|---|---|
id | string | Network id against what action event was triggered.
|
name | string | Name of the network with given id.
|
nodes | assoc array | This attribute contains the list of nodes joined to
private network in form “vm id” : “vm name”
|
cURL Example:
curl -X POST -H 'Content-Type: application/json' -u 'user@example.com:password' -d '{"type":"change_nodes","nodes":["a57598d3ae004ee085ba152709b632e5", "82ed0abac2b84ffea59d64b3d2929b95"]}' "https://cloudsfor.com/api/v1/networks/5609f1ee1b0c4d2da622737b5ca25e6c/actions"
Request Headers:
Content-Type: application/json
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Request Body:
{
"type": "change_nodes",
"data": [
"a57598d3ae004ee085ba152709b632e5",
"82ed0abac2b84ffea59d64b3d2929b95"
]
}
Response Headers:
content-type: application/json; charset=utf-8
status: 201 Created
Response Body:
{
"network": {
"id": "5609f1ee1b0c4d2da622737b5ca25e6c",
"name": "new-name",
"nodes": [
{"id": "a57598d3ae004ee085ba152709b632e5", "name": "vm1"},
{"id": "82ed0abac2b84ffea59d64b3d2929b95", "name": "vm2"}
]
}
}