cyclades-api-guide.rst 96 KB
Newer Older
1 2
.. _cyclades-api-guide:

3 4 5
API Guide
*********

6 7
`Cyclades <cyclades.html>`_ is the compute service developed by `GRNET 
<http://www.grnet.gr>`_ as part of the `synnefo <http://www.synnefo.org>`_
8
software. Cyclades API started as an extension of the `OpenStack Compute API v2
9
<http://docs.openstack.org/api/openstack-compute/2/content>`_.
10

11
This document's goals are:
12

13
* Define the Cyclades/Compute ReST API
14
* Clarify the differences between Cyclades and OS/Compute
15

16 17
Users and developers who wish to access a Synnefo Cyclades deployment through
its ReST API are advised to use the `kamaki <http://docs.dev.grnet.gr/kamaki>`_
18 19
command-line client and associated python library, instead of making direct
calls.
20 21 22 23

Overview
========

24 25 26 27
* It is not defined if requests for invalid URLs should return 404 or a Fault.
  We return a BadRequest Fault.
* It is not defined if requests with a wrong HTTP method should return 405 or a
  Fault. We return a BadRequest Fault.
28 29 30 31 32 33 34 35


General API Information
=======================

Authentication
--------------

36 37 38
All requests use the same authentication method: an ``X-Auth-Token`` header is
passed to the servive, which is used to authenticate the user and retrieve user
related information. No other user details are passed through HTTP.
39 40 41 42

Efficient Polling with the Changes-Since Parameter
--------------------------------------------------

43
* Effectively limit support of the changes-since parameter in **List Servers**
44 45
  and **List Images**.

46
* Assume that garbage collection of deleted servers will only affect servers
47 48 49
  deleted ``POLL_TIME`` seconds (default: 3600) in the past or earlier. Else
  loose the information of a server getting deleted.

50
* Images do not support a deleted state, so deletions cannot be tracked.
51

52 53
Limitations
-----------
54

55
* Version MIME type and vesionless requests are not currently supported.
56

57 58
* Cyclades only supports JSON Requests and JSON/XML Responses. XML Requests are
  currently not supported.
59

60
* Optional content compression support is currently not supported.
61

62 63
* To prevent abuse, HTTP sessions have a timeout of 20 seconds before being
  closed.
64

65
* Full URI references and ``self`` and ``bookmark`` links are not supported.
66

67
* Pagination is currently not supported.
68

69 70 71 72 73
* Cached responses are currently not supported.

* Limits are currently not supported.

* Extensions are currently not supported.
74 75 76 77 78 79 80 81 82 83 84


API Operations
==============

Servers
-------

List Servers
............

85 86 87 88
List all virtual servers owned by the user.

.. rubric:: Request

89
=================== ====== ======== ==========
90
URI                 Method Cyclades OS/Compute
91 92
=================== ====== ======== ==========
``/servers``        GET    ✔        ✔
Stavros Sachtouris's avatar
Stavros Sachtouris committed
93
``/servers/detail`` GET    ✔        ✔
94 95
=================== ====== ======== ==========

96
* Both requests return a list of servers. The first returns just ``id`` and
97 98
  ``name``, while the second returns the full collections of server
  attributes.
99

100 101 102
|

==============  ========================= ======== ==========
103
Request Header  Value                     Cyclades OS/Compute
104 105 106 107 108 109
==============  ========================= ======== ==========
X-Auth-Token    User authentication token required required
==============  ========================= ======== ==========

|

110
================= =================================== ======== ==========
111
Request Parameter Value                               Cyclades OS/Compute
112
================= =================================== ======== ==========
113 114
json              Respond in json                     default  **✘**
xml               Respond in xml                      ✔        **✘**
115 116 117 118 119 120 121 122 123
changes-since     Servers delete since that timestamp ✔        ✔
image             Image reference                     **✘**    ✔
flavor            VM flavor reference                 **✘**    ✔
server            Server flavor reference             **✘**    ✔
status            Server status                       **✘**    ✔
marker            Last list last ID                   **✘**    ✔
limit             Page size                           **✘**    ✔
================= =================================== ======== ==========

124 125
* **json** and **xml** parameters are mutually exclusive. If none supported,
the response will be formated in json.
126

127 128
* **status** refers to the `server status <#status-ref>`_

129 130
* **changes-since** must be an ISO8601 date string

131
.. note:: Request body should be empty
132

133
.. rubric:: Response
134 135 136 137 138 139 140 141

