Statistics
| Branch: | Tag: | Revision:

root / docs / cyclades-api-guide.rst @ 30fe9049

History | View | Annotate | Download (103.8 kB)

1
.. _cyclades-api-guide:
2

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

    
6
`Cyclades <cyclades.html>`_ is the Compute Service of `Synnefo
7
<http://www.synnefo.org>`_. The Cyclades API tries to be as close to the
8
`OpenStack Compute API v2
9
<http://docs.openstack.org/api/openstack-compute/2/content>`_ as possible.
10

    
11
This document's goals are:
12

    
13
* Define the Cyclades/Compute REST API
14
* Clarify the differences between Cyclades and OpenStack/Compute
15

    
16
Users and developers who wish to access Cyclades through its REST API are
17
advised to use the `kamaki <http://www.synnefo.org/docs/kamaki/latest/index.html>`_ command-line
18
client and associated python library, instead of making direct calls.
19

    
20
Overview
21
========
22

    
23
* OpenStack does not define if requests for invalid URLs should return 404 or a
24
* Fault. We return a BadRequest Fault.
25
* OpenStack does not define if requests with a wrong HTTP method should return
26
* 405 or a Fault. We return a BadRequest Fault.
27

    
28
General API Information
29
=======================
30

    
31
Authentication
32
--------------
33

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

    
38
Efficient Polling with the Changes-Since Parameter
39
--------------------------------------------------
40

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

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

    
48
* Images do not support a deleted state, so deletions cannot be tracked.
49

    
50
Limitations
51
-----------
52

    
53
* Version MIME type and vesionless requests are not currently supported.
54

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

    
58
* Optional content compression support is currently not supported.
59

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

    
63
* Full URI references and ``self`` and ``bookmark`` links are not supported.
64

    
65
* Pagination is currently not supported.
66

    
67
* Cached responses are currently not supported.
68

    
69
* Limits are currently not supported.
70

    
71
* Extensions are currently not supported.
72

    
73

    
74
API Operations
75
==============
76

    
77
Servers
78
-------
79

    
80
=================================================== ========================================= ====== ======== ==========
81
Description                                         URI                                       Method Cyclades OS/Compute
82
=================================================== ========================================= ====== ======== ==========
83
`List <#list-servers>`_                             ``/servers``                              GET    ✔        ✔
84
\                                                   ``/servers/detail``                       GET    ✔        ✔
85
`Create <#create-server>`_                          ``/servers``                              POST   ✔        ✔
86
`Get Stats <#get-server-stats>`_                    ``/servers/<server-id>/stats``            GET    ✔        **✘**
87
`Get Diagnostics <#get-server-diagnostics>`_        ``/servers/<server-id>/diagnostics``      GET    ✔        **✘**
88
`Get Details <#get-server-details>`_                ``/servers/<server id>``                  GET    ✔        ✔
89
`Rename <#rename-server>`_                          ``/servers/<server id>``                  PUT    ✔        ✔
90
`Delete <#delete-server>`_                          ``/servers/<server id>``                  DELETE ✔        ✔
91
`List Addresses <#list-server-addresses>`_          ``/servers/<server id>/ips``              GET    ✔        ✔
92
`Get NICs by Net <#get-server-nics-by-network>`_    ``/servers/<server id>/ips/<network id>`` GET    ✔        ✔
93
`List Metadata <#list-server-metadata>`_            ``/servers/<server-id>/metadata``         GET    ✔        ✔
94
`Update Metadata <#set-update-server-metadata>`_    ``/servers/<server-id>/metadata``         PUT    **✘**    ✔
95
\                                                   ``/servers/<server-id>/metadata``         POST   ✔        ✔
96
`Get Meta Item <#get-server-metadata-item>`_        ``/servers/<server-id>/metadata/<key>``   GET    ✔        ✔
97
`Update Meta Item <#update-server-metadatum-item>`_ ``/servers/<server-id>/metadata/<key>``   PUT    ✔        ✔
98
`Delete Meta Item <#delete-server-metadatum>`_      ``/servers/<server-id>/metadata/<key>``   DELETE ✔        ✔
99
=================================================== ========================================= ====== ======== ==========
100

    
101
List Servers
102
............
103

    
104
List all virtual servers owned by the user.
105

    
106
.. rubric:: Request
107

    
108
=================== ====== ======== ==========
109
URI                 Method Cyclades OS/Compute
110
=================== ====== ======== ==========
111
``/servers``        GET    ✔        ✔
112
``/servers/detail`` GET    ✔        ✔
113
=================== ====== ======== ==========
114

    
115
* Both requests return a list of servers. The first returns just ``id`` and
116
  ``name``, while the second returns the full collections of server
117
  attributes.
118

    
119
|
120

    
121
==============  ========================= ======== ==========
122
Request Header  Value                     Cyclades OS/Compute
123
==============  ========================= ======== ==========
124
X-Auth-Token    User authentication token required required
125
==============  ========================= ======== ==========
126

    
127
|
128

    
129
================= =================================== ======== ==========
130
Request Parameter Value                               Cyclades OS/Compute
131
================= =================================== ======== ==========
132
json              Respond in json                     default  **✘**
133
xml               Respond in xml                      ✔        **✘**
134
changes-since     Servers delete since that timestamp ✔        ✔
135
image             Image reference                     **✘**    ✔
136
flavor            VM flavor reference                 **✘**    ✔
137
server            Server flavor reference             **✘**    ✔
138
status            Server status                       **✘**    ✔
139
marker            Last list last ID                   **✘**    ✔
140
limit             Page size                           **✘**    ✔
141
================= =================================== ======== ==========
142

    
143
* **json** and **xml** parameters are mutually exclusive. If none supported,
144
the response will be formated in json.
145

    
146
* **status** refers to the `server status <#status-ref>`_
147

    
148
* **changes-since** must be an ISO8601 date string
149

    
150
.. note:: Request body should be empty
151

    
152
.. rubric:: Response
153

    
154
=========================== =====================
155
Return Code                 Description
156
=========================== =====================
157
200 (OK)                    Request succeeded
158
304 (No servers since date) Can be returned if ``changes-since`` is given
159
400 (Bad Request)           Invalid or malformed ``changes-since`` parameter
160
401 (Unauthorized)          Missing or expired user token
161
403 (Forbidden)             User is not allowed to perform this operation
162
500 (Internal Server Error) The request cannot be completed because of an
163
\                           internal error
164
503 (Service Unavailable)   The server is not currently available
165
=========================== =====================
166

    
167
|
168

    
169
Response body contents::
170

    
171
  servers: [
172
    {
173
      <server attribute>: <value>,
174
      ...
175
    }, ...
176
  ]
177

    
178
================= ====================== ======== ==========
179
Server Attributes Description            Cyclades OS/Compute
180
================= ====================== ======== ==========
181
id                The server id          ✔        ✔
182
name              The server name        ✔        ✔
183
hostId            Server playground      empty    ✔
184
created           Creation date          ✔        ✔
185
updated           Creation date          ✔        ✔
186
flavor            The flavor id          ✔        ✔
187
image             The image id           ✔        ✔
188
progress          Build progress         ✔        ✔
189
status            Server status          ✔        ✔
190
attachments       Network interfaces     ✔        **✘**
191
addresses         Network interfaces     **✘**    ✔
192
metadata          Server custom metadata ✔        ✔
193
================= ====================== ======== ==========
194

    
195
* **hostId** is not used in Cyclades, but is returned as an empty string for
196
  compatibility
197

    
198
* **progress** is changing while the server is building up and has values
199
  between 0 and 100. When it reaches 100 the server is built.
200

    
201
* **status** refers to `the status <#status-ref>`_ of the server
202

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

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

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

    
219
*Example List Servers: JSON*
220

    
221
.. code-block:: javascript
222

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

    
282

    
283
Create Server
284
.............
285

    
286
Create a new virtual server
287

    
288
.. rubric:: Request
289

    
290
============ ====== ======== ==========
291
URI          Method Cyclades OS/Compute
292
============ ====== ======== ==========
293
``/servers`` POST   ✔        ✔
294
============ ====== ======== ==========
295

    
296
|
297

    
298
==============  ========================= ======== ==========
299
Request Header  Value                     Cyclades OS/Compute
300
==============  ========================= ======== ==========
301
X-Auth-Token    User authentication token required required
302
Content-Type    Type or request body      required required
303
Content-Length  Length of request body    required required
304
==============  ========================= ======== ==========
305

    
306
*Example Request Headers*::
307

    
308
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
309
  Content-Type:   application/json
310
  Content-Length: 735
311

    
312
|
313

    
314
================= ===============
315
Request Parameter Value
316
================= ===============
317
json              Respond in json
318
xml               Respond in xml
319
================= ===============
320

    
321
Request body contents::
322

    
323
  server: {
324
      <server attribute>: <value>,
325
      ...
326
      personality: [
327
        {
328
          <personality attribute>: <value>,
329
          ...
330
        },
331
        ...
332
      ],
333
      ...
334
  }
335

    
336
=========== ==================== ======== ==========
337
Attributes  Description          Cyclades OS/Compute
338
=========== ==================== ======== ==========
339
name        The server name      ✔        ✔
340
imageRef    Image id             ✔        ✔
341
flavorRef   Resources flavor     ✔        ✔
342
personality Personality contents ✔        ✔
343
metadata    Custom metadata      ✔        ✔
344
=========== ==================== ======== ==========
345

    
346
* **name** can be any string
347

    
348
* **imageRed** and **flavorRed** should refer to existing images and hardware
349
  flavors accessible by the user
350

    
351
* **metadata** are ``key``:``value`` pairs of custom server-specific metadata.
352
  There are no semantic limitations.
353

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

    
360
====================== =================== ======== ==========
361
Personality Attributes Description         Cyclades OS/Compute
362
====================== =================== ======== ==========
363
path                   File path on server ✔        ✔
364
contents               Data to inject      ✔        ✔
365
group                  User group          ✔        **✘**
366
mode                   File access mode    ✔        **✘**
367
owner                  File owner          ✔        **✘**
368
====================== =================== ======== ==========
369

    
370
*Example Create Server Request: JSON*
371

    
372
.. code-block:: javascript
373

    
374
  {
375
    "server": {
376
      "name": "My Server Name: Example Name",
377
      "imageRef": "da7a211f-...-f901ce81a3e6",
378
      "flavorRef": 289,
379
      "personality": [
380
        {
381
          "path": "/Users/myusername/personlities/example1.file",
382
          "contents": "some data to inject",
383
          "group": "remotely-set user group",
384
          "mode": "rw",
385
          "owner": "ausername"
386
        }, {
387
          "path": "/Users/myusername/personlities/example2.file",
388
          "contents": "some more data to inject",
389
          "group": "",
390
          "mode": "r",
391
          "owner": "anotherusername"
392
        }
393
      ],
394
      "metadata": {
395
        "EloquentDescription": "Example server with personality",
396
        "ShortDescription": "Trying VMs"
397
      }
398
    }
399
  }
400

    
401
.. rubric:: Response
402

    
403
=========================== =====================
404
Return Code                 Description
405
=========================== =====================
406
200 (OK)                    Request succeeded
407
400 (Bad Request)           Malformed request data
408
401 (Unauthorized)          Missing or expired user token
409
403 (Forbidden)             User is not allowed to perform this operation
410
404 (Not Found)             Image or Flavor not found
411
413 (Over Limit)            Exceeded some resource limit (#VMs, personality
412
size, etc.)
413
415 (Bad Media Type)        
414
500 (Internal Server Error) The request cannot be completed because of an
415
\                           internal error
416
503 (Service Unavailable)   No available backends or service currently
417
\                           unavailable
418
=========================== =====================
419

    
420
|
421

    
422
Response body contents::
423

    
424
  server: {
425
    <server attribute>: <value>,
426
    ...
427
  }
428

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

    
431
*Example Create Server Response: JSON*
432

    
433
.. code-block:: javascript
434

    
435
  {
436
    "server": {
437
      "id": 28130
438
      "status": "BUILD",
439
      "updated": "2013-04-10T13:52:18.140686+00:00",
440
      "hostId": "",
441
      "name": "My Server Name: Example Name",
442
      "imageRef": "da7a211f-...-f901ce81a3e6",
443
      "created": "2013-04-10T13:52:17.085402+00:00",
444
      "flavorRef": 289,
445
      "adminPass": "fKCqlZe2at",
446
      "suspended": false,
447
      "progress": 0
448
      "metadata": {
449
        "EloquentDescription": "Example server with personality",
450
        "ShortDescription": "Trying VMs"
451
      }
452
    }
453
  }
