Back to top

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 Pools
GET/compute_pools/

Query all compute pools in current zone

Example URI

GET http://nanos.cloud/api/v1/compute_pools/
Request  Get All Compute Pools
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Status
GET/compute_pools/{pool}

Get status of a compute pool

Example URI

GET http://nanos.cloud/api/v1/compute_pools/pool
URI Parameters
HideShow
pool
string (required) 

name of compute pool

Request  Get Compute Pool Status
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Pool
POST/compute_pools/{pool}

Create a new compute pool

Example URI

POST http://nanos.cloud/api/v1/compute_pools/pool
URI Parameters
HideShow
pool
string (required) 

name of compute pool

Request  Create New Compute Pool
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Pool
DELETE/compute_pools/{pool}

Delete a compute pool

Example URI

DELETE http://nanos.cloud/api/v1/compute_pools/pool
URI Parameters
HideShow
pool
string (required) 

name of compute pool

Request  Delete Compute Pool
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Pool
PUT/compute_pools/{pool}

Modify configure of a compute pool

Example URI

PUT http://nanos.cloud/api/v1/compute_pools/pool
URI Parameters
HideShow
pool
string (required) 

name of compute pool

Request  Modify Compute Pool
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Cells
GET/compute_pool_cells/

query cells not attached to any pool

Example URI

GET http://nanos.cloud/api/v1/compute_pool_cells/
Request  Query Unallocated Cells
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Pool
GET/compute_pool_cells/{pool}

Query all cells attached in a pool

Example URI

GET http://nanos.cloud/api/v1/compute_pool_cells/pool
URI Parameters
HideShow
pool
string (required) 

pool name

Request  Query Attached Cells
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Cell
POST/compute_pool_cells/{pool}/{cell}

Add a new cell to the compute pool

Example URI

POST http://nanos.cloud/api/v1/compute_pool_cells/pool/cell
URI Parameters
HideShow
pool
string (required) 

pool name

cell
string (required) 

cell name

Request  Add Compute Cell
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Cell
DELETE/compute_pool_cells/{pool}/{cell}

Remove an attached cell from the compute pool

Example URI

DELETE http://nanos.cloud/api/v1/compute_pool_cells/pool/cell
URI Parameters
HideShow
pool
string (required) 

pool name

cell
string (required) 

cell name

Request  Remove Compute Cell
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Cell
PUT/compute_pool_cells/{pool}/{cell}

Modify a compute cell

Example URI

PUT http://nanos.cloud/api/v1/compute_pool_cells/pool/cell
URI Parameters
HideShow
pool
string (required) 

pool name

cell
string (required) 

cell name

Request  Modify Compute Cell
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Status
GET/compute_pool_cells/{pool}/{cell}

Get current status of a compute cell

Example URI

GET http://nanos.cloud/api/v1/compute_pool_cells/pool/cell
URI Parameters
HideShow
pool
string (required) 

pool name

cell
string (required) 

cell name

Request  Get Cell Status
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Pool
GET/storage_pools/

Query configures of all storage pool

Example URI

GET http://nanos.cloud/api/v1/storage_pools/
Request  Query Storage Pool
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Configure
GET/storage_pools/{pool}

Get the configure of a storage pool

Example URI

GET http://nanos.cloud/api/v1/storage_pools/pool
URI Parameters
HideShow
pool
string (required) 

name of storage pool

Request  Get Storage Pool Configure
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "error_code": 0,
    "message": "",
    "data": {
      "type": "nfs",
      "host": "nfs.nano.com",
      "target": "/var/nano/pool1"
    }
  }
]

Create New Storage Pool
POST/storage_pools/{pool}

Create a new stoarge pool

Example URI

POST http://nanos.cloud/api/v1/storage_pools/pool
URI Parameters
HideShow
pool
string (required) 

name of storage pool

Request  Create Storage Pool
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Pool
PUT/storage_pools/{pool}

Modify stoarge pool, only available on an empty storage pool.

Example URI

PUT http://nanos.cloud/api/v1/storage_pools/pool
URI Parameters
HideShow
pool
string (required) 

name of storage pool

Request  Modify Storage Pool
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Pool
DELETE/storage_pools/{pool}

Delete a storage pool, only available on an empty storage pool.

Example URI

DELETE http://nanos.cloud/api/v1/storage_pools/pool
URI Parameters
HideShow
pool
string (required) 