=========================== =====================
Return Code                 Description
=========================== =====================
200 (OK)                    Request succeeded
304 (No servers since date) Can be returned if ``changes-since`` is given
400 (Bad Request)           Invalid or malformed ``changes-since`` parameter
401 (Unauthorized)          Missing or expired user token
142
403 (Forbidden)             User is not allowed to perform this operation
143
500 (Internal Server Error) The request cannot be completed because of an
Stavros Sachtouris's avatar
Stavros Sachtouris committed
144
\                           internal error
145 146 147
503 (Service Unavailable)   The server is not currently available
=========================== =====================

148 149 150
|

Response body contents::
151

152 153 154 155 156 157
  servers: [
    {
      <server attribute>: <value>,
      ...
    }, ...
  ]
158 159

================= ====================== ======== ==========
160
Server Attributes Description            Cyclades OS/Compute
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
================= ====================== ======== ==========
id                The server id          ✔        ✔
name              The server name        ✔        ✔
hostId            Server playground      empty    ✔
created           Creation date          ✔        ✔
updated           Creation date          ✔        ✔
flavorRef         The flavor id          ✔        **✘**
flavor            The flavor id          **✘**    ✔
imageRef          The image id           ✔        **✘**
image             The image id           **✘**    ✔
progress          Build progress         ✔        ✔
status            Server status          ✔        ✔
attachments       Network interfaces     ✔        **✘**
addresses         Network interfaces     **✘**    ✔
metadata          Server custom metadata ✔        ✔
================= ====================== ======== ==========
177

178 179
* **hostId** is not used in Cyclades, but is returned as an empty string for
  compatibility
180

181
* **progress** is changing while the server is building up and has values
182
  between 0 and 100. When it reaches 100 the server is built.
183

184
* **status** refers to `the status <#status-ref>`_ of the server
185

186
* **metadata** are custom key:value pairs used to specify various attributes of
187
  the VM (e.g. OS, super user, etc.)
188

189
* **attachments** in Cyclades are lists of network interfaces (nics).
190
  **Attachments** are different to OS/Compute's **addresses**. The former is a
191 192 193 194 195
  list of the server's `network interface connections <#nic-ref>`_ while the
  later is just a list of networks. Thus, a Cyclades virtual server may be
  connected to the same network through more than one distinct network
  interfaces (e.g. server 43 is connected to network 101 with nic-43-1 and
  nic-43-2 in the example bellow).
196

197
* **Network Interfaces (NICs)** contain information about a server's connection
198 199 200
  to a network. Each NIC is identified by an id of the form
  nic-<server-id>-<ordinal-number>. More details can be found `here
  <#nic-ref>`_.
201

202 203 204
**Example List Servers: JSON**

.. code-block:: javascript
205 206

  {
207 208
    "servers":
      {"values": [
209
        {
210 211
          "attachments": {
            "values": [
212
              {
213 214 215 216 217 218
                "id": "nic-42-0",
                "network_id": "101",
                "mac_address": "aa:00:00:49:2e:7e",
                "firewallProfile": "DISABLED",
                "ipv4": "192.168.4.5",
                "ipv6": "2001:648:2ffc:1222:a800:ff:fef5:3f5b"
219 220 221
              }
            ]
          },
222 223 224 225 226 227 228 229 230
          "created': '2011-04-19T10:18:52.085737+00:00',
          "flavorRef": "1",
          "hostId": "",
          "id": "42",
          "imageRef": "3",
          "metadata": {"values": {"foo": "bar"}},
          "name": "My Server",
          "status": "ACTIVE",
          "updated": "2011-05-29T14:07:07.037602+00:00"
231
        }, {
232 233
          "attachments": {
            "values": [
234
              {
235 236 237 238
                "id": "nic-43-0",
                "mac_address": "aa:00:00:91:2f:df",
                "network_id": "1",
                "ipv4": "192.168.32.2"
239
              }, {
240 241 242 243 244 245
                "id": "nic-43-1",
                "network_id": "101",
                "mac_address": "aa:00:00:49:2g:7f",
                "firewallProfile": "DISABLED",
                "ipv4": "192.168.32.6",
                "ipv6": "2001:648:2ffc:1222:a800:ff:fef5:3f5c'
246
              }, {
247 248 249 250 251 252
                "id": "nic-43-2",
                "network_id": "101",
                "mac_address": "aa:00:00:51:2h:7f",
                "firewallProfile": "DISABLED",
                "ipv4": "192.168.32.7",
                "ipv6": "2001:638:2eec:1222:a800:ff:fef5:3f5c"
253
              }
254 255
            ]
          },
256 257 258 259 260 261 262 263 264 265
          "created": "2011-05-02T20:51:08.527759+00:00",
          "flavorRef": "1",
          "hostId": "",
          "id": "43",
          "imageRef": "3",
          "name": "Other Server",
          "description": "A sample server to showcase server requests",
          "progress": "0",
          "status": "ACTIVE",
          "updated": "2011-05-29T14:59:11.267087+00:00"
266 267 268
        }
      ]
    }
269 270 271
  }