454

    
455
*Example Create Server Response: XML*
456

    
457
.. code-block:: xml
458

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

    
474
Get Server Stats
475
................
476

    
477
.. note:: This operation is not part of OS/Compute v2.
478

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

    
481
.. rubric:: Request
482

    
483
============================== ====== ======== ==========
484
URI                            Method Cyclades OS/Compute
485
============================== ====== ======== ==========
486
``/servers/<server-id>/stats`` GET    ✔        **✘**
487
============================== ====== ======== ==========
488

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

    
491
|
492

    
493
==============  ========================= ======== ==========
494
Request Header  Value                     Cyclades OS/Compute
495
==============  ========================= ======== ==========
496
X-Auth-Token    User authentication token required required
497
==============  ========================= ======== ==========
498

    
499
|
500

    
501
================= ===============
502
Request Parameter Value          
503
================= ===============
504
json              Respond in json
505
xml               Respond in xml 
506
================= ===============
507

    
508
* **json** and **xml** parameters are mutually exclusive. If none supported,
509
the response will be formated in json.
510

    
511
.. note:: Request body should be empty
512

    
513
.. rubric:: Response
514

    
515
=========================== =====================
516
Return Code                 Description
517
=========================== =====================
518
200 (OK)                    Request succeeded
519
400 (Bad Request)           Invalid server ID or Server deleted
520
401 (Unauthorized)          Missing or expired user token
521
403 (Forbidden)             Administratively suspended server
522
404 (Not Found)             Server not found
523
500 (Internal Server Error) The request cannot be completed because of an
524
\                           internal error
525
503 (Service Unavailable)   The server is not currently available
526
=========================== =====================
527

    
528
|
529

    
530
Response body contents::
531

    
532
  stats: {<parameter>: <value> }
533

    
534
============= ======================
535
Parameter     Description
536
============= ======================
537
serverRef     Server ID
538
refresh       Refresh frequency
539
cpuBar        Latest CPU load graph URL
540
cpuTimeSeries CPU load / time graph URL
541
netBar        Latest Network load graph URL
542
netTimeSeries Network load / time graph URL
543
============= ======================
544

    
545
* **refresh** is the recommended sampling rate
546

    
547
*Example Get Server Stats Response: JSON*
548

    
549
.. code-block:: javascript
550

    
551
  {
552
    "stats": {
553
      "serverRef": 1,
554
      "refresh": 60,
555
      "cpuBar": "http://stats.okeanos.grnet.gr/b9a...048c/cpu-bar.png",
556
      "cpuTimeSeries": "http://stats.okeanos.grnet.gr/b9a...048c/cpu-ts.png",
557
      "netBar": "http://stats.okeanos.grnet.gr/b9a...048c/net-bar.png",
558
      "netTimeSeries": "http://stats.okeanos.grnet.gr/b9a...048c/net-ts.png"
559
    }
560
  }
561

    
562
*Example Get Network Details Response: XML*
563

    
564
.. code-block:: xml
565

    
566
  <?xml version="1.0" encoding="UTF-8"?>
567
  <stats xmlns="http://docs.openstack.org/compute/api/v1.1"\
568
    xmlns:atom="http://www.w3.org/2005/Atom"
569
    serverRef="1"
570
    refresh="60"
571
    cpuBar="https://www.example.com/stats/snf-42/cpu-bar/",
572
    netTimeSeries="https://example.com/stats/snf-42/net-ts/",
573
    netBar="https://example.com/stats/snf-42/net-bar/",
574
    cpuTimeSeries="https://www.example.com/stats/snf-42/cpu-ts/"
575
  </stats>
576

    
577
Get Server Diagnostics
578
......................
579

    
580
.. note:: This operation is not part of OS/Compute v2.
581

    
582
This operation returns diagnostic information (logs) for a server.
583

    
584
.. rubric:: Request
585

    
586
==================================== ====== ======== ==========
587
URI                                  Method Cyclades OS/Compute
588
==================================== ====== ======== ==========
589
``/servers/<server-id>/diagnostics`` GET    ✔        **✘**
590
==================================== ====== ======== ==========
591

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

    
594
|
595

    
596
==============  ========================= ======== ==========
597
Request Header  Value                     Cyclades OS/Compute
598
==============  ========================= ======== ==========
599
X-Auth-Token    User authentication token required required
600
==============  ========================= ======== ==========
601

    
602
.. note:: Request parameters should be empty
603

    
604
.. note:: Request body should be empty
605

    
606
.. rubric:: Response
607

    
608
=========================== =====================
609
Return Code                 Description
610
=========================== =====================
611
200 (OK)                    Request succeeded
612
400 (Bad Request)           Invalid server ID or Server deleted
613
401 (Unauthorized)          Missing or expired user token
614
403 (Forbidden)             Administratively suspended server
615
404 (Not Found)             Server not found
616
500 (Internal Server Error) The request cannot be completed because of an
617
\                           internal error
618
503 (Service Unavailable)   The server is not currently available
619
=========================== =====================
620

    
621
|
622

    
623
Response body contents::
624

    
625
  [
626
    {
627
      <diagnostic attribute}: <value>,
628
      ...
629
    }, {
630
      <diagnostic attribute}: <value>,
631
      ...
632
    },
633
    ...
634
  ]
635

    
636
==================== ===========
637
Diagnostic attribute Description
638
==================== ===========
639
level                Debug level
640
created              Log entry timestamp
641
source               Log source proccess
642
source_date          Log source date
643
message              Log description
644
details              Detailed log description
645
==================== ===========
646

    
647
*Example Get Server Diagnostics Response: JSON*
648

    
649
.. code-block:: javascript
650

    
651
  [
652
    {
653
      "level": "DEBUG",
654
      "created": "2013-04-09T15:25:53.965144+00:00",
655
      "source": "image-helper-task-start",
656
      "source_date": "2013-04-09T15:25:53.954695+00:00",
657
      "message": "FixPartitionTable",
658
      "details": null
659
    }, {
660
      "level": "DEBUG",
661
      "created": "2013-04-09T15:25:46.413718+00:00",
662
      "source": "image-info",
663
      "source_date": "2013-04-09T15:25:46.404477+00:00",
664
      "message": "Starting customization VM...",
665
      "details": null
666
    }, {
667
      "level": "DEBUG",
668
      "created": "2013-04-09T15:25:46.207038+00:00",
669
      "source": "image-info",
670
      "source_date": "2013-04-09T15:25:46.197183+00:00",
671
      "message": "Image copy finished.",
672
      "details": "All operations finished as they should. No errors reported."
673
    }
674
  ]
675

    
676
Get Server Details
677
..................
678

    
679
This operation returns detailed information for a virtual server
680

    
681
.. rubric:: Request
682

    
683
======================== ====== ======== ==========
684
URI                      Method Cyclades OS/Compute
685
======================== ====== ======== ==========
686
``/servers/<server id>`` GET    ✔        ✔
687
======================== ====== ======== ==========
688

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

    
691
|
692

    
693
==============  ========================= ======== ==========
694
Request Header  Value                     Cyclades OS/Compute
695
==============  ========================= ======== ==========
696
X-Auth-Token    User authentication token required required
697
==============  ========================= ======== ==========
698

    
699
.. note:: Request parameters should be empty
700

    
701
.. note:: Request body should be empty
702

    
703
.. rubric:: Response
704

    
705
=========================== =====================
706
Return Code                 Description
707
=========================== =====================
708
200 (OK)                    Request succeeded
709
400 (Bad Request)           Malformed server id
710
401 (Unauthorized)          Missing or expired user token
711
403 (Forbidden)             Administratively suspended server
712
404 (Not Found)             Server not found
713
500 (Internal Server Error) The request cannot be completed because of an
714
\                           internal error
715
503 (Service Unavailable)   No available backends or service currently
716
\                           unavailable
717
=========================== =====================
718

    
719
|
720

    
721
Response body contents::
722

    
723
  server: {
724
    <server attribute>: <value>,
725
    ...
726
  }
727

    
728
================= ====================== ======== ==========
729
Server Attributes Description            Cyclades OS/Compute
730
================= ====================== ======== ==========
731
id                The server id          ✔        ✔
732
name              The server name        ✔        ✔
733
hostId            Server playground      empty    ✔
734
created           Creation date          ✔        ✔
735
updated           Creation date          ✔        ✔
736
flavor            The flavor id          ✔        ✔
737
image             The image id           ✔        ✔
738
progress          Build progress         ✔        ✔
739
status            Server status          ✔        ✔
740
suspended         If server is suspended ✔        **✘**
741
attachments       Network interfaces     ✔        **✘**
742
addresses         Network interfaces     **✘**    ✔
743
metadata          Server custom metadata ✔        ✔
744
diagnostics       Diagnostic information ✔        **✘**
745
================= ====================== ======== ==========
746

    
747
* **hostId** is not used in Cyclades, but is returned as an empty string for
748
  compatibility
749

    
750
* **progress** is changing while the server is building up and has values
751
  between 0 and 100. When it reaches 100 the server is built.
752

    
753
* **status** refers to `the status <#status-ref>`_ of the server
754

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

    
758
* **attachments** in Cyclades are lists of network interfaces (NICs).
759
  **Attachments** are different to OS/Compute's **addresses**. The former is a
760
  list of the server's `network interface connections <#nic-ref>`_ while the
761
  later is just a list of networks. Thus, a Cyclades virtual server may be
762
  connected to the same network through more than one distinct network
763
  interfaces.
764

    
765
* **diagnostics** is a list of items that contain key:value information useful
766
  for diagnosing the server behavior and may be used by the administrators of
767
  deployed Synnefo setups.
768

    
769
*Example Details for server with id 42042: JSON*
770

    
771
.. code-block:: javascript
772

    
773
  {
774
    "server": {
775
      "id": 42042,
776
      "name": "My Example Server",
777
      "status": "ACTIVE",
778
      "updated": "2013-04-18T10:09:57.824266+00:00",
779
      "hostId": "",
780
      "imageRef": "926a1bc5-2d85-49d4-aebe-0fc127ed89b9",
781
      "created": "2013-04-18T10:06:58.288273+00:00",
782
      "flavorRef": 22,
783
      "attachments": [
784
        {
785
          "network_id": "1888",
786
          "mac_address": "aa:0c:f5:ad:16:41",
787
          "firewallProfile": "DISABLED",
788
          "ipv4": "83.212.112.56",
789
          "ipv6": "2001:648:2ffc:1119:a80c:f5ff:fead:1641",
790
          "id": "nic-42042-0"
791
        }
792
      ],
793
      "suspended": false,
794
      "diagnostics": [
795
        {
796
          "level": "DEBUG",
797
          "created": "2013-04-18T10:09:52.776920+00:00",
798
          "source": "image-info",
799
          "source_date": "2013-04-18T10:09:52.709791+00:00",
800
          "message": "Image customization finished successfully.",
801
          "details": null
802
        }
803
      ],
804
      "progress": 100,
805
      "metadata": {
806
        "OS": "windows",
807
        "users": "Administrator"
808
      }
809
    }
810
  }
811

    
812
Rename Server
813
.............
814

    
815
Modify the ``name`` attribute of a virtual server. OS/Compute API also features
816
the modification of IP addresses
817

    
818
.. rubric:: Response
819

    
820
======================== ====== ======== ==========
821
URI                      Method Cyclades OS/Compute
822
======================== ====== ======== ==========
823
``/servers/<server id>`` PUT    ✔        ✔
824
======================== ====== ======== ==========
825

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

    
828
|
829

    
830
==============  ========================= ======== ==========
831
Request Header  Value                     Cyclades OS/Compute
832
==============  ========================= ======== ==========
833
X-Auth-Token    User authentication token required required
834
Content-Type    Type or request body      required required
835
Content-Length  Length of request body    required required
836
==============  ========================= ======== ==========
837

    
838
**Example Request Headers**::
839

    
840
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
841
  Content-Type:   application/json
842
  Content-Length: 54
843

    
844
.. note:: Request parameters should be empty
845

    
846
Request body contents::
847

    
848
  server: {
849
    <server attribute>: <value>,
850
    ...
851
  }
852

    
853
=========== ==================== ======== ==========
854
Attribute   Description          Cyclades OS/Compute
855
=========== ==================== ======== ==========
856
name        The server name      ✔        ✔
857
accessIPv4  IP v4 address        **✘**    ✔
858
accessIPv6  IP v6 address        **✘**    ✔
859
=========== ==================== ======== ==========
860

    
861
* Cyclades support multiple network connections per virtual server, which
862
  explains the above differences in request body attributes.
863

    
864
*Example Rename Server Request: JSON*
865

    
866
.. code-block:: javascript
867

    
868
  {"server": {"name": "A new name for my virtual server"}}