name of storage pool

Request  Delete Storage Pool
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Status
GET/compute_zone_status/

Query lastest status of a whole zone

Example URI

GET http://nanos.cloud/api/v1/compute_zone_status/
Request  Query Zone Status
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Pools
GET/compute_pool_status/

Collect status of all compute pools

Example URI

GET http://nanos.cloud/api/v1/compute_pool_status/
Request  Query Status of Compute Pools
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Pool
GET/compute_pool_status/{pool}

Collect statistic status on a compute pool

Example URI

GET http://nanos.cloud/api/v1/compute_pool_status/pool
URI Parameters
HideShow
pool
string (required) 

name of a compute pool

Request  Get Status of A Compute Pool
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Cells
GET/compute_cell_status/{pool}/

Collect statistic status of compute cells in a pool

Example URI

GET http://nanos.cloud/api/v1/compute_cell_status/pool/
URI Parameters
HideShow
pool
string (required) 

name of target pool

Request  Query Status of Compute Cells
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Status
GET/compute_cell_status/{cell}

Collect statistic status of a compute cell

Example URI

GET http://nanos.cloud/api/v1/compute_cell_status/cell
URI Parameters
HideShow
cell
string (required) 

name of target cell

Request  Get Status of A Compute Cell
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Storages
GET/compute_cell_status/{pool}/{cell}/storages/

Get Storage Paths for a cell

Example URI

GET http://nanos.cloud/api/v1/compute_cell_status/pool/cell/storages/
URI Parameters
HideShow
pool
string (required) 

name of target pool

cell
string (required) 

name of target cell

Request  Query Storages
HideShow
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Paths
PUT/compute_cell_status/{pool}/{cell}/storages/

Modify Storage Paths

Example URI

PUT http://nanos.cloud/api/v1/compute_cell_status/pool/cell/storages/
URI Parameters
HideShow
pool
string (required) 

name of target pool

cell
string (required) 

name of target cell

Request  Modify Storage Paths
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Pool
GET/instance_status/{pool}/

Query status of all instances in a pool

Example URI

GET http://nanos.cloud/api/v1/instance_status/pool/
URI Parameters
HideShow
pool
string (required) 

name of target pool

Request  Query Instances In Pool
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Cell
GET/instance_status/{cell}/

Query status of instances in a cell

Example URI

GET http://nanos.cloud/api/v1/instance_status/cell/
URI Parameters
HideShow
cell
string (required) 

name of target cell

Request  Query Instances In Cell
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Pools
GET/address_pools/

Query all address pools

Example URI

GET http://nanos.cloud/api/v1/address_pools/
Request  Query All Address Pools
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Status
GET/address_pools/{name}

Get address pool status

Example URI

GET http://nanos.cloud/api/v1/address_pools/name
URI Parameters
HideShow
name
string (required) 

pool name

Request  Get Address Pool Status
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Pool
POST/address_pools/{name}

Create a new address pool

Example URI

POST http://nanos.cloud/api/v1/address_pools/name
URI Parameters
HideShow
name
string (required) 

pool name

Request  Create A New Address Pool
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Pool
PUT/address_pools/{name}

Modify address pool

Example URI

PUT http://nanos.cloud/api/v1/address_pools/name
URI Parameters
HideShow
name
string (required) 

pool name

Request  Modify A Address Pool
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Pool
DELETE/address_pools/{name}

Delete an address pool

Example URI

DELETE http://nanos.cloud/api/v1/address_pools/name
URI Parameters
HideShow
name
string (required) 

pool name

Request  Delete Address Pool
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Ranges
GET/address_pools/{name}/{type}/ranges/

Query all ranges in pool

Example URI

GET http://nanos.cloud/api/v1/address_pools/name/type/ranges/
URI Parameters
HideShow
name
string (required) 

name of address pool

type
string (optional) Default: internal 

range type

Choices: internal external

Request  Query Address Ranges
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Status
GET/address_pools/ranges/{start}

Get address range status

Example URI

GET http://nanos.cloud/api/v1/address_pools/ranges/start
URI Parameters
HideShow
start
string (required) 

start address of range

Request  Get Address Ranges Status
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Range
POST/address_pools/ranges/{start}

Add a new address range

Example URI

POST http://nanos.cloud/api/v1/address_pools/ranges/start
URI Parameters
HideShow
start
string (required) 