272 273 274
Create Server
.............

275 276 277 278
Create a new virtual server

.. rubric:: Request

279
============ ====== ======== ==========
280
URI          Method Cyclades OS/Compute
281 282 283
============ ====== ======== ==========
``/servers`` POST   ✔        ✔
============ ====== ======== ==========
284 285 286

|

287 288 289 290 291 292 293 294
==============  ========================= ======== ==========
Request Header  Value                     Cyclades OS/Compute
==============  ========================= ======== ==========
X-Auth-Token    User authentication token required required
==============  ========================= ======== ==========

|

295 296 297 298 299 300 301
================= ===============
Request Parameter Value          
================= ===============
json              Respond in json
xml               Respond in xml 
================= ===============

302
Request body contents::
303

304 305 306 307 308 309 310 311 312 313 314 315
  server: {
      <server attribute>: <value>,
      ...
      personality: [
        {
          <personality attribute>: <value>,
          ...
        },
        ...
      ],
      ...
  }
316 317

=========== ==================== ======== ==========
318
Attributes  Description          Cyclades OS/Compute
319 320 321 322 323 324 325 326 327 328
=========== ==================== ======== ==========
name        The server name      ✔        ✔
imageRef    Image id             ✔        ✔
flavorRef   Resources flavor     ✔        ✔
personality Personality contents ✔        ✔
metadata    Custom metadata      ✔        ✔
=========== ==================== ======== ==========

* **name** can be any string

329
* **imageRed** and **flavorRed** should refer to existing images and hardware
330
  flavors accessible by the user
331

332 333
* **metadata** are ``key``:``value`` pairs of custom server-specific metadata.
  There are no semantic limitations.
334

335 336 337 338 339
* **personality** (optional) is a list of personality injections. A personality
  injection is a small set of changes to a virtual server. Each change modifies
  a file on the virtual server, by injecting some data in it. The injected data
  (``contents``) should exceed 10240 *bytes* in size and must be base64
  encoded.A personality injection contains the following attributes:
340

341 342 343 344 345 346 347 348 349
====================== =================== ======== ==========
Personality Attributes Description         Cyclades OS/Compute
====================== =================== ======== ==========
path                   File path on server ✔        ✔
contents               Data to inject      ✔        ✔
group                  User group          ✔        **✘**
mode                   File access mode    ✔        **✘**
owner                  File owner          ✔        **✘**
====================== =================== ======== ==========
350 351 352

|

353 354
.. rubric:: Response

355 356 357 358 359 360 361 362
=========================== =====================
Return Code                 Description
=========================== =====================
200 (OK)                    Request succeeded
400 (Bad Request)           Malformed request data
401 (Unauthorized)          Missing or expired user token
403 (Forbidden)             User is not allowed to perform this operation
404 (Not Found)             Image or Flavor not found
363 364
413 (Over Limit)            Exceeded some resource limit (#VMs, personality
size, etc.) 
365
415 (Bad Media Type)        
366
500 (Internal Server Error) The request cannot be completed because of an
Stavros Sachtouris's avatar
Stavros Sachtouris committed
367
\                           internal error
368
503 (Service Unavailable)   No available backends or service currently
Stavros Sachtouris's avatar
Stavros Sachtouris committed
369
\                           unavailable
370 371 372 373
=========================== =====================

|

374 375 376 377 378 379 380 381
Response body contents::

  server: {
    <server attribute>: <value>,
    ...
  }

Server attributes are `listed here <#server-ref>`_.
382

383 384 385
**Example Create Server Response: JSON**

.. code-block:: javascript
386

387 388 389 390 391 392 393 394 395 396 397 398
  {
    "server": {
      "id": 28130
      "status": "BUILD",
      "updated": "2013-04-10T13:52:18.140686+00:00",
      "hostId": "",
      "name": "My Server Name: Example Name",
      "imageRef": "da7a211f-...-f901ce81a3e6",
      "created": "2013-04-10T13:52:17.085402+00:00",
      "flavorRef": 289,
      "adminPass": "fKCqlZe2at",
      "suspended": false,
399
      "progress": 0
400 401
    }
  }
402

403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421
**Example Create Server Response: XML**:

.. code-block:: xml

  <?xml version="1.0" encoding="UTF-8"?>
  <server xmlns="http://docs.openstack.org/compute/api/v1.1"\
    xmlns:atom="http://www.w3.org/2005/Atom"
    id="1"
    status="BUILD"
    hostId="",
    name="My Server Name: Example Name"
    imageRef="da7a211f-...-f901ce81a3e6"
    created="2013-04-10T13:52:17.085402+00:00"
    flavorRef="289"
    adminPass="fKCqlZe2at"
    suspended="false"
    progress="0"
  />