869

    
870
.. rubric:: Response
871

    
872
=========================== =====================
873
Return Code                 Description
874
=========================== =====================
875
204 (OK)                    Request succeeded
876
400 (Bad Request)           Malformed request or malformed server id
877
401 (Unauthorized)          Missing or expired user token
878
403 (Forbidden)             User is not allowed to perform this operation
879
404 (Not Found)             Server not found
880
415 (Bad Media Type)
881
409 (Build In Progress)     Server is not ready yet
882
500 (Internal Server Error) The request cannot be completed because of an
883
\                           internal error
884
503 (Service Unavailable)   No available backends or service currently
885
\                           unavailable
886
=========================== =====================
887

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

    
892
Delete Server
893
.............
894

    
895
Delete a virtual server. When a server is deleted, all its connections are
896
deleted as well.
897

    
898
.. rubric:: Request
899

    
900
======================== ====== ======== ==========
901
URI                      Method Cyclades OS/Compute
902
======================== ====== ======== ==========
903
``/servers/<server id>`` DELETE ✔        ✔
904
======================== ====== ======== ==========
905

    
906
* **server-id** is the identifier of the virtual server.
907

    
908
|
909

    
910
==============  ========================= ======== ==========
911
Request Header  Value                     Cyclades OS/Compute
912
==============  ========================= ======== ==========
913
X-Auth-Token    User authentication token required required
914
==============  ========================= ======== ==========
915

    
916
.. note:: Request parameters should be empty
917

    
918
.. note:: Request body should be empty
919

    
920
.. rubric:: Response
921

    
922
=========================== =====================
923
Return Code                 Description
924
=========================== =====================
925
204 (OK)                    Request succeeded
926
400 (Bad Request)           Malformed server id or machine already deleted
927
401 (Unauthorized)          Missing or expired user token
928
404 (Not Found)             Server not found
929
409 (Build In Progress)     Server is not ready yet
930
500 (Internal Server Error) The request cannot be completed because of an
931
\                           internal error
932
503 (Service Unavailable)   Action not supported or service currently
933
\                           unavailable
934
=========================== =====================
935

    
936
.. note:: In case of a 204 code, response body should be empty
937

    
938
List Server Addresses
939
.....................
940

    
941
List all network connections of a server. In Cyclades API, connections are
942
represented as Network Connection Interfaces (NICs), which describe a server -
943
network relation through their respective identifiers. This mechanism ensures
944
flexibility and multiple networks connecting the same virtual servers.
945

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

    
949
.. rubric:: Request
950

    
951
============================ ====== ======== ==========
952
URI                          Method Cyclades OS/Compute
953
============================ ====== ======== ==========
954
``/servers/<server id>/ips`` GET    ✔        ✔
955
============================ ====== ======== ==========
956

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

    
959
|
960

    
961
==============  ========================= ======== ==========
962
Request Header  Value                     Cyclades OS/Compute
963
==============  ========================= ======== ==========
964
X-Auth-Token    User authentication token required required
965
==============  ========================= ======== ==========
966

    
967
.. note:: Request parameters should be empty
968

    
969
.. note:: Request body should be empty
970

    
971
.. rubric:: Response
972

    
973
=========================== =====================
974
Return Code                 Description
975
=========================== =====================
976
200 (OK)                    Request succeeded
977
400 (Bad Request)           Malformed server id or machine already deleted
978
401 (Unauthorized)          Missing or expired user token
979
404 (Not Found)             Server not found
980
409 (Build In Progress)     Server is not ready yet
981
500 (Internal Server Error) The request cannot be completed because of an
982
\                           internal error
983
503 (Service Unavailable)   Service currently unavailable
984
=========================== =====================
985

    
986
Response body contents::
987

    
988
  addresses: [
989
    {
990
      <NIC attribute>: <value>,
991
      ...
992
    },
993
    ...
994
  ]
995

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

    
1000
*Example List Addresses: JSON*
1001

    
1002
.. code-block:: javascript
1003

    
1004
  {
1005
    "addresses": [
1006
      {
1007
        "id": "nic-25455-0"
1008
        "network_id": "1",
1009
        "mac_address": "aa:00:03:7a:84:bb",
1010
        "firewallProfile": "DISABLED",
1011
        "ipv4": "192.168.0.27",
1012
        "ipv6": "2001:646:2ffc:1222:a820:3fd:fe7a:84bb",
1013
      }, {
1014
        "id": "nic-25455-1"
1015
        "network_id": "7",
1016
        "mac_address": "aa:00:03:7a:84:cc",
1017
        "firewallProfile": "DISABLED",
1018
        "ipv4": "192.168.0.28",
1019
        "ipv6": "2002:646:2fec:1222:a820:3fd:fe7a:84bc",
1020
      },
1021
    ]
1022
  }
1023

    
1024
Get Server NICs by Network
1025
..........................
1026

    
1027
Return the NIC that connects a server to a network.
1028

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

    
1033
.. rubric:: Request
1034

    
1035
========================================= ====== ======== ==========
1036
URI                                       Method Cyclades OS/Compute
1037
========================================= ====== ======== ==========
1038
``/servers/<server id>/ips/<network id>`` GET    ✔        ✔
1039
========================================= ====== ======== ==========
1040

    
1041
* **server id** is the identifier of the virtual server
1042

    
1043
* **network id** is the identifier of the network
1044

    
1045
|
1046

    
1047
==============  ========================= ======== ==========
1048
Request Header  Value                     Cyclades OS/Compute
1049
==============  ========================= ======== ==========
1050
X-Auth-Token    User authentication token required required
1051
==============  ========================= ======== ==========
1052

    
1053
.. note:: Request parameters should be empty
1054

    
1055
.. note:: Request body should be empty
1056

    
1057
.. rubric:: Response
1058

    
1059
=========================== =====================
1060
Return Code                 Description
1061
=========================== =====================
1062
200 (OK)                    Request succeeded
1063
400 (Bad Request)           Malformed server id or machine already deleted
1064
401 (Unauthorized)          Missing or expired user token
1065
404 (Not Found)             Server not found
1066
409 (Build In Progress)     Server is not ready yet
1067
500 (Internal Server Error) The request cannot be completed because of an
1068
\                           internal error
1069
503 (Service Unavailable)   Service currently unavailable
1070
=========================== =====================
1071

    
1072
|
1073

    
1074
Response body contents::
1075

    
1076
  network: {
1077
    <NIC attributes>: <value>,
1078
    ...
1079
  }
1080

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

    
1083
**List Server NICs Example with server id 25455, network id 7: JSON**
1084

    
1085
.. code-block:: javascript
1086

    
1087
  {
1088
    "network": {
1089
      "id": "nic-25455-0"
1090
      "network_id": "7",
1091
      "mac_address": "aa:00:03:7a:84:bb",
1092
      "firewallProfile": "DISABLED",
1093
      "ipv4": "192.168.0.27",
1094
      "ipv6": "2001:646:2ffc:1222:a820:3fd:fe7a:84bb",
1095
    }
1096
  }
1097

    
1098

    
1099
List Server Metadata
1100
....................
1101

    
1102
List the metadata of a server
1103

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

    
1107
.. rubric:: Request
1108

    
1109
================================= ====== ======== ==========
1110
URI                               Method Cyclades OS/Compute
1111
================================= ====== ======== ==========
1112
``/servers/<server-id>/metadata`` GET    ✔        ✔
1113
================================= ====== ======== ==========
1114

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

    
1117
|
1118

    
1119
==============  ========================= ======== ==========
1120
Request Header  Value                     Cyclades OS/Compute
1121
==============  ========================= ======== ==========
1122
X-Auth-Token    User authentication token required required
1123
==============  ========================= ======== ==========
1124

    
1125
.. note:: Request parameters should be empty
1126

    
1127
.. note:: Request body should be empty
1128

    
1129
.. rubric:: Response
1130

    
1131
=========================== =====================
1132
Return Code                 Description
1133
=========================== =====================
1134
200 (OK)                    Request succeeded
1135
400 (Bad Request)           Invalid server ID or Malformed request
1136
401 (Unauthorized)          Missing or expired user token
1137
403 (Forbidden)             Administratively suspended server
1138
404 (Not Found)             Server not found
1139
500 (Internal Server Error) The request cannot be completed because of an
1140
\                           internal error
1141
503 (Service Unavailable)   The server is not currently available
1142
=========================== =====================
1143

    
1144
Response body contents::
1145

    
1146
  metadata: {
1147
    <key>: <value>,
1148
      ...
1149
  }
1150

    
1151
*Example List Server Metadata: JSON*
1152

    
1153
.. code-block:: javascript
1154

    
1155
  {
1156
    ""metadata": {
1157
      "OS": "Linux",
1158
      "users": "root"
1159
    }
1160
  }
1161

    
1162
Set / Update Server Metadata
1163
............................
1164

    
1165
In Cyclades API, setting new metadata and updating the values of existing ones
1166
is achieved with the same type of request (``POST``), while in OS/Compute API
1167
there are two separate request types (``PUT`` and ``POST`` for
1168
`setting new <http://docs.openstack.org/api/openstack-compute/2/content/Create_or_Replace_Metadata-d1e5358.html>`_
1169
and
1170
`updating existing <http://docs.openstack.org/api/openstack-compute/2/content/Update_Metadata-d1e5208.html>`_
1171
metadata, respectively).
1172

    
1173
In Cyclades API, metadata keys which are not referred by the operation will
1174
remain intact, while metadata referred by the operation will be overwritten.
1175

    
1176
.. rubric:: Request
1177

    
1178
================================= ====== ======== ==========
1179
URI                               Method Cyclades OS/Compute
1180
================================= ====== ======== ==========
1181
``/servers/<server-id>/metadata`` PUT    **✘**    ✔
1182
``/servers/<server-id>/metadata`` POST   ✔       ✔
1183
================================= ====== ======== ==========
1184

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

    
1187
|
1188

    
1189
==============  ========================= ======== ==========
1190
Request Header  Value                     Cyclades OS/Compute
1191
==============  ========================= ======== ==========
1192
X-Auth-Token    User authentication token required required
1193
Content-Type    Type or request body      required required
1194
Content-Length  Length of request body    required required
1195
==============  ========================= ======== ==========
1196

    
1197
**Example Request Headers**::
1198

    
1199
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
1200
  Content-Type:   application/json
1201
  Content-Length: 56
1202

    
1203
.. note:: Request parameters should be empty
1204

    
1205
Request body contents::
1206

    
1207
  metadata: {
1208
    <key>: <value>,
1209
    ...
1210
  }
1211

    
1212
*Example Request Set / Update Server Metadata: JSON*
1213

    
1214
.. code-block:: javascript
1215

    
1216
  {"metadata": {"role": "webmail", "users": "root,maild"}}
1217

    
1218
.. rubric:: Response
1219

    
1220
=========================== =====================
1221
Return Code                 Description
1222
=========================== =====================
1223
201 (OK)                    Request succeeded
1224
400 (Bad Request)           Invalid server ID or Malformed request
1225
401 (Unauthorized)          Missing or expired user token
1226
403 (Forbidden)             Administratively suspended server
1227
404 (Not Found)             Server not found
1228
413 (OverLimit)             Maximum number of metadata exceeded
1229
500 (Internal Server Error) The request cannot be completed because of an
1230
\                           internal error
1231
503 (Service Unavailable)   The server is not currently available
1232
=========================== =====================
1233

    
1234
Response body contents::
1235

    
1236
  metadata: {
1237
    <key>: <value>,
1238
    ...
1239
  }
1240

    
1241
*Example Response Set / Update Server Metadata: JSON*
1242

    
1243
.. code-block:: javascript
1244

    
1245
  {"metadata": {"OS": "Linux", "role": "webmail", "users": "root,maild"}}
1246

    
1247
Get Server Metadata Item
1248
........................
1249

    
1250
Get the value of a specific piece of metadata of a virtual server
1251

    
1252
.. rubric:: Request
1253

    
1254
======================================= ====== ======== ==========
1255
URI                                     Method Cyclades OS/Compute
1256
======================================= ====== ======== ==========
1257
``/servers/<server-id>/metadata/<key>`` GET    ✔        ✔
1258
======================================= ====== ======== ==========
1259

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

    
1262
* **key** is the key of a matadatum ``key``:``value`` pair
1263

    
1264
|
1265

    
1266
==============  ========================= ======== ==========
1267
Request Header  Value                     Cyclades OS/Compute
1268
==============  ========================= ======== ==========
1269
X-Auth-Token    User authentication token required required
1270
==============  ========================= ======== ==========
1271

    
1272
.. note:: Request parameters should be empty
1273

    
1274
.. note:: Request body should be empty
1275

    
1276
.. rubric:: Response
1277

    
1278
=========================== =====================
1279
Return Code                 Description
1280
=========================== =====================
1281
200 (OK)                    Request succeeded
1282
400 (Bad Request)           Invalid server ID or Malformed request
1283
401 (Unauthorized)          Missing or expired user token
1284
403 (Forbidden)             Administratively suspended server
1285
404 (Not Found)             Metadatum key not found
1286
500 (Internal Server Error) The request cannot be completed because of an
1287
\                           internal error
1288
503 (Service Unavailable)   The server is not currently available
1289
=========================== =====================
1290

    
1291
Response body content::
1292

    
1293
  metadata: {<key>: <value>}
1294

    
1295
*Example Get Server Metadatum for Item 'role', JSON*
1296

    
1297
.. code-block:: javascript
1298

    
1299
  {"metadata": {"role": "webmail"}}