start address of range

Request  Add Address Range
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Range
DELETE/address_pools/ranges/{start}

Remove an address range

Example URI

DELETE http://nanos.cloud/api/v1/address_pools/ranges/start
URI Parameters
HideShow
start
string (required) 

start address of range

Request  Remove Range
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Conditions
GET/guest_search/{?pool,cell,status,created}

Example URI

GET http://nanos.cloud/api/v1/guest_search/?pool=&cell=&status=&created=
URI Parameters
HideShow
pool
string (required) 

target pool name

cell
string (optional) 

target cell

status
number (optional) 

running status

created
boolean (optional) 

guest created

Request  Query Guests
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Status
GET/guests/{id}

Get status with ID when creating, 201 for creating guest, 200 for created guest

Example URI

GET http://nanos.cloud/api/v1/guests/id
URI Parameters
HideShow
id
string (required) 

guest id

Request  Guest Guest Status
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  201
HideShow
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"
        }
      }
    }
  }
}
Response  200
HideShow
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 Guest
POST/guests/

Creating a new guest, return an ID for later querying

Example URI

POST http://nanos.cloud/api/v1/guests/
Request  Create New Guest
HideShow
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"
    }
  }
}
Response  202
HideShow
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 Guest
DELETE/guests/{id}

delete guest, release all allocated resources

Example URI

DELETE http://nanos.cloud/api/v1/guests/id
URI Parameters
HideShow
id
string (required) 

guest id

Request  delete guest
HideShow
Headers
Content-Type: application/json
Body
{
  "force": true
}
Response  200
HideShow
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 Option
PUT/guests/{id}/auto_start

Change status of auto start option

Example URI

PUT http://nanos.cloud/api/v1/guests/id/auto_start
URI Parameters
HideShow
id
string (required) 

guest ID

Request  Modify Auto Start Option
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Cores
PUT/guests/{id}/cores

Change number of cores

Example URI

PUT http://nanos.cloud/api/v1/guests/id/cores
URI Parameters
HideShow
id
string (required) 

guest ID

Request  Modify Cores
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Capacity
PUT/guests/{id}/memory

Change memory size of guest, only available when guest offline

Example URI

PUT http://nanos.cloud/api/v1/guests/id/memory
URI Parameters
HideShow
id
string (required) 

guest ID

Request  Change Memory Capacity
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Capacity
PUT/guests/{id}/disks/resize/{disk}

Change disk capacity of the guest to larger. Only allow operating in an offline instance.

Example URI

PUT http://nanos.cloud/api/v1/guests/id/disks/resize/disk
URI Parameters
HideShow
id
string (required) 

guest ID

disk
number (required) 

index of target disk, system:0, data0:1, data1:2…

Request  Extend Disk Capacity
HideShow
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"
    }
  }
}
Response  200
HideShow
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 File
PUT/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

PUT http://nanos.cloud/api/v1/guests/id/disks/shrink/disk
URI Parameters
HideShow
id
string (required) 

guest ID

disk
number (required) 

index of target disk, system:0, data0:1, data1:2…

Request  Shrink Disk File
HideShow
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"
    }
  }
}
Response  200
HideShow
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 System
PUT/guests/{id}/system/

Reset operating system of the guest from a disk image, all user data discard.

Example URI

PUT http://nanos.cloud/api/v1/guests/id/system/
URI Parameters
HideShow
id
string (required) 

guest ID

Request  Reset Guest System
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Password
PUT/guests/{id}/auth

Reset a new password for administator of guest

Example URI

PUT http://nanos.cloud/api/v1/guests/id/auth
URI Parameters
HideShow
id
string (required) 

guest ID

Request  Reset Administrator Password
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Password
GET/guests/{id}/auth

Get current name and password of administrator

Example URI

GET http://nanos.cloud/api/v1/guests/id/auth
URI Parameters
HideShow
id
string (required) 

guest ID

Request  Get Administrator Password
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Name
PUT/guests/{id}/name/

Change guest name

Example URI

PUT http://nanos.cloud/api/v1/guests/id/name/
URI Parameters
HideShow
id
string (required) 

guest ID

Request  Modify Guest Name
HideShow
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"
    }
  }
}
Response  200
HideShow
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 prioirty
PUT/guests/{id}/qos/cpu/

Change CPU priority

Example URI