422 423 424
Get Server Stats
................

425 426 427
.. note:: This operation is not part of OS/Compute v2.

This operation returns URLs of graphs showing CPU and Network statistics.
428

429
.. rubric:: Request
430

431
============================== ====== ======== ==========
432
URI                            Method Cyclades OS/Compute
433 434 435
============================== ====== ======== ==========
``/servers/<server-id>/stats`` GET    ✔        **✘**
============================== ====== ======== ==========
436

437
* **server-id** is the identifier of the virtual server
438

439 440
|

441
==============  ========================= ======== ==========
442
Request Header  Value                     Cyclades OS/Compute
443 444 445
==============  ========================= ======== ==========
X-Auth-Token    User authentication token required required
==============  ========================= ======== ==========
446 447 448 449 450 451 452 453 454 455

|

================= ===============
Request Parameter Value          
================= ===============
json              Respond in json
xml               Respond in xml 
================= ===============

456 457
* **json** and **xml** parameters are mutually exclusive. If none supported,
the response will be formated in json.
458

459 460 461
.. note:: Request body should be empty

.. rubric:: Response
462 463 464 465 466 467 468 469 470

=========================== =====================
Return Code                 Description
=========================== =====================
200 (OK)                    Request succeeded
400 (Bad Request)           Invalid server ID or Server deleted
401 (Unauthorized)          Missing or expired user token
403 (Forbidden)             Administratively suspended server
404 (Not Found)             Server not found
471
500 (Internal Server Error) The request cannot be completed because of an
Stavros Sachtouris's avatar
Stavros Sachtouris committed
472
\                           internal error
473 474 475 476
503 (Service Unavailable)   The server is not currently available
=========================== =====================

|
477

478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493
Response body contents::

  stats: {<parameter>: <value> }

============= ======================
Parameter     Description           
============= ======================
serverRef     Server ID
refresh       Refresh frequency
cpuBar        Latest CPU load graph URL
cpuTimeSeries CPU load / time graph URL
netBar        Latest Network load graph URL
netTimeSeries Network load / time graph URL
============= ======================

* **refresh** is the recommended sampling rate
494

495 496 497
**Example Get Server Stats Response: JSON**:

.. code-block:: javascript
498 499

  {
500 501 502 503 504 505 506 507
    "stats": {
      "serverRef": 1,
      "refresh": 60,
      "cpuBar": "http://stats.okeanos.grnet.gr/b9a...048c/cpu-bar.png",
      "cpuTimeSeries": "http://stats.okeanos.grnet.gr/b9a...048c/cpu-ts.png",
      "netBar": "http://stats.okeanos.grnet.gr/b9a...048c/net-bar.png",
      "netTimeSeries": "http://stats.okeanos.grnet.gr/b9a...048c/net-ts.png"
    }
508 509
  }

510 511 512
**Example Get Network Details Response: XML**:

.. code-block:: xml
513 514

  <?xml version="1.0" encoding="UTF-8"?>
515
  <stats xmlns="http://docs.openstack.org/compute/api/v1.1"\
516 517 518 519 520 521 522
    xmlns:atom="http://www.w3.org/2005/Atom"
    serverRef="1"
    refresh="60"
    cpuBar="https://www.example.com/stats/snf-42/cpu-bar/",
    netTimeSeries="https://example.com/stats/snf-42/net-ts/",
    netBar="https://example.com/stats/snf-42/net-bar/",
    cpuTimeSeries="https://www.example.com/stats/snf-42/cpu-ts/"
523 524
  </stats>

525 526 527
Get Server Diagnostics
......................

528
.. note:: This operation is not part of OS/Compute v2.
529

530 531 532
This operation returns diagnostic information (logs) for a server.

.. rubric:: Request
533 534

==================================== ====== ======== ==========
535
URI                                  Method Cyclades OS/Compute
536 537 538 539 540 541 542 543
==================================== ====== ======== ==========
``/servers/<server-id>/diagnostics`` GET    ✔        **✘**
==================================== ====== ======== ==========

* **server-id** is the identifier of the virtual server

|

544 545 546 547 548
============================== ====== ======== ==========
URI                            Method Cyclades OS/Compute
============================== ====== ======== ==========
``/servers/<server-id>/stats`` GET    ✔        **✘**
============================== ====== ======== ==========
549

550 551 552 553 554
.. note:: Request parameters should be empty

.. note:: Request body should be empty

.. rubric:: Response
555 556 557 558 559 560 561 562 563 564

