console/SWSCloudAPI
viacheslav anzhiganov c7286dc164 #1 fix
2024-12-11 20:42:33 +03:00
..
API refactoting and new apiv2 2017-01-26 01:53:51 +03:00
Utils #1 fix 2024-12-11 20:42:33 +03:00
__init__.py 66 API 2016-06-09 02:49:22 +03:00
application.py refactoting and new apiv2 2017-01-26 01:53:51 +03:00
README.md refactoting and new apiv2 2017-01-26 01:53:51 +03:00

Compute API v1

...

Compute API v2

Auth

Create new Token

$ curl -X POST http://localhost:5001/api/auth/v2/token \
-d '{"email":"vanzhiganov@ya.ru","password":"qwepoi123"}' \
-H "Content-Type: application/json"

{
  "payload": {
    "token": true
  },
  "status": "ok"
}

Get token data

curl -X GET http://localhost:5001/api/auth/v2/token \
-H 'X-Auth-Token: e7a49627-1199-4c3a-a7d3-b482c00fa503' \
-H "Content-Type: application/json"

{
  "payload": {
    "email": "vanzhiganov@ya.ru",
    "user_id": "1f3936af-be4c-43d5-b352-2f9c88c56857"
  },
  "status": "ok"
}

Delete token

curl -X DELETE http://localhost:5001/api/auth/v2/token \
-H 'X-Auth-Token: e7a49627-1199-4c3a-a7d3-b482c00fa503' \
-H "Content-Type: application/json"

{
  "status": "ok"
}

Data Centers

Get list data centers

curl -X GET http://localhost:5001/api/compute/v2/datacenters/ \
-H "X-Auth-Token: ef381b13-425d-4635-9d8a-bba91910dd26" \
-H "Content-Type: application/json"
{
  "payload": [
    {
      "city": "moscow",
      "country": "russia",
      "id": "531511b2-dcf5-11e6-9175-a315ee8fdabf",
      "name": "moscow 1"
    }
  ],
  "status": "ok",
  "total": 1
}

Pricing

curl -X GET http://localhost:5001/api/compute/v2/pricing/ \
-H "X-Auth-Token: ef381b13-425d-4635-9d8a-bba91910dd26" \
-H "Content-Type: application/json"
{
  "payload": [],
  "status": "ok"
}

Virtual machines

Create new virtual achine

curl -X POST http://localhost:5001/api/compute/v2/vms/ \
-H "X-Auth-Token: ef381b13-425d-4635-9d8a-bba91910dd26" \
-H "Content-Type: application/json" '
-d '{"plan": "", "datacenter": "", }'

Errors

{
  "message": "no money",
  "status": "error"
}

Get list virtual achines

curl -X GET http://localhost:5001/api/compute/v2/vms/ \
-H "X-Auth-Token: ef381b13-425d-4635-9d8a-bba91910dd26" \
-H "Content-Type: application/json"
{
  "payload": [],
  "status": "ok"
}