PUT http://nanos.cloud/api/v1/guests/id/qos/cpu/
URI Parameters
HideShow
id
string (required) 

guest ID

Request  Modify CPU priority
HideShow
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"
    }
  }
}
Response  200
HideShow
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 QoS
PUT/guests/{id}/qos/disk/

Change disk QoS configure

Example URI

PUT http://nanos.cloud/api/v1/guests/id/qos/disk/
URI Parameters
HideShow
id
string (required) 

guest ID

Request  Modify Disk QoS
HideShow
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"
    }
  }
}
Response  200
HideShow
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 QoS
PUT/guests/{id}/qos/network/

change network QoS configure

Example URI

PUT http://nanos.cloud/api/v1/guests/id/qos/network/
URI Parameters
HideShow
id
string (required) 

guest ID

Request  Modify Network QoS
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Policy
GET/guests/{id}/security_policy/

Example URI

GET http://nanos.cloud/api/v1/guests/id/security_policy/
URI Parameters
HideShow
id
string (required) 

guest id

Request  Get Security Policy
HideShow
Headers
Nano-session: 1234567890-abcdef
Accept: text/plain
Response  200
HideShow
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 Action
PUT/guests/{id}/security_policy/default_action

Change the default action when no rules matched

Example URI

PUT http://nanos.cloud/api/v1/guests/id/security_policy/default_action
URI Parameters
HideShow
id
string (required) 

guest id

Request  Change Default Action
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Rule
POST/guests/{id}/security_policy/rules/

Append new security policy rule to tail

Example URI

POST http://nanos.cloud/api/v1/guests/id/security_policy/rules/
URI Parameters
HideShow
id
string (required) 

guest id

Request  Append New Security Policy Rule
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Rule
PUT/guests/security_policy/rules/{index}

Modify Security Policy Rule

Example URI

PUT http://nanos.cloud/api/v1/guests/security_policy/rules/index
URI Parameters
HideShow
index
number (required) 

index of policy rule

Request  Modify Security Policy Rule
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Order
PUT/guests/security_policy/rules/{index}/order

Change Rule Order

Example URI

PUT http://nanos.cloud/api/v1/guests/security_policy/rules/index/order
URI Parameters
HideShow
index
number (required) 

index of policy rule

Request  Change Rule Order
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Rule
DELETE/guests/security_policy/rules/{index}

Remove Security Policy Rule

Example URI

DELETE http://nanos.cloud/api/v1/guests/security_policy/rules/index
URI Parameters
HideShow
index
number (required) 

index of policy rule

Request  Remove Security Policy Rule
HideShow
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Status
GET/instances/{id}

Get current status of an instance

Example URI

GET http://nanos.cloud/api/v1/instances/id
URI Parameters
HideShow
id
string (required) 

guest ID

Request  Get Instance Status
HideShow
Headers
Nano-Session: 12345678-abcdef
Response  200
HideShow
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/Instance
POST/instances/{id}

Start guest(create instance)

Example URI

POST http://nanos.cloud/api/v1/instances/id
URI Parameters
HideShow
id
string (required) 

guest ID

Request  Start Instance
HideShow
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"
    }
  }
}
Response  200
HideShow
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/Instance
DELETE/instances/{id}

Stop guest(delete instance)

Example URI

DELETE http://nanos.cloud/api/v1/instances/id
URI Parameters
HideShow
id
string (required) 

guest ID

Request  Stop Guest
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Media
POST/instances/{id}/media

Insert media into a running instance

Example URI

POST http://nanos.cloud/api/v1/instances/id/media
URI Parameters
HideShow
id
string (required) 

guest ID

Request  Insert Media
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Media
DELETE/instances/{id}/media

Eject media from a running instance

Example URI

DELETE http://nanos.cloud/api/v1/instances/id/media
URI Parameters
HideShow
id
string (required) 

guest ID

Request  Eject Media
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Snapshots
GET/instances/{id}/snapshots/

Query all snapshots attached to the guest

Example URI

GET http://nanos.cloud/api/v1/instances/id/snapshots/
URI Parameters
HideShow
id
string (required) 

guest ID

Request  Query Snapshots
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Snapshot
POST/instances/{id}/snapshots/

Create a new snapshot, only available when guest stopped

Example URI

POST http://nanos.cloud/api/v1/instances/id/snapshots/
URI Parameters
HideShow
id
string (required) 