1300

    
1301
Update Server Metadatum Item
1302
.............................
1303

    
1304
Set a new or update an existing a metadum value for a virtual server.
1305

    
1306
.. rubric:: Request
1307

    
1308
======================================= ====== ======== ==========
1309
URI                                     Method Cyclades OS/Compute
1310
======================================= ====== ======== ==========
1311
``/servers/<server-id>/metadata/<key>`` PUT    ✔        ✔
1312
======================================= ====== ======== ==========
1313

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

    
1316
* **key** is the key of a ``key``:``value`` pair piece of metadata
1317

    
1318
|
1319

    
1320
==============  ========================= ======== ==========
1321
Request Header  Value                     Cyclades OS/Compute
1322
==============  ========================= ======== ==========
1323
X-Auth-Token    User authentication token required required
1324
Content-Type    Type or request body      required required
1325
Content-Length  Length of request body    required required
1326
==============  ========================= ======== ==========
1327

    
1328
**Example Request Headers**::
1329

    
1330
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
1331
  Content-Type:   application/json
1332
  Content-Length: 29
1333

    
1334
.. note:: Request parameters should be empty
1335

    
1336
Request body content::
1337

    
1338
  metadata: {<key>: <value>}
1339

    
1340
*Example Request to Set or Update Server Metadatum "role": JSON*
1341

    
1342
.. code-block:: javascript
1343

    
1344
  {"metadata": {"role": "gateway"}}
1345

    
1346
.. rubric:: Response
1347

    
1348
=========================== =====================
1349
Return Code                 Description
1350
=========================== =====================
1351
201 (OK)                    Request succeeded
1352
400 (Bad Request)           Invalid server ID or Malformed request
1353
401 (Unauthorized)          Missing or expired user token
1354
403 (Forbidden)             Administratively suspended server
1355
404 (Not Found)             Metadatum key not found
1356
413 (OverLimit)             Maximum number of metadata exceeded
1357
500 (Internal Server Error) The request cannot be completed because of an
1358
\                           internal error
1359
503 (Service Unavailable)   The server is not currently available
1360
=========================== ====================
1361

    
1362
Response body content::
1363

    
1364
  metadata: {<key>: <value>}
1365

    
1366
*Example Set or Update Server Metadatum "role":"gateway": JSON*
1367

    
1368
.. code-block:: javascript
1369

    
1370
  {"metadata": {"role": "gateway"}}
1371

    
1372
Delete Server Metadatum
1373
.......................
1374

    
1375
Delete a metadatum of a virtual server
1376

    
1377
.. rubric:: Request
1378

    
1379
======================================= ====== ======== ==========
1380
URI                                     Method Cyclades OS/Compute
1381
======================================= ====== ======== ==========
1382
``/servers/<server-id>/metadata/<key>`` DELETE ✔        ✔
1383
======================================= ====== ======== ==========
1384

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

    
1387
* **key** is the key of a matadatum ``key``:``value`` pair
1388

    
1389
|
1390

    
1391
==============  ========================= ======== ==========
1392
Request Header  Value                     Cyclades OS/Compute
1393
==============  ========================= ======== ==========
1394
X-Auth-Token    User authentication token required required
1395
==============  ========================= ======== ==========
1396

    
1397
.. note:: Request parameters should be empty
1398

    
1399
.. note:: Request body should be empty
1400

    
1401
.. rubric:: Response
1402

    
1403
=========================== =====================
1404
Return Code                 Description
1405
=========================== =====================
1406
204 (OK)                    Request succeeded
1407
400 (Bad Request)           Invalid server ID
1408
401 (Unauthorized)          Missing or expired user token
1409
403 (Forbidden)             Administratively suspended server
1410
404 (Not Found)             Metadatum key not found
1411
500 (Internal Server Error) The request cannot be completed because of an
1412
\                           internal error
1413
503 (Service Unavailable)   The server is not currently available
1414
=========================== =====================
1415

    
1416
.. note:: In case of a 204 code, response body should be empty
1417

    
1418
Server Actions
1419
--------------
1420

    
1421
Actions are operations that are achieved through the same type of request
1422
(``POST``). There are differences in the implementations of some operations
1423
between Synnefo/Cyclades and OS/Compute. Although this document focuses on
1424
Synnefo/Cyclades, differences and similarities between the APIs are also
1425
briefed.
1426

    
1427
=============================================== ======== ==========
1428
Operations                                      Cyclades OS/Compute
1429
=============================================== ======== ==========
1430
`Start <#start-server>`_                        ✔        **✘**
1431
`Shutdown <#shutdown-server>`_                  ✔        **✘**
1432
`Reboot <#reboot-server>`_                      ✔        ✔
1433
`Get Console <#get-server-console>`_            ✔        **✘**
1434
`Set Firewall <#set-server-firewall-profile>`_  ✔        **✘**
1435
`Change Admin Password <#os-compute-specific>`_ **✘**    ✔
1436
`Rebuild <#os-compute-specific>`_               **✘**    ✔
1437
`Resize <#os-compute-specific>`_                **✘**    ✔
1438
`Confirm Resized <#os-compute-specific>`_       **✘**    ✔
1439
`Revert Resized <#os-compute-specific>`_        **✘**    ✔
1440
`Create Image <#os-compute-specific>`_          **✘**    ✔
1441
=============================================== ======== ==========
1442

    
1443
.. rubric:: Request
1444

    
1445
=============================== ====== ======== ==========
1446
URI                             Method Cyclades OS/Compute
1447
=============================== ====== ======== ==========
1448
``/servers/<server id>/action`` POST   ✔        ✔
1449
=============================== ====== ======== ==========
1450

    
1451
|
1452

    
1453
==============  ========================= ======== ==========
1454
Request Header  Value                     Cyclades OS/Compute
1455
==============  ========================= ======== ==========
1456
X-Auth-Token    User authentication token required required
1457
Content-Type    Type or request body      required required
1458
Content-Length  Length of request body    required required
1459
==============  ========================= ======== ==========
1460

    
1461
**Example Request Headers**::
1462

    
1463
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
1464
  Content-Type:   application/json
1465
  Content-Length: 32
1466

    
1467
.. note:: Request parameters should be empty
1468

    
1469
.. note:: Request body varies between operations (see bellow)
1470

    
1471
.. rubric:: Response
1472

    
1473
=========================== =====================
1474
Return Code                 Description
1475
=========================== =====================
1476
200 (OK)                    Request succeeded (for console operation)
1477
202 (OK)                    Request succeeded
1478
400 (Bad Request)           Invalid request or unknown action
1479
401 (Unauthorized)          Missing or expired user token
1480
403 (Forbidden)             User is not allowed to perform this operation
1481
500 (Internal Server Error) The request cannot be completed because of an
1482
\                           internal error
1483
503 (Service Unavailable)   The server is not currently available
1484
=========================== =====================
1485

    
1486
.. note:: Response body varies between operations (see bellow)
1487

    
1488
Start server
1489
................
1490

    
1491
This operation transitions a server from a STOPPED to an ACTIVE state.
1492

    
1493
Request body contents::
1494

    
1495
  start: {}
1496

    
1497
*Example Start Server: JSON*
1498

    
1499
.. code-block:: javascript
1500

    
1501
  {"start": {}}
1502

    
1503
.. note:: Response body should be empty
1504

    
1505
Reboot Server
1506
.............
1507

    
1508
This operation transitions a server from ``ACTIVE`` to ``REBOOT`` and then
1509
``ACTIVE`` again.
1510

    
1511
Synnefo and OS/Compute APIs offer two reboot modes: ``soft``
1512
and ``hard``. OS/Compute distinguishes between the two intermediate states
1513
(``REBOOT`` and ``HARD_REBOOT``) while rebooting, while Synnefo/Cyclades use
1514
only the ``REBOOT`` term. The expected behavior is the same, though.
1515

    
1516
Request body contents::
1517

    
1518
  reboot: {type: <reboot type>}
1519

    
1520
* **reboot type** can be either ``SOFT`` or ``HARD``.
1521

    
1522
*Example (soft) Reboot Server: JSON*
1523

    
1524
.. code-block:: javascript
1525

    
1526
  {"reboot" : { "type": "soft"}}
1527

    
1528
.. note:: Response body should be empty
1529

    
1530
Shutdown server
1531
...............
1532

    
1533
This operation transitions a server from an ACTIVE to a STOPPED state.
1534

    
1535
Request body contents::
1536

    
1537
  shutdown: {}
1538

    
1539
*Example Shutdown Server: JSON*
1540

    
1541
.. code-block:: javascript
1542

    
1543
  {"shutdown": {}}
1544

    
1545
.. note:: Response body should be empty
1546

    
1547
Get Server Console
1548
..................
1549

    
1550
.. note:: This operation is not part of OS/Compute API
1551

    
1552
The console operation arranges for an OOB console of the specified type. Only
1553
consoles of type ``vnc`` are supported for now. Cyclades server uses a running
1554
instance of vncauthproxy to setup proper VNC forwarding with a random password,
1555
then returns the necessary VNC connection info to the caller.
1556

    
1557
Request body contents::
1558

    
1559
  console: {type: vnc}