=========================== =====================
Return Code                 Description
=========================== =====================
200 (OK)                    Request succeeded
400 (Bad Request)           Invalid server ID or Server deleted
401 (Unauthorized)          Missing or expired user token
403 (Forbidden)             Administratively suspended server
404 (Not Found)             Server not found
500 (Internal Server Error) The request cannot be completed because of an
Stavros Sachtouris's avatar
Stavros Sachtouris committed
565
\                           internal error
566 567 568
503 (Service Unavailable)   The server is not currently available
=========================== =====================

569 570 571 572 573 574 575 576 577 578 579 580 581 582
|

Response body contents::

  [
    {
      <diagnostic attribute}: <value>,
      ...
    }, {
      <diagnostic attribute}: <value>,
      ...
    },
    ...
  ]
583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623

==================== ===========
Diagnostic attribute Description
==================== ===========
level                Debug level
created              Log entry timestamp
source               Log source proccess
source_date          Log source date          
message              Log description
details              Detailed log description
==================== ===========

For example:

.. code-block:: javascript

  [
    {
      "level": "DEBUG",
      "created": "2013-04-09T15:25:53.965144+00:00",
      "source": "image-helper-task-start",
      "source_date": "2013-04-09T15:25:53.954695+00:00",
      "message": "FixPartitionTable",
      "details": null
    }, {
      "level": "DEBUG",
      "created": "2013-04-09T15:25:46.413718+00:00",
      "source": "image-info",
      "source_date": "2013-04-09T15:25:46.404477+00:00",
      "message": "Starting customization VM...",
      "details": null
    }, {
      "level": "DEBUG",
      "created": "2013-04-09T15:25:46.207038+00:00",
      "source": "image-info",
      "source_date": "2013-04-09T15:25:46.197183+00:00",
      "message": "Image copy finished.",
      "details": "All operations finished as they should. No errors reported."
    }
  ]

624 625 626
Get Server Details
..................

627 628 629 630
This operation returns detailed information for a virtual server

.. rubric:: Request

631
======================== ====== ======== ==========
632
URI                      Method Cyclades OS/Compute
633 634 635 636 637 638 639 640 641
======================== ====== ======== ==========
``/servers/<server id>`` GET    ✔        ✔
======================== ====== ======== ==========

* **server-id** is the identifier of the virtual server

|

==============  ========================= ======== ==========
642
Request Header  Value                     Cyclades OS/Compute
643 644 645 646
==============  ========================= ======== ==========
X-Auth-Token    User authentication token required required
==============  ========================= ======== ==========

647 648 649 650 651
.. note:: Request parameters should be empty

.. note:: Request body should be empty

.. rubric:: Response
652 653 654 655 656 657 658 659 660

=========================== =====================
Return Code                 Description
=========================== =====================
200 (OK)                    Request succeeded
400 (Bad Request)           Malformed server id
401 (Unauthorized)          Missing or expired user token
403 (Forbidden)             Administratively suspended server
404 (Not Found)             Server not found
661
500 (Internal Server Error) The request cannot be completed because of an
Stavros Sachtouris's avatar
Stavros Sachtouris committed
662
\                           internal error
663
503 (Service Unavailable)   No available backends or service currently
Stavros Sachtouris's avatar
Stavros Sachtouris committed
664
\                           unavailable
665 666 667 668
=========================== =====================

|

669 670 671 672 673 674
Response body contents::

  server: {
    <server attribute>: <value>,
    ...
  }
675 676

================= ====================== ======== ==========
677
Server Attributes Description            Cyclades OS/Compute
678 679 680 681 682 683 684 685 686 687 688 689
================= ====================== ======== ==========
id                The server id          ✔        ✔
name              The server name        ✔        ✔
hostId            Server playground      empty    ✔
created           Creation date          ✔        ✔
updated           Creation date          ✔        ✔
flavorRef         The flavor id          ✔        **✘**
flavor            The flavor id          **✘**    ✔
imageRef          The image id           ✔        **✘**
image             The image id           **✘**    ✔
progress          Build progress         ✔        ✔
status            Server status          ✔        ✔
690
suspended         If server is suspended ✔        **✘**
691 692 693
attachments       Network interfaces     ✔        **✘**
addresses         Network interfaces     **✘**    ✔
metadata          Server custom metadata ✔        ✔
694
diagnostics       Diagnostic information ✔        **✘**
695 696
================= ====================== ======== ==========

697 698
* **hostId** is not used in Cyclades, but is returned as an empty string for
  compatibility
699

700
* **progress** is changing while the server is building up and has values
701
  between 0 and 100. When it reaches 100 the server is built.
702

Stavros Sachtouris's avatar
Stavros Sachtouris committed
703
* **status** refers to `the status <#status-ref>`_ of the server
704

705
* **metadata** are custom key:value pairs used to specify various attributes of
706
  the VM (e.g. OS, super user, etc.)
707