guest ID

Request  Create New Snapshot
HideShow
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"
    }
  }
}
Response  200
HideShow
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 snapshot
PUT/instances/{id}/snapshots/

Resume to a specified snapshot, available on stopped guest

Example URI

PUT http://nanos.cloud/api/v1/instances/id/snapshots/
URI Parameters
HideShow
id
string (required) 

guest ID

Request  Restore Snapshot
HideShow
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"
    }
  }
}
Response  200
HideShow
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 info
GET/instances/{id}/snapshots/{name}

Query info of a snapshot

Example URI

GET http://nanos.cloud/api/v1/instances/id/snapshots/name
URI Parameters
HideShow
id
string (required) 

guest id

name
string (required) 

snapshot

Request  Get Snapshot Info
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 snapshot
DELETE/instances/{id}/snapshots/{name}

Delete a snapshot

Example URI

DELETE http://nanos.cloud/api/v1/instances/id/snapshots/name
URI Parameters
HideShow
id
string (required) 

guest id

name
string (required) 

snapshot

Request  Delete Snapshot
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Channel
POST/monitor_channels/

Establish a new monitor channel

Example URI

POST http://nanos.cloud/api/v1/monitor_channels/
Request  Create New Monitor Channel
HideShow
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"
    }
  }
}
Response  200
HideShow
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

Manage Media Images

Synchronize Local Media Images
PATCH/media_images/

Synchronize media images from local directory

Example URI

PATCH http://nanos.cloud/api/v1/media_images/
Request  Synchronize Local Media Images
HideShow
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#"
}
Response  200
HideShow
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 Images
GET/media_images/

Query all media image

Example URI

GET http://nanos.cloud/api/v1/media_images/
Request  Query All Media Images
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Image
GET/media_images/{id}

Get info of media image

Example URI

GET http://nanos.cloud/api/v1/media_images/id
URI Parameters
HideShow
id
string (required) 

media image id

Request  Get Media Image Status
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Image
POST/media_images/

Create a new media image

Example URI

POST http://nanos.cloud/api/v1/media_images/
Request  Create A New Media Image
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Image
PUT/media_images/{id}

Modify info of media image

Example URI

PUT http://nanos.cloud/api/v1/media_images/id
URI Parameters
HideShow
id
string (required) 

media image id

Request  Modify Media Image
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Image
DELETE/media_images/{id}

Delete a media image

Example URI

DELETE http://nanos.cloud/api/v1/media_images/id
URI Parameters
HideShow
id
string (required) 

media image id

Request  Detele Media Image
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 File
GET/media_image_files/{id}

Download binary media image data

Example URI

GET http://nanos.cloud/api/v1/media_image_files/id
URI Parameters
HideShow
id
string (required) 

image id

Response  200
HideShow
Headers
Content-Type: application/octet-stream

Upload Image File
POST/media_image_files/{id}

Upload iso data as media image

Example URI

POST http://nanos.cloud/api/v1/media_image_files/id
URI Parameters
HideShow
id
string (required) 

image id

Request  upload
HideShow
Headers
Content-Type: multipart/form-data
Body
-----BOUNDARY
Content-Disposition: form-data; name="image"; filename="image.iso"

-----BOUNDARY
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "error_code": 0,
    "message": "",
    "data": ""
  }
]

Disk Image

Manage Disk Images

Synchronize Local Disk Image
PATCH/disk_images/

Synchronize disk images from local directory

Example URI

PATCH http://nanos.cloud/api/v1/disk_images/
Request  Synchronize Local Disk Image
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Image
GET/disk_images/{id}

Get status of disk image

Example URI

GET http://nanos.cloud/api/v1/disk_images/id
URI Parameters
HideShow
id
string (required) 

disk image id

Request  Get Disk Image Status
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  202
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Image
POST/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

POST http://nanos.cloud/api/v1/disk_images/
Request  Create A New Disk Image
HideShow
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"
    }
  }
}
Response  202
HideShow
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 Image
PUT/disk_images/{id}

Modify info of disk image

Example URI

PUT http://nanos.cloud/api/v1/disk_images/id
URI Parameters
HideShow
id
string (required) 

disk image id

Request  Modify Disk Image
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Image
DELETE/disk_images/{id}

delete a disk image

Example URI

DELETE http://nanos.cloud/api/v1/disk_images/id
URI Parameters
HideShow
id
string (required) 