1560

    
1561
*Example Get Server Console: JSON*
1562

    
1563
.. code-block:: javascript
1564

    
1565
  {"console": {"type": "vnc" }
1566

    
1567
Response body contents::
1568

    
1569
  console: {
1570
    <vnc attribute>: <value>,
1571
    ...
1572
  }
1573

    
1574
============== ======================
1575
VNC Attributes Description
1576
============== ======================
1577
host           The vncprocy host
1578
port           vncprocy port
1579
password       Temporary password
1580
type           Connection type (only VNC)
1581
============== ======================
1582

    
1583
*Example Action Console Response: JSON*
1584

    
1585
.. code-block:: javascript
1586

    
1587
  {
1588
    "console": {
1589
      "type": "vnc",
1590
      "host": "vm42.example.org",
1591
      "port": 1234,
1592
      "password": "513NR14PN0T"
1593
    }
1594
  }
1595

    
1596
Set Server Firewall Profile
1597
...........................
1598

    
1599
The firewallProfile function sets a firewall profile for the public interface
1600
of a server.
1601

    
1602
Request body contents::
1603

    
1604
  firewallProfile: { profile: <firewall profile>}
1605

    
1606
* **firewall profile** can be ``ENABLED``, ``DISABLED`` or ``PROTECTED``
1607

    
1608
*Example Action firewallProfile: JSON**
1609

    
1610
.. code-block:: javascript
1611

    
1612
  {"firewallProfile": {"profile": "ENABLED"}}
1613

    
1614
.. note:: Response body should be empty
1615

    
1616
OS/Compute Specific
1617
...................
1618

    
1619
The following operations are meaningless or not supported in the context of
1620
Synnefo/Cyclades, but are parts of the OS/Compute API:
1621

    
1622
* `Change Administrator Password <http://docs.openstack.org/api/openstack-compute/2/content/Change_Password-d1e3234.html>`_
1623
* `Rebuild Server <http://docs.openstack.org/api/openstack-compute/2/content/Rebuild_Server-d1e3538.html>`_
1624
* `Resize Server <http://docs.openstack.org/api/openstack-compute/2/content/Resize_Server-d1e3707.html>`_
1625
* `Confirm Resized Server <http://docs.openstack.org/api/openstack-compute/2/content/Confirm_Resized_Server-d1e3868.html>`_
1626
* `Revert Resized Server <http://docs.openstack.org/api/openstack-compute/2/content/Revert_Resized_Server-d1e4024.html>`_
1627
* `Create Image <http://docs.openstack.org/api/openstack-compute/2/content/Create_Image-d1e4655.html>`_
1628

    
1629

    
1630
Flavors
1631
-------
1632

    
1633
A flavor is a hardware configuration for a server.
1634

    
1635
==================================== ======================== ====== ======== ==========
1636
Description                          URI                      Method Cyclades OS/Compute
1637
==================================== ======================== ====== ======== ==========
1638
`List <#list-flavors>`_              ``/flavors``             GET    ✔        ✔
1639
\                                    ``/flavors/detail``      GET    ✔        **✘**
1640
`Get details <#get-flavor-details>`_ ``/flavors/<flavor-id>`` GET    ✔        ✔
1641
==================================== ======================== ====== ======== ==========
1642

    
1643
List Flavors
1644
............
1645

    
1646
List the flavors that are accessible by the user
1647

    
1648
.. rubric:: Request
1649

    
1650
=================== ====== ======== ==========
1651
URI                 Method Cyclades OS/Compute
1652
=================== ====== ======== ==========
1653
``/flavors``        GET    ✔        ✔
1654
``/flavors/detail`` GET    ✔        ✔
1655
=================== ====== ======== ==========
1656

    
1657
|
1658

    
1659
==============  ========================= ======== ==========
1660
Request Header  Value                     Cyclades OS/Compute
1661
==============  ========================= ======== ==========
1662
X-Auth-Token    User authentication token required required
1663
==============  ========================= ======== ==========
1664

    
1665
|
1666

    
1667
================= ===============
1668
Request Parameter Value
1669
================= ===============
1670
json              Respond in json
1671
xml               Respond in xml
1672
================= ===============
1673

    
1674
.. note:: Request body should be empty
1675

    
1676
.. rubric:: Response
1677

    
1678
=========================== =====================
1679
Return Code                 Description
1680
=========================== =====================
1681
200 (OK)                    Request succeeded
1682
400 (Bad Request)           Malformed request
1683
401 (Unauthorized)          Missing or expired user token
1684
403 (Forbidden)             Forbidden to use this flavor
1685
500 (Internal Server Error) The request cannot be completed because of an
1686
\                           internal error
1687
503 (Service Unavailable)   The server is not currently available
1688
=========================== =====================
1689

    
1690
Response code contents::
1691

    
1692
  flavors: [
1693
    {
1694
      <flavor attribute>: <value>,
1695
      ...
1696
    },
1697
    ...
1698
  ]
1699

    
1700
Flavor attributes are `listed here <#flavor-ref>`_. Regular listing contains
1701
only ``id`` and ``name`` attributes.
1702

    
1703
*Example List Flavors (regular): JSON*
1704

    
1705
.. code-block:: javascript
1706

    
1707
  {
1708
    "flavors": [
1709
      {
1710
        "id": 1,
1711
        "name": "One code",
1712
      }, {
1713
        "id": 3,
1714
        "name": "Four core",
1715
      }
1716
    ]
1717
  }
1718

    
1719

    
1720
*Example List Flavors (regular): XML*
1721

    
1722
.. code-block:: xml
1723

    
1724
  <?xml version="1.0" encoding="UTF-8"?>
1725
  <flavors xmlns="http://docs.openstack.org/compute/api/v1"
1726
    xmlns:atom="http://www.w3.org/2005/Atom">
1727
    <flavor id="1" name="One core"/>
1728
    <flavor id="3" name="Four core"/>
1729
  </flavors>
1730

    
1731
*Example List Flavors (detail): JSON*
1732

    
1733
.. code-block:: javascript
1734

    
1735
  {
1736
    "flavors": [
1737
      {
1738
        "id": 1,
1739
        "name": "One core",
1740
        "ram": 1024,
1741
        "SNF:disk_template": "drbd",
1742
        "disk": 20,
1743
        "cpu": 1
1744
      }, {
1745
        "id": 3,
1746
        "name": "Four core",
1747
        "ram": 1024,
1748
        "SNF:disk_template": "drbd",
1749
        "disk": 40,
1750
        "cpu": 4
1751
      }
1752
    ]
1753
  }
1754

    
1755
Get Flavor Details
1756
..................
1757

    
1758
Get the configuration of a specific flavor
1759

    
1760
.. rubric:: Request
1761

    
1762
======================= ====== ======== ==========
1763
URI                     Method Cyclades OS/Compute
1764
======================= ====== ======== ==========
1765
``/flavors/<flavor-id`` GET    ✔        ✔
1766
======================= ====== ======== ==========
1767

    
1768
* **flavor-id** is the identifier of the flavor
1769

    
1770
|
1771

    
1772
==============  ========================= ======== ==========
1773
Request Header  Value                     Cyclades OS/Compute
1774
==============  ========================= ======== ==========
1775
X-Auth-Token    User authentication token required required
1776
==============  ========================= ======== ==========
1777

    
1778
|
1779

    
1780
================= ===============
1781
Request Parameter Value
1782
================= ===============
1783
json              Respond in json
1784
xml               Respond in xml
1785
================= ===============
1786

    
1787
.. note:: Request body should be empty
1788

    
1789
.. rubric:: Response
1790

    
1791
=========================== =====================
1792
Return Code                 Description
1793
=========================== =====================
1794
200 (OK)                    Request succeeded
1795
400 (Bad Request)           Malformed flavor ID
1796
401 (Unauthorized)          Missing or expired user token
1797
403 (Forbidden)             Forbidden to use this flavor
1798
404 (Not Found)             Flavor id not founmd
1799
500 (Internal Server Error) The request cannot be completed because of an
1800
\                           internal error
1801
503 (Service Unavailable)   The server is not currently available
1802
=========================== =====================
1803

    
1804
Response code contents::
1805

    
1806
  flavor: {
1807
    <flavor attribute>: <value>,
1808
    ...
1809
  }
1810

    
1811
All flavor attributes are `listed here <flavor-ref>`_.
1812

    
1813
*Example Flavor Details: JSON*
1814

    
1815
.. code-block:: javascript
1816

    
1817
  {
1818
    "flavor": {
1819
      {
1820
        "id": 1,
1821
        "name": "One core",
1822
        "ram": 1024,
1823
        "SNF:disk_template": "drbd",
1824
        "disk": 20,
1825
        "cpu": 1
1826
      }
1827
    }
1828
  }
1829

    
1830
*Example Flavor Details: XML*
1831

    
1832
.. code-block:: xml
1833

    
1834
  <?xml version="1.0" encoding="UTF-8"?>
1835
  <flavor xmlns="http://docs.openstack.org/compute/api/v1"
1836
    xmlns:atom="http://www.w3.org/2005/Atom"
1837
    id="1" name="One core" ram="1024" disk="20" cpu="1" />
1838

    
1839
Images
1840
------
1841

    
1842
An image is a collection of files used to create or rebuild a server. Synnefo
1843
deployments usually provide pre-built OS images, but custom image creation is
1844
also supported.
1845

    
1846
============================================= ===================================== ====== ======== ==========
1847
Description                                   URI                                   Method Cyclades OS/Compute
1848
============================================= ===================================== ====== ======== ==========
1849
`List <#list-images>`_                        ``/images``                           GET    ✔        ✔
1850
\                                             ``/images/detail``                    GET    ✔        ✔
1851
`Get details <#get-image-details>`_           ``/images/<image-id>``                GET    ✔        ✔
1852
`Delete <#delete-image>`_                     ``/images/<image id>``                DELETE ✔        ✔
1853
`List Metadata <#list-image-metadata>`_       ``/images/<image-id>/metadata``       GET    ✔        ✔
1854
`Update Metadata <#update-image-metadata>`_   ``/images/<image-id>/metadata``       POST   ✔        ✔
1855
\                                             ``/images/<image-id>/metadata``       PUT    **✘**    ✔
1856
`Get Meta Item <#get-image-metadatum>`_       ``/image/<image-id>/metadata/<key>``  GET    ✔        ✔
1857
`Update Metadatum <#update-image-metadatum>`_ ``/images/<image-id>/metadata/<key>`` PUT    ✔        ✔
1858
`Delete Metadatum <#delete-image-metadatum>`_ ``/images/<image-id>/metadata/<key>`` DELETE ✔        ✔
1859
============================================= ===================================== ====== ======== ==========
1860

    
1861

    
1862
List Images
1863
...........
1864

    
1865
List all images accessible by the user
1866

    
1867
.. rubric:: Request
1868

    
1869
=================== ====== ======== ==========
1870
URI                 Method Cyclades OS/Compute
1871
=================== ====== ======== ==========
1872
``/images``        GET    ✔        ✔
1873
``/images/detail`` GET    ✔        ✔
1874
=================== ====== ======== ==========
1875

    
1876
|
1877

    
1878
==============  ========================= ======== ==========
1879
Request Header  Value                     Cyclades OS/Compute
1880
==============  ========================= ======== ==========
1881
X-Auth-Token    User authentication token required required
1882
==============  ========================= ======== ==========
1883

    
1884
|
1885

    
1886
================= ======================== ======== ==========
1887
Request Parameter Value                    Cyclades OS/Compute
1888
================= ======================== ======== ==========
1889
server            Server filter            **✘**    ✔
1890
name              Image name filter        **✘**    ✔
1891
status            Server status filter     **✘**    ✔
1892
changes-since     Change timestamp filter  ✔        ✔
1893
marker            Last list last ID filter **✘**    ✔
1894
limit             Page size filter         **✘**    ✔
1895
type              Request filter type      **✘**    ✔
1896
================= ======================== ======== ==========
1897

    
1898
* **changes-since** must be an ISO8601 date string. In Cyclades it refers to
1899
  the image ``updated_at`` attribute and it should be a date in the window
1900
  [- POLL_LIMIT ... now]. POLL_LIMIT default value is 3600 seconds except if it
1901
  is set otherwise at server side.
1902

    
1903
.. note:: Request body should be empty
1904

    
1905
.. rubric:: Response
1906

    
1907
=========================== =====================
1908
Return Code                 Description
1909
=========================== =====================
1910
200 (OK)                    Request succeeded
1911
304 (No images since date)  Can be returned if ``changes-since`` is given
1912
400 (Bad Request)           Invalid or malformed ``changes-since`` parameter
1913
401 (Unauthorized)          Missing or expired user token
1914
403 (Forbidden)             User is not allowed to perform this operation
1915
500 (Internal Server Error) The request cannot be completed because of an
1916
\                           internal error
1917
503 (Service Unavailable)   The server is not currently available
1918
=========================== =====================
1919

    
1920
Response body contents::
1921

    
1922
  images: [
1923
    {
1924
      <image attribute>: <value>,
1925
      ...
1926
      metadata: {
1927
        <image metadatum key>: <value>,
1928
        ...
1929
      },
1930
      ...
1931
    },
1932
    ...
1933
  ]
1934

    
1935
The regular response returns just ``id`` and ``name``, while the detail returns
1936
a collections of the `image attributes listed here <#image-ref>`_.
1937

    
1938
*Example List Image (detail): JSON*
1939

    
1940
.. code-block:: javascript
1941

    
1942
  {
1943
    "images: [
1944
      {
1945
        "status": "ACTIVE",
1946
        "updated": "2013-03-02T15:57:03+00:00",
1947
        "name": "edx_saas",
1948
        "created": "2013-03-02T12:21:00+00:00",
1949
        "progress": 100,
1950
        "id": "175716...526236",
1951
        "metadata": {
1952
          "partition_table": "msdos",
1953
          "osfamily": "linux",
1954
          "users": "root saasbook",
1955
          "exclude_task_changepassword": "yes",
1956
          "os": "ubuntu",
1957
          "root_partition": "1",
1958
          "description": "Ubuntu 12.04 LTS"
1959
        }
1960
      }, {
1961
        "status": "ACTIVE",
1962
        "updated": "2013-03-02T15:57:03+00:00",
1963
        "name": "edx_saas",
1964
        "created": "2013-03-02T12:21:00+00:00",
1965
        "progress": 100,
1966
        "id": "1357163d...c526206",
1967
        "metadata": {
1968
          "partition_table": "msdos",
1969
          "osfamily": "windows",
1970
          "users": "Administratior",
1971
          "exclude_task_changepassword": "yes",
1972
          "os": "WinME",
1973
          "root_partition": "1",
1974
          "description": "Rerto Windows"
1975
        }
1976
      }
1977
    ]
1978
  }
1979

    
1980
Get Image Details
1981
.................
1982

    
1983
Get the details of a specific image
1984

    
1985
.. rubric:: Request
1986

    
1987
====================== ====== ======== ==========
1988
URI                    Method Cyclades OS/Compute
1989
====================== ====== ======== ==========
1990
``/images/<image-id>`` GET    ✔        ✔
1991
====================== ====== ======== ==========
1992

    
1993
* **image-id** is the identifier of the virtual image
1994

    
1995
|
1996

    
1997
==============  ========================= ======== ==========
1998
Request Header  Value                     Cyclades OS/Compute
1999
==============  ========================= ======== ==========
2000
X-Auth-Token    User authentication token required required
2001
==============  ========================= ======== ==========
2002

    
2003
.. note:: Request parameters should be empty
2004

    
2005
.. note:: Request body should be empty
2006

    
2007
.. rubric:: Response
2008

    
2009
=========================== =====================
2010
Return Code                 Description
2011
=========================== =====================
2012
200 (OK)                    Request succeeded
2013
400 (Bad Request)           Malformed image id
2014
401 (Unauthorized)          Missing or expired user token
2015
403 (Forbidden)             Not allowed to use this image
2016
404 (Not Found)             Image not found
2017
500 (Internal Server Error) The request cannot be completed because of an
2018
\                           internal error
2019
503 (Service Unavailable)   No available backends or service currently
2020
\                           unavailable
2021
=========================== =====================
2022

    
2023
Response body contents::
2024

    
2025
  image: {
2026
    <image attribute>: <value>,
2027
    ...
2028
    metadata: {
2029
      <image metadatum key>: <value>
2030
    }
2031
  }
2032

    
2033
Image attributes are `listed here <#image-ref>`_.
2034

    
2035
*Example Details for an image with id 6404619d-...-aef57eaff4af, in JSON*
2036

    
2037
.. code-block:: javascript
2038

    
2039
  {
2040
  "image": {
2041
    "id": "6404619d-...-aef57eaff4af",
2042
    "name": "FreeBSD",
2043
    "status": "ACTIVE",
2044
    "updated": "2013-04-24T12:06:02+00:00",
2045
    "created": "2013-04-24T11:52:16+00:00",
2046
    "progress": 100,
2047
    "metadata": {
2048
      "kernel": "9.1 RELEASE",
2049
      "osfamily": "freebsd",
2050
      "users": "root",
2051
      "gui": "No GUI",
2052
      "sortorder": "9",
2053
      "os": "freebsd",
2054
      "root_partition": "2",
2055
      "description": "FreeBSD 9"
2056
      }
2057
    }
2058
  }