708
* **attachments** in Cyclades are lists of network interfaces (NICs).
709
  **Attachments** are different to OS/Compute's **addresses**. The former is a
710 711 712 713
  list of the server's `network interface connections <#nic-ref>`_ while the
  later is just a list of networks. Thus, a Cyclades virtual server may be
  connected to the same network through more than one distinct network
  interfaces.
714

715
* **diagnostics** is a list of items that contain key:value information useful
716 717
  for diagnosing the server behavior and may be used by the administrators of
  deployed Synnefo setups.
718

719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757
**Example Details for server with id 42042, in JSON**

.. code-block:: javascript

  {
    "server": {
      "id": 42042,
      "name": "My Example Server",
      "status": "ACTIVE",
      "updated": "2013-04-18T10:09:57.824266+00:00",
      "hostId": "",
      "imageRef": "926a1bc5-2d85-49d4-aebe-0fc127ed89b9",
      "created": "2013-04-18T10:06:58.288273+00:00",
      "flavorRef": 22,
      "attachments": {
        "values": [{
          "network_id": "1888",
          "mac_address": "aa:0c:f5:ad:16:41",
          "firewallProfile": "DISABLED",
          "ipv4": "83.212.112.56",
          "ipv6": "2001:648:2ffc:1119:a80c:f5ff:fead:1641",
          "id": "nic-42042-0"
        }]
      },
      "suspended": false,
      "diagnostics": [{
        "level": "DEBUG",
        "created": "2013-04-18T10:09:52.776920+00:00",
        "source": "image-info",
        "source_date": "2013-04-18T10:09:52.709791+00:00",
        "message": "Image customization finished successfully.",
        "details": null
      }],
      "progress": 100,
      "metadata": {
        "values": {"OS": "windows", "users": "Administrator"}
      }
    }
  }
758

759 760
.. note:: the ``values`` layer is not featured in OS/Compute API

761 762 763
Rename Server
.............

764 765 766 767 768
Modify the ``name`` attribute of a virtual server. OS/Compute API also features
the modification of IP addresses

.. rubric:: Response

769
======================== ====== ======== ==========
770
URI                      Method Cyclades OS/Compute
771 772 773 774 775 776 777 778 779
======================== ====== ======== ==========
``/servers/<server id>`` PUT    ✔        ✔
======================== ====== ======== ==========

* **server-id** is the identifier of the virtual server

|

==============  ========================= ======== ==========
780
Request Header  Value                     Cyclades OS/Compute
781 782 783 784
==============  ========================= ======== ==========
X-Auth-Token    User authentication token required required
==============  ========================= ======== ==========

785 786 787 788 789 790 791 792
.. note:: Request parameters should be empty

Request body contents::

  server: {
    <server attribute>: <value>,
    ...
  }
793 794

=========== ==================== ======== ==========
795
Attribute   Description          Cyclades OS/Compute
796 797 798 799 800 801
=========== ==================== ======== ==========
name        The server name      ✔        ✔
accessIPv4  IP v4 address        **✘**    ✔
accessIPv6  IP v6 address        **✘**    ✔
=========== ==================== ======== ==========

802 803
* Cyclades support multiple network connections per virtual server, which
  explains the above differences in request body attributes.
804

805
.. rubric:: Response
806 807 808 809 810 811 812 813 814 815 816

=========================== =====================
Return Code                 Description
=========================== =====================
204 (OK)                    Request succeeded
400 (Bad Request)           Malformed request or malformed server id
401 (Unauthorized)          Missing or expired user token
403 (Forbidden)             User is not allowed to perform this operation
404 (Not Found)             Server not found
415 (Bad Media Type)
409 (Build In Progress)     Server is not ready yet
817
500 (Internal Server Error) The request cannot be completed because of an
Stavros Sachtouris's avatar
Stavros Sachtouris committed
818
\                           internal error
819
503 (Service Unavailable)   No available backends or service currently
Stavros Sachtouris's avatar
Stavros Sachtouris committed
820
\                           unavailable
821 822
=========================== =====================

823 824 825
.. note:: In case of a 204 return code, there will be no request results
  according to the Cyclades API. Compute OS API suggests that response should
  include the new server details.
826

827 828 829
Delete Server
.............

830 831 832 833 834
Delete a virtual server. When a server is deleted, all its connections are
deleted as well.

.. rubric:: Request

835
======================== ====== ======== ==========
836
URI                      Method Cyclades OS/Compute
837 838 839 840
======================== ====== ======== ==========
``/servers/<server id>`` DELETE ✔        ✔
======================== ====== ======== ==========

841
* **server-id** is the identifier of the virtual server.
842 843 844 845

|

==============  ========================= ======== ==========
846
Request Header  Value                     Cyclades OS/Compute
847 848 849 850
==============  ========================= ======== ==========
X-Auth-Token    User authentication token required required
==============  ========================= ======== ==========