disk image id

Request  Delete Disk Image
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 File
POST/disk_image_files/{id}

Upload a qcow2 file as disk image

Example URI

POST http://nanos.cloud/api/v1/disk_image_files/id
URI Parameters
HideShow
id
string (required) 

image id

Request  Upload New Image File
HideShow
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
Response  200
HideShow
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 Templates
GET/templates/

Query All Templates

Example URI

GET http://nanos.cloud/api/v1/templates/
Request  Query Templates
HideShow
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Template
GET/templates/{id}

Get configure of a system template

Example URI

GET http://nanos.cloud/api/v1/templates/id
URI Parameters
HideShow
id
string (required) 

template id

Request  Get Template Detail
HideShow
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Template
POST/templates/

Create System Template

Example URI

POST http://nanos.cloud/api/v1/templates/
Request  Create System Template
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Templates
PUT/templates/{id}

Modify System Templates

Example URI

PUT http://nanos.cloud/api/v1/templates/id
URI Parameters
HideShow
id
string (required) 

template id

Request  Modify System Templates
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Template
DELETE/templates/{id}

Delete System Template

Example URI

DELETE http://nanos.cloud/api/v1/templates/id
URI Parameters
HideShow
id
string (required) 

template id

Request  Delete System Template
HideShow
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Group
GET/security_policy_groups/{id}

Get Security Group

Example URI

GET http://nanos.cloud/api/v1/security_policy_groups/id
URI Parameters
HideShow
id
string (required) 

group id

Request  Get Security Group
HideShow
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Group
POST/security_policy_groups/

Create Security Group

Example URI

POST http://nanos.cloud/api/v1/security_policy_groups/
Request  Create Security Group
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Group
PUT/security_policy_groups/{id}

Modify Security Group

Example URI

PUT http://nanos.cloud/api/v1/security_policy_groups/id
URI Parameters
HideShow
id
string (required) 

group id

Request  Modify Security Group
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Group
DELETE/security_policy_groups/{id}

Delete Security Group

Example URI

DELETE http://nanos.cloud/api/v1/security_policy_groups/id
URI Parameters
HideShow
id
string (required) 

group id

Request  Delete Security Group
HideShow
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Rules
GET/security_policy_groups/{id}/rules/

Query Security Policy Rule

Example URI

GET http://nanos.cloud/api/v1/security_policy_groups/id/rules/
URI Parameters
HideShow
id
string (required) 

group id

Request  Query Security Policy Rule
HideShow
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Rule
POST/security_policy_groups/{id}/rules/

Add Security Policy Rule

Example URI

POST http://nanos.cloud/api/v1/security_policy_groups/id/rules/
URI Parameters
HideShow
id
string (required) 

group id

Request  Add Security Policy Rule
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Rule
PUT/security_policy_groups/{id}/rules/{index}

Modify Security Policy Rule

Example URI

PUT http://nanos.cloud/api/v1/security_policy_groups/id/rules/index
URI Parameters
HideShow
id
string (required) 

group id

index
number (required) 

index of policy rule, start from 0

Request  Modify Security Policy Rule
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Order
PUT/security_policy_groups/{id}/rules/{index}/order

Change Rule Order

Example URI

PUT http://nanos.cloud/api/v1/security_policy_groups/id/rules/index/order
URI Parameters
HideShow
id
string (required) 

group id

index
number (required) 

index of policy rule, start from 0

Request  Change Rule Order
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Rule
DELETE/security_policy_groups/{id}/rules/{index}

Remove Security Policy Rule

Example URI

DELETE http://nanos.cloud/api/v1/security_policy_groups/id/rules/index
URI Parameters
HideShow
id
string (required) 

group id

index
number (required) 

index of policy rule, start from 0

Request  Remove Security Policy Rule
HideShow
Headers
Content-Type: application/json
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Migration
POST/migrations/

Create and start a new migration task

Example URI

POST http://nanos.cloud/api/v1/migrations/
Request  Start Migration
HideShow
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"
    }
  }
}
Response  202
HideShow
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 Task
GET/migrations/{id}

Query status of a migration task

Example URI

GET http://nanos.cloud/api/v1/migrations/id
URI Parameters
HideShow
id
string (required) 

migration task id

Request  Get Migration Task Status
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  201
HideShow
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"
        }
      }
    }
  }
}
Response  200
HideShow
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 progress
GET/migrations/