2059

    
2060

    
2061
Delete Image
2062
............
2063

    
2064
Delete an image, by changing its status from ``ACTIVE`` to ``DELETED``.
2065

    
2066
.. rubric:: Request
2067

    
2068
====================== ====== ======== ==========
2069
URI                    Method Cyclades OS/Compute
2070
====================== ====== ======== ==========
2071
``/images/<image id>`` DELETE ✔        ✔
2072
====================== ====== ======== ==========
2073

    
2074
* **image id** is the identifier of the image
2075

    
2076
|
2077

    
2078
==============  ========================= ======== ==========
2079
Request Header  Value                     Cyclades OS/Compute
2080
==============  ========================= ======== ==========
2081
X-Auth-Token    User authentication token required required
2082
==============  ========================= ======== ==========
2083

    
2084
.. note:: Request parameters should be empty
2085

    
2086
.. note:: Request body should be empty
2087

    
2088
.. rubric:: Response
2089

    
2090
=========================== =====================
2091
Return Code                 Description
2092
=========================== =====================
2093
204 (OK)                    Request succeeded
2094
400 (Bad Request)           Invalid request or image id
2095
401 (Unauthorized)          Missing or expired user token
2096
404 (Not Found)             Image not found
2097
500 (Internal Server Error) The request cannot be completed because of an
2098
\                           internal error
2099
503 (Service Unavailable)   Action not supported or service currently
2100
\                           unavailable
2101
=========================== =====================
2102

    
2103
.. note:: In case of a 204 code, request body should be empty
2104

    
2105
List Image Metadata
2106
...................
2107

    
2108
.. rubric:: Request
2109

    
2110
=============================== ====== ======== ==========
2111
URI                             Method Cyclades OS/Compute
2112
=============================== ====== ======== ==========
2113
``/images/<image-id>/metadata`` GET    ✔        ✔
2114
=============================== ====== ======== ==========
2115

    
2116
* **image-id** is the identifier of the virtual image
2117

    
2118
|
2119

    
2120
==============  ========================= ======== ==========
2121
Request Header  Value                     Cyclades OS/Compute
2122
==============  ========================= ======== ==========
2123
X-Auth-Token    User authentication token required required
2124
==============  ========================= ======== ==========
2125

    
2126
.. note:: Request parameters should be empty
2127

    
2128
.. note:: Request body should be empty
2129

    
2130
.. rubric:: Response
2131

    
2132
=========================== =====================
2133
Return Code                 Description
2134
=========================== =====================
2135
201 (OK)                    Request succeeded
2136
400 (Bad Request)           Invalid image ID or Malformed request
2137
401 (Unauthorized)          Missing or expired user token
2138
403 (Forbidden)             Administratively suspended server
2139
404 (Not Found)             Server not found
2140
409 (Build In Progress)     The image is not ready yet
2141
500 (Internal Server Error) The request cannot be completed because of an
2142
\                           internal error
2143
503 (Service Unavailable)   The server is not currently available
2144
=========================== =====================
2145

    
2146
Response body content::
2147

    
2148
  metadata: {
2149
    <metadatum key>: <value>,
2150
  ...
2151
  }
2152

    
2153
*Example List Image Metadata: JSON*
2154

    
2155
.. code-block:: javascript
2156

    
2157
  {
2158
    "metadata": {
2159
      "partition_table": "msdos",
2160
      "kernel": "3.2.0",
2161
      "osfamily": "linux",
2162
      "users": "user",
2163
      "gui": "Unity 5",
2164
      "sortorder": "3",
2165
      "os": "ubuntu",
2166
      "root_partition": "1",
2167
      "description": "Ubuntu 12 LTS"
2168
    }
2169
  }
2170

    
2171
.. note:: In OS/Compute API  the ``values`` level is missing from the response.
2172

    
2173
Update Image Metadata
2174
.....................
2175

    
2176
In Cyclades API, setting new metadata and updating the values of existing ones
2177
is achieved using one type of request (POST), while in OS/Compute API two
2178
different types are used (PUT and POST for
2179
`setting new <http://docs.openstack.org/api/openstack-compute/2/content/Create_or_Replace_Metadata-d1e5358.html>`_
2180
and
2181
`updating existing <http://docs.openstack.org/api/openstack-compute/2/content/Update_Metadata-d1e5208.html>`_
2182
metadata, respectively).
2183

    
2184
In Cyclades API, unmentioned metadata keys will remain intact, while metadata
2185
referred by the operation will be overwritten.
2186

    
2187
.. rubric:: Request
2188

    
2189
=============================== ====== ======== ==========
2190
URI                             Method Cyclades OS/Compute
2191
=============================== ====== ======== ==========
2192
``/images/<image-id>/metadata`` PUT    **✘**    ✔
2193
``/images/<image-id>/metadata`` POST   ✔        ✔
2194
=============================== ====== ======== ==========
2195

    
2196
* **image-id** is the identifier of the virtual image
2197

    
2198
|
2199

    
2200
==============  ========================= ======== ==========
2201
Request Header  Value                     Cyclades OS/Compute
2202
==============  ========================= ======== ==========
2203
X-Auth-Token    User authentication token required required
2204
Content-Type    Type or request body      required required
2205
Content-Length  Length of request body    required required
2206
==============  ========================= ======== ==========
2207

    
2208
**Example Request Headers**::
2209

    
2210
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
2211
  Content-Type:   application/json
2212
  Content-Length: 52
2213

    
2214
.. note:: Request parameters should be empty
2215

    
2216
Request body content::
2217

    
2218
  metadata: {
2219
    <metadatum key>: <value>,
2220
    ...
2221
  }
