FrontEnd API (Project Nano)
RESTful API provided by FrontEnd module, listen at port 5870 by default.
This document corresponds to version 1.3.1
Verify and allocate a new session before call functions, set session ID in header ‘Nano-Session’ for authentication.
Resource Pool ¶
APIs for manage resource pools
Compute Pool ¶
Manage compute pools
Get All Compute PoolsGET/compute_pools/
Query all compute pools in current zone
Example URI
Get All Compute Pools
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data":[
{
"name": "default",
"enabled": true,
"cells": 10,
"storage": "some\_ceph\_cluster",
"network": "nat\_address\_pool\_1",
"failover": true
},
{
"name": "fast_instance",
"enabled": true,
"cells": 12,
"storage": "some\_ceph\_cluster",
"network": "nat\_address\_pool\_1",
"failover": false
}
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"storage": {
"type": "string",
"description": "name of storage pool, using local storage when omit"
},
"network": {
"type": "string",
"description": "name of address pool, using bridge mode by default when omit"
},
"failover": {
"type": "boolean",
"description": "enable failover on shared storage"
},
"name": {
"type": "string",
"description": "pool name"
},
"enabled": {
"type": "boolean",
"description": "is pool enabled"
},
"cells": {
"type": "number",
"description": "count of attached cells in the pool"
}
}
},
"description": "list of compute pools"
}
}
}
Get Compute Pool StatusGET/compute_pools/{pool}
Get status of a compute pool
Example URI
- pool
string
(required)name of compute pool
Get Compute Pool Status
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data": {
"name": "default",
"enabled": true,
"cells": 10,
"storage": "some_cluster",
"network": "address_pool1",
"failover": true
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"storage": {
"type": "string",
"description": "name of storage pool, using local storage when omit"
},
"network": {
"type": "string",
"description": "name of address pool, using bridge mode by default when omit"
},
"failover": {
"type": "boolean",
"description": "enable failover on shared storage"
},
"name": {
"type": "string",
"description": "pool name"
},
"enabled": {
"type": "boolean",
"description": "is pool enabled"
},
"cells": {
"type": "number",
"description": "count of attached cells in the pool"
}
},
"description": "status of compute pool"
}
}
}
Create New Compute PoolPOST/compute_pools/{pool}
Create a new compute pool
Example URI
- pool
string
(required)name of compute pool
Create New Compute Pool
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
[
{
"storage": "some_cephcluster",
"network": "address_pool1",
"failover": true
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"storage": {
"type": "string",
"description": "name of storage pool, using local storage when omit"
},
"network": {
"type": "string",
"description": "name of address pool, using bridge mode by default when omit"
},
"failover": {
"type": "boolean",
"description": "enable failover on shared storage"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Delete Compute PoolDELETE/compute_pools/{pool}
Delete a compute pool
Example URI
- pool
string
(required)name of compute pool
Delete Compute Pool
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Modify Compute PoolPUT/compute_pools/{pool}
Modify configure of a compute pool
Example URI
- pool
string
(required)name of compute pool
Modify Compute Pool
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
[
{
"failover": true,
"storage": "nfs-poo1"
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"storage": {
"type": "string",
"description": "name of storage pool, using local storage when omit"
},
"network": {
"type": "string",
"description": "name of address pool, using bridge mode by default when omit"
},
"failover": {
"type": "boolean",
"description": "enable failover on shared storage"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Compute Pool Cell ¶
Manage compute cells in a pool
Query Unallocated CellsGET/compute_pool_cells/
query cells not attached to any pool
Example URI
Query Unallocated Cells
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": [
{
"name": "cell3",
"address": "172.16.3.78",
"enabled": true,
"alive": true,
},
{
"name": "cell4",
"address": "172.16.3.79",
"enabled": true,
"alive": true,
}
]
}
]
Query Cells In PoolGET/compute_pool_cells/{pool}
Query all cells attached in a pool
Example URI
- pool
string
(required)pool name
Query Attached Cells
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": [
{
"name": "cell1",
"address": "172.16.4.7",
"enabled": true,
"alive": true,
},
{
"name": "cell2",
"address": "172.16.7.3",
"enabled": true,
"alive": true,
}
]
}
]
Add Compute CellPOST/compute_pool_cells/{pool}/{cell}
Add a new cell to the compute pool
Example URI
- pool
string
(required)pool name
- cell
string
(required)cell name
Add Compute Cell
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Remove Compute CellDELETE/compute_pool_cells/{pool}/{cell}
Remove an attached cell from the compute pool
Example URI
- pool
string
(required)pool name
- cell
string
(required)cell name
Remove Compute Cell
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Modify Compute CellPUT/compute_pool_cells/{pool}/{cell}
Modify a compute cell
Example URI
- pool
string
(required)pool name
- cell
string
(required)cell name
Modify Compute Cell
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"enable": false
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"enable": {
"type": "boolean",
"description": "enable cell. The disabled cell does not participate in instance allocation"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Get Cell StatusGET/compute_pool_cells/{pool}/{cell}
Get current status of a compute cell
Example URI
- pool
string
(required)pool name
- cell
string
(required)cell name
Get Cell Status
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": {
"name": "cell1",
"address": "172.16.4.7",
"enabled": true,
"alive": true,
"storage": [
{
"name": "nfspool1",
"attached": true
},
{
"name": "cephpool1",
"attached": false,
"error": "not support yet"
}
]
}
}
]
Storage Pool ¶
APIs manage the storage pools
Query Storage PoolGET/storage_pools/
Query configures of all storage pool
Example URI
Query Storage Pool
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": [
{
"name": "nfspool1",
"type": "nfs",
"host": "nfs.nano.com",
"target": "/var/nano/pool1"
},
{
"name": "cephpool1",
"type": "ceph",
"host": "ceph.nano.com",
"target": "some_pool_in_ceph"
}
]
}
]
Get Storage Pool ConfigureGET/storage_pools/{pool}
Get the configure of a storage pool
Example URI
- pool
string
(required)name of storage pool
Get Storage Pool Configure
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": {
"type": "nfs",
"host": "nfs.nano.com",
"target": "/var/nano/pool1"
}
}
]
Create New Storage PoolPOST/storage_pools/{pool}
Create a new stoarge pool
Example URI
- pool
string
(required)name of storage pool
Create Storage Pool
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"type": "nfs",
"host": "nfs.nano.com",
"target": "/var/nano/pool1"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"nfs"
],
"default": "nfs",
"description": "backend storage type"
},
"host": {
"type": "string",
"description": "IP or hostname of target host"
},
"target": {
"type": "string",
"description": "path of target host"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Modify Storage PoolPUT/storage_pools/{pool}
Modify stoarge pool, only available on an empty storage pool.
Example URI
- pool
string
(required)name of storage pool
Modify Storage Pool
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"type": "nfs",
"host": "another_nfs.nano.com",
"target": "/var/nano/new_location"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"nfs"
],
"default": "nfs",
"description": "backend storage type"
},
"host": {
"type": "string",
"description": "IP or hostname of target host"
},
"target": {
"type": "string",
"description": "path of target host"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Delete Storage PoolDELETE/storage_pools/{pool}
Delete a storage pool, only available on an empty storage pool.
Example URI
- pool
string
(required)name of storage pool
Delete Storage Pool
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Compute Zone Status ¶
Collect status and statistic data on compute zone
Query Zone StatusGET/compute_zone_status/
Query lastest status of a whole zone
Example URI
Query Zone Status
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data":{
"name": "default",
"pools": [1, 0]//[disabled, enabled]
"cells": [0, 25], //[offline, online]
"instances": [3, 100, 3, 1], //[stopped, running, lost, migrate]
"cpu_usage": 156.45,
"max_cpu": 320,
"available_memory": 560,
"max_memory": 960,
"available_disk": 12457,
"max_disk": 34000,
"read_speed": 8634,
"write_speed": 3673,
"receive_speed": 7634,
"send_speed": 2643,
"start_time": "2018-01-02 15:04:05"
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "source name"
},
"cpu_usage": {
"type": "number",
"description": "used cores in total"
},
"max_cpu": {
"type": "number",
"description": "total number of cores"
},
"available_memory": {
"type": "number",
"description": "total usable memory in bytes"
},
"max_memory": {
"type": "number",
"description": "all memory in bytes"
},
"available_disk": {
"type": "number",
"description": "total usable disk in bytes"
},
"max_disk": {
"type": "number",
"description": "all disk in bytes"
},
"read_speed": {
"type": "number",
"description": "disk read speed in bytes per second"
},
"write_speed": {
"type": "number",
"description": "disk write speed in bytes per second"
},
"receive_speed": {
"type": "number",
"description": "network receive speed in bytes per second"
},
"send_speed": {
"type": "number",
"description": "network send speed in bytes per second"
},
"pools": {
"type": "array",
"items": {
"type": "number"
},
"description": "[disabledPools, enabledPools]"
},
"cells": {
"type": "array",
"items": {
"type": "number"
},
"description": "[offlineCells, onlineCells]"
},
"instances": {
"type": "array",
"items": {
"type": "number"
},
"description": "[stoppedInstances, runningInstances, lostInstances, migratingInstances]"
},
"start_time": {
"type": "string",
"description": "system start time in 'YYYY-MM-DD HH:MI:SS' format"
}
},
"description": "statistic status"
}
}
}
Compute Pool Status ¶
Collect statistic status of compute pools
Query Status of All Compute PoolsGET/compute_pool_status/
Collect status of all compute pools
Example URI
Query Status of Compute Pools
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data":[{
"name": "default",
"enabled": true,
"cells": [0, 25], //[offline, online]
"instances": [3, 100, 3, 1], //[stopped, running, lost, migrate]
"cpu_usage": 156.45,
"max_cpu": 320,
"available_memory": 560,
"max_memory": 960,
"available_disk": 12457,
"max_disk": 34000,
"read_speed": 8634,
"write_speed": 3673,
"receive_speed": 7634,
"send_speed": 2643
},
{
"name": "pool2",
"enabled": true,
"cells": [0, 15], //[offline, online]
"instances": [3, 50, 0, 0], //[stopped, running, lost, migrate]
"cpu_usage": 156.45,
"max_cpu": 320,
"available_memory": 560,
"max_memory": 960,
"available_disk": 12457,
"max_disk": 34000,
"read_speed": 8634,
"write_speed": 3673,
"receive_speed": 7634,
"send_speed": 2643
}]
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "source name"
},
"cpu_usage": {
"type": "number",
"description": "used cores in total"
},
"max_cpu": {
"type": "number",
"description": "total number of cores"
},
"available_memory": {
"type": "number",
"description": "total usable memory in bytes"
},
"max_memory": {
"type": "number",
"description": "all memory in bytes"
},
"available_disk": {
"type": "number",
"description": "total usable disk in bytes"
},
"max_disk": {
"type": "number",
"description": "all disk in bytes"
},
"read_speed": {
"type": "number",
"description": "disk read speed in bytes per second"
},
"write_speed": {
"type": "number",
"description": "disk write speed in bytes per second"
},
"receive_speed": {
"type": "number",
"description": "network receive speed in bytes per second"
},
"send_speed": {
"type": "number",
"description": "network send speed in bytes per second"
},
"enabled": {
"type": "boolean",
"description": "is pool enabled"
},
"cells": {
"type": "array",
"items": {
"type": "number"
},
"description": "[offlineCells, onlineCells]"
},
"instances": {
"type": "array",
"items": {
"type": "number"
},
"description": "[stoppedInstances, runningInstances, lostInstances, migratingInstances]"
}
}
},
"description": "list of statistic status"
}
}
}
Get Status of a Compute PoolGET/compute_pool_status/{pool}
Collect statistic status on a compute pool
Example URI
- pool
string
(required)name of a compute pool
Get Status of A Compute Pool
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data":{
"name": "default",
"enabled": true,
"cells": [0, 25], //[offline, online]
"instances": [3, 100, 3, 1], //[stopped, running, lost, migrate]
"cpu_usage": 156.45,
"max_cpu": 320,
"available_memory": 560,
"max_memory": 960,
"available_disk": 12457,
"max_disk": 34000,
"read_speed": 8634,
"write_speed": 3673,
"receive_speed": 7634,
"send_speed": 2643
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "source name"
},
"cpu_usage": {
"type": "number",
"description": "used cores in total"
},
"max_cpu": {
"type": "number",
"description": "total number of cores"
},
"available_memory": {
"type": "number",
"description": "total usable memory in bytes"
},
"max_memory": {
"type": "number",
"description": "all memory in bytes"
},
"available_disk": {
"type": "number",
"description": "total usable disk in bytes"
},
"max_disk": {
"type": "number",
"description": "all disk in bytes"
},
"read_speed": {
"type": "number",
"description": "disk read speed in bytes per second"
},
"write_speed": {
"type": "number",
"description": "disk write speed in bytes per second"
},
"receive_speed": {
"type": "number",
"description": "network receive speed in bytes per second"
},
"send_speed": {
"type": "number",
"description": "network send speed in bytes per second"
},
"enabled": {
"type": "boolean",
"description": "is pool enabled"
},
"cells": {
"type": "array",
"items": {
"type": "number"
},
"description": "[offlineCells, onlineCells]"
},
"instances": {
"type": "array",
"items": {
"type": "number"
},
"description": "[stoppedInstances, runningInstances, lostInstances, migratingInstances]"
}
},
"description": "statistic status"
}
}
}
Compute Cell Status ¶
Collect statistic status of compute cells
Query Status of Compute CellsGET/compute_cell_status/{pool}/
Collect statistic status of compute cells in a pool
Example URI
- pool
string
(required)name of target pool
Query Status of Compute Cells
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data":[
{
"name": "cell_93e3de24f0a4",
"address": "172.16.4.7",
"enabled": true,
"alive": true,
"instances": [3, 15, 0, 0], //[stopped, running, lost, migrate]
"cpu_usage": 156.45,
"max_cpu": 320,
"available_memory": 560,
"max_memory": 960,
"available_disk": 12457,
"max_disk": 34000,
"read_speed": 8634,
"write_speed": 3673,
"receive_speed": 7634,
"send_speed": 2643
},
{
"name": "cell_93e3de24f0a3",
"address": "172.16.4.8",
"enabled": true,
"alive": true,
"instances": [0, 12, 1, 0], //[stopped, running, lost, migrate]
"cpu_usage": 156.45,
"max_cpu": 320,
"available_memory": 560,
"max_memory": 960,
"available_disk": 12457,
"max_disk": 34000,
"read_speed": 8634,
"write_speed": 3673,
"receive_speed": 7634,
"send_speed": 2643
}
]
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "source name"
},
"cpu_usage": {
"type": "number",
"description": "used cores in total"
},
"max_cpu": {
"type": "number",
"description": "total number of cores"
},
"available_memory": {
"type": "number",
"description": "total usable memory in bytes"
},
"max_memory": {
"type": "number",
"description": "all memory in bytes"
},
"available_disk": {
"type": "number",
"description": "total usable disk in bytes"
},
"max_disk": {
"type": "number",
"description": "all disk in bytes"
},
"read_speed": {
"type": "number",
"description": "disk read speed in bytes per second"
},
"write_speed": {
"type": "number",
"description": "disk write speed in bytes per second"
},
"receive_speed": {
"type": "number",
"description": "network receive speed in bytes per second"
},
"send_speed": {
"type": "number",
"description": "network send speed in bytes per second"
},
"address": {
"type": "string",
"description": "IP or hostname of cell node"
},
"enabled": {
"type": "boolean",
"description": "is cell enabled"
},
"alive": {
"type": "boolean",
"description": "is cell alive"
}
}
},
"description": "list of statistic status"
}
}
}
Get Compute Cell StatusGET/compute_cell_status/{cell}
Collect statistic status of a compute cell
Example URI
- cell
string
(required)name of target cell
Get Status of A Compute Cell
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data":{
"name": "cell_93e3de24f0a4",
"address": "172.16.4.7",
"enabled": true,
"alive": true,
"instances": [3, 15, 0, 0], //[stopped, running, lost, migrate]
"cpu_usage": 156.45,
"max_cpu": 320,
"available_memory": 560,
"max_memory": 960,
"available_disk": 12457,
"max_disk": 34000,
"read_speed": 8634,
"write_speed": 3673,
"receive_speed": 7634,
"send_speed": 2643
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "source name"
},
"cpu_usage": {
"type": "number",
"description": "used cores in total"
},
"max_cpu": {
"type": "number",
"description": "total number of cores"
},
"available_memory": {
"type": "number",
"description": "total usable memory in bytes"
},
"max_memory": {
"type": "number",
"description": "all memory in bytes"
},
"available_disk": {
"type": "number",
"description": "total usable disk in bytes"
},
"max_disk": {
"type": "number",
"description": "all disk in bytes"
},
"read_speed": {
"type": "number",
"description": "disk read speed in bytes per second"
},
"write_speed": {
"type": "number",
"description": "disk write speed in bytes per second"
},
"receive_speed": {
"type": "number",
"description": "network receive speed in bytes per second"
},
"send_speed": {
"type": "number",
"description": "network send speed in bytes per second"
},
"address": {
"type": "string",
"description": "IP or hostname of cell node"
},
"enabled": {
"type": "boolean",
"description": "is cell enabled"
},
"alive": {
"type": "boolean",
"description": "is cell alive"
}
},
"description": "statistic status"
}
}
}
Cell Storages ¶
Manage storage configure of a cell
Query Cell StoragesGET/compute_cell_status/{pool}/{cell}/storages/
Get Storage Paths for a cell
Example URI
- pool
string
(required)name of target pool
- cell
string
(required)name of target cell
Query Storages
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data":{
"mode": "local",
"system": [
"/var/lib/libvirt/images/"
],
"data": [
"/var/lib/libvirt/images/"
],
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"mode": {
"type": "string",
"enum": [
"local",
"nfs",
"ceph"
],
"default": "local",
"description": "cell storage mode"
},
"system": {
"type": "array",
"description": "disk path for storage system disk of guests, available for local mode"
},
"data": {
"type": "array",
"description": "disk path for storage data disk of guests, available for local mode"
}
},
"description": "cell storages configure"
}
}
}
Modify Cell Storage PathsPUT/compute_cell_status/{pool}/{cell}/storages/
Modify Storage Paths
Example URI
- pool
string
(required)name of target pool
- cell
string
(required)name of target cell
Modify Storage Paths
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"default": "/var/lib/libvirt/images/"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"default": {
"type": "string",
"description": "default storage path"
}
}
}
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Instance Status ¶
Query status of instances
Query Status of Instances In PoolGET/instance_status/{pool}/
Query status of all instances in a pool
Example URI
- pool
string
(required)name of target pool
Query Instances In Pool
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": [
{
"name": "test01",
"id": "df6723jhew67f3fdsf-fefew",
"cell": "cell_abc",
"host": "10.100.13.9",
"created": true,
"running": true,
"cores": 4,
"memory": 5120,
"disks": [
4864000,
854365
],
"auto_start": true,
"system": "linux",
"display_protocol": "vnc",
"monitor_secret": "abd",
"internal": {
"network_address": "172.18.6.7",
"display_address": "172.18.5.3:5901",
"allocated_address": "172.18.6.7"
},
"external": {
"network_address": "202.3.1.34",
"display_address": "202.3.1.34:5901"
},
"create_time": "2018-08-21 00:12:34",
"media_attached": true,
"media_source": "centos_7_x64_iso"
},
{
"name": "test02",
"id": "dr6ufh73dgjf3fdsf-fefew",
"cell": "cell_edv",
"host": "10.100.13.6",
"created": false,
"progress": 46,
"running": false,
"cores": 4,
"memory": 5120,
"disks": [
4864000,
854365
],
"auto_start": false,
"system": "linux"
}
]
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "guest name"
},
"owner": {
"type": "string",
"description": "user id"
},
"group": {
"type": "string",
"description": "user group"
},
"pool": {
"type": "string",
"description": "compute pool name"
},
"cores": {
"type": "number",
"description": "number of cpu cores"
},
"memory": {
"type": "number",
"description": "memory size in bytes"
},
"disks": {
"type": "array",
"items": {
"type": "number"
},
"description": "[system_disk_size, data_disk_n_size...], size in bytes"
},
"auto_start": {
"type": "boolean",
"description": "auto start instance"
},
"system": {
"type": "string",
"description": "id of system"
},
"network_address": {
"type": "string",
"description": "optional specified ip address"
},
"ethernet_address": {
"type": "string",
"description": "optional specified mac address"
},
"from_image": {
"type": "string",
"description": "ID of source disk image when cloning"
},
"ports": {
"type": "array",
"description": "nat ports"
},
"template": {
"type": "string",
"description": "id of system template"
},
"modules": {
"type": "array",
"description": "installed guest module, \"qemu\"/\"cloud-init\""
},
"cloud_init": {
"type": "object",
"properties": {
"root_enabled": {
"type": "boolean",
"description": "allow root user login via SSH, enable in default"
},
"admin_name": {
"type": "string",
"description": "specify admin name, using `root` when omitted"
},
"admin_secret": {
"type": "string",
"description": "password in plain text, nano generate a new one when omitted"
},
"data_path": {
"type": "string",
"description": "data disk mount path, `/opt/data` in default"
}
},
"description": "cloud-init params"
},
"qos": {
"type": "object",
"properties": {
"cpu_priority": {
"type": "string",
"enum": [
"high",
"medium",
"low"
],
"default": "medium",
"description": "CPU priority"
},
"write_speed": {
"type": "number",
"description": "disk write bps limit, 0 = unlimited"
},
"write_iops": {
"type": "number",
"description": "disk write iops limit, 0 = unlimited"
},
"read_speed": {
"type": "number",
"description": "disk read bps limit, 0 = unlimited"
},
"read_iops": {
"type": "number",
"description": "disk read iops limit, 0 = unlimited"
},
"receive_speed": {
"type": "number",
"description": "network receive bps, 0 = unlimited"
},
"send_speed": {
"type": "number",
"description": "network send bps, 0 = unlimited"
}
},
"description": "qos config"
},
"security_policy_group": {
"type": "string",
"description": "id of security group"
},
"id": {
"type": "string",
"description": "guest ID"
},
"created": {
"type": "boolean",
"description": "is instance created"
},
"running": {
"type": "boolean",
"description": "is instance running"
},
"cell": {
"type": "string",
"description": "name of hosting cell"
},
"host": {
"type": "string",
"description": "IP/domain of hosting server"
},
"lost": {
"type": "boolean",
"description": "is instance lost"
},
"monitor_secret": {
"type": "string",
"description": "monitor password"
},
"display_protocol": {
"type": "string",
"description": "name of monitor protocol"
},
"total_disk": {
"type": "number",
"description": "total disk size in bytes"
},
"progress": {
"type": "number",
"description": "creating progress, range from 0 to 100"
},
"create_time": {
"type": "string",
"description": "created time in format 'YYYY-MM-DD HH:MI:SS'"
},
"internal": {
"type": "object",
"properties": {
"network_address": {
"type": "string",
"description": "network address of interface, IPv4 dot format: '172.10.6.8'"
},
"display_address": {
"type": "string",
"description": "monitor address of guest, 'host:port'"
},
"allocated_address": {
"type": "string",
"description": "interface address allocated by system when attached with address pool"
}
},
"description": "status of internal network interface"
},
"external": {
"type": "object",
"properties": {
"network_address": {
"type": "string",
"description": "network address of interface, IPv4 dot format: '172.10.6.8'"
},
"display_address": {
"type": "string",
"description": "monitor address of guest, 'host:port'"
},
"allocated_address": {
"type": "string",
"description": "interface address allocated by system when attached with address pool"
}
},
"description": "status of external network interface"
},
"cpu_usage": {
"type": "number",
"description": "total CPU usage range from 0.00 to 100.00"
},
"memory_available": {
"type": "number",
"description": "available memory size in bytes"
},
"disk_available": {
"type": "number",
"description": "available disk size in bytes"
},
"bytes_read": {
"type": "number",
"description": "total read disk bytes"
},
"bytes_written": {
"type": "number",
"description": "total written disk bytes"
},
"bytes_received": {
"type": "number",
"description": "total received network bytes"
},
"bytes_sent": {
"type": "number",
"description": "total sent network bytes"
},
"media_attached": {
"type": "boolean",
"description": "is media image attached"
},
"media_source": {
"type": "string",
"description": "id of attached media image"
}
}
},
"description": "list of statistic status"
}
}
}
Query Instances In CellGET/instance_status/{cell}/
Query status of instances in a cell
Example URI
- cell
string
(required)name of target cell
Query Instances In Cell
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": [
{
"name": "test01",
"id": "df6723jhew67f3fdsf-fefew",
"cell": "cell_abc",
"host": "10.100.13.9",
"created": true,
"running": true,
"cores": 4,
"memory": 5120,
"disks": [
4864000,
854365
],
"auto_start": true,
"system": "linux",
"display_protocol": "vnc",
"monitor_secret": "abd",
"internal": {
"network_address": "172.18.6.7",
"display_address": "172.18.5.3:5901",
"allocated_address": "172.18.6.7"
},
"external": {
"network_address": "202.3.1.34",
"display_address": "202.3.1.34:5901"
},
"create_time": "2018-08-21 00:12:34",
"media_attached": true,
"media_source": "centos_7_x64_iso"
},
{
"name": "test02",
"id": "dr6ufh73dgjf3fdsf-fefew",
"cell": "cell_edv",
"host": "10.100.13.6",
"created": false,
"progress": 46,
"running": false,
"cores": 4,
"memory": 5120,
"disks": [
4864000,
854365
],
"auto_start": false,
"system": "linux"
}
]
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "guest name"
},
"owner": {
"type": "string",
"description": "user id"
},
"group": {
"type": "string",
"description": "user group"
},
"pool": {
"type": "string",
"description": "compute pool name"
},
"cores": {
"type": "number",
"description": "number of cpu cores"
},
"memory": {
"type": "number",
"description": "memory size in bytes"
},
"disks": {
"type": "array",
"items": {
"type": "number"
},
"description": "[system_disk_size, data_disk_n_size...], size in bytes"
},
"auto_start": {
"type": "boolean",
"description": "auto start instance"
},
"system": {
"type": "string",
"description": "id of system"
},
"network_address": {
"type": "string",
"description": "optional specified ip address"
},
"ethernet_address": {
"type": "string",
"description": "optional specified mac address"
},
"from_image": {
"type": "string",
"description": "ID of source disk image when cloning"
},
"ports": {
"type": "array",
"description": "nat ports"
},
"template": {
"type": "string",
"description": "id of system template"
},
"modules": {
"type": "array",
"description": "installed guest module, \"qemu\"/\"cloud-init\""
},
"cloud_init": {
"type": "object",
"properties": {
"root_enabled": {
"type": "boolean",
"description": "allow root user login via SSH, enable in default"
},
"admin_name": {
"type": "string",
"description": "specify admin name, using `root` when omitted"
},
"admin_secret": {
"type": "string",
"description": "password in plain text, nano generate a new one when omitted"
},
"data_path": {
"type": "string",
"description": "data disk mount path, `/opt/data` in default"
}
},
"description": "cloud-init params"
},
"qos": {
"type": "object",
"properties": {
"cpu_priority": {
"type": "string",
"enum": [
"high",
"medium",
"low"
],
"default": "medium",
"description": "CPU priority"
},
"write_speed": {
"type": "number",
"description": "disk write bps limit, 0 = unlimited"
},
"write_iops": {
"type": "number",
"description": "disk write iops limit, 0 = unlimited"
},
"read_speed": {
"type": "number",
"description": "disk read bps limit, 0 = unlimited"
},
"read_iops": {
"type": "number",
"description": "disk read iops limit, 0 = unlimited"
},
"receive_speed": {
"type": "number",
"description": "network receive bps, 0 = unlimited"
},
"send_speed": {
"type": "number",
"description": "network send bps, 0 = unlimited"
}
},
"description": "qos config"
},
"security_policy_group": {
"type": "string",
"description": "id of security group"
},
"id": {
"type": "string",
"description": "guest ID"
},
"created": {
"type": "boolean",
"description": "is instance created"
},
"running": {
"type": "boolean",
"description": "is instance running"
},
"cell": {
"type": "string",
"description": "name of hosting cell"
},
"host": {
"type": "string",
"description": "IP/domain of hosting server"
},
"lost": {
"type": "boolean",
"description": "is instance lost"
},
"monitor_secret": {
"type": "string",
"description": "monitor password"
},
"display_protocol": {
"type": "string",
"description": "name of monitor protocol"
},
"total_disk": {
"type": "number",
"description": "total disk size in bytes"
},
"progress": {
"type": "number",
"description": "creating progress, range from 0 to 100"
},
"create_time": {
"type": "string",
"description": "created time in format 'YYYY-MM-DD HH:MI:SS'"
},
"internal": {
"type": "object",
"properties": {
"network_address": {
"type": "string",
"description": "network address of interface, IPv4 dot format: '172.10.6.8'"
},
"display_address": {
"type": "string",
"description": "monitor address of guest, 'host:port'"
},
"allocated_address": {
"type": "string",
"description": "interface address allocated by system when attached with address pool"
}
},
"description": "status of internal network interface"
},
"external": {
"type": "object",
"properties": {
"network_address": {
"type": "string",
"description": "network address of interface, IPv4 dot format: '172.10.6.8'"
},
"display_address": {
"type": "string",
"description": "monitor address of guest, 'host:port'"
},
"allocated_address": {
"type": "string",
"description": "interface address allocated by system when attached with address pool"
}
},
"description": "status of external network interface"
},
"cpu_usage": {
"type": "number",
"description": "total CPU usage range from 0.00 to 100.00"
},
"memory_available": {
"type": "number",
"description": "available memory size in bytes"
},
"disk_available": {
"type": "number",
"description": "available disk size in bytes"
},
"bytes_read": {
"type": "number",
"description": "total read disk bytes"
},
"bytes_written": {
"type": "number",
"description": "total written disk bytes"
},
"bytes_received": {
"type": "number",
"description": "total received network bytes"
},
"bytes_sent": {
"type": "number",
"description": "total sent network bytes"
},
"media_attached": {
"type": "boolean",
"description": "is media image attached"
},
"media_source": {
"type": "string",
"description": "id of attached media image"
}
}
},
"description": "list of statistic status"
}
}
}
Address Pool ¶
Manage Address Pools
Query All Address PoolsGET/address_pools/
Query all address pools
Example URI
Query All Address Pools
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data": [
{
"name": "address1",
"gateway": "172.16.3.254",
"addresses": 120,
"allocated": 17
},
{
"name": "address2",
"gateway": "172.16.7.254",
"addresses": 230,
"allocated": 10
}
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "pool name"
},
"gateway": {
"type": "string",
"description": "gateway address"
},
"provider": {
"type": "string",
"enum": [
"dhcp",
"cloudinit"
],
"default": "dhcp",
"description": "provider method"
},
"mode": {
"type": "string",
"enum": [
"internal",
"external",
"both"
],
"default": "internal",
"description": "network interface mode"
},
"addresses": {
"type": "number",
"description": "address count"
},
"allocated": {
"type": "number",
"description": "allocated count"
}
}
},
"description": "list of address pool"
}
}
}
Get Address Pool StatusGET/address_pools/{name}
Get address pool status
Example URI
- name
string
(required)pool name
Get Address Pool Status
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data":{
"gateway": "172.16.3.254",
"dns": [
"8.8.8.8",
"10.10.10.10"
],
"provider": "dhcp",
"mode": "internal",
"ranges": [
{
"start": "172.16.3.1",
"end": "172.16.3.18",
"netmask": "255.255.255.0",
},
{
"start": "172.16.3.20",
"end": "172.16.3.190",
"netmask": "255.255.255.0",
}
],
"allocated": [
{
"address": "172.16.3.6",
"instance": "abcdef-1234567890",
},
{
"address": "172.16.3.17",
"instance": "abcdef-1234567893",
}
]
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "pool name"
},
"gateway": {
"type": "string",
"description": "gateway address"
},
"provider": {
"type": "string",
"enum": [
"dhcp",
"cloudinit"
],
"default": "dhcp",
"description": "provider method"
},
"mode": {
"type": "string",
"enum": [
"internal",
"external",
"both"
],
"default": "internal",
"description": "network interface mode"
},
"ranges": {
"type": "array",
"description": "list of address range"
},
"allocated": {
"type": "array",
"description": "list of allocated address"
}
},
"description": "address pool status"
}
}
}
Create New Address PoolPOST/address_pools/{name}
Create a new address pool
Example URI
- name
string
(required)pool name
Create A New Address Pool
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"gateway": "172.16.3.254",
"dns": [
"8.8.8.8",
"10.10.10.10"
],
"provider": "cloudinit",
"mode": "external"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "pool name"
},
"gateway": {
"type": "string",
"description": "gateway address"
},
"provider": {
"type": "string",
"enum": [
"dhcp",
"cloudinit"
],
"default": "dhcp",
"description": "provider method"
},
"mode": {
"type": "string",
"enum": [
"internal",
"external",
"both"
],
"default": "internal",
"description": "network interface mode"
}
}
}
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Modify Address PoolPUT/address_pools/{name}
Modify address pool
Example URI
- name
string
(required)pool name
Modify A Address Pool
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"gateway": "172.16.3.254",
"dns": [
"8.8.8.8",
"10.10.10.10"
],
"provider": "dhcp",
"mode": "both"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "pool name"
},
"gateway": {
"type": "string",
"description": "gateway address"
},
"provider": {
"type": "string",
"enum": [
"dhcp",
"cloudinit"
],
"default": "dhcp",
"description": "provider method"
},
"mode": {
"type": "string",
"enum": [
"internal",
"external",
"both"
],
"default": "internal",
"description": "network interface mode"
}
}
}
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Delete Address PoolDELETE/address_pools/{name}
Delete an address pool
Example URI
- name
string
(required)pool name
Delete Address Pool
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Address Range ¶
Manage Address Range
Query Address RangesGET/address_pools/{name}/{type}/ranges/
Query all ranges in pool
Example URI
- name
string
(required)name of address pool
- type
string
(optional) Default: internalrange type
Choices:
internal
external
Query Address Ranges
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data": [
{
"start": "172.16.3.1",
"end": "172.16.3.18",
"netmask": "255.255.255.0"
},
{
"start": "172.16.3.25",
"end": "172.16.3.200",
"netmask": "255.255.255.0"
}
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"start": {
"type": "string",
"description": "start of address range"
},
"end": {
"type": "string",
"description": "end of address range"
},
"netmask": {
"type": "string",
"description": "netmask of address range"
},
"type": {
"type": "string",
"enum": [
"internal",
"external"
],
"default": "internal",
"description": "address type"
}
}
},
"description": "list of address range"
}
}
}
Get Address Ranges StatusGET/address_pools/ranges/{start}
Get address range status
Example URI
- start
string
(required)start address of range
Get Address Ranges Status
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data":{
"start": "172.16.3.1",
"end": "172.16.3.18",
"netmask": "255.255.255.0",
"allocated": [
{
"address": "172.16.3.6",
"instance": "abcdef-1234567890",
},
{
"address": "172.16.3.17",
"instance": "abcdef-1234567893",
}
]
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"start": {
"type": "string",
"description": "start address of ip range"
},
"end": {
"type": "string",
"description": "end address of ip range"
},
"netmask": {
"type": "string",
"description": "netmask of ip range"
},
"allocated": {
"type": "array",
"description": "list of allocated addresses"
}
}
}
}
}
Add Address RangePOST/address_pools/ranges/{start}
Add a new address range
Example URI
- start
string
(required)start address of range
Add Address Range
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"end": "172.16.3.18",
"netmask": "255.255.255.0"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"end": {
"type": "string",
"description": "end address of ip range"
},
"netmask": {
"type": "string",
"description": "netmask of ip range"
}
}
}
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Remove Address RangeDELETE/address_pools/ranges/{start}
Remove an address range
Example URI
- start
string
(required)start address of range
Remove Range
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Virtual machines ¶
Manage All guests and instances
Guest Query ¶
Interface for query all guest in specified pool, cell or status flags
Query Guests With ConditionsGET/guest_search/{?pool,cell,status,created}
Example URI
- pool
string
(required)target pool name
- cell
string
(optional)target cell
- status
number
(optional)running status
- created
boolean
(optional)guest created
Query Guests
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data":[
{
"name": "guest1",
"id": "df6723jhew67f3fdsf-fefew",
"running": false,
"owner": "admin",
"group": "manager",
"pool": "pool1",
"cell": "cell_93e3de24f0a4",
"host": "172.10.4.1",
"cores": 4,
"memory": 5120,
"total_disk": 4864000,
"disks": [482345, 487534],
"auto_start": true,
"system": "windows",
"ethernet_address": "ed:35:3d:5a:4e:3f",
"display_protocol": "vnc",
"internal":{
"network_address": "172.18.6.7",
"display_address": "172.18.5.3:5901",
"allocated_address": "172.18.6.7"
},
"external":{
"network_address": "202.3.1.34",
"display_address": "202.3.1.34:5901"
},
"create_time": "2018-08-21 00:12:34",
"qos": {
"cpu_priority": "high",
"write_speed": 1048576,
"write_iops": 100,
"read_speed": 1048576,
"read_iops": 100,
"receive_speed": 10485760,
"send_speed": 10485760
}
}
],
[
{
"name": "guest2",
"id": "df6723jhew67f3fdsf-fefet",
"running": false,
"owner": "admin",
"group": "manager",
"pool": "pool1",
"cell": "cell_93e3de24f0a4",
"host": "172.10.4.1",
"cores": 4,
"memory": 5120,
"total_disk": 4864000,
"disks": [482345, 487534]
"auto_start": true,
"system": "linux",
"ethernet_address": "ed:35:3d:5a:4e:3f",
"display_protocol": "vnc",
"internal":{
"network_address": "172.18.6.7",
"display_address": "172.18.5.3:5901",
"allocated_address": "172.18.6.7"
},
"external":{
"network_address": "202.3.1.34",
"display_address": "202.3.1.34:5901"
},
"create_time": "2018-08-21 00:12:34",
"qos": {
"cpu_priority": "high",
"write_speed": 1048576,
"write_iops": 100,
"read_speed": 1048576,
"read_iops": 100,
"receive_speed": 10485760,
"send_speed": 10485760
}
}
]
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "guest name"
},
"owner": {
"type": "string",
"description": "user id"
},
"group": {
"type": "string",
"description": "user group"
},
"pool": {
"type": "string",
"description": "compute pool name"
},
"cores": {
"type": "number",
"description": "number of cpu cores"
},
"memory": {
"type": "number",
"description": "memory size in bytes"
},
"disks": {
"type": "array",
"items": {
"type": "number"
},
"description": "[system_disk_size, data_disk_n_size...], size in bytes"
},
"auto_start": {
"type": "boolean",
"description": "auto start instance"
},
"system": {
"type": "string",
"description": "id of system"
},
"network_address": {
"type": "string",
"description": "optional specified ip address"
},
"ethernet_address": {
"type": "string",
"description": "optional specified mac address"
},
"from_image": {
"type": "string",
"description": "ID of source disk image when cloning"
},
"ports": {
"type": "array",
"description": "nat ports"
},
"template": {
"type": "string",
"description": "id of system template"
},
"modules": {
"type": "array",
"description": "installed guest module, \"qemu\"/\"cloud-init\""
},
"cloud_init": {
"type": "object",
"properties": {
"root_enabled": {
"type": "boolean",
"description": "allow root user login via SSH, enable in default"
},
"admin_name": {
"type": "string",
"description": "specify admin name, using `root` when omitted"
},
"admin_secret": {
"type": "string",
"description": "password in plain text, nano generate a new one when omitted"
},
"data_path": {
"type": "string",
"description": "data disk mount path, `/opt/data` in default"
}
},
"description": "cloud-init params"
},
"qos": {
"type": "object",
"properties": {
"cpu_priority": {
"type": "string",
"enum": [
"high",
"medium",
"low"
],
"default": "medium",
"description": "CPU priority"
},
"write_speed": {
"type": "number",
"description": "disk write bps limit, 0 = unlimited"
},
"write_iops": {
"type": "number",
"description": "disk write iops limit, 0 = unlimited"
},
"read_speed": {
"type": "number",
"description": "disk read bps limit, 0 = unlimited"
},
"read_iops": {
"type": "number",
"description": "disk read iops limit, 0 = unlimited"
},
"receive_speed": {
"type": "number",
"description": "network receive bps, 0 = unlimited"
},
"send_speed": {
"type": "number",
"description": "network send bps, 0 = unlimited"
}
},
"description": "qos config"
},
"security_policy_group": {
"type": "string",
"description": "id of security group"
},
"id": {
"type": "string",
"description": "guest ID"
},
"created": {
"type": "boolean",
"description": "is instance created"
},
"running": {
"type": "boolean",
"description": "is instance running"
},
"cell": {
"type": "string",
"description": "name of hosting cell"
},
"host": {
"type": "string",
"description": "IP/domain of hosting server"
},
"lost": {
"type": "boolean",
"description": "is instance lost"
},
"monitor_secret": {
"type": "string",
"description": "monitor password"
},
"display_protocol": {
"type": "string",
"description": "name of monitor protocol"
},
"total_disk": {
"type": "number",
"description": "total disk size in bytes"
},
"progress": {
"type": "number",
"description": "creating progress, range from 0 to 100"
},
"create_time": {
"type": "string",
"description": "created time in format 'YYYY-MM-DD HH:MI:SS'"
},
"internal": {
"type": "object",
"properties": {
"network_address": {
"type": "string",
"description": "network address of interface, IPv4 dot format: '172.10.6.8'"
},
"display_address": {
"type": "string",
"description": "monitor address of guest, 'host:port'"
},
"allocated_address": {
"type": "string",
"description": "interface address allocated by system when attached with address pool"
}
},
"description": "status of internal network interface"
},
"external": {
"type": "object",
"properties": {
"network_address": {
"type": "string",
"description": "network address of interface, IPv4 dot format: '172.10.6.8'"
},
"display_address": {
"type": "string",
"description": "monitor address of guest, 'host:port'"
},
"allocated_address": {
"type": "string",
"description": "interface address allocated by system when attached with address pool"
}
},
"description": "status of external network interface"
}
}
},
"description": "list of instances"
}
}
}
Manage Guest ¶
Creating, Deleting or query one guest
Query Guest StatusGET/guests/{id}
Get status with ID when creating, 201 for creating guest, 200 for created guest
Example URI
- id
string
(required)guest id
Guest Guest Status
Headers
Nano-session: 1234567890-abcdef
201
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": {
"name": "test01",
"created": false,
"progress": 57
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "guest id"
},
"created": {
"type": "boolean",
"description": "is guest created"
},
"progress": {
"type": "number",
"description": "range from 0 to 100"
}
}
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": {
"name": "test01",
"created": true,
"running": false,
"owner": "admin",
"group": "manager",
"pool": "pool1",
"cell": "cell_93e3de24f0a4",
"host": "172.10.4.1",
"cores": 4,
"memory": 5120,
"total_disk": 4864000,
"disks": [
482345,
487534
],
"auto_start": true,
"system": "linux",
"ethernet_address": "ed:35:3d:5a:4e:3f",
"display_protocol": "vnc",
"monitor_secret": "abd",
"internal": {
"network_address": "172.18.6.7",
"display_address": "172.18.5.3:5901",
"allocated_address": "172.18.6.7"
},
"external": {
"network_address": "202.3.1.34",
"display_address": "202.3.1.34:5901"
},
"create_time": "2018-08-21 00:12:34",
"qos": {
"cpu_priority": "high",
"write_speed": 1048576,
"write_iops": 100,
"read_speed": 1048576,
"read_iops": 100,
"receive_speed": 10485760,
"send_speed": 10485760
}
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "guest name"
},
"owner": {
"type": "string",
"description": "user id"
},
"group": {
"type": "string",
"description": "user group"
},
"pool": {
"type": "string",
"description": "compute pool name"
},
"cores": {
"type": "number",
"description": "number of cpu cores"
},
"memory": {
"type": "number",
"description": "memory size in bytes"
},
"disks": {
"type": "array",
"items": {
"type": "number"
},
"description": "[system_disk_size, data_disk_n_size...], size in bytes"
},
"auto_start": {
"type": "boolean",
"description": "auto start instance"
},
"system": {
"type": "string",
"description": "id of system"
},
"network_address": {
"type": "string",
"description": "optional specified ip address"
},
"ethernet_address": {
"type": "string",
"description": "optional specified mac address"
},
"from_image": {
"type": "string",
"description": "ID of source disk image when cloning"
},
"ports": {
"type": "array",
"description": "nat ports"
},
"template": {
"type": "string",
"description": "id of system template"
},
"modules": {
"type": "array",
"description": "installed guest module, \"qemu\"/\"cloud-init\""
},
"cloud_init": {
"type": "object",
"properties": {
"root_enabled": {
"type": "boolean",
"description": "allow root user login via SSH, enable in default"
},
"admin_name": {
"type": "string",
"description": "specify admin name, using `root` when omitted"
},
"admin_secret": {
"type": "string",
"description": "password in plain text, nano generate a new one when omitted"
},
"data_path": {
"type": "string",
"description": "data disk mount path, `/opt/data` in default"
}
},
"description": "cloud-init params"
},
"qos": {
"type": "object",
"properties": {
"cpu_priority": {
"type": "string",
"enum": [
"high",
"medium",
"low"
],
"default": "medium",
"description": "CPU priority"
},
"write_speed": {
"type": "number",
"description": "disk write bps limit, 0 = unlimited"
},
"write_iops": {
"type": "number",
"description": "disk write iops limit, 0 = unlimited"
},
"read_speed": {
"type": "number",
"description": "disk read bps limit, 0 = unlimited"
},
"read_iops": {
"type": "number",
"description": "disk read iops limit, 0 = unlimited"
},
"receive_speed": {
"type": "number",
"description": "network receive bps, 0 = unlimited"
},
"send_speed": {
"type": "number",
"description": "network send bps, 0 = unlimited"
}
},
"description": "qos config"
},
"security_policy_group": {
"type": "string",
"description": "id of security group"
},
"id": {
"type": "string",
"description": "guest ID"
},
"created": {
"type": "boolean",
"description": "is instance created"
},
"running": {
"type": "boolean",
"description": "is instance running"
},
"cell": {
"type": "string",
"description": "name of hosting cell"
},
"host": {
"type": "string",
"description": "IP/domain of hosting server"
},
"lost": {
"type": "boolean",
"description": "is instance lost"
},
"monitor_secret": {
"type": "string",
"description": "monitor password"
},
"display_protocol": {
"type": "string",
"description": "name of monitor protocol"
},
"total_disk": {
"type": "number",
"description": "total disk size in bytes"
},
"progress": {
"type": "number",
"description": "creating progress, range from 0 to 100"
},
"create_time": {
"type": "string",
"description": "created time in format 'YYYY-MM-DD HH:MI:SS'"
},
"internal": {
"type": "object",
"properties": {
"network_address": {
"type": "string",
"description": "network address of interface, IPv4 dot format: '172.10.6.8'"
},
"display_address": {
"type": "string",
"description": "monitor address of guest, 'host:port'"
},
"allocated_address": {
"type": "string",
"description": "interface address allocated by system when attached with address pool"
}
},
"description": "status of internal network interface"
},
"external": {
"type": "object",
"properties": {
"network_address": {
"type": "string",
"description": "network address of interface, IPv4 dot format: '172.10.6.8'"
},
"display_address": {
"type": "string",
"description": "monitor address of guest, 'host:port'"
},
"allocated_address": {
"type": "string",
"description": "interface address allocated by system when attached with address pool"
}
},
"description": "status of external network interface"
}
},
"description": "current instance data"
}
}
}
Create GuestPOST/guests/
Creating a new guest, return an ID for later querying
Example URI
Create New Guest
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"name": "some_instance",
"owner": "admin",
"group": "manager",
"pool": "pool_1",
"cores": 8,
"memory": 4048,
"disks": [
4048,
38443
],
"auto_start": true,
"template": "1234-axvdewd",
"modules": [
"qemu",
"cloud-init"
],
"cloud_init": {
"root_enabled": true,
"admin_name": "nano",
"admin_secret": "12345678",
"data_path": "/opt/data"
},
"security_policy_group": "1234-abcdefg"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "guest name"
},
"owner": {
"type": "string",
"description": "user id"
},
"group": {
"type": "string",
"description": "user group"
},
"pool": {
"type": "string",
"description": "compute pool name"
},
"cores": {
"type": "number",
"description": "number of cpu cores"
},
"memory": {
"type": "number",
"description": "memory size in bytes"
},
"disks": {
"type": "array",
"items": {
"type": "number"
},
"description": "[system_disk_size, data_disk_n_size...], size in bytes"
},
"auto_start": {
"type": "boolean",
"description": "auto start instance"
},
"system": {
"type": "string",
"description": "id of system"
},
"network_address": {
"type": "string",
"description": "optional specified ip address"
},
"ethernet_address": {
"type": "string",
"description": "optional specified mac address"
},
"from_image": {
"type": "string",
"description": "ID of source disk image when cloning"
},
"ports": {
"type": "array",
"description": "nat ports"
},
"template": {
"type": "string",
"description": "id of system template"
},
"modules": {
"type": "array",
"description": "installed guest module, \"qemu\"/\"cloud-init\""
},
"cloud_init": {
"type": "object",
"properties": {
"root_enabled": {
"type": "boolean",
"description": "allow root user login via SSH, enable in default"
},
"admin_name": {
"type": "string",
"description": "specify admin name, using `root` when omitted"
},
"admin_secret": {
"type": "string",
"description": "password in plain text, nano generate a new one when omitted"
},
"data_path": {
"type": "string",
"description": "data disk mount path, `/opt/data` in default"
}
},
"description": "cloud-init params"
},
"qos": {
"type": "object",
"properties": {
"cpu_priority": {
"type": "string",
"enum": [
"high",
"medium",
"low"
],
"default": "medium",
"description": "CPU priority"
},
"write_speed": {
"type": "number",
"description": "disk write bps limit, 0 = unlimited"
},
"write_iops": {
"type": "number",
"description": "disk write iops limit, 0 = unlimited"
},
"read_speed": {
"type": "number",
"description": "disk read bps limit, 0 = unlimited"
},
"read_iops": {
"type": "number",
"description": "disk read iops limit, 0 = unlimited"
},
"receive_speed": {
"type": "number",
"description": "network receive bps, 0 = unlimited"
},
"send_speed": {
"type": "number",
"description": "network send bps, 0 = unlimited"
}
},
"description": "qos config"
},
"security_policy_group": {
"type": "string",
"description": "id of security group"
},
"id": {
"type": "string",
"description": "guest ID"
},
"created": {
"type": "boolean",
"description": "is instance created"
},
"running": {
"type": "boolean",
"description": "is instance running"
},
"cell": {
"type": "string",
"description": "name of hosting cell"
},
"host": {
"type": "string",
"description": "IP/domain of hosting server"
},
"lost": {
"type": "boolean",
"description": "is instance lost"
},
"monitor_secret": {
"type": "string",
"description": "monitor password"
},
"display_protocol": {
"type": "string",
"description": "name of monitor protocol"
},
"total_disk": {
"type": "number",
"description": "total disk size in bytes"
},
"progress": {
"type": "number",
"description": "creating progress, range from 0 to 100"
},
"create_time": {
"type": "string",
"description": "created time in format 'YYYY-MM-DD HH:MI:SS'"
},
"internal": {
"type": "object",
"properties": {
"network_address": {
"type": "string",
"description": "network address of interface, IPv4 dot format: '172.10.6.8'"
},
"display_address": {
"type": "string",
"description": "monitor address of guest, 'host:port'"
},
"allocated_address": {
"type": "string",
"description": "interface address allocated by system when attached with address pool"
}
},
"description": "status of internal network interface"
},
"external": {
"type": "object",
"properties": {
"network_address": {
"type": "string",
"description": "network address of interface, IPv4 dot format: '172.10.6.8'"
},
"display_address": {
"type": "string",
"description": "monitor address of guest, 'host:port'"
},
"allocated_address": {
"type": "string",
"description": "interface address allocated by system when attached with address pool"
}
},
"description": "status of external network interface"
}
}
}
202
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data":{
"id": "dsfds8979847r3dsf-3r67",
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "creating guest id"
}
}
}
}
}
Delete GuestDELETE/guests/{id}
delete guest, release all allocated resources
Example URI
- id
string
(required)guest id
delete guest
Headers
Content-Type: application/json
Body
{
"force": true
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Auto Start ¶
Enable or disable auto start option of guest
Modify Auto Start OptionPUT/guests/{id}/auto_start
Change status of auto start option
Example URI
- id
string
(required)guest ID
Modify Auto Start Option
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"enable": false
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"enable": {
"type": "boolean",
"description": "enable auto start"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Number Of Cores ¶
Manage cores of guest
Modify CoresPUT/guests/{id}/cores
Change number of cores
Example URI
- id
string
(required)guest ID
Modify Cores
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"cores": 4,
"immediate": false
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"cores": {
"type": "number",
"description": "core number"
},
"immediate": {
"type": "boolean",
"description": "take effect when running"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Memory Capacity ¶
Modify Memory CapacityPUT/guests/{id}/memory
Change memory size of guest, only available when guest offline
Example URI
- id
string
(required)guest ID
Change Memory Capacity
Headers
Content-Type: application/json
Body
{
"memory": 4294967296,
"immediate": false
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"memory": {
"type": "number",
"description": "memory in bytes"
},
"immediate": {
"type": "boolean",
"description": "take effect when running"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Resize Disk Capacity ¶
Manage disk capacity of guest
Extend Disk CapacityPUT/guests/{id}/disks/resize/{disk}
Change disk capacity of the guest to larger. Only allow operating in an offline instance.
Example URI
- id
string
(required)guest ID
- disk
number
(required)index of target disk, system:0, data0:1, data1:2…
Extend Disk Capacity
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"size": 42949672960,
"immediate": false
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"size": {
"type": "number",
"description": "size in bytes"
},
"immediate": {
"type": "boolean",
"description": "take effect when running"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Shrink Disk Capacity ¶
Shrink the disk capacity of guest
Shrink Disk FilePUT/guests/{id}/disks/shrink/{disk}
Shrink size of guest disk file to minimal for building images. Only allow operating in an offline instance.
Example URI
- id
string
(required)guest ID
- disk
number
(required)index of target disk, system:0, data0:1, data1:2…
Shrink Disk File
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"immediate": false
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"immediate": {
"type": "boolean",
"description": "take effect when running"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Operating System ¶
Manage operating system of guest
Reset Operating SystemPUT/guests/{id}/system/
Reset operating system of the guest from a disk image, all user data discard.
Example URI
- id
string
(required)guest ID
Reset Guest System
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"from_image": "0123456789-abcdef"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"from_image": {
"type": "string",
"description": "id of new system image"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Administrator Password ¶
Manage administator password
Reset Administrator PasswordPUT/guests/{id}/auth
Reset a new password for administator of guest
Example URI
- id
string
(required)guest ID
Reset Administrator Password
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"password": "asdb12356",
"user": "root"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"password": {
"type": "string",
"description": "new password, automated generate when omitted"
},
"user": {
"type": "number",
"description": "username, automated choose username by system type when omitted"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": {
"password": "1235656756",
"user": "root"
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"password": {
"type": "string",
"description": "admin password"
},
"user": {
"type": "number",
"description": "admin name"
}
}
}
Get Administrator PasswordGET/guests/{id}/auth
Get current name and password of administrator
Example URI
- id
string
(required)guest ID
Get Administrator Password
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": {
"password": "1235656756",
"user": "root"
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"password": {
"type": "string",
"description": "admin password"
},
"user": {
"type": "number",
"description": "admin name"
}
}
}
Guest Name ¶
Manage name of guest
Modify Guest NamePUT/guests/{id}/name/
Change guest name
Example URI
- id
string
(required)guest ID
Modify Guest Name
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"name": "some_instance",
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "guest name"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
CPU priority ¶
Manage QoS of CPU cores
Change CPU prioirtyPUT/guests/{id}/qos/cpu/
Change CPU priority
Example URI
- id
string
(required)guest ID
Modify CPU priority
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"priority": "high",
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"priority": {
"type": "string",
"enum": [
"high",
"medium",
"low"
],
"description": "CPU priority"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Disk QoS ¶
Manage Disk QoS
Modify Disk QoSPUT/guests/{id}/qos/disk/
Change disk QoS configure
Example URI
- id
string
(required)guest ID
Modify Disk QoS
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"write_speed": 1048576,
"write_iops": 100,
"read_speed": 1048576,
"read_iops": 100
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"write_speed": {
"type": "number",
"description": "disk write bps limit, 0 = unlimited"
},
"write_iops": {
"type": "number",
"description": "disk write iops limit, 0 = unlimited"
},
"read_speed": {
"type": "number",
"description": "disk read bps limit, 0 = unlimited"
},
"read_iops": {
"type": "number",
"description": "disk read iops limit, 0 = unlimited"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Network QoS ¶
Manage network QoS
Modify Network QoSPUT/guests/{id}/qos/network/
change network QoS configure
Example URI
- id
string
(required)guest ID
Modify Network QoS
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"receive_speed": 10485760,
"send_speed": 10485760
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"receive_speed": {
"type": "number",
"description": "network receive bps, 0 = unlimited"
},
"send_speed": {
"type": "number",
"description": "network send bps, 0 = unlimited"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Guest Security Policy ¶
Manage security policy of guest
Get Security PolicyGET/guests/{id}/security_policy/
Example URI
- id
string
(required)guest id
Get Security Policy
Headers
Nano-session: 1234567890-abcdef
Accept: text/plain
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data": {
"default_action": "reject",
"rules": [
{
"action": "accept",
"to_port": 22,
"protocol": "tcp"
},
{
"action": "accept",
"to_port": 80,
"protocol": "tcp"
},
{
"action": "accept",
"to_port": 8080,
"from_address": "127.0.0.1",
"protocol": "tcp"
}
]
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"default_action": {
"type": "string",
"enum": [
"accept",
"reject"
],
"default": "accept",
"description": "default action when no rule matched"
},
"rules": {
"type": "array",
"items": {
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": [
"accept",
"reject"
],
"default": "accept",
"description": "action when rule matched"
},
"to_port": {
"type": "number",
"description": "destination port"
},
"protocol": {
"type": "string",
"enum": [
"all",
"tcp",
"udp",
"icmp"
],
"default": "all",
"description": "match protocol"
},
"from_address": {
"type": "string",
"description": "packet source address"
},
"interface": {
"type": "number",
"description": "index of match interface, 0 for all, 1 for first"
}
}
},
"description": "list of rules"
}
}
}
}
}
Guest Security Policy Default Action ¶
Manage default action of security policy, invoked when a packet does not match any rules.
Change Default ActionPUT/guests/{id}/security_policy/default_action
Change the default action when no rules matched
Example URI
- id
string
(required)guest id
Change Default Action
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"action": "accept"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": [
"accept",
"reject"
],
"default": "accept",
"description": "default action when no rule matched"
}
}
}
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Guest Security Policy Rules ¶
Manage security policy rules
Append New Security Policy RulePOST/guests/{id}/security_policy/rules/
Append new security policy rule to tail
Example URI
- id
string
(required)guest id
Append New Security Policy Rule
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"action": "accept",
"to_port": 8088,
"protocol": "tcp",
"from_address": "127.0.0.1",
"interface": 1
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": [
"accept",
"reject"
],
"default": "accept",
"description": "action when rule matched"
},
"to_port": {
"type": "number",
"description": "destination port"
},
"protocol": {
"type": "string",
"enum": [
"all",
"tcp",
"udp",
"icmp"
],
"default": "all",
"description": "match protocol"
},
"from_address": {
"type": "string",
"description": "packet source address"
},
"interface": {
"type": "number",
"description": "index of match interface, 0 for all, 1 for first"
}
}
}
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Modify Security Policy RulePUT/guests/security_policy/rules/{index}
Modify Security Policy Rule
Example URI
- index
number
(required)index of policy rule
Modify Security Policy Rule
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"action": "accept",
"to_port": 8088,
"protocol": "tcp",
"from_address": "127.0.0.1",
"interface": 1
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": [
"accept",
"reject"
],
"default": "accept",
"description": "action when rule matched"
},
"to_port": {
"type": "number",
"description": "destination port"
},
"protocol": {
"type": "string",
"enum": [
"all",
"tcp",
"udp",
"icmp"
],
"default": "all",
"description": "match protocol"
},
"from_address": {
"type": "string",
"description": "packet source address"
},
"interface": {
"type": "number",
"description": "index of match interface, 0 for all, 1 for first"
}
}
}
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Change Rule OrderPUT/guests/security_policy/rules/{index}/order
Change Rule Order
Example URI
- index
number
(required)index of policy rule
Change Rule Order
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"direction": "up"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"direction": {
"type": "string",
"enum": [
"up",
"down"
],
"description": "change direction"
}
}
}
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Remove Security Policy RuleDELETE/guests/security_policy/rules/{index}
Remove Security Policy Rule
Example URI
- index
number
(required)index of policy rule
Remove Security Policy Rule
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Manage Instances ¶
Manage guest instances
Get Running StatusGET/instances/{id}
Get current status of an instance
Example URI
- id
string
(required)guest ID
Get Instance Status
Headers
Nano-Session: 12345678-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": {
"name": "test01",
"created": true,
"running": true,
"owner": "admin",
"group": "manager",
"pool": "pool1",
"cell": "cell_93e3de24f0a4",
"cores": 4,
"memory": 5120,
"total_disk": 4864000,
"disks": [482345, 487534],
"auto_start": true,
"ethernet_address": "ed:35:3d:5a:4e:3f",
"display_protocol": "vnc",
"internal":{
"network_address": "172.18.6.7",
"display_address": "172.18.5.3:5901",
"allocated_address": "172.18.6.7"
},
"external":{
"network_address": "202.3.1.34",
"display_address": "202.3.1.34:5901"
},
"create_time": "2018-08-21 00:12:34",
"media_attached": true,
"medi\_source": "centos\_7\_x64\_iso",
"cpu_usage": 5.34,
"memory_available": 1280,
"disk_available": 4925700,
"bytes_read": 3673,
"bytes_written": 8634,
"bytes_received": 2643,
"bytes_sent": 7634
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "guest name"
},
"owner": {
"type": "string",
"description": "user id"
},
"group": {
"type": "string",
"description": "user group"
},
"pool": {
"type": "string",
"description": "compute pool name"
},
"cores": {
"type": "number",
"description": "number of cpu cores"
},
"memory": {
"type": "number",
"description": "memory size in bytes"
},
"disks": {
"type": "array",
"items": {
"type": "number"
},
"description": "[system_disk_size, data_disk_n_size...], size in bytes"
},
"auto_start": {
"type": "boolean",
"description": "auto start instance"
},
"system": {
"type": "string",
"description": "id of system"
},
"network_address": {
"type": "string",
"description": "optional specified ip address"
},
"ethernet_address": {
"type": "string",
"description": "optional specified mac address"
},
"from_image": {
"type": "string",
"description": "ID of source disk image when cloning"
},
"ports": {
"type": "array",
"description": "nat ports"
},
"template": {
"type": "string",
"description": "id of system template"
},
"modules": {
"type": "array",
"description": "installed guest module, \"qemu\"/\"cloud-init\""
},
"cloud_init": {
"type": "object",
"properties": {
"root_enabled": {
"type": "boolean",
"description": "allow root user login via SSH, enable in default"
},
"admin_name": {
"type": "string",
"description": "specify admin name, using `root` when omitted"
},
"admin_secret": {
"type": "string",
"description": "password in plain text, nano generate a new one when omitted"
},
"data_path": {
"type": "string",
"description": "data disk mount path, `/opt/data` in default"
}
},
"description": "cloud-init params"
},
"qos": {
"type": "object",
"properties": {
"cpu_priority": {
"type": "string",
"enum": [
"high",
"medium",
"low"
],
"default": "medium",
"description": "CPU priority"
},
"write_speed": {
"type": "number",
"description": "disk write bps limit, 0 = unlimited"
},
"write_iops": {
"type": "number",
"description": "disk write iops limit, 0 = unlimited"
},
"read_speed": {
"type": "number",
"description": "disk read bps limit, 0 = unlimited"
},
"read_iops": {
"type": "number",
"description": "disk read iops limit, 0 = unlimited"
},
"receive_speed": {
"type": "number",
"description": "network receive bps, 0 = unlimited"
},
"send_speed": {
"type": "number",
"description": "network send bps, 0 = unlimited"
}
},
"description": "qos config"
},
"security_policy_group": {
"type": "string",
"description": "id of security group"
},
"id": {
"type": "string",
"description": "guest ID"
},
"created": {
"type": "boolean",
"description": "is instance created"
},
"running": {
"type": "boolean",
"description": "is instance running"
},
"cell": {
"type": "string",
"description": "name of hosting cell"
},
"host": {
"type": "string",
"description": "IP/domain of hosting server"
},
"lost": {
"type": "boolean",
"description": "is instance lost"
},
"monitor_secret": {
"type": "string",
"description": "monitor password"
},
"display_protocol": {
"type": "string",
"description": "name of monitor protocol"
},
"total_disk": {
"type": "number",
"description": "total disk size in bytes"
},
"progress": {
"type": "number",
"description": "creating progress, range from 0 to 100"
},
"create_time": {
"type": "string",
"description": "created time in format 'YYYY-MM-DD HH:MI:SS'"
},
"internal": {
"type": "object",
"properties": {
"network_address": {
"type": "string",
"description": "network address of interface, IPv4 dot format: '172.10.6.8'"
},
"display_address": {
"type": "string",
"description": "monitor address of guest, 'host:port'"
},
"allocated_address": {
"type": "string",
"description": "interface address allocated by system when attached with address pool"
}
},
"description": "status of internal network interface"
},
"external": {
"type": "object",
"properties": {
"network_address": {
"type": "string",
"description": "network address of interface, IPv4 dot format: '172.10.6.8'"
},
"display_address": {
"type": "string",
"description": "monitor address of guest, 'host:port'"
},
"allocated_address": {
"type": "string",
"description": "interface address allocated by system when attached with address pool"
}
},
"description": "status of external network interface"
},
"cpu_usage": {
"type": "number",
"description": "total CPU usage range from 0.00 to 100.00"
},
"memory_available": {
"type": "number",
"description": "available memory size in bytes"
},
"disk_available": {
"type": "number",
"description": "available disk size in bytes"
},
"bytes_read": {
"type": "number",
"description": "total read disk bytes"
},
"bytes_written": {
"type": "number",
"description": "total written disk bytes"
},
"bytes_received": {
"type": "number",
"description": "total received network bytes"
},
"bytes_sent": {
"type": "number",
"description": "total sent network bytes"
},
"media_attached": {
"type": "boolean",
"description": "is media image attached"
},
"media_source": {
"type": "string",
"description": "id of attached media image"
}
},
"description": "current status"
}
}
}
Start Guest/InstancePOST/instances/{id}
Start guest(create instance)
Example URI
- id
string
(required)guest ID
Start Instance
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"from_media": true,
"source": "bd0fe127-a8db-4c89-98ea-9a5070b08aae"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"from_media": {
"type": "boolean",
"description": "boot from media"
},
"from_network": {
"type": "boolean",
"description": "boot from network source/PXE"
},
"source": {
"type": "string",
"description": "boot source id/URI"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Stop Guest/InstanceDELETE/instances/{id}
Stop guest(delete instance)
Example URI
- id
string
(required)guest ID
Stop Guest
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"reboot": false,
"force": true
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"reboot": {
"type": "boolean",
"description": "shutdown or reboot"
},
"force": {
"type": "boolean",
"description": "force operate"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Instance Media ¶
Manage media in the running instance
Insert MediaPOST/instances/{id}/media
Insert media into a running instance
Example URI
- id
string
(required)guest ID
Insert Media
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"source": "bd0fe127-a8db-4c89-98ea-9a5070b08aae",
"type": 0
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"source": {
"type": "string",
"description": "media id"
},
"type": {
"type": "number",
"description": "media type, 0 = Media Image"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Eject MediaDELETE/instances/{id}/media
Eject media from a running instance
Example URI
- id
string
(required)guest ID
Eject Media
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Guest Snapshots ¶
Manage snapshots of a guest
Query SnapshotsGET/instances/{id}/snapshots/
Query all snapshots attached to the guest
Example URI
- id
string
(required)guest ID
Query Snapshots
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data":[
"origin":{
"is_root": true
},
"snapshot1": {
"backing": "origin"
},
"snapshot2": {
"backing": "snapshot1"
},
"snapshot3": {
"backing": "snapshot2",
"is_current": true
},
"another_branch": {
"backing": "origin"
},
"another_end": {
"backing": "another_branch"
}
]
}
]
Create New SnapshotPOST/instances/{id}/snapshots/
Create a new snapshot, only available when guest stopped
Example URI
- id
string
(required)guest ID
Create New Snapshot
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"name": "snapshot1",
"description": "this is a snapshot example"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "snapshot name"
},
"description": {
"type": "string",
"description": "snapshot description"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Restore snapshotPUT/instances/{id}/snapshots/
Resume to a specified snapshot, available on stopped guest
Example URI
- id
string
(required)guest ID
Restore Snapshot
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"target": "snapshot1"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"target": {
"type": "string",
"description": "snapshot name"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Configure Snapshot ¶
Operate on a specified snapshot
Get snapshot infoGET/instances/{id}/snapshots/{name}
Query info of a snapshot
Example URI
- id
string
(required)guest id
- name
string
(required)snapshot
Get Snapshot Info
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": {
"running": false,
"description": "this is snapshot before installing cloud-init",
"create_time": "2018-08-21 12:34:56"
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"running": {
"type": "boolean",
"description": "is running snapshot"
},
"create_time": {
"type": "string",
"description": "created time in 'YYYY-MM-DD HH:MI:SS' format"
},
"description": {
"type": "string",
"description": "snapshot description"
}
}
}
Delete snapshotDELETE/instances/{id}/snapshots/{name}
Delete a snapshot
Example URI
- id
string
(required)guest id
- name
string
(required)snapshot
Delete Snapshot
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Monitor Channel ¶
create channel for monitor and control instance. Create a new temporary channel id ABC
using POST Method, then connect and consumed channel with websocket address ws://host/monitor_channels/ABC
using noVNC or other clients. Unused channel will be released if no connection established in time.
Create New ChannelPOST/monitor_channels/
Establish a new monitor channel
Example URI
Create New Monitor Channel
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"guest": "some_guest_id",
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"guest": {
"type": "string",
"description": "target guest id"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data":{
"id": "channel-id-123",
"protocol": "vnc",
"username": "",
"password": "some_secret",
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "channel id"
},
"protocol": {
"type": "string",
"description": "monitor protocol"
},
"username": {
"type": "string",
"description": "monitor user name"
},
"password": {
"type": "string",
"description": "monitor password"
}
}
}
}
}
Image ¶
APIs manage disk and media images
Media Image Search ¶
Search Media Images
Search Media ImageGET/media_image_search/
Search media images with login session
Example URI
Search Media Image
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data": [
{
"name": "centos7_64_minimal",
"id": "sdf83kjfe-23r4wedf",
"description": "some desc",
"create_time": "2018-08-21 00:12:34",
"modify_time": "2018-08-21 00:13:34",
"size": 4872334659735,
"tags": [
"linux",
"64bit",
"centos"
]
},
{
"name": "win7_home_64",
"id": "sdf83kjfe-23r4wertytdf",
"description": "win desktop",
"create_time": "2018-08-21 00:12:34",
"modify_time": "2018-08-21 00:13:34",
"size": 4872334659774,
"tags": [
"windows",
"64bit",
"windows7"
]
}
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "image name"
},
"owner": {
"type": "string",
"description": "owner name of image"
},
"group": {
"type": "string",
"description": "group name of owner"
},
"description": {
"type": "string",
"description": "image description"
},
"tags": {
"type": "array",
"description": "image tags"
},
"id": {
"type": "string",
"description": "image id"
},
"created": {
"type": "boolean",
"description": "image created"
},
"progress": {
"type": "number",
"description": "progress range from 0 to 100"
},
"create_time": {
"type": "string",
"description": "created time, format YYYY-MM-DD HH:MI:SS"
},
"modify_time": {
"type": "string",
"description": "modified time, format YYYY-MM-DD HH:MI:SS"
},
"size": {
"type": "number",
"description": "image size in bytes"
}
}
},
"description": "list of image status"
}
}
}
Media Image ¶
Manage Media Images
Synchronize Local Media ImagesPATCH/media_images/
Synchronize media images from local directory
Example URI
Synchronize Local Media Images
Headers
Nano-session: 1234567890-abcdef
Body
{
"owner": "admin",
"group": "manager",
}
Schema
{
"type": "object",
"properties": {
"owner": {
"type": "string",
"description": "owner of synchronized image"
},
"group": {
"type": "string",
"description": "group of synchronized image"
}
},
"$schema": "http://json-schema.org/draft-04/schema#"
}
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Query All Media ImagesGET/media_images/
Query all media image
Example URI
Query All Media Images
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data": [
{
"name": "centos7_64_minimal",
"id": "sdf83kjfe-23r4wedf",
"description": "some desc",
"create_time": "2018-08-21 00:12:34",
"modify_time": "2018-08-21 00:13:34",
"size": 4872334659735,
"tags": [
"linux",
"64bit",
"centos"
]
},
{
"name": "win7_home_64",
"id": "sdf83kjfe-23r4wertytdf",
"description": "win desktop",
"create_time": "2018-08-21 00:12:34",
"modify_time": "2018-08-21 00:13:34",
"size": 4872334659774,
"tags": [
"windows",
"64bit",
"windows7"
]
}
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "image name"
},
"owner": {
"type": "string",
"description": "owner name of image"
},
"group": {
"type": "string",
"description": "group name of owner"
},
"description": {
"type": "string",
"description": "image description"
},
"tags": {
"type": "array",
"description": "image tags"
},
"id": {
"type": "string",
"description": "image id"
},
"created": {
"type": "boolean",
"description": "image created"
},
"progress": {
"type": "number",
"description": "progress range from 0 to 100"
},
"create_time": {
"type": "string",
"description": "created time, format YYYY-MM-DD HH:MI:SS"
},
"modify_time": {
"type": "string",
"description": "modified time, format YYYY-MM-DD HH:MI:SS"
},
"size": {
"type": "number",
"description": "image size in bytes"
}
}
},
"description": "list of image status"
}
}
}
Get Media ImageGET/media_images/{id}
Get info of media image
Example URI
- id
string
(required)media image id
Get Media Image Status
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data": {
"name": "centos7_64_minimal",
"id": "sdf83kjfe-23r4wedf",
"description": "some desc",
"create_time": "2018-08-21 00:12:34",
"modify_time": "2018-08-21 00:13:34",
"size": 4872334659735,
"tags": [
"linux",
"64bit",
"centos"
]
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "image name"
},
"owner": {
"type": "string",
"description": "owner name of image"
},
"group": {
"type": "string",
"description": "group name of owner"
},
"description": {
"type": "string",
"description": "image description"
},
"tags": {
"type": "array",
"description": "image tags"
},
"id": {
"type": "string",
"description": "image id"
},
"created": {
"type": "boolean",
"description": "image created"
},
"progress": {
"type": "number",
"description": "progress range from 0 to 100"
},
"create_time": {
"type": "string",
"description": "created time, format YYYY-MM-DD HH:MI:SS"
},
"modify_time": {
"type": "string",
"description": "modified time, format YYYY-MM-DD HH:MI:SS"
},
"size": {
"type": "number",
"description": "image size in bytes"
}
},
"description": "image status"
}
}
}
Create Media ImagePOST/media_images/
Create a new media image
Example URI
Create A New Media Image
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"name": "centos7_64_minimal",
"owner": "admin",
"group": "manager",
"description": "some desc",
"tags": [
"linux",
"64bit",
"centos"
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "image name"
},
"owner": {
"type": "string",
"description": "owner name of image"
},
"group": {
"type": "string",
"description": "group name of owner"
},
"description": {
"type": "string",
"description": "image description"
},
"tags": {
"type": "array",
"description": "image tags"
}
}
}
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data":[
{
"id": "sdf83kjfe-23r4wedf",
}
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "image id"
}
}
}
}
}
Modify Media ImagePUT/media_images/{id}
Modify info of media image
Example URI
- id
string
(required)media image id
Modify Media Image
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"name": "centos7_64_minimal",
"owner": "admin",
"group": "manager",
"description": "some desc",
"tags": [
"linux",
"64bit",
"centos"
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "image name"
},
"owner": {
"type": "string",
"description": "owner name of image"
},
"group": {
"type": "string",
"description": "group name of owner"
},
"description": {
"type": "string",
"description": "image description"
},
"tags": {
"type": "array",
"description": "image tags"
}
}
}
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Detele Media ImageDELETE/media_images/{id}
Delete a media image
Example URI
- id
string
(required)media image id
Detele Media Image
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Media Image File ¶
APIs manage file of media images
Download Image FileGET/media_image_files/{id}
Download binary media image data
Example URI
- id
string
(required)image id
200
Headers
Content-Type: application/octet-stream
Upload Image FilePOST/media_image_files/{id}
Upload iso data as media image
Example URI
- id
string
(required)image id
upload
Headers
Content-Type: multipart/form-data
Body
-----BOUNDARY
Content-Disposition: form-data; name="image"; filename="image.iso"
-----BOUNDARY
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": ""
}
]
Disk Image Search ¶
Search disk images
Search Disk ImageGET/disk_image_search/{?tags}
Search disk images
Example URI
- tags
array[string]
(optional)image tags
Search Disk Image By Conditions
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data": [
{
"name": "centos7_64_minimal",
"id": "sdf83kjfe-23r4wedf",
"description": "some desc",
"create_time": "2018-08-21 00:12:34",
"modify_time": "2018-08-21 00:13:34",
"size": 4872334659735,
"tags": [
"linux",
"64bit",
"centos"
]
},
{
"name": "win7_home_64",
"id": "sdf83kjfe-23r4wertytdf",
"description": "win desktop",
"create_time": "2018-08-21 00:12:34",
"modify_time": "2018-08-21 00:13:34",
"size": 4872334659774,
"tags": [
"windows",
"64bit",
"windows7"
]
}
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "image name"
},
"owner": {
"type": "string",
"description": "owner name of image"
},
"group": {
"type": "string",
"description": "group name of owner"
},
"description": {
"type": "string",
"description": "image description"
},
"tags": {
"type": "array",
"description": "image tags"
},
"id": {
"type": "string",
"description": "image id"
},
"created": {
"type": "boolean",
"description": "image created"
},
"progress": {
"type": "number",
"description": "progress range from 0 to 100"
},
"create_time": {
"type": "string",
"description": "created time, format YYYY-MM-DD HH:MI:SS"
},
"modify_time": {
"type": "string",
"description": "modified time, format YYYY-MM-DD HH:MI:SS"
},
"size": {
"type": "number",
"description": "image size in bytes"
}
}
},
"description": "list of image status"
}
}
}
Disk Image ¶
Manage Disk Images
Synchronize Local Disk ImagePATCH/disk_images/
Synchronize disk images from local directory
Example URI
Synchronize Local Disk Image
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Get Disk ImageGET/disk_images/{id}
Get status of disk image
Example URI
- id
string
(required)disk image id
Get Disk Image Status
Headers
Nano-session: 1234567890-abcdef
202
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data": {
"name": "centos7_64_minimal",
"created": false,
"progress": 46,
"description": "some desc",
"tags": [
"linux",
"64bit",
"centos"
]
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "image name"
},
"owner": {
"type": "string",
"description": "owner name of image"
},
"group": {
"type": "string",
"description": "group name of owner"
},
"description": {
"type": "string",
"description": "image description"
},
"tags": {
"type": "array",
"description": "image tags"
},
"id": {
"type": "string",
"description": "image id"
},
"created": {
"type": "boolean",
"description": "image created"
},
"progress": {
"type": "number",
"description": "progress range from 0 to 100"
},
"create_time": {
"type": "string",
"description": "created time, format YYYY-MM-DD HH:MI:SS"
},
"modify_time": {
"type": "string",
"description": "modified time, format YYYY-MM-DD HH:MI:SS"
},
"size": {
"type": "number",
"description": "image size in bytes"
}
},
"description": "image status"
}
}
}
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data": {
"name": "centos7_64_minimal",
"created": true,
"description": "some desc",
"create_time": "2018-08-21 00:12:34",
"modify_time": "2018-08-21 00:13:34",
"size": 4872334659735,
"tags": [
"linux",
"64bit",
"centos"
]
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "image name"
},
"owner": {
"type": "string",
"description": "owner name of image"
},
"group": {
"type": "string",
"description": "group name of owner"
},
"description": {
"type": "string",
"description": "image description"
},
"tags": {
"type": "array",
"description": "image tags"
},
"id": {
"type": "string",
"description": "image id"
},
"created": {
"type": "boolean",
"description": "image created"
},
"progress": {
"type": "number",
"description": "progress range from 0 to 100"
},
"create_time": {
"type": "string",
"description": "created time, format YYYY-MM-DD HH:MI:SS"
},
"modify_time": {
"type": "string",
"description": "modified time, format YYYY-MM-DD HH:MI:SS"
},
"size": {
"type": "number",
"description": "image size in bytes"
}
},
"description": "image status"
}
}
}
Create Disk ImagePOST/disk_images/
Clone a new disk image from the source guest, or create an empty one for uploading when the guest ID omits.
Example URI
Create A New Disk Image
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"name": "centos7_64_minimal",
"guest": "dir723rgfyu-rre67grg-efw",
"owner": "admin",
"group": "manager",
"description": "some desc",
"tags": [
"linux",
"64bit",
"centos"
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "image name"
},
"owner": {
"type": "string",
"description": "owner name of image"
},
"group": {
"type": "string",
"description": "group name of owner"
},
"description": {
"type": "string",
"description": "image description"
},
"tags": {
"type": "array",
"description": "image tags"
},
"guest": {
"type": "string",
"description": "source guest id"
}
}
}
202
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data":[
{
"id": "sdf83kjfe-23r4wedf",
}
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "image id"
}
}
}
}
}
Modify Disk ImagePUT/disk_images/{id}
Modify info of disk image
Example URI
- id
string
(required)disk image id
Modify Disk Image
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"name": "centos7_64_minimal",
"owner": "admin",
"group": "manager",
"description": "some desc",
"tags": [
"linux",
"64bit",
"centos"
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "image name"
},
"owner": {
"type": "string",
"description": "owner name of image"
},
"group": {
"type": "string",
"description": "group name of owner"
},
"description": {
"type": "string",
"description": "image description"
},
"tags": {
"type": "array",
"description": "image tags"
},
"guest": {
"type": "string",
"description": "source guest id"
}
}
}
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Delete Disk ImageDELETE/disk_images/{id}
delete a disk image
Example URI
- id
string
(required)disk image id
Delete Disk Image
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Disk Image File ¶
APIs manage files of disk images
Upload Image FilePOST/disk_image_files/{id}
Upload a qcow2 file as disk image
Example URI
- id
string
(required)image id
Upload New Image File
Headers
Content-Type: multipart/form-data
Nano-session: 1234567890-abcdef
Body
-----BOUNDARY
Content-Disposition: form-data; name="image"; filename="centos7.qcow2"
-----BOUNDARY
Content-Disposition: form-data; name="checksum"
0123456789abcdef
-----BOUNDARY
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
System Maintain ¶
APIs for maintaing system
System Templates ¶
Manage system templates
Query System TemplatesGET/templates/
Query All Templates
Example URI
Query Templates
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data": [
{
"id": "1234-abcdef",
"name": "CentOS 7",
"operating_system": "linux",
"created_time": "2020-04-06 00:00:00",
"modified_time": "2020-04-06 00:00:00"
},
{
"id": "1234-abcdee",
"name": "CentOS 6",
"operating_system": "linux",
"created_time": "2020-04-06 00:00:00",
"modify_time": "2020-04-06 00:00:00"
}
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "template id"
},
"name": {
"type": "string",
"description": "template name"
},
"operating_system": {
"type": "string",
"enum": [
"linux",
"windows"
],
"default": "linux",
"description": "operating system"
},
"created_time": {
"type": "string",
"description": "template created time, format `YYYY-MM-DD HH:MI:SS`"
},
"modified_time": {
"type": "string",
"description": "template modified time, format `YYYY-MM-DD HH:MI:SS`"
}
}
},
"description": "list of templates"
}
}
}
Get System TemplateGET/templates/{id}
Get configure of a system template
Example URI
- id
string
(required)template id
Get Template Detail
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data": {
"id": "1234-abcdef",
"name": "CentOS 7",
"admin": "root",
"operating_system": "linux",
"disk": "scsi",
"network": "virtio",
"display": "vga",
"control": "vnc",
"usb": "none",
"tablet": "none",
"created_time": "2020-04-06 00:00:00",
"modified_time": "2020-04-06 00:00:00"
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "template name"
},
"admin": {
"type": "string",
"description": "default administrator name"
},
"operating_system": {
"type": "string",
"enum": [
"linux",
"windows"
],
"default": "linux",
"description": "operating system"
},
"disk": {
"type": "string",
"enum": [
"scsi",
"sata",
"ide"
],
"default": "scsi",
"description": "disk driver type"
},
"network": {
"type": "string",
"enum": [
"virtio",
"e1000",
"rtl8139"
],
"default": "virtio",
"description": "network model"
},
"display": {
"type": "string",
"enum": [
"vga",
"cirrus"
],
"default": "vga",
"description": "display driver"
},
"control": {
"type": "string",
"enum": [
"vnc",
"spice"
],
"default": "vnc",
"description": "remote control"
},
"usb": {
"type": "string",
"enum": [
"``",
"nec-xhci"
],
"default": "``",
"description": "usb interface model"
},
"tablet": {
"type": "string",
"enum": [
"``",
"usb"
],
"default": "``",
"description": "tablet interface model"
},
"id": {
"type": "string",
"description": "template id"
},
"created_time": {
"type": "string",
"description": "template created time, format `YYYY-MM-DD HH:MI:SS`"
},
"modified_time": {
"type": "string",
"description": "template modified time, format `YYYY-MM-DD HH:MI:SS`"
}
},
"description": "status"
}
}
}
Create New System TemplatePOST/templates/
Create System Template
Example URI
Create System Template
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"name": "CentOS 7",
"admin": "root",
"operating_system": "linux",
"disk": "scsi",
"network": "virtio",
"display": "vga",
"control": "vnc",
"usb": "",
"tablet": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "template name"
},
"admin": {
"type": "string",
"description": "default administrator name"
},
"operating_system": {
"type": "string",
"enum": [
"linux",
"windows"
],
"default": "linux",
"description": "operating system"
},
"disk": {
"type": "string",
"enum": [
"scsi",
"sata",
"ide"
],
"default": "scsi",
"description": "disk driver type"
},
"network": {
"type": "string",
"enum": [
"virtio",
"e1000",
"rtl8139"
],
"default": "virtio",
"description": "network model"
},
"display": {
"type": "string",
"enum": [
"vga",
"cirrus"
],
"default": "vga",
"description": "display driver"
},
"control": {
"type": "string",
"enum": [
"vnc",
"spice"
],
"default": "vnc",
"description": "remote control"
},
"usb": {
"type": "string",
"enum": [
"``",
"nec-xhci"
],
"default": "``",
"description": "usb interface model"
},
"tablet": {
"type": "string",
"enum": [
"``",
"usb"
],
"default": "``",
"description": "tablet interface model"
}
}
}
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data": {
"id": "1234-abcdef"
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "template id"
}
}
}
}
}
Modify System TemplatesPUT/templates/{id}
Modify System Templates
Example URI
- id
string
(required)template id
Modify System Templates
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"name": "CentOS 7",
"admin": "root",
"operating_system": "linux",
"disk": "scsi",
"network": "virtio",
"display": "vga",
"control": "vnc",
"usb": "",
"tablet": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "template name"
},
"admin": {
"type": "string",
"description": "default administrator name"
},
"operating_system": {
"type": "string",
"enum": [
"linux",
"windows"
],
"default": "linux",
"description": "operating system"
},
"disk": {
"type": "string",
"enum": [
"scsi",
"sata",
"ide"
],
"default": "scsi",
"description": "disk driver type"
},
"network": {
"type": "string",
"enum": [
"virtio",
"e1000",
"rtl8139"
],
"default": "virtio",
"description": "network model"
},
"display": {
"type": "string",
"enum": [
"vga",
"cirrus"
],
"default": "vga",
"description": "display driver"
},
"control": {
"type": "string",
"enum": [
"vnc",
"spice"
],
"default": "vnc",
"description": "remote control"
},
"usb": {
"type": "string",
"enum": [
"``",
"nec-xhci"
],
"default": "``",
"description": "usb interface model"
},
"tablet": {
"type": "string",
"enum": [
"``",
"usb"
],
"default": "``",
"description": "tablet interface model"
}
}
}
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Delete System TemplateDELETE/templates/{id}
Delete System Template
Example URI
- id
string
(required)template id
Delete System Template
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Security Policy Group ¶
APIs manage security policy groups
Get Security GroupGET/security_policy_groups/{id}
Get Security Group
Example URI
- id
string
(required)group id
Get Security Group
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data": {
"name": "centos7_1",
"description": "Some Group For CentOS 7",
"user": "nano",
"group": "super",
"enabled": true,
"global": true,
"default_action": "reject",
"id": "1234-asvddf"
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "group name"
},
"description": {
"type": "string",
"description": "group description"
},
"user": {
"type": "string",
"description": "creator id"
},
"group": {
"type": "string",
"description": "group id of creator"
},
"enabled": {
"type": "boolean",
"description": "policy group enabled"
},
"global": {
"type": "boolean",
"description": "global policy group visiable to all users"
},
"default_action": {
"type": "string",
"enum": [
"accept",
"reject"
],
"default": "accept",
"description": "default action when no rule matched"
},
"id": {
"type": "string",
"description": "group id"
}
},
"description": "status"
}
}
}
Create Security GroupPOST/security_policy_groups/
Create Security Group
Example URI
Create Security Group
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"name": "linux_1",
"description": "Some Group for Linux",
"user": "nano",
"group": "super",
"enabled": false,
"global": false,
"default_action": "accept"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "group name"
},
"description": {
"type": "string",
"description": "group description"
},
"user": {
"type": "string",
"description": "creator id"
},
"group": {
"type": "string",
"description": "group id of creator"
},
"enabled": {
"type": "boolean",
"description": "policy group enabled"
},
"global": {
"type": "boolean",
"description": "global policy group visiable to all users"
},
"default_action": {
"type": "string",
"enum": [
"accept",
"reject"
],
"default": "accept",
"description": "default action when no rule matched"
}
}
}
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data": {
"id": "1234-abcdef"
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "group id"
}
}
}
}
}
Modify Security GroupPUT/security_policy_groups/{id}
Modify Security Group
Example URI
- id
string
(required)group id
Modify Security Group
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"name": "linux_2",
"description": "Some Group for Linux",
"user": "nano",
"group": "super",
"enabled": false,
"global": false,
"default_action": "accept"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "group name"
},
"description": {
"type": "string",
"description": "group description"
},
"user": {
"type": "string",
"description": "creator id"
},
"group": {
"type": "string",
"description": "group id of creator"
},
"enabled": {
"type": "boolean",
"description": "policy group enabled"
},
"global": {
"type": "boolean",
"description": "global policy group visiable to all users"
},
"default_action": {
"type": "string",
"enum": [
"accept",
"reject"
],
"default": "accept",
"description": "default action when no rule matched"
}
}
}
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Delete Security GroupDELETE/security_policy_groups/{id}
Delete Security Group
Example URI
- id
string
(required)group id
Delete Security Group
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Query Security Policy RulesGET/security_policy_groups/{id}/rules/
Query Security Policy Rule
Example URI
- id
string
(required)group id
Query Security Policy Rule
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data": [
{
"action": "accept",
"to_port": 22,
"protocol": "tcp"
},
{
"action": "accept",
"to_port": 80,
"protocol": "tcp"
},
{
"action": "accept",
"to_port": 8080,
"from_address": "127.0.0.1",
"protocol": "tcp"
}
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": [
"accept",
"reject"
],
"default": "accept",
"description": "action when rule matched"
},
"to_port": {
"type": "number",
"description": "destination port"
},
"protocol": {
"type": "string",
"enum": [
"all",
"tcp",
"udp",
"icmp"
],
"default": "all",
"description": "match protocol"
},
"from_address": {
"type": "string",
"description": "packet source address"
},
"interface": {
"type": "number",
"description": "index of match interface, 0 for all, 1 for first"
}
}
},
"description": "list of rules"
}
}
}
Add Security Policy RulePOST/security_policy_groups/{id}/rules/
Add Security Policy Rule
Example URI
- id
string
(required)group id
Add Security Policy Rule
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"action": "accept",
"to_port": 8088,
"protocol": "tcp",
"from_address": "127.0.0.1",
"interface": 1
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": [
"accept",
"reject"
],
"default": "accept",
"description": "action when rule matched"
},
"to_port": {
"type": "number",
"description": "destination port"
},
"protocol": {
"type": "string",
"enum": [
"all",
"tcp",
"udp",
"icmp"
],
"default": "all",
"description": "match protocol"
},
"from_address": {
"type": "string",
"description": "packet source address"
},
"interface": {
"type": "number",
"description": "index of match interface, 0 for all, 1 for first"
}
}
}
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Modify Security Policy RulePUT/security_policy_groups/{id}/rules/{index}
Modify Security Policy Rule
Example URI
- id
string
(required)group id
- index
number
(required)index of policy rule, start from 0
Modify Security Policy Rule
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"action": "accept",
"to_port": 8088,
"protocol": "tcp",
"from_address": "127.0.0.1",
"interface": 1
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": [
"accept",
"reject"
],
"default": "accept",
"description": "action when rule matched"
},
"to_port": {
"type": "number",
"description": "destination port"
},
"protocol": {
"type": "string",
"enum": [
"all",
"tcp",
"udp",
"icmp"
],
"default": "all",
"description": "match protocol"
},
"from_address": {
"type": "string",
"description": "packet source address"
},
"interface": {
"type": "number",
"description": "index of match interface, 0 for all, 1 for first"
}
}
}
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Change Rule OrderPUT/security_policy_groups/{id}/rules/{index}/order
Change Rule Order
Example URI
- id
string
(required)group id
- index
number
(required)index of policy rule, start from 0
Change Rule Order
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"direction": "up"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"direction": {
"type": "string",
"enum": [
"up",
"down"
],
"description": "move direction"
}
}
}
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Remove Security Policy RuleDELETE/security_policy_groups/{id}/rules/{index}
Remove Security Policy Rule
Example URI
- id
string
(required)group id
- index
number
(required)index of policy rule, start from 0
Remove Security Policy Rule
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": ""
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Migration ¶
Manage instance migrations
Start MigrationPOST/migrations/
Create and start a new migration task
Example URI
Start Migration
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"source_pool": "default",
"source_cell": "cell1",
"target_pool": "another-pool",
"target_cell": "new-cell",
"instances": [
"jhfguf85-34uyf-4t4tghjh",
"dfjui-euy37-dyuy3t5qn"
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"source_pool": {
"type": "string",
"description": "pool of instance host"
},
"source_cell": {
"type": "string",
"description": "cell of instance host"
},
"target_pool": {
"type": "string",
"description": "target pool you want to migrate"
},
"target_cell": {
"type": "string",
"description": "target cell you want to migrate"
},
"instances": {
"type": "array",
"description": "UUID list of instances need to migrate"
}
}
}
202
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": [
{
"id": "abcdef-1234567890"
}
]
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "migration ID"
}
}
}
}
}
Get Status Of Migration TaskGET/migrations/{id}
Query status of a migration task
Example URI
- id
string
(required)migration task id
Get Migration Task Status
Headers
Nano-session: 1234567890-abcdef
201
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data":{
"finished": false,
"progress": 57 //limit to 100
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"finished": {
"type": "boolean",
"description": "is migration finished"
},
"progress": {
"type": "number",
"description": "migration progress range from 0 to 100"
}
}
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": {
"finished": true
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"finished": {
"type": "boolean",
"description": "is migration finished"
}
}
}
}
}
Query All Migration in progressGET/migrations/
Query all pending migrations
Example URI
Query Pending Migration Tasks
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data":[
{
"id": "1234567890-abcdef",
"finished": false,
"progress": 57 //limit to 100
},
{
"id": "1234567890-abcdef",
"finished": true
}
]
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array"
}
}
}
Batch Creating Guest ¶
Manage batch creating tasks
Start CreationPOST/batch/create_guest/
Create a bulk of new guests, return a task ID for query status
Example URI
Start Batch Creating
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"name_rule": "order",
"name_prefix": "test",
"owner": "admin",
"group": "manager",
"pool": "pool_1",
"count": 3,
"cores": 8,
"memory": 4048,
"disks": [
4048,
38443
],
"auto_start": true,
"template": "1234-abcde",
"modules": [
"qemu",
"cloud-init"
],
"cloud_init": {
"root_enabled": true,
"admin_name": "nano",
"admin_secret": "12345678",
"data_path": "/opt/data"
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name_rule": {
"type": "string",
"enum": [
"order",
"MAC",
"address"
],
"description": "rule of generating guest name"
},
"name_prefix": {
"type": "string",
"description": "guest name prefix"
},
"owner": {
"type": "string",
"description": "user id"
},
"group": {
"type": "string",
"description": "user group"
},
"pool": {
"type": "string",
"description": "compute pool name"
},
"count": {
"type": "number",
"description": "instance count"
},
"cores": {
"type": "number",
"description": "vm cpu cores"
},
"memory": {
"type": "number",
"description": "vm memory"
},
"disks": {
"type": "array",
"items": {
"type": "number"
},
"description": "[system_disk_size, data_disk_n_size...]"
},
"auto_start": {
"type": "boolean",
"description": "auto start instance"
},
"from_image": {
"type": "string",
"description": "initial disk image id"
},
"template": {
"type": "string",
"description": "id of system template"
},
"modules": {
"type": "array",
"description": "installed guest module, \"qemu\"/\"cloud-init\""
},
"cloud_init": {
"type": "object",
"properties": {
"root_enabled": {
"type": "boolean",
"description": "allow root user login via SSH, enable in default"
},
"admin_name": {
"type": "string",
"description": "specify admin name, using `root` when omitted"
},
"admin_secret": {
"type": "string",
"description": "password in plain text, nano generate a new one when omitted"
},
"data_path": {
"type": "string",
"description": "data disk mount path, `/opt/data` in default"
}
},
"description": "cloud-init params"
},
"qos": {
"type": "object",
"properties": {
"cpu_priority": {
"type": "string",
"enum": [
"high",
"medium",
"low"
],
"default": "medium",
"description": "CPU priority"
},
"write_speed": {
"type": "number",
"description": "disk write bps limit, 0 = unlimited"
},
"write_iops": {
"type": "number",
"description": "disk write iops limit, 0 = unlimited"
},
"read_speed": {
"type": "number",
"description": "disk read bps limit, 0 = unlimited"
},
"read_iops": {
"type": "number",
"description": "disk read iops limit, 0 = unlimited"
},
"receive_speed": {
"type": "number",
"description": "network receive bps, 0 = unlimited"
},
"send_speed": {
"type": "number",
"description": "network send bps, 0 = unlimited"
}
},
"description": "QoS config"
}
}
}
202
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data":{
"id": "dsfds8979847r3dsf-3r67",
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "batch id"
}
}
}
}
}
Query Batch Creating StatusGET/batch/create_guest/{id}
Query task status of batch creating
Example URI
- id
string
(required)id of batch task
Query Pending Creating
Headers
Nano-session: 1234567890-abcdef
202
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": [
{
"name": "test_1",
"id": "0123456789-abcdef-1",
"progress": 45,
"status": "creating"
},
{
"name": "test_2",
"id": "0123456789-abcdef-2",
"status": "fail",
"error": "not enough space"
},
{
"name": "test_3",
"id": "0123456789-abcdef-3",
"status": "created"
}
]
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": [
{
"name": "test_1",
"id": "0123456789-abcdef-1",
"status": "created"
},
{
"name": "test_2",
"id": "0123456789-abcdef-2",
"status": "fail",
"error": "not enough space"
},
{
"name": "test_3",
"id": "0123456789-abcdef-3",
"status": "created"
}
]
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array"
}
}
}
Batch Deleting Guest ¶
Manage batch deleting tasks
Start Batch DeletingPOST/batch/delete_guest/
Delete a bulk of guests, return a task ID for query status
Example URI
Start Batch Deleting
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"guest": [
"0123456789-abcdef-1",
"0123456789-abcdef-2",
"0123456789-abcdef-3"
],
"force": false
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"guest": {
"type": "array",
"items": {
"type": "string"
},
"description": "list of target guest UUID"
},
"force": {
"type": "boolean",
"description": "stop running instance for deleting"
}
}
}
202
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data":{
"id": "dsfds8979847r3dsf-3r67",
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "batch id"
}
}
}
}
}
Query Batch Deleting StatusGET/batch/delete_guest/{id}
Query task status of batch deleting
Example URI
- id
string
(required)id of batch task
Query Pending Deleting
Headers
Nano-session: 1234567890-abcdef
202
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": [
{
"id": "0123456789-abcdef-1",
"status": "deleted"
},
{
"id": "0123456789-abcdef-2",
"status": "fail",
"error": "invalid guest"
},
{
"id": "0123456789-abcdef-3",
"status": "deleting"
}
]
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": [
{
"id": "0123456789-abcdef-1",
"status": "deleted"
},
{
"id": "0123456789-abcdef-2",
"status": "fail",
"error": "invalid guest"
},
{
"id": "0123456789-abcdef-3",
"status": "deleted"
}
]
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array"
}
}
}
Batch Stopping Guest ¶
APIs manage batch stopping tasks
Start Batch StoppingPOST/batch/stop_guest/
Stop a bulk of guests, return a task ID for query status
Example URI
Start Batch Stopping
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"guests": [
"0123456789-abcdef-1",
"0123456789-abcdef-2",
"0123456789-abcdef-3"
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"guest": {
"type": "array",
"items": {
"type": "string"
},
"description": "list of target guest UUID"
}
}
}
202
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data":{
"id": "dsfds8979847r3dsf-3r67",
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "batch id"
}
}
}
}
}
Query Batch Stopping StatusGET/batch/stop_guest/{id}
Query task status of batch stopping
Example URI
- id
string
(required)id of batch task
Query Pending Stopping
Headers
Nano-session: 1234567890-abcdef
202
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": [
{
"id": "0123456789-abcdef-1",
"status": "stopped"
},
{
"id": "0123456789-abcdef-2",
"status": "fail",
"error": "invalid guest"
},
{
"id": "0123456789-abcdef-3",
"status": "stopping"
}
]
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": [
{
"id": "0123456789-abcdef-1",
"status": "stopped"
},
{
"id": "0123456789-abcdef-2",
"status": "fail",
"error": "invalid guest"
},
{
"id": "0123456789-abcdef-3",
"status": "stopped"
}
]
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array"
}
}
}
Resource Search ¶
APIs for search resources
Search Security Policy Groups ¶
Search secuirity policy groups by condition
Query Security GroupGET/search/security_policy_groups/{?enabled_only,global_only,owner,group}
Query security group by current user/group
Example URI
- owner
string
(optional)return policy created by owner
- group
string
(optional)return policy in specified group
- enabled_only
boolean
(optional)enabled group only
- global_only
boolean
(optional)global group only
Query Security Group
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
{
"error_code": 0,
"message": "",
"data": [
{
"id": "123-5dfdf",
"name": "group1",
"user": "nano",
"group": "super",
"enabled": true,
"global": true,
"default_action": "accept"
},
{
"id": "123-5dfdd",
"name": "group2",
"user": "user_a",
"group": "users",
"enabled": true,
"global": false,
"default_action": "reject"
}
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "group name"
},
"description": {
"type": "string",
"description": "group description"
},
"user": {
"type": "string",
"description": "creator id"
},
"group": {
"type": "string",
"description": "group id of creator"
},
"enabled": {
"type": "boolean",
"description": "policy group enabled"
},
"global": {
"type": "boolean",
"description": "global policy group visiable to all users"
},
"default_action": {
"type": "string",
"enum": [
"accept",
"reject"
],
"default": "accept",
"description": "default action when no rule matched"
},
"id": {
"type": "string",
"description": "group id"
}
}
},
"description": "list of security policy groups"
}
}
}
Search Guests ¶
Search GuestsPOST/search/guests/
Search guests by conditions with current user, keyword could using guest name or target IP
Example URI
Search Guests
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"limit": 10,
"offset": 20,
"keyword": "example"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"limit": {
"type": "number",
"description": "max record returned"
},
"offset": {
"type": "number",
"description": "record offset"
},
"pool": {
"type": "string",
"description": "hosting pool"
},
"cell": {
"type": "string",
"description": "hosting cell"
},
"keyword": {
"type": "string",
"description": "search keyword, match guest name/IP, hosting cell name/IP"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": {
"result": [
{
"name": "test01",
"id": "df6723jhew67f3fdsf-fefew",
"cell": "cell_abc",
"host": "10.100.13.9",
"created": true,
"running": true,
"cores": 4,
"memory": 5120,
"disks": [
4864000,
854365
],
"auto_start": true,
"system": "linux",
"display_protocol": "vnc",
"monitor_secret": "abd",
"internal": {
"network_address": "172.18.6.7",
"display_address": "172.18.5.3:5901",
"allocated_address": "172.18.6.7"
},
"external": {
"network_address": "202.3.1.34",
"display_address": "202.3.1.34:5901"
},
"create_time": "2018-08-21 00:12:34",
"media_attached": true,
"media_source": "centos_7_x64_iso"
},
{
"name": "test02",
"id": "dr6ufh73dgjf3fdsf-fefew",
"cell": "cell_edv",
"host": "10.100.13.6",
"created": false,
"progress": 46,
"running": false,
"cores": 4,
"memory": 5120,
"disks": [
4864000,
854365
],
"auto_start": false,
"system": "linux"
}
],
"total": 100,
"limit": 2,
"offset": 10
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"result": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "guest name"
},
"owner": {
"type": "string",
"description": "user id"
},
"group": {
"type": "string",
"description": "user group"
},
"pool": {
"type": "string",
"description": "compute pool name"
},
"cores": {
"type": "number",
"description": "number of cpu cores"
},
"memory": {
"type": "number",
"description": "memory size in bytes"
},
"disks": {
"type": "array",
"items": {
"type": "number"
},
"description": "[system_disk_size, data_disk_n_size...], size in bytes"
},
"auto_start": {
"type": "boolean",
"description": "auto start instance"
},
"system": {
"type": "string",
"description": "id of system"
},
"network_address": {
"type": "string",
"description": "optional specified ip address"
},
"ethernet_address": {
"type": "string",
"description": "optional specified mac address"
},
"from_image": {
"type": "string",
"description": "ID of source disk image when cloning"
},
"ports": {
"type": "array",
"description": "nat ports"
},
"template": {
"type": "string",
"description": "id of system template"
},
"modules": {
"type": "array",
"description": "installed guest module, \"qemu\"/\"cloud-init\""
},
"cloud_init": {
"type": "object",
"properties": {
"root_enabled": {
"type": "boolean",
"description": "allow root user login via SSH, enable in default"
},
"admin_name": {
"type": "string",
"description": "specify admin name, using `root` when omitted"
},
"admin_secret": {
"type": "string",
"description": "password in plain text, nano generate a new one when omitted"
},
"data_path": {
"type": "string",
"description": "data disk mount path, `/opt/data` in default"
}
},
"description": "cloud-init params"
},
"qos": {
"type": "object",
"properties": {
"cpu_priority": {
"type": "string",
"enum": [
"high",
"medium",
"low"
],
"default": "medium",
"description": "CPU priority"
},
"write_speed": {
"type": "number",
"description": "disk write bps limit, 0 = unlimited"
},
"write_iops": {
"type": "number",
"description": "disk write iops limit, 0 = unlimited"
},
"read_speed": {
"type": "number",
"description": "disk read bps limit, 0 = unlimited"
},
"read_iops": {
"type": "number",
"description": "disk read iops limit, 0 = unlimited"
},
"receive_speed": {
"type": "number",
"description": "network receive bps, 0 = unlimited"
},
"send_speed": {
"type": "number",
"description": "network send bps, 0 = unlimited"
}
},
"description": "qos config"
},
"security_policy_group": {
"type": "string",
"description": "id of security group"
},
"id": {
"type": "string",
"description": "guest ID"
},
"created": {
"type": "boolean",
"description": "is instance created"
},
"running": {
"type": "boolean",
"description": "is instance running"
},
"cell": {
"type": "string",
"description": "name of hosting cell"
},
"host": {
"type": "string",
"description": "IP/domain of hosting server"
},
"lost": {
"type": "boolean",
"description": "is instance lost"
},
"monitor_secret": {
"type": "string",
"description": "monitor password"
},
"display_protocol": {
"type": "string",
"description": "name of monitor protocol"
},
"total_disk": {
"type": "number",
"description": "total disk size in bytes"
},
"progress": {
"type": "number",
"description": "creating progress, range from 0 to 100"
},
"create_time": {
"type": "string",
"description": "created time in format 'YYYY-MM-DD HH:MI:SS'"
},
"internal": {
"type": "object",
"properties": {
"network_address": {
"type": "string",
"description": "network address of interface, IPv4 dot format: '172.10.6.8'"
},
"display_address": {
"type": "string",
"description": "monitor address of guest, 'host:port'"
},
"allocated_address": {
"type": "string",
"description": "interface address allocated by system when attached with address pool"
}
},
"description": "status of internal network interface"
},
"external": {
"type": "object",
"properties": {
"network_address": {
"type": "string",
"description": "network address of interface, IPv4 dot format: '172.10.6.8'"
},
"display_address": {
"type": "string",
"description": "monitor address of guest, 'host:port'"
},
"allocated_address": {
"type": "string",
"description": "interface address allocated by system when attached with address pool"
}
},
"description": "status of external network interface"
},
"cpu_usage": {
"type": "number",
"description": "total CPU usage range from 0.00 to 100.00"
},
"memory_available": {
"type": "number",
"description": "available memory size in bytes"
},
"disk_available": {
"type": "number",
"description": "available disk size in bytes"
},
"bytes_read": {
"type": "number",
"description": "total read disk bytes"
},
"bytes_written": {
"type": "number",
"description": "total written disk bytes"
},
"bytes_received": {
"type": "number",
"description": "total received network bytes"
},
"bytes_sent": {
"type": "number",
"description": "total sent network bytes"
},
"media_attached": {
"type": "boolean",
"description": "is media image attached"
},
"media_source": {
"type": "string",
"description": "id of attached media image"
}
}
},
"description": "list of guests"
},
"total": {
"type": "number",
"description": "total record count"
},
"limit": {
"type": "number",
"description": "max returned record count"
},
"offset": {
"type": "number",
"description": "search start offset"
}
}
}
}
}
FrontEnd Management ¶
Management APIs for FrontEnd module
Role ¶
Manage user roles
List RolesGET/roles/
Query all user roles in the system
Example URI
Query All Roles
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": [
"maintainer",
"auditor",
"user"
]
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array",
"description": "list of role names"
}
}
}
Get RoleGET/roles/{role_name}
Get configure data for the specified role
Example URI
- role_name
string
(required)name of user role
Get Role Data
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data":{
"menu": ["dashboard", "compute\_pool", "address\_pool", "instance"]
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"menu": {
"type": "array",
"description": "list of menu tags"
}
}
}
}
}
Add RolePOST/roles/{role_name}
Add a new user role to system
Example URI
- role_name
string
(required)name of user role
Add Role
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"menu": [
"dashboard",
"compute_pool",
"address_pool",
"instance"
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"menu": {
"type": "array",
"items": {
"type": "string"
},
"description": "menu tags list which can access using this role"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Modify RolePUT/roles/{role_name}
Change resource can access for a specified role
Example URI
- role_name
string
(required)name of user role
Modify Role
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"menu": ["dashboard", "compute\_pool", "address\_pool", "instance"]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"menu": {
"type": "array",
"items": {
"type": "string"
},
"description": "menu tags list which can access using this role"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Remove RoleDELETE/roles/{role_name}
Remove a role from the system, only available when the role don’t bind to any user or group
Example URI
- role_name
string
(required)name of user role
Remove Role
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
User Group ¶
APIs manage user groups
Query All User GroupsGET/user_groups/
Query all user groups in the system
Example URI
Query All User Groups
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": [
{
"name": "manager_group",
"display": "Group of Manager",
"member": 3
},
{
"name": "auditor_group",
"display": "Group of Auditor",
"member": 1
},
{
"name": "user_group",
"display": "Group of User",
"member": 10
}
]
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array"
}
}
}
Get User Group DetailGET/user_groups/{group_name}
Get detail data of a user group
Example URI
- group_name
string
(required)name of user group
Get User Group Data
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": {
"name": "manager_group",
"display": "Group of Manager",
"role": [
"manager",
"user"
],
"member": [
"admin",
"nano",
"akumas"
]
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "group name"
},
"display": {
"type": "string",
"description": "display name of group"
},
"role": {
"type": "array",
"items": {
"type": "string"
},
"description": "list of attached roles"
},
"member": {
"type": "array",
"items": {
"type": "string"
},
"description": "list of group members"
}
}
}
}
}
Add User GroupPOST/user_groups/{group_name}
Add a new user group to the system
Example URI
- group_name
string
(required)name of user group
Add User Group
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"display": "Group of Manager",
"role": [
"manager",
"user"
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"display": {
"type": "string",
"description": "display name of group"
},
"role": {
"type": "array",
"description": "list of attached roles"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Modify User GroupPUT/user_groups/{group_name}
Modify a user group
Example URI
- group_name
string
(required)name of user group
Modify User Group
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"display": "Group of Manager",
"role": [
"manager",
"user"
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"display": {
"type": "string",
"description": "display name of group"
},
"role": {
"type": "array",
"description": "list of attached roles"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Remove User GroupDELETE/user_groups/{group_name}
Remove a user group from the system
Example URI
- group_name
string
(required)name of user group
Remove User Group
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
User Group Members ¶
APIs manage members of a user group
Query User Group MembersGET/user_groups/members/
Query all members of a user group
Example URI
Query User Group Members
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": [
"admin",
"nano",
"akumas"
]
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array",
"items": {
"type": "string"
},
"description": "list of member names"
}
}
}
Add User Group MemberPOST/user_groups/{group_name}/members/{user_name}
Add a new member to the user group
Example URI
- group_name
string
(required)name of user group
- user_name
string
(required)user name
Add User Group Member
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Remove User Group MemberDELETE/user_groups/{group_name}/members/{user_name}
Remove a member from the user group
Example URI
- group_name
string
(required)name of user group
- user_name
string
(required)user name
Remove User Group Member
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
User ¶
APIs manage users
Query All UsersGET/users/
Query all users in the system
Example URI
Query All Users
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": [
"admin",
"nano",
"akumas"
]
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array",
"items": {
"type": "string"
},
"description": "list of users"
}
}
}
Get User InfoGET/users/{user_name}
Get info of a user
Example URI
- user_name
string
(required)user name
Get User Info
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": {
"nick": "AK",
"mail": "a@b.com"
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"nick": {
"type": "string",
"description": "nick name"
},
"mail": {
"type": "string",
"description": "user email address"
}
}
}
}
}
Create New UserPOST/users/{user_name}
Create a new user in the system
Example URI
- user_name
string
(required)user name
Create New User
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"nick": "AK",
"mail": "a@b.com",
"password": "abcdefg"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"nick": {
"type": "string",
"description": "nick name for display"
},
"mail": {
"type": "string",
"description": "user email"
},
"password": {
"type": "string",
"description": "user password"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Modify UserPUT/users/{user_name}
Modify user info
Example URI
- user_name
string
(required)user name
Modify User Info
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"nick": "AK",
"mail": "a@b.com"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"nick": {
"type": "string",
"description": "nick name for display"
},
"mail": {
"type": "string",
"description": "user email"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Delete UserDELETE/users/{user_name}
Delete a user
Example URI
- user_name
string
(required)user name
Delete User
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
User Password ¶
APIs manage user password
Modify User PasswordPUT/users/{user_name}/password/
Verify and update a new user password
Example URI
- user_name
string
(required)user name
Modify Password
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"old": "123456",
"new": "abcdef"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"old": {
"type": "string",
"description": "old password for verify"
},
"new": {
"type": "string",
"description": "new password"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
User Search ¶
APIs for searching users
Search UserGET/user_search/{?group}
Search users by group
Example URI
- group
string
(optional)user group
Search Users
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": [
"nano",
"alex",
"sam"
]
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "array",
"items": {
"type": "string"
},
"description": "list of users"
}
}
}
Sessions ¶
Manage authenticated session
Authenticate New SessionPOST/sessions/
Verify and allocate a new sesion for all other requests, set session ID in header ‘Nano-Session’ for authentication.
Example URI
Create New Session
Headers
Content-Type: application/json
Body
{
"user": "alex",
"password": "abcdef",
"nonce": "1234567890"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"user": {
"type": "string",
"description": "user name"
},
"password": {
"type": "string",
"description": "new password"
},
"nonce": {
"type": "string",
"description": "nonce for crypt"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": {
"session": "bsu6384js3=",
"timeout": 120
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"session": {
"type": "string",
"description": "allocated session ID"
},
"timeout": {
"type": "number",
"description": "session timeout in seconds"
}
}
}
}
}
Update SessionPUT/sessions/{session_id}
Keep session alive
Example URI
- session_id
string
(required)session ID
Keep Alive
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Obtain Authenticated SessionGET/sessions/{session_id}
Get attached info with authenticated session
Example URI
- session_id
string
(required)session ID
Obtain Session Data
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data":{
"menu": ["dashboard", "compute\_pool", "address\_pool", "instance"],
"resource": [],
"user": "nano",
"group": "admin",
"address": "192.168.1.100"
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"user": {
"type": "string",
"description": "authenticated user name"
},
"group": {
"type": "string",
"description": "authenticated group name"
},
"address": {
"type": "string",
"description": "current request IP"
},
"menu": {
"type": "array",
"description": "list of menu tags"
},
"resource": {
"type": "array",
"description": "list of allocated resources"
}
}
}
}
}
Resource Visibility ¶
Manage resource visibility with login session
Get Current VisibilityGET/resource_visibilities/
Get current visibility configure with the group of current user
Example URI
Get Visiblity
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": {
"instance_visible": true,
"media_image_visible": true,
"disk_image_visible": false
}
}
]
Set Current VisibilityPUT/resource_visibilities/
Modify current visibility configure with the group of current user
Example URI
Modify Visibility
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"instance_visible": true,
"media_image_visible": true,
"disk_image_visible": false
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"instance_visible": {
"type": "boolean",
"description": "user can view instances in the same group"
},
"media_image_visible": {
"type": "boolean",
"description": "user can view media images in the same group"
},
"disk_image_visible": {
"type": "boolean",
"description": "user can view disk images in the same group"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Logs ¶
APIs manage system logs
Query Log EntryGET/logs/{?limit,start,after,before}
Query system logs by conditions
Example URI
- limit
number
(required)max entries returned
- start
number
(optional)start offset
- after
string
(optional)query logs after this date
- before
string
(optional)query logs before this date
Query Logs
Headers
Nano-session: 1234567890-abcdef
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": "",
"data": {
"logs": [
{
"id": "201812011457390001",
"time": "2018-12-01 14:57:39",
"content": "admin create new user example"
},
{
"id": "201812031427190001",
"time": "2018-12-03 14:27:19",
"content": "nano.sabrina create new guest nano.test1"
}
],
"total": 100
}
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
},
"data": {
"type": "object",
"properties": {
"logs": {
"type": "array"
},
"total": {
"type": "number",
"description": "total log entries"
}
}
}
}
}
Add Log EntryPOST/logs/
Add a single log entry
Example URI
Add Log
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"format": "string",
"content": "here is a new log for somebody creating a new instance"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"format": {
"type": "string",
"description": "format of content"
},
"content": {
"type": "string",
"description": "log content"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}
Delete Log EntryDELETE/logs/
Delete logs
Example URI
Delete Log
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Body
{
"entries": [
"201812011457390001",
"201812031427190001"
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"entries": {
"type": "array",
"items": {
"type": "string"
},
"description": "list of log entry"
}
}
}
200
Headers
Content-Type: application/json
Body
[
{
"error_code": 0,
"message": ""
}
]
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error_code": {
"type": "number",
"description": "error code"
},
"message": {
"type": "string",
"description": "error message"
}
}
}