Query all pending migrations

Example URI

GET http://nanos.cloud/api/v1/migrations/
Request  Query Pending Migration Tasks
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Creation
POST/batch/create_guest/

Create a bulk of new guests, return a task ID for query status

Example URI

POST http://nanos.cloud/api/v1/batch/create_guest/
Request  Start Batch Creating
HideShow
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"
    }
  }
}
Response  202
HideShow
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 Status
GET/batch/create_guest/{id}

Query task status of batch creating

Example URI

GET http://nanos.cloud/api/v1/batch/create_guest/id
URI Parameters
HideShow
id
string (required) 

id of batch task

Request  Query Pending Creating
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  202
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Deleting
POST/batch/delete_guest/

Delete a bulk of guests, return a task ID for query status

Example URI

POST http://nanos.cloud/api/v1/batch/delete_guest/
Request  Start Batch Deleting
HideShow
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"
    }
  }
}
Response  202
HideShow
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 Status
GET/batch/delete_guest/{id}

Query task status of batch deleting

Example URI

GET http://nanos.cloud/api/v1/batch/delete_guest/id
URI Parameters
HideShow
id
string (required) 

id of batch task

Request  Query Pending Deleting
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  202
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Stopping
POST/batch/stop_guest/

Stop a bulk of guests, return a task ID for query status

Example URI

POST http://nanos.cloud/api/v1/batch/stop_guest/
Request  Start Batch Stopping
HideShow
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"
    }
  }
}
Response  202
HideShow
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 Status
GET/batch/stop_guest/{id}

Query task status of batch stopping

Example URI

GET http://nanos.cloud/api/v1/batch/stop_guest/id
URI Parameters
HideShow
id
string (required) 

id of batch task

Request  Query Pending Stopping
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  202
HideShow
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"
    }
  }
}
Response  200
HideShow
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"
    }
  }
}

FrontEnd Management

Management APIs for FrontEnd module

Role

Manage user roles

List Roles
GET/roles/

Query all user roles in the system

Example URI

GET http://nanos.cloud/api/v1/roles/
Request  Query All Roles
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Role
GET/roles/{role_name}

Get configure data for the specified role

Example URI

GET http://nanos.cloud/api/v1/roles/role_name
URI Parameters
HideShow
role_name
string (required) 

name of user role

Request  Get Role Data
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Role
POST/roles/{role_name}

Add a new user role to system

Example URI

POST http://nanos.cloud/api/v1/roles/role_name
URI Parameters
HideShow
role_name
string (required) 

name of user role

Request  Add Role
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Role
PUT/roles/{role_name}

Change resource can access for a specified role

Example URI

PUT http://nanos.cloud/api/v1/roles/role_name
URI Parameters
HideShow
role_name
string (required) 

name of user role

Request  Modify Role
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Role
DELETE/roles/{role_name}

Remove a role from the system, only available when the role don’t bind to any user or group

Example URI

DELETE http://nanos.cloud/api/v1/roles/role_name
URI Parameters
HideShow
role_name
string (required) 

name of user role

Request  Remove Role
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Groups
GET/user_groups/

Query all user groups in the system

Example URI

GET http://nanos.cloud/api/v1/user_groups/
Request  Query All User Groups
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Detail
GET/user_groups/{group_name}

Get detail data of a user group

Example URI

GET http://nanos.cloud/api/v1/user_groups/group_name
URI Parameters
HideShow
group_name
string (required) 

name of user group

Request  Get User Group Data
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Group
POST/user_groups/{group_name}

Add a new user group to the system

Example URI

POST http://nanos.cloud/api/v1/user_groups/group_name
URI Parameters
HideShow
group_name
string (required) 

name of user group

Request  Add User Group
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Group
PUT/user_groups/{group_name}

Modify a user group

Example URI

PUT http://nanos.cloud/api/v1/user_groups/group_name
URI Parameters
HideShow
group_name
string (required) 

name of user group

Request  Modify User Group
HideShow
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"
    }
  }
}
Response  200
HideShow
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
DELETE/user_groups/{group_name}

Remove a user group from the system

Example URI

DELETE http://nanos.cloud/api/v1/user_groups/group_name
URI Parameters
HideShow
group_name
string (required) 

name of user group

Request  Remove User Group
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Members
GET/user_groups/members/