851 852 853 854 855
.. note:: Request parameters should be empty

.. note:: Request body should be empty

.. rubric:: Response
856 857 858 859 860 861 862 863 864

=========================== =====================
Return Code                 Description
=========================== =====================
204 (OK)                    Request succeeded
400 (Bad Request)           Malformed server id or machine already deleted
401 (Unauthorized)          Missing or expired user token
404 (Not Found)             Server not found
409 (Build In Progress)     Server is not ready yet
865
500 (Internal Server Error) The request cannot be completed because of an
Stavros Sachtouris's avatar
Stavros Sachtouris committed
866
\                           internal error
867
503 (Service Unavailable)   Action not supported or service currently
Stavros Sachtouris's avatar
Stavros Sachtouris committed
868
\                           unavailable
869 870
=========================== =====================

871
.. note:: In case of a 204 code, response body should be empty
872

873 874
List Server Addresses
.....................
875

876 877 878 879 880 881 882 883 884
List all network connections of a server. In Cyclades API, connections are
represented as Network Connection Interfaces (NICs), which describe a server -
network relation through their respective identifiers. This mechanism ensures
flexibility and multiple networks connecting the same virtual servers.

The Synnefo/Cyclades approach in this matter differs substantially to the
`one suggested by the OS/Compute API <http://docs.openstack.org/api/openstack-compute/2/content/List_Addresses-d1e3014.html>`_.

.. rubric:: Request
885 886

============================ ====== ======== ==========
887
URI                          Method Cyclades OS/Compute
888 889 890 891 892 893 894 895 896
============================ ====== ======== ==========
``/servers/<server id>/ips`` GET    ✔        ✔
============================ ====== ======== ==========

* **server-id** is the identifier of the virtual server

|

==============  ========================= ======== ==========
897
Request Header  Value                     Cyclades OS/Compute
898 899 900 901
==============  ========================= ======== ==========
X-Auth-Token    User authentication token required required
==============  ========================= ======== ==========

902
.. note:: Request parameters should be empty
903

904
.. note:: Request body should be empty
905

906
.. rubric:: Response
907 908 909 910 911 912 913 914 915

=========================== =====================
Return Code                 Description
=========================== =====================
200 (OK)                    Request succeeded
400 (Bad Request)           Malformed server id or machine already deleted
401 (Unauthorized)          Missing or expired user token
404 (Not Found)             Server not found
409 (Build In Progress)     Server is not ready yet
916
500 (Internal Server Error) The request cannot be completed because of an
Stavros Sachtouris's avatar
Stavros Sachtouris committed
917
\                           internal error
918 919 920
503 (Service Unavailable)   Service currently unavailable
=========================== =====================

921 922 923 924 925 926 927 928 929
Response body contents::

  addresses: {values: [
    {
      <NIC attribute>: <value>,
      ...
    },
    ...
  ]}
930

931 932 933
A Network Interface Connection (or NIC) connects the current server to a
network, through their respective identifiers. More information in NIC
attributes are `enlisted here <#nic-ref>`_.
934

935
**Example List Addresses: JSON**
936 937 938 939 940 941

.. code-block:: javascript

  {
    "addresses": {
      "values": [
942
        {
943
          "id": "nic-25455-0"
944 945 946 947 948 949
          "network_id": "1",
          "mac_address": "aa:00:03:7a:84:bb",
          "firewallProfile": "DISABLED",
          "ipv4": "192.168.0.27",
          "ipv6": "2001:646:2ffc:1222:a820:3fd:fe7a:84bb",
        }, {
950
          "id": "nic-25455-1"
951 952 953 954 955 956
          "network_id": "7",
          "mac_address": "aa:00:03:7a:84:cc",
          "firewallProfile": "DISABLED",
          "ipv4": "192.168.0.28",
          "ipv6": "2002:646:2fec:1222:a820:3fd:fe7a:84bc",
        },
957 958 959 960
      ]
    }
  }

961 962 963 964 965 966 967 968
Get Server NICs by Network
..........................

Return the NIC that connects a server to a network.

The semantics of this operation are substantially different to the respective
OS/Compute
`List Addresses by Network semantics <http://docs.openstack.org/api/openstack-compute/2/content/List_Addresses_by_Network-d1e3118.html>`_.
969

970
.. rubric:: Request
971 972

========================================= ====== ======== ==========
973
URI                                       Method Cyclades OS/Compute
974 975 976 977
========================================= ====== ======== ==========
``/servers/<server id>/ips/<network id>`` GET    ✔        ✔
========================================= ====== ======== ==========

978
* **server id** is the identifier of the virtual server
979

980
* **network id** is the identifier of the network
981 982 983 984