2222

    
2223
*Example Update Image Metadata Request: JSON*
2224

    
2225
.. code-block:: javascript
2226

    
2227
  {"metadata": {"NewAttr": "NewVal", "os": "Xubuntu'}}
2228

    
2229
.. rubric:: Response
2230

    
2231
=========================== =====================
2232
Return Code                 Description
2233
=========================== =====================
2234
201 (OK)                    Request succeeded
2235
400 (Bad Request)           Malformed request or image id
2236
401 (Unauthorized)          Missing or expired user token
2237
403 (Forbidden)             Not allowed to modify this image
2238
404 (Not Found)             Image or metadatum key not found
2239
413 (OverLimit)             Maximum number of metadata exceeded
2240
500 (Internal Server Error) The request cannot be completed because of an
2241
\                           internal error
2242
503 (Service Unavailable)   The server is not currently available
2243
=========================== =====================
2244

    
2245
Response body content::
2246

    
2247
  metadata: {
2248
    <key>: <value>,
2249
    ...
2250
  }
2251

    
2252
*Example Update Image Response: JSON*
2253

    
2254
.. code-block:: javascript
2255

    
2256
  {
2257
    "metadata": {
2258
      "partition_table": "msdos",
2259
      "kernel": "3.2.0",
2260
      "osfamily": "linux",
2261
      "users": "user",
2262
      "gui": "Unity 5",
2263
      "sortorder": "3",
2264
      "os": "Xubuntu",
2265
      "root_partition": "1",
2266
      "description": "Ubuntu 12 LTS",
2267
      "NewAttr": "NewVal"
2268
    }
2269
  }
2270

    
2271
Get Image Metadatum
2272
...................
2273

    
2274
.. rubric:: Request
2275

    
2276
===================================== ====== ======== ==========
2277
URI                                   Method Cyclades OS/Compute
2278
===================================== ====== ======== ==========
2279
``/images/<image-id>/metadata/<key>`` GET    ✔        ✔
2280
===================================== ====== ======== ==========
2281

    
2282
* **image-id** is the identifier of the image
2283

    
2284
* **key** is the key of a matadatum ``key``:``value`` pair
2285

    
2286
|
2287

    
2288
==============  ========================= ======== ==========
2289
Request Header  Value                     Cyclades OS/Compute
2290
==============  ========================= ======== ==========
2291
X-Auth-Token    User authentication token required required
2292
==============  ========================= ======== ==========
2293

    
2294
.. note:: Request parameters should be empty
2295

    
2296
.. note:: Request body should be empty
2297

    
2298
.. rubric:: Response
2299

    
2300
=========================== =====================
2301
Return Code                 Description
2302
=========================== =====================
2303
200 (OK)                    Request succeeded
2304
400 (Bad Request)           Malformed request or image id
2305
401 (Unauthorized)          Missing or expired user token
2306
403 (Forbidden)             Not allowed to access this information
2307
404 (Not Found)             Metadatum key not found
2308
500 (Internal Server Error) The request cannot be completed because of an
2309
\                           internal error
2310
503 (Service Unavailable)   The server is not currently available
2311
=========================== =====================
2312

    
2313
Response body content::
2314

    
2315
  metadata: {<key>: <value>}
2316

    
2317
*Example Get Image Metadatum Item: JSON*
2318

    
2319
.. code-block:: javascript
2320

    
2321
  {"metadata": {"os": "Xubuntu"}}
2322

    
2323
.. note:: In OS/Compute, ``metadata`` is ``meta``
2324

    
2325
Update Image Metadatum
2326
......................
2327

    
2328
.. rubric:: Request
2329

    
2330
===================================== ====== ======== ==========
2331
URI                                   Method Cyclades OS/Compute
2332
===================================== ====== ======== ==========
2333
``/images/<image-id>/metadata/<key>`` PUT    ✔        ✔
2334
===================================== ====== ======== ==========
2335

    
2336
* **image-id** is the identifier of the image
2337

    
2338
* **key** is the key of a matadatum ``key``:``value`` pair
2339

    
2340
|
2341

    
2342
==============  ========================= ======== ==========
2343
Request Header  Value                     Cyclades OS/Compute
2344
==============  ========================= ======== ==========
2345
X-Auth-Token    User authentication token required required
2346
Content-Type    Type or request body      required required
2347
Content-Length  Length of request body    required required
2348
==============  ========================= ======== ==========
2349

    
2350
**Example Request Headers**::
2351

    
2352
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
2353
  Content-Type:   application/json
2354
  Content-Length: 27
2355

    
2356
|
2357

    
2358
.. note:: Request parameters should be empty
2359

    
2360
Request body content::
2361

    
2362
  metadata: {<key>: <value>}
2363

    
2364
*Example Update Image Metadatum Item Request: JSON*
2365

    
2366
.. code-block:: javascript
2367

    
2368
  {"metadata": {"os": "Kubuntu"}}
2369

    
2370
.. rubric:: Response
2371

    
2372
=========================== =====================
2373
Return Code                 Description
2374
=========================== =====================
2375
201 (OK)                    Request succeeded
2376
400 (Bad Request)           Malformed request or image id
2377
401 (Unauthorized)          Missing or expired user token
2378
403 (Forbidden)             Not allowed to modify this image
2379
404 (Not Found)             Metadatum key not found
2380
413 (OverLimit)             Maximum number of metadata exceeded
2381
500 (Internal Server Error) The request cannot be completed because of an
2382
\                           internal error
2383
503 (Service Unavailable)   The server is not currently available
2384
=========================== =====================
2385

    
2386
Request body content::
2387

    
2388
  metadata: {<key>: <value>}
2389

    
2390
*Example Update Image Metadatum Item Response: JSON*
2391

    
2392
.. code-block:: javascript
2393

    
2394
  {"metadata": {"os": "Kubuntu"}}
2395

    
2396
Delete Image Metadatum
2397
......................
2398

    
2399
Delete an image metadatum by its key.
2400

    
2401
.. rubric:: Request
2402

    
2403
===================================== ====== ======== ==========
2404
URI                                   Method Cyclades OS/Compute
2405
===================================== ====== ======== ==========
2406
``/images/<image-id>/metadata/<key>`` DELETE ✔        ✔
2407
===================================== ====== ======== ==========
2408

    
2409
* **image-id** is the identifier of the image
2410

    
2411
* **key** is the key of a matadatum ``key``:``value`` pair
2412

    
2413
|
2414

    
2415
==============  ========================= ======== ==========
2416
Request Header  Value                     Cyclades OS/Compute
2417
==============  ========================= ======== ==========
2418
X-Auth-Token    User authentication token required required
2419
==============  ========================= ======== ==========
2420

    
2421
.. note:: Request parameters should be empty
2422

    
2423
.. note:: Request body should be empty
2424

    
2425
.. rubric:: Response
2426

    
2427
=========================== =====================
2428
Return Code                 Description
2429
=========================== =====================
2430
204 (OK)                    Request succeeded
2431
400 (Bad Request)           Malformed image ID
2432
401 (Unauthorized)          Missing or expired user token
2433
403 (Forbidden)             Not allowed to modify this image
2434
404 (Not Found)             Metadatum key not found
2435
500 (Internal Server Error) The request cannot be completed because of an
2436
\                           internal error
2437
503 (Service Unavailable)   The server is not currently available
2438
=========================== =====================
2439

    
2440
.. note:: In case of a 204 code, the response body should be empty.
2441

    
2442
Networks
2443
--------
2444

    
2445
============= ======== ==========
2446
BASE URI      Cyclades OS/Compute
2447
============= ======== ==========
2448
``/networks`` ✔        **✘**
2449
============= ======== ==========
2450

    
2451
The Network part of Cyclades API is not supported by the OS/Compute API,
2452
although it shares some similarities with the
2453
`OS Quantum API <http://docs.openstack.org/api/openstack-network/1.0/content/API_Operations.html>`_.
2454
There are key design differences between the two systems but they exceed the
2455
scope of this document, although they affect the respective APIs.
2456

    
2457
A Server can connect to one or more networks identified by a numeric id.
2458
Networks are accessible only by the users who created them. When a network is
2459
deleted, all connections to it are deleted.
2460

    
2461
There is a special **public** network with the id *public* that can be accessed
2462
at */networks/public*. All servers are connected to **public** by default and
2463
this network can not be deleted or modified in any way.
2464

    
2465
=============================================== ================================= ======
2466
Description                                     URI                               Method
2467
=============================================== ================================= ======
2468
`List <#list-networks>`_                        ``/networks``                     GET
2469
\                                               ``/networks/detail``              GET
2470
`Create <#create-network>`_                     ``/networks``                     POST
2471
`Get details <#get-network-details>`_           ``/networks/<network-id>``        GET
2472
`Rename <#rename-network>`_                     ``/networks/<network-id>``        PUT
2473
`Delete <#delete-network>`_                     ``/networks/<network-id>``        DELETE
2474
`Connect <#connect-network-to-server>`_         ``/networks/<network-id>/action`` POST
2475
`Disconnect <#disconnect-network-from-server>`_ ``/networks/<network-id>/action`` POST
2476
=============================================== ================================= ======
2477

    
2478

    
2479
List Networks
2480
.............
2481

    
2482
This operation lists the networks associated with a users account
2483

    
2484
.. rubric:: Request
2485

    
2486
==================== ======
2487
URI                  Method
2488
==================== ======
2489
``/networks``        GET
2490
``/networks/detail`` GET
2491
==================== ======
2492

    
2493
|
2494

    
2495
==============  =========================
2496
Request Header  Value
2497
==============  =========================
2498
X-Auth-Token    User authentication token
2499
==============  =========================
2500

    
2501
.. note:: Request parameters should be empty
2502

    
2503
.. note:: Request body should be empty
2504

    
2505
.. rubric:: Response
2506

    
2507
=========================== =====================
2508
Return Code                 Description
2509
=========================== =====================
2510
204 (OK)                    Request succeeded
2511
304 (Not Modified)
2512
400 (Bad Request)           Malformed network id
2513
401 (Unauthorized)          Missing or expired user token
2514
404 (Not Found)             Network not found
2515
409 (Build In Progress)     Server is not ready yet
2516
500 (Internal Server Error) The request cannot be completed because of an
2517
\                           internal error
2518
503 (Service Unavailable)   Action not supported or service currently
2519
\                           unavailable
2520
=========================== =====================
2521

    
2522
Response body content::
2523

    
2524
  networks: [
2525
    {
2526
      <network attribute>: <value>,
2527
      ...
2528
    },
2529
    ...
2530
  }
2531

    
2532
The ``detail`` operation lists the `full network attributes <#network-ref>`_,
2533
while the regular operation returns only the ``id`` and ``name`` attributes.
2534

    
2535
*Example Networks List Response: JSON (regular)*
2536

    
2537
.. code-block:: javascript
2538

    
2539
  {
2540
    "networks": [
2541
      {"id": "1", "name": "public"},
2542
      {"id": "2", "name": "my private network"}
2543
    ]
2544
  }
2545

    
2546
*Example Networks List Response: JSON (detail)*
2547

    
2548
.. code-block:: javascript
2549

    
2550
  {
2551
    "networks": [
2552
      {
2553
        "id": "1",
2554
        "name": "public",
2555
        "created": "2011-04-20T15:31:08.199640+00:00",
2556
        "updated": "2011-05-06T12:47:05.582679+00:00",
2557
        "attachments": ["nic-42-0", "nic-73-0"]
2558
      }, {
2559
        "id": 2,
2560
        "name": "my private network",
2561
        "created": "2011-04-20T14:32:08.199640+00:00",
2562
        "updated": "2011-05-06T11:40:05.582679+00:00",
2563
        "attachments": ["nic-42-2", "nic-7-3"]
2564
      }
2565
    ]
2566
  }
2567

    
2568

    
2569
Create Network
2570
..............
2571

    
2572
This operation asynchronously provisions a new network.
2573

    
2574
.. rubric:: Request
2575

    
2576
==================== ======
2577
URI                  Method
2578
==================== ======
2579
``/networks``        POST
2580
==================== ======
2581

    
2582
|
2583

    
2584
==============  =========================
2585
Request Header  Value
2586
==============  =========================
2587
X-Auth-Token    User authentication token
2588
Content-Type    Type or request body     
2589
Content-Length  Length of request body   
2590
==============  =========================
2591

    
2592
**Example Request Headers**::
2593

    
2594
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
2595
  Content-Type:   application/json
2596
  Content-Length: 60
2597

    
2598
.. note:: Request parameters should be empty
2599

    
2600
Request body content::
2601

    
2602
  network: {
2603
    <request attribute>: <value>,
2604
    ...
2605
  }
2606

    
2607
================== ======================= ======== =======
2608
Request Attributes Description             Required Default
2609
================== ======================= ======== =======
2610
name               Network name            ✔
2611
type               Network type            ✔
2612
dhcp               If use DHCP             **✘**    True
2613
cidr               IPv4 CIDR               **✘**    192.168.1.0/2
2614
cidr6              IPv6 CDIR               **✘**    null
2615
gateway            IPv4 gateway address    **✘**    null
2616
gateway6           IPv6 gateway address    **✘**    null
2617
public             If a public network     **✘**    False
2618
================== ======================= ======== =======
2619

    
2620
* **name** is a string
2621

    
2622
* **type** can be CUSTOM, IP_LESS_ROUTED, MAC_FILTERED, PHYSICAL_VLAN
2623

    
2624
* **dhcp** and **public** are flags
2625

    
2626
* **cidr**, and **gateway** are IPv4 addresses
2627

    
2628
* **cidr6**, and **gateway6** are IPv6 addresses
2629

    
2630
* **public** should better not be used. If True, a 403 error is returned.
2631

    
2632
*Example Create Network Request Body: JSON*
2633

    
2634
.. code-block:: javascript
2635

    
2636
  {"network": {"name": "private_net", "type": "MAC_FILTERED"}}
2637

    
2638
.. rubric:: Response
2639

    
2640
=========================== =====================
2641
Return Code                 Description
2642
=========================== =====================
2643
202 (OK)                    Request succeeded
2644
400 (Bad Request)           Malformed network id or request
2645
401 (Unauthorized)          Missing or expired user token
2646
403 (Forbidden)             Public network is forbidden
2647
404 (Not Found)             Network not found
2648
413 (Over Limit)            Reached networks limit
2649
415 (Bad Media Type)        Bad network type
2650
500 (Internal Server Error) The request cannot be completed because of an
2651
\                           internal error
2652
503 (Service Unavailable)   Failed to allocated network resources
2653
=========================== =====================
2654

    
2655
Response body content::
2656

    
2657
  network: {
2658
    <network attribute>: <value>,
2659
    ...
2660
  }
2661

    
2662
A list of the valid network attributes can be found `here <#network-ref>`_.
2663

    
2664
*Example Create Network Response: JSON*
2665

    
2666
.. code-block:: javascript
2667

    
2668
  {
2669
    "network": {
2670
      "status": "PENDING",
2671
      "updated": "2013-04-25T13:31:17.165237+00:00",
2672
      "name": "my private network",
2673
      "created": "2013-04-25T13:31:17.165088+00:00",
2674
      "cidr6": null,
2675
      "id": "6567",
2676
      "gateway6": null,
2677
      "public": false,
2678
      "dhcp": false,
2679
      "cidr": "192.168.1.0/24",
2680
      "type": "MAC_FILTERED",
2681
      "gateway": null,
2682
      "attachments": []
2683
    }
2684
  }
2685

    
2686
Get Network Details
2687
...................
2688

    
2689
.. rubric:: Request
2690

    
2691
========================== ======
2692
URI                        Method
2693
========================== ======
2694
``/networks/<network-id>`` GET
2695
========================== ======
2696

    
2697
* **network-id** is the identifier of the network
2698

    
2699
|
2700

    
2701
==============  =========================
2702
Request Header  Value
2703
==============  =========================
2704
X-Auth-Token    User authentication token
2705
==============  =========================
2706

    
2707
.. note:: Request parameters should be empty
2708

    
2709
.. note:: Request body should be empty
2710

    
2711
.. rubric:: Response
2712

    
2713
=========================== =====================
2714
Return Code                 Description
2715
=========================== =====================
2716
200 (OK)                    Request succeeded
2717
400 (Bad Request)           Malformed request or network id
2718
401 (Unauthorized)          Missing or expired user token
2719
404 (Not Found)             Network not found
2720
500 (Internal Server Error) The request cannot be completed because of an
2721
\                           internal error
2722
503 (Service Unavailable)   The service is not currently available
2723
=========================== =====================
2724

    
2725
Response code content::
2726

    
2727
  network: {
2728
    <network attribute>: <value>,
2729
    ...
2730
  }
2731

    
2732
A list of network attributes can be found `here <#network-ref>`_.
2733

    
2734
*Example Get Network Details Response: JSON*
2735

    
2736
.. code-block:: javascript
2737

    
2738
  {
2739
    "network": {
2740
      "status": "PENDING",
2741
      "updated": "2013-04-25T13:31:17.165237+00:00",
2742
      "name": "my private network",
2743
      "created": "2013-04-25T13:31:17.165088+00:00",
2744
      "cidr6": null,
2745
      "id": "6567",
2746
      "gateway6": null,
2747
      "public": false,
2748
      "dhcp": false,
2749
      "cidr": "192.168.1.0/24",
2750
      "type": "MAC_FILTERED",
2751
      "gateway": null,
2752
      "attachments": []
2753
    }
2754
  }
2755

    
2756
Rename Network
2757
..............
2758

    
2759
.. rubric:: Request
2760

    
2761
========================== ======
2762
URI                        Method
2763
========================== ======
2764
``/networks/<network-id>`` PUT
2765
========================== ======
2766

    
2767
* **network-id** is the identifier of the network
2768

    
2769
|
2770

    
2771
==============  =========================
2772
Request Header  Value
2773
==============  =========================
2774
X-Auth-Token    User authentication token
2775
Content-Type    Type or request body
2776
Content-Length  Length of request body
2777
==============  =========================
2778

    
2779
**Example Request Headers**::
2780

    
2781
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
2782
  Content-Type:   application/json
2783
  Content-Length: 33
2784

    
2785
.. note:: Request parameters should be empty
2786

    
2787
Request body content::
2788

    
2789
  network: {name: <new value>}
2790

    
2791
*Example Update Network Name Request: JSON*
2792

    
2793
.. code-block:: javascript
2794

    
2795
  {"network": {"name": "new_name"}}
2796

    
2797
.. rubric:: Response
2798

    
2799
=========================== =====================
2800
Return Code                 Description
2801
=========================== =====================
2802
204 (OK)                    Request succeeded
2803
400 (Bad Request)           Malformed request or network deleted
2804
401 (Unauthorized)          Missing or expired user token
2805
403 (Forbidden)             Administratively suspended server
2806
404 (Not Found)             Network not found
2807
413 (Over Limit)            Network Limit Exceeded
2808
415 (Bad Media Type)        Bad network type
2809
500 (Internal Server Error) The request cannot be completed because of an
2810
\                           internal error
2811
503 (Service Unavailable)   The service is not currently available
2812
=========================== =====================
2813

    
2814
.. note:: In case of a 204 code, the response body should be empty
2815

    
2816
Delete Network
2817
..............
2818

    
2819
A network is deleted as long as it is not attached to any virtual servers.
2820

    
2821
.. rubric:: Request
2822

    
2823
========================== ======
2824
URI                        Method
2825
========================== ======
2826
``/networks/<network-id>`` DELETE
2827
========================== ======
2828

    
2829
* **network-id** is the identifier of the network
2830

    
2831
|
2832

    
2833
==============  =========================
2834
Request Header  Value
2835
==============  =========================
2836
X-Auth-Token    User authentication token
2837
==============  =========================
2838

    
2839
.. note:: Request parameters should be empty
2840

    
2841
.. note:: Request body should be empty
2842

    
2843
.. rubric:: Response
2844

    
2845
=========================== =====================
2846
Return Code                 Description
2847
=========================== =====================
2848
204 (OK)                    Request succeeded
2849
400 (Bad Request)           Malformed request or network already deleted
2850
401 (Unauthorized)          Missing or expired user token
2851
403 (Forbidden)             Administratively suspended server
2852
404 (Not Found)             Network not found
2853
421 (Network In Use)        The network is in use and cannot be deleted
2854
500 (Internal Server Error) The request cannot be completed because of an
2855
\                           internal error
2856
503 (Service Unavailable)   The service is not currently available
2857
=========================== =====================
2858

    
2859
.. note:: In case of a 204 code, the response body should be empty
2860

    
2861

    
2862
Connect network to Server
2863
..........................
2864

    
2865
Connect a network to a virtual server. The effect of this operation is the
2866
creation of a NIC that connects the two parts.
2867

    
2868
.. rubric:: Request
2869

    
2870
================================= ======
2871
URI                               Method
2872
================================= ======
2873
``/networks/<network-id>/action`` POST
2874
================================= ======
2875

    
2876
* **network-id** is the identifier of the network
2877

    
2878
|
2879

    
2880
==============  =========================
2881
Request Header  Value
2882
==============  =========================
2883
X-Auth-Token    User authentication token
2884
Content-Type    Type or request body
2885
Content-Length  Length of request body
2886
==============  =========================
2887

    
2888
**Example Request Headers**::
2889

    
2890
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
2891
  Content-Type:   application/json
2892
  Content-Length: 28
2893

    
2894
.. note:: Request parameters should be empty
2895

    
2896
Response body content (connect)::
2897

    
2898
  add {serverRef: <server id to connect>}
2899

    
2900
*Example Action Add (connect to): JSON*
2901

    
2902
.. code-block:: javascript
2903

    
2904
  {"add" : {"serverRef" : 42}}
2905

    
2906
.. rubric:: Response
2907

    
2908
=========================== =====================
2909
Return Code                 Description
2910
=========================== =====================
2911
202 (OK)                    Request succeeded
2912
400 (Bad Request)           Malformed request or network already deleted
2913
401 (Unauthorized)          Missing or expired user token
2914
403 (Forbidden)             Not allowed to modify this network (e.g. public)
2915
404 (Not Found)             Network not found
2916
500 (Internal Server Error) The request cannot be completed because of an
2917
\                           internal error
2918
503 (Service Unavailable)   The service is not currently available
2919
=========================== =====================
2920

    
2921
.. note:: In case of a 202 code, the request body should be empty
2922

    
2923
Disconnect network from Server
2924
..............................
2925

    
2926
Disconnect a network from a virtual server. The effect of this operation is the
2927
deletion of the NIC that connects the two parts.
2928

    
2929
.. rubric:: Request
2930

    
2931
================================= ======
2932
URI                               Method
2933
================================= ======
2934
``/networks/<network-id>/action`` POST
2935
================================= ======
2936

    
2937
* **network-id** is the identifier of the network
2938

    
2939
|
2940

    
2941
==============  =========================
2942
Request Header  Value
2943
==============  =========================
2944
X-Auth-Token    User authentication token
2945
Content-Type    Type or request body
2946
Content-Length  Length of request body
2947
==============  =========================
2948

    
2949
**Example Request Headers**::
2950

    
2951
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
2952
  Content-Type:   application/json
2953
  Content-Length: 31
2954

    
2955
.. note:: Request parameters should be empty
2956

    
2957
Response body content (disconnect)::
2958

    
2959
  remove {serverRef: <server id to disconnect>}
2960

    
2961
*Example Action Remove (disconnect from): JSON*
2962

    
2963
.. code-block:: javascript
2964

    
2965
  {"remove" : {"serverRef" : 42}}
2966

    
2967
.. rubric:: Response
2968

    
2969
=========================== =====================
2970
Return Code                 Description
2971
=========================== =====================
2972
202 (OK)                    Request succeeded
2973
400 (Bad Request)           Malformed request or network already deleted
2974
401 (Unauthorized)          Missing or expired user token
2975
403 (Forbidden)             Not allowed to modify this network (e.g. public)
2976
404 (Not Found)             Network not found
2977
500 (Internal Server Error) The request cannot be completed because of an
2978
\                           internal error
2979
503 (Service Unavailable)   The service is not currently available
2980
=========================== =====================
2981

    
2982
.. note:: In case of a 202 code, the request body should be empty
2983

    
2984
Index of Attributes
2985
-------------------
2986

    
2987
.. _server-ref:
2988

    
2989
Server Attributes
2990
.................
2991

    
2992
================ ========================== ======== ==========
2993
Server attribute Description                Cyclades OS/Compute
2994
================ ========================== ======== ==========
2995
id               Server ID                  ✔        ✔
2996
name             Server Name                ✔        ✔
2997
status           Server Status              ✔        ✔
2998
updated          Date of last modification  ✔        ✔
2999
created          Date of creation           ✔        ✔
3000
hostId           Physical host              empty    ✔
3001
image            A full image descreption   ✔        ✔
3002
flavor           A full flavor description  ✔        ✔
3003
adminPass        Superuser Password         ✔        ✔
3004
suspended        If server is suspended     ✔        ✔
3005
progress         Build progress             ✔        ✔
3006
metadata         Custom server metadata     ✔        ✔
3007
user_id          Server owner               **✘**    ✔
3008
tenant_id        Server tenant              **✘**    ✔
3009
accessIPv4       Server IPV4 net address    **✘**    ✔
3010
accessIPv6       Server IPV4 net address    **✘**    ✔
3011
addresses        Nets connected on server   **✘**    ✔
3012
links            Server links               **✘**    ✔
3013
================ ========================== ======== ==========
3014

    
3015
* **status** values are described `here <#status-ref>`_
3016

    
3017
* **updated** and **created** are date-formated
3018

    
3019
* **hostId** is always empty in Cyclades and is returned for compatibility reasons
3020

    
3021
* **image** and **flavor** always refer to existing Image and Flavor
3022
  specifications.
3023

    
3024
* **adminPass** in Cyclades it is generated automatically during creation. For
3025
  safety, it is not stored anywhere in the system and it cannot be recovered
3026
  with a query request
3027

    
3028
* **suspended** is True only of the server is suspended by the cloud
3029
  administrations or policy
3030

    
3031
* **progress** is a number between 0 and 100 and reflects the server building
3032
  status
3033

    
3034
* **metadata** are custom key:value pairs refering to the VM. In Cyclades, the
3035
  ``OS`` and ``users`` metadata are automatically retrieved from the servers
3036
  image during creation
3037

    
3038
.. _status-ref:
3039

    
3040
Server Status
3041
.............
3042

    
3043
============= ==================== ======== ==========
3044
Status        Description          Cyclades OS/Compute
3045
============= ==================== ======== ==========
3046
BUILD         Building             ✔        ✔
3047
ACTIVE        Up and running       ✔        ✔
3048
STOPPED       Shut down            ✔        **✘**
3049
REBOOT        Rebooting            ✔        ✔
3050
DELETED       Removed              ✔        ✔
3051
UNKNOWN       Unexpected error     ✔        ✔
3052
ERROR         In error             ✔        ✔
3053
HARD_REBOOT   Hard rebooting       **✘**    ✔
3054
PASSWORD      Resetting password   **✘**    ✔
3055
REBUILD       Rebuilding server    **✘**    ✔
3056
RESCUE        In rescue mode       **✘**    ✔
3057
RESIZE        Resizing             **✘**    ✔
3058
REVERT_RESIZE Failed to resize     **✘**    ✔
3059
SHUTOFF       Shut down by user    **✘**    ✔
3060
SUSPENDED     Suspended            **✘**    ✔
3061
VERIFY_RESIZE Waiting confirmation **✘**    ✔
3062
============= ==================== ======== ==========
3063

    
3064
.. _network-ref:
3065

    
3066
Network
3067
.......
3068

    
3069
.. note:: Networks are features in Cyclades API but not in OS/Compute API
3070

    
3071
================== ===========
3072
Network Attributes Description
3073
================== ===========
3074
id                 Network identifier
3075
name               Network name
3076
created            Date of creation
3077
updates            Date of last update
3078
cidr               IPv4 CIDR Address
3079
cidr6              IPv6 CIDR Address
3080
dhcp               IPv4 DHCP Address
3081
dhcp6              IPv6 DHCP Address
3082
gateway            IPv4 Gateway Address
3083
gateway6           IPv6 Gateway Address
3084
public             If the network is public
3085
status             Network status
3086
attachments        Network Interface Connections (NICs)
3087
================== ===========
3088

    
3089
* **id** and **name** are int and string respectively
3090

    
3091
* **created** and **updated** are ISO8061 date strings
3092

    
3093
* **public** is a boolean flag
3094

    
3095
* **status** can be PENDING, ACTIVE or DELETED
3096

    
3097
* **attachments** refers to the NICs connecting servers on that network.
3098

    
3099
.. _nic-ref:
3100

    
3101
Network Interface Connection (NIC)
3102
..................................
3103

    
3104
A Network Interface Connection (NIC) represents a servers connection to a
3105
network.
3106

    
3107
A NIC is identified by a server and an (obviously unique) mac address. A server
3108
can have multiple NICs, though. In practice, a NIC id is used of reference and
3109
identification.
3110

    
3111
Each NIC is used to connect a specific server to a network. The network is
3112
aware of that connection for as long as it holds. If a NIC is disconnected from
3113
a network, it is destroyed.
3114

    
3115
A NIC specification contains the following information:
3116

    
3117
================= ====================== ======== ==========
3118
Server Attributes Description            Cyclades OS/Compute
3119
================= ====================== ======== ==========
3120
id                The NIC id             ✔        **✘**
3121
mac_address       NIC's mac address      ✔        **✘**
3122
network_id        Network of connection  ✔        **✘**
3123
firewallProfile   The firewall profile   ✔        **✘**
3124
ipv4              IP v4 address          ✔        **✘**
3125
ipv6              IP v6 address          ✔        **✘**
3126
================= ====================== ======== ==========
3127

    
3128
* **id** is the unique identified of the NIC. It consists of the server id and
3129
  an ordinal number nic-<server-id>-<ordinal number> , e.g. for a server with
3130
  id 42::
3131

    
3132
    nic-42-0, nic-42-1, ...
3133

    
3134
* **mac_address** is the unique mac address of the interface
3135

    
3136
* **network_id** is the id of the network this nic connects to.
3137

    
3138
* **firewallProfile** , if set, refers to the mode of the firewall. Valid
3139
  firewall profile values::
3140

    
3141
    ENABLED, DISABLED, PROTECTED
3142

    
3143
* **ipv4** and **ipv6** are the IP addresses (versions 4 and 6 respectively) of
3144
  the specific network connection for that machine.
3145

    
3146
.. _flavor-ref:
3147

    
3148
Flavor
3149
......
3150

    
3151
A flavor is a hardware configuration for a server. It contains the following
3152
information:
3153

    
3154
================= ==================== ======== ==========
3155
Flavor Attributes Description          Cyclades OS/Compute
3156
================= ==================== ======== ==========
3157
id                The flavor id        ✔        ✔
3158
name              The flavor name      ✔        ✔
3159
ram               Server RAM size      ✔        ✔
3160
SNF:disk_template Storage mechanism    ✔        **✘**
3161
disk              Server disk size     ✔        ✔
3162
vcpus             # of Virtual CPUs    ✔        ✔
3163
links rel         Atom link rel field  **✘**    ✔
3164
links href        Atom link href field **✘**    ✔
3165
================= ==================== ======== ==========
3166

    
3167
* **id** is the flavor unique id (a possitive integer)
3168

    
3169
* **name** is the flavor name (a string)
3170

    
3171
* **ram** is the server RAM size in MB
3172

    
3173
* **SNF:disk_template** is a reference to the underlying storage mechanism
3174
  used by the Cyclades server. It is Cyclades specific.
3175

    
3176
* **disk** the servers disk size in GB
3177

    
3178
* **vcpus** refer to the number of virtual CPUs assigned to a server
3179

    
3180
* **link ref** and **link href** refer to the Atom link attributes that are
3181
  `used in OS/Compute API <http://docs.openstack.org/api/openstack-compute/2/content/List_Flavors-d1e4188.html>`_.
3182

    
3183
.. _image-ref:
3184

    
3185
Image
3186
.....
3187

    
3188
An image is a collection of files you use to create or rebuild a server.
3189

    
3190
An image item may have the fields presented bellow:
3191

    
3192
================= ====================== ======== ==========
3193
Server Attributes Description            Cyclades OS/Compute
3194
================= ====================== ======== ==========
3195
id                Image ID               ✔        ✔
3196
name              Image name             ✔        ✔
3197
updated           Last update date       ✔        ✔
3198
created           Image creation date    ✔        ✔
3199
progress          Ready status progress  ✔        **✘**
3200
status            Image status           **✘**    ✔
3201
tenant_id         Image creator          **✘**    ✔
3202
user_id           Image users            **✘**    ✔
3203
metadata          Custom metadata        ✔        ✔
3204
links             Atom links             **✘**    ✔
3205
minDisk           Minimum required disk  **✘**    ✔
3206
minRam            Minimum required RAM   **✘**    ✔
3207
================= ====================== ======== ==========
3208

    
3209
* **id** is the image id and **name** is the image name. They are both strings.
3210

    
3211
* **updated** and **created** are both ISO8601 date strings
3212

    
3213
* **progress** varies between 0 and 100 and denotes the status of the image
3214

    
3215
* **metadata** is a collection of ``key``:``values`` pairs of custom metadata,
3216
  under the tag ``values`` which lies under the tag ``metadata``.
3217

    
3218
.. note:: in OS/Compute, the ``values`` layer is missing