Query all members of a user group

Example URI

GET http://nanos.cloud/api/v1/user_groups/members/
Request  Query User Group Members
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Member
POST/user_groups/{group_name}/members/{user_name}

Add a new member to the user group

Example URI

POST http://nanos.cloud/api/v1/user_groups/group_name/members/user_name
URI Parameters
HideShow
group_name
string (required) 

name of user group

user_name
string (required) 

user name

Request  Add User Group Member
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Member
DELETE/user_groups/{group_name}/members/{user_name}

Remove a member from the user group

Example URI

DELETE http://nanos.cloud/api/v1/user_groups/group_name/members/user_name
URI Parameters
HideShow
group_name
string (required) 

name of user group

user_name
string (required) 

user name

Request  Remove User Group Member
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Users
GET/users/

Query all users in the system

Example URI

GET http://nanos.cloud/api/v1/users/
Request  Query All Users
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Info
GET/users/{user_name}

Get info of a user

Example URI

GET http://nanos.cloud/api/v1/users/user_name
URI Parameters
HideShow
user_name
string (required) 

user name

Request  Get User Info
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 User
POST/users/{user_name}

Create a new user in the system

Example URI

POST http://nanos.cloud/api/v1/users/user_name
URI Parameters
HideShow
user_name
string (required) 

user name

Request  Create New User
HideShow
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"
    }
  }
}
Response  200
HideShow
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
PUT/users/{user_name}

Modify user info

Example URI

PUT http://nanos.cloud/api/v1/users/user_name
URI Parameters
HideShow
user_name
string (required) 

user name

Request  Modify User Info
HideShow
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"
    }
  }
}
Response  200
HideShow
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 User
DELETE/users/{user_name}

Delete a user

Example URI

DELETE http://nanos.cloud/api/v1/users/user_name
URI Parameters
HideShow
user_name
string (required) 

user name

Request  Delete User
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Password
PUT/users/{user_name}/password/

Verify and update a new user password

Example URI

PUT http://nanos.cloud/api/v1/users/user_name/password/
URI Parameters
HideShow
user_name
string (required) 

user name

Request  Modify Password
HideShow
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"
    }
  }
}
Response  200
HideShow
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"
    }
  }
}

Sessions

Manage authenticated session

Authenticate New Session
POST/sessions/

Verify and allocate a new sesion for all other requests, set session ID in header ‘Nano-Session’ for authentication.

Example URI

POST http://nanos.cloud/api/v1/sessions/
Request  Create New Session
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Session
PUT/sessions/{session_id}

Keep session alive

Example URI

PUT http://nanos.cloud/api/v1/sessions/session_id
URI Parameters
HideShow
session_id
string (required) 

session ID

Request  Keep Alive
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Session
GET/sessions/{session_id}

Get attached info with authenticated session

Example URI

GET http://nanos.cloud/api/v1/sessions/session_id
URI Parameters
HideShow
session_id
string (required) 

session ID

Request  Obtain Session Data
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Visibility
GET/resource_visibilities/

Get current visibility configure with the group of current user

Example URI

GET http://nanos.cloud/api/v1/resource_visibilities/
Request  Get Visiblity
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "error_code": 0,
    "message": "",
    "data": {
      "instance_visible": true,
      "media_image_visible": true,
      "disk_image_visible": false
    }
  }
]

Set Current Visibility
PUT/resource_visibilities/

Modify current visibility configure with the group of current user

Example URI

PUT http://nanos.cloud/api/v1/resource_visibilities/
Request  Modify Visibility
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Entry
GET/logs/{?limit,start,after,before}

Query system logs by conditions

Example URI

GET http://nanos.cloud/api/v1/logs/?limit=&start=&after=&before=
URI Parameters
HideShow
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

Request  Query Logs
HideShow
Headers
Nano-session: 1234567890-abcdef
Response  200
HideShow
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 Entry
POST/logs/

Add a single log entry

Example URI

POST http://nanos.cloud/api/v1/logs/
Request  Add Log
HideShow
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"
    }
  }
}
Response  200
HideShow
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 Entry
DELETE/logs/

Delete logs

Example URI

DELETE http://nanos.cloud/api/v1/logs/
Request  Delete Log
HideShow
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"
    }
  }
}
Response  200
HideShow
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"
    }
  }
}

Generated by aglio on 10 Feb 2021