|

==============  ========================= ======== ==========
985
Request Header  Value                     Cyclades OS/Compute
986 987 988 989
==============  ========================= ======== ==========
X-Auth-Token    User authentication token required required
==============  ========================= ======== ==========

990
.. note:: Request parameters should be empty
991

992
.. note:: Request body should be empty
993

994
.. rubric:: Response
995 996 997 998 999 1000 1001 1002 1003

=========================== =====================
Return Code                 Description
=========================== =====================
200 (OK)                    Request succeeded
400 (Bad Request)           Malformed server id or machine already deleted
401 (Unauthorized)          Missing or expired user token
404 (Not Found)             Server not found
409 (Build In Progress)     Server is not ready yet
1004
500 (Internal Server Error) The request cannot be completed because of an
Stavros Sachtouris's avatar
Stavros Sachtouris committed
1005
\                           internal error
1006 1007 1008
503 (Service Unavailable)   Service currently unavailable
=========================== =====================

1009 1010 1011 1012 1013 1014 1015 1016
|

Response body contents::

  network: {
    <NIC attributes>: <value>,
    ...
  }
1017

1018
Network Interface Connection (NIC) attributes are listed `here <#nic-ref>`_. 
1019

1020
**List Server NICs Example with server id 25455, network id 7: JSON**
1021 1022 1023 1024 1025

.. code-block:: javascript

  {
    "network": {
1026
      "id": "nic-25455-0"
1027 1028 1029 1030 1031
      "network_id": "7",
      "mac_address": "aa:00:03:7a:84:bb",
      "firewallProfile": "DISABLED",
      "ipv4": "192.168.0.27",
      "ipv6": "2001:646:2ffc:1222:a820:3fd:fe7a:84bb",
1032 1033 1034
    }
  }

1035

1036
List Server Metadata
1037 1038
....................

1039 1040 1041 1042 1043 1044
List the metadata of a server

.. note:: This operation is semantically equivalent in Cyclades and OS/Compute
  besides the different URI.

.. rubric:: Request
1045 1046

================================= ====== ======== ==========
1047
URI                               Method Cyclades OS/Compute
1048 1049 1050 1051 1052 1053 1054 1055 1056
================================= ====== ======== ==========
``/servers/<server-id>/meta``     GET    ✔        **✘**
``/servers/<server-id>/metadata`` GET    **✘**    ✔
================================= ====== ======== ==========

* **server-id** is the identifier of the virtual server

|

1057
==============  ========================= ======== ==========
1058
Request Header  Value                     Cyclades OS/Compute
1059 1060 1061
==============  ========================= ======== ==========
X-Auth-Token    User authentication token required required
==============  ========================= ======== ==========
1062

1063 1064 1065 1066 1067
.. note:: Request parameters should be empty

.. note:: Request body should be empty

.. rubric:: Response
1068 1069 1070 1071 1072 1073 1074 1075 1076 1077

=========================== =====================
Return Code                 Description
=========================== =====================
200 (OK)                    Request succeeded
400 (Bad Request)           Invalid server ID or Malformed request
401 (Unauthorized)          Missing or expired user token
403 (Forbidden)             Administratively suspended server
404 (Not Found)             Server not found
500 (Internal Server Error) The request cannot be completed because of an
Stavros Sachtouris's avatar
Stavros Sachtouris committed
1078
\                           internal error
1079 1080 1081
503 (Service Unavailable)   The server is not currently available
=========================== =====================

1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093
Response body contents::

  metadata: {values:
    {
      <metadatum key>: <value>,
      ...
    }
  }

**Example List Server Metadata: JSON**

.. code-block:: javascript
1094 1095

  { 
1096 1097 1098 1099
    ""metadata": {
      "values": {
        "OS": "Linux",
        "users": "root"
1100 1101 1102 1103
      }
    }
  }

1104
.. note:: In OS/Compute API  the ``values`` level is missing from the response.
1105 1106 1107 1108 1109

Set / Update Server Metadata
............................

In Cyclades API, setting new metadata and updating the values of existing ones
1110 1111
is achieved with the same type of request (``POST``), while in OS/Compute API
there are two separate request types (``PUT`` and ``POST`` for
1112 1113 1114 1115 1116
`setting new <http://docs.openstack.org/api/openstack-compute/2/content/Create_or_Replace_Metadata-d1e5358.html>`_
and
`updating existing <http://docs.openstack.org/api/openstack-compute/2/content/Update_Metadata-d1e5208.html>`_
metadata, respectively).

1117
In Cyclades API, metadata keys which are not referred by the operation will
1118 1119 1120
remain intact, while metadata referred by the operation will be overwritten.

.. rubric:: Request
1121 1122

================================= ====== ======== ==========