Statistics
| Branch: | Tag: | Revision:

root / docs / compute-api-guide.rst @ 99667854

History | View | Annotate | Download (116.2 kB)

1
.. _compute-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``,
116
  ``name`` and ``links``, while the second returns the full collections of
117
  server 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
links             Reference links        ✔        ✔
184
hostId            Server playground      empty    ✔
185
created           Creation date          ✔        ✔
186
updated           Creation date          ✔        ✔
187
flavor            The flavor id          ✔        ✔
188
image             The image id           ✔        ✔
189
progress          Build progress         ✔        ✔
190
status            Server status          ✔        ✔
191
attachments       Network interfaces     ✔        **✘**
192
addresses         Network interfaces     **✘**    ✔
193
metadata          Server custom metadata ✔        ✔
194
================= ====================== ======== ==========
195

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

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

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

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

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

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

    
220

    
221
*Example List Servers: JSON (regular)*
222

    
223
.. code-block:: javascript
224

    
225
    [
226
      {
227
        "links": [
228
            {
229
                "href": "https://example.org/compute/v2.0/servers/42", 
230
                "rel": "self"
231
            }, 
232
            {
233
                "href": "https://example.org/compute/v2.0/servers/42", 
234
                "rel": "bookmark"
235
            }
236
        ],
237
        "id": "42",
238
        "name": "My Server",
239
      }, {
240
        "links": [
241
            {
242
                "href": "https://example.org/compute/v2.0/servers/43", 
243
                "rel": "self"
244
            }, 
245
            {
246
                "href": "https://example.org/compute/v2.0/servers/43", 
247
                "rel": "bookmark"
248
            }
249
        ],
250
        "id": "43",
251
        "name": "My Server",
252
      }
253
    ]
254

    
255
*Example List Servers: JSON (detail)*
256

    
257
.. code-block:: javascript
258

    
259
    [
260
      {
261
        "attachments": [
262
            {
263
              "id": "nic-42-0",
264
              "network_id": "101",
265
              "mac_address": "aa:00:00:49:2e:7e",
266
              "firewallProfile": "DISABLED",
267
              "ipv4": "192.168.4.5",
268
              "ipv6": "2001:648:2ffc:1222:a800:ff:fef5:3f5b"
269
            }
270
        ],
271
        "links": [
272
            {
273
                "href": "https://example.org/compute/v2.0/servers/42", 
274
                "rel": "self"
275
            }, 
276
            {
277
                "href": "https://example.org/compute/v2.0/servers/42", 
278
                "rel": "bookmark"
279
            }
280
        ],
281
        "created': '2011-04-19T10:18:52.085737+00:00',
282
        "flavor": {
283
            "id": 1",
284
            "links": [
285
                {
286
                    "href": "https://example.org/compute/v2.0/flavors/1", 
287
                    "rel": "self"
288
                }, 
289
                {
290
                    "href": "https://example.org/compute/v2.0/flavors/1", 
291
                    "rel": "bookmark"
292
                }
293
            ]
294

    
295
        },
296
        "hostId": "",
297
        "id": "42",
298
        "image": {
299
            "id": "im4g3-1d",
300
            "links": [
301
                {
302
                    "href": "https://example.org/compute/v2.0/images/im4g3-1d", 
303
                    "rel": "self"
304
                }, 
305
                {
306
                    "href": "https://example.org/compute/v2.0/images/im4g3-1d", 
307
                    "rel": "bookmark"
308
                }, 
309
                {
310
                    "href": "https://example.org/image/v1.0/images/im4g3-1d", 
311
                    "rel": "alternate"
312
                }
313
            ]
314
        },
315
        "metadata": {{"foo": "bar"},
316
        "name": "My Server",
317
        "status": "ACTIVE",
318
        "updated": "2011-05-29T14:07:07.037602+00:00"
319
      }, {
320
        "attachments": [
321
            {
322
              "id": "nic-43-0",
323
              "mac_address": "aa:00:00:91:2f:df",
324
              "network_id": "1",
325
              "ipv4": "192.168.32.2"
326
            }, {
327
              "id": "nic-43-1",
328
              "network_id": "101",
329
              "mac_address": "aa:00:00:49:2g:7f",
330
              "firewallProfile": "DISABLED",
331
              "ipv4": "192.168.32.6",
332
              "ipv6": "2001:648:2ffc:1222:a800:ff:fef5:3f5c'
333
            }, {
334
              "id": "nic-43-2",
335
              "network_id": "101",
336
              "mac_address": "aa:00:00:51:2h:7f",
337
              "firewallProfile": "DISABLED",
338
              "ipv4": "192.168.32.7",
339
              "ipv6": "2001:638:2eec:1222:a800:ff:fef5:3f5c"
340
            }
341
        ],
342
        "links": [
343
            {
344
                "href": "https://example.org/compute/v2.0/servers/43", 
345
                "rel": "self"
346
            }, 
347
            {
348
                "href": "https://example.org/compute/v2.0/servers/43", 
349
                "rel": "bookmark"
350
            }
351
        ],
352
        "created": "2011-05-02T20:51:08.527759+00:00",
353
        "flavor": {
354
            "id": 1",
355
            "links": [
356
                {
357
                    "href": "https://example.org/compute/v2.0/flavors/1", 
358
                    "rel": "self"
359
                }, 
360
                {
361
                    "href": "https://example.org/compute/v2.0/flavors/1", 
362
                    "rel": "bookmark"
363
                }
364
            ]
365

    
366
        },
367
        "hostId": "",
368
        "id": "43",
369
        "image": {
370
            "id": "im4g3-1d",
371
            "links": [
372
                {
373
                    "href": "https://example.org/compute/v2.0/images/im4g3-1d", 
374
                    "rel": "self"
375
                }, 
376
                {
377
                    "href": "https://example.org/compute/v2.0/images/im4g3-1d", 
378
                    "rel": "bookmark"
379
                }, 
380
                {
381
                    "href": "https://example.org/image/v1.0/images/im4g3-1d", 
382
                    "rel": "alternate"
383
                }
384
            ]
385
        },
386
        "name": "Other Server",
387
        "description": "A sample server to showcase server requests",
388
        "progress": "0",
389
        "status": "ACTIVE",
390
        "updated": "2011-05-29T14:59:11.267087+00:00"
391
      }
392
    ]
393

    
394

    
395
Create Server
396
.............
397

    
398
Create a new virtual server
399

    
400
.. rubric:: Request
401

    
402
============ ====== ======== ==========
403
URI          Method Cyclades OS/Compute
404
============ ====== ======== ==========
405
``/servers`` POST   ✔        ✔
406
============ ====== ======== ==========
407

    
408
|
409

    
410
==============  ========================= ======== ==========
411
Request Header  Value                     Cyclades OS/Compute
412
==============  ========================= ======== ==========
413
X-Auth-Token    User authentication token required required
414
Content-Type    Type or request body      required required
415
Content-Length  Length of request body    required required
416
==============  ========================= ======== ==========
417

    
418
*Example Request Headers*::
419

    
420
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
421
  Content-Type:   application/json
422
  Content-Length: 735
423

    
424
|
425

    
426
================= ===============
427
Request Parameter Value
428
================= ===============
429
json              Respond in json
430
xml               Respond in xml
431
================= ===============
432

    
433
Request body contents::
434

    
435
  server: {
436
      <server attribute>: <value>,
437
      ...
438
      personality: [
439
        {
440
          <personality attribute>: <value>,
441
          ...
442
        },
443
        ...
444
      ],
445
      ...
446
  }
447

    
448
=========== ==================== ======== ==========
449
Attributes  Description          Cyclades OS/Compute
450
=========== ==================== ======== ==========
451
name        The server name      ✔        ✔
452
imageRef    Image id             ✔        ✔
453
flavorRef   Resources flavor     ✔        ✔
454
personality Personality contents ✔        ✔
455
metadata    Custom metadata      ✔        ✔
456
project     Project assignment   ✔        **✘**
457
=========== ==================== ======== ==========
458

    
459
* **name** can be any string
460

    
461
* **imageRed** and **flavorRed** should refer to existing images and hardware
462
  flavors accessible by the user
463

    
464
* **metadata** are ``key``:``value`` pairs of custom server-specific metadata.
465
  There are no semantic limitations.
466

    
467
* **project** (optional) is the project where the VM is to be assigned. If not
468
  given, user's base project is assumed (identified with the same uuid as the
469
  user).
470

    
471
* **personality** (optional) is a list of personality injections. A personality
472
  injection is a way to add a file into a virtual server while creating it.
473
  Each change modifies/creates a file on the virtual server. The injected data
474
  (``contents``) should not exceed 10240 *bytes* in size and must be base64
475
  encoded. The file mode should be a number, not a string. A personality
476
  injection contains the following attributes:
477

    
478
====================== =================== ======== ==========
479
Personality Attributes Description         Cyclades OS/Compute
480
====================== =================== ======== ==========
481
path                   File path on server ✔        ✔
482
contents               Data to inject      ✔        ✔
483
group                  User group          ✔        **✘**
484
mode                   File access mode    ✔        **✘**
485
owner                  File owner          ✔        **✘**
486
====================== =================== ======== ==========
487

    
488
*Example Create Server Request: JSON*
489

    
490
.. code-block:: javascript
491

    
492
  {
493
    "server": {
494
      "name": "My Server Name: Example Name",
495
      "imageRef": "da7a211f-...-f901ce81a3e6",
496
      "flavorRef": 289,
497
      "personality": [
498
        {
499
          "path": "/Users/myusername/personlities/example1.file",
500
          "contents": "some data to inject",
501
          "group": "remotely-set user group",
502
          "mode": 0600,
503
          "owner": "ausername"
504
        }, {
505
          "path": "/Users/myusername/personlities/example2.file",
506
          "contents": "some more data to inject",
507
          "group": "",
508
          "mode": 0777,
509
          "owner": "anotherusername"
510
        }
511
      ],
512
      "metadata": {
513
        "EloquentDescription": "Example server with personality",
514
        "ShortDescription": "Trying VMs"
515
      }
516
    }
517
  }
518

    
519
.. rubric:: Response
520

    
521
=========================== =====================
522
Return Code                 Description
523
=========================== =====================
524
200 (OK)                    Request succeeded
525
400 (Bad Request)           Malformed request data
526
401 (Unauthorized)          Missing or expired user token
527
403 (Forbidden)             User is not allowed to perform this operation
528
404 (Not Found)             Image or Flavor not found
529
413 (Over Limit)            Exceeded some resource limit (#VMs, personality
530
size, etc.)
531
415 (Bad Media Type)        
532
500 (Internal Server Error) The request cannot be completed because of an
533
\                           internal error
534
503 (Service Unavailable)   No available backends or service currently
535
\                           unavailable
536
=========================== =====================
537

    
538
|
539

    
540
Response body contents::
541

    
542
  server: {
543
    <server attribute>: <value>,
544
    ...
545
  }
546

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

    
549
*Example Create Server Response: JSON*
550

    
551
.. code-block:: javascript
552

    
553
  {
554
    "server": {
555
      "addresses": 
556
      "id": 28130,
557
        "links": [
558
            {
559
                "href": "https://example.org/compute/v2.0/servers/42", 
560
                "rel": "self"
561
            }, 
562
            {
563
                "href": "https://example.org/compute/v2.0/servers/42", 
564
                "rel": "bookmark"
565
            }
566
        ],
567

    
568
      "image": {
569
        "id": im4g3-1d
570
        "links": [
571
            {
572
                "href": "https://example.org/compute/v2.0/images/im4g3-1d"
573
                "rel": "self"
574
            }, {
575
                "href": "https://example.org/compute/v2.0/images/im4g3-1d"
576
                "rel": "bookmark"
577
            }, {
578
                "href": "https://example.org/image/v1.0/images/im4g3-1d"
579
                "rel": "alternate"
580
            }
581
        ]
582
      },
583
      "flavor": {
584
        "id": 289
585
        "links": [
586
            {
587
                "href": "https://example.org/compute/v2.0/flavors/289"
588
                "rel": "self"
589
            }, {
590
                "href": "https://example.org/compute/v2.0/flavors/289"
591
                "rel": "bookmark"
592
            }
593
        ]
594
      },
595
      "status": "BUILD",
596
      "updated": "2013-04-10T13:52:18.140686+00:00",
597
      "hostId": "",
598
      "name": "My Server Name: Example Name",
599
      "created": "2013-04-10T13:52:17.085402+00:00",
600
      "adminPass": "fKCqlZe2at",
601
      "suspended": false,
602
      "progress": 0
603
      "metadata": {
604
        "EloquentDescription": "Example server with personality",
605
        "ShortDescription": "Trying VMs"
606
      }
607
    }
608
  }
609

    
610
*Example Create Server Response: XML*
611

    
612
.. code-block:: xml
613

    
614
  <?xml version="1.0" encoding="UTF-8"?>
615
  <server xmlns="http://docs.openstack.org/compute/api/v1.1"\
616
    xmlns:atom="http://www.w3.org/2005/Atom"
617
    id="1"
618
    status="BUILD"
619
    hostId="",
620
    name="My Server Name: Example Name"
621
    created="2013-04-10T13:52:17.085402+00:00"
622
    adminPass="fKCqlZe2at"
623
    suspended="false"
624
    progress="0"
625
    ...
626
  />
627

    
628
Get Server Stats
629
................
630

    
631
.. note:: This operation is not part of OS/Compute v2.
632

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

    
635
.. rubric:: Request
636

    
637
============================== ====== ======== ==========
638
URI                            Method Cyclades OS/Compute
639
============================== ====== ======== ==========
640
``/servers/<server-id>/stats`` GET    ✔        **✘**
641
============================== ====== ======== ==========
642

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

    
645
|
646

    
647
==============  ========================= ======== ==========
648
Request Header  Value                     Cyclades OS/Compute
649
==============  ========================= ======== ==========
650
X-Auth-Token    User authentication token required required
651
==============  ========================= ======== ==========
652

    
653
|
654

    
655
================= ===============
656
Request Parameter Value          
657
================= ===============
658
json              Respond in json
659
xml               Respond in xml 
660
================= ===============
661

    
662
* **json** and **xml** parameters are mutually exclusive. If none supported,
663
the response will be formated in json.
664

    
665
.. note:: Request body should be empty
666

    
667
.. rubric:: Response
668

    
669
=========================== =====================
670
Return Code                 Description
671
=========================== =====================
672
200 (OK)                    Request succeeded
673
400 (Bad Request)           Invalid server ID or Server deleted
674
401 (Unauthorized)          Missing or expired user token
675
403 (Forbidden)             Administratively suspended server
676
404 (Not Found)             Server not found
677
500 (Internal Server Error) The request cannot be completed because of an
678
\                           internal error
679
503 (Service Unavailable)   The server is not currently available
680
=========================== =====================
681

    
682
|
683

    
684
Response body contents::
685

    
686
  stats: {<parameter>: <value> }
687

    
688
============= ======================
689
Parameter     Description
690
============= ======================
691
serverRef     Server ID
692
refresh       Refresh frequency
693
cpuBar        Latest CPU load graph URL
694
cpuTimeSeries CPU load / time graph URL
695
netBar        Latest Network load graph URL
696
netTimeSeries Network load / time graph URL
697
============= ======================
698

    
699
* **refresh** is the recommended sampling rate
700

    
701
*Example Get Server Stats Response: JSON*
702

    
703
.. code-block:: javascript
704

    
705
  {
706
    "stats": {
707
      "serverRef": 1,
708
      "refresh": 60,
709
      "cpuBar": "http://stats.okeanos.grnet.gr/b9a...048c/cpu-bar.png",
710
      "cpuTimeSeries": "http://stats.okeanos.grnet.gr/b9a...048c/cpu-ts.png",
711
      "netBar": "http://stats.okeanos.grnet.gr/b9a...048c/net-bar.png",
712
      "netTimeSeries": "http://stats.okeanos.grnet.gr/b9a...048c/net-ts.png"
713
    }
714
  }
715

    
716
*Example Get Network Details Response: XML*
717

    
718
.. code-block:: xml
719

    
720
  <?xml version="1.0" encoding="UTF-8"?>
721
  <stats xmlns="http://docs.openstack.org/compute/api/v1.1"\
722
    xmlns:atom="http://www.w3.org/2005/Atom"
723
    serverRef="1"
724
    refresh="60"
725
    cpuBar="https://www.example.com/stats/snf-42/cpu-bar/",
726
    netTimeSeries="https://example.com/stats/snf-42/net-ts/",
727
    netBar="https://example.com/stats/snf-42/net-bar/",
728
    cpuTimeSeries="https://www.example.com/stats/snf-42/cpu-ts/"
729
  </stats>
730

    
731
Get Server Diagnostics
732
......................
733

    
734
.. note:: This operation is not part of OS/Compute v2.
735

    
736
This operation returns diagnostic information (logs) for a server.
737

    
738
.. rubric:: Request
739

    
740
==================================== ====== ======== ==========
741
URI                                  Method Cyclades OS/Compute
742
==================================== ====== ======== ==========
743
``/servers/<server-id>/diagnostics`` GET    ✔        **✘**
744
==================================== ====== ======== ==========
745

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

    
748
|
749

    
750
==============  ========================= ======== ==========
751
Request Header  Value                     Cyclades OS/Compute
752
==============  ========================= ======== ==========
753
X-Auth-Token    User authentication token required required
754
==============  ========================= ======== ==========
755

    
756
.. note:: Request parameters should be empty
757

    
758
.. note:: Request body should be empty
759

    
760
.. rubric:: Response
761

    
762
=========================== =====================
763
Return Code                 Description
764
=========================== =====================
765
200 (OK)                    Request succeeded
766
400 (Bad Request)           Invalid server ID or Server deleted
767
401 (Unauthorized)          Missing or expired user token
768
403 (Forbidden)             Administratively suspended server
769
404 (Not Found)             Server not found
770
500 (Internal Server Error) The request cannot be completed because of an
771
\                           internal error
772
503 (Service Unavailable)   The server is not currently available
773
=========================== =====================
774

    
775
|
776

    
777
Response body contents::
778

    
779
  [
780
    {
781
      <diagnostic attribute}: <value>,
782
      ...
783
    }, {
784
      <diagnostic attribute}: <value>,
785
      ...
786
    },
787
    ...
788
  ]
789

    
790
==================== ===========
791
Diagnostic attribute Description
792
==================== ===========
793
level                Debug level
794
created              Log entry timestamp
795
source               Log source proccess
796
source_date          Log source date
797
message              Log description
798
details              Detailed log description
799
==================== ===========
800

    
801
*Example Get Server Diagnostics Response: JSON*
802

    
803
.. code-block:: javascript
804

    
805
  [
806
    {
807
      "level": "DEBUG",
808
      "created": "2013-04-09T15:25:53.965144+00:00",
809
      "source": "image-helper-task-start",
810
      "source_date": "2013-04-09T15:25:53.954695+00:00",
811
      "message": "FixPartitionTable",
812
      "details": null
813
    }, {
814
      "level": "DEBUG",
815
      "created": "2013-04-09T15:25:46.413718+00:00",
816
      "source": "image-info",
817
      "source_date": "2013-04-09T15:25:46.404477+00:00",
818
      "message": "Starting customization VM...",
819
      "details": null
820
    }, {
821
      "level": "DEBUG",
822
      "created": "2013-04-09T15:25:46.207038+00:00",
823
      "source": "image-info",
824
      "source_date": "2013-04-09T15:25:46.197183+00:00",
825
      "message": "Image copy finished.",
826
      "details": "All operations finished as they should. No errors reported."
827
    }
828
  ]
829

    
830
Get Server Details
831
..................
832

    
833
This operation returns detailed information for a virtual server
834

    
835
.. rubric:: Request
836

    
837
======================== ====== ======== ==========
838
URI                      Method Cyclades OS/Compute
839
======================== ====== ======== ==========
840
``/servers/<server id>`` GET    ✔        ✔
841
======================== ====== ======== ==========
842

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

    
845
|
846

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

    
853
.. note:: Request parameters should be empty
854

    
855
.. note:: Request body should be empty
856

    
857
.. rubric:: Response
858

    
859
=========================== =====================
860
Return Code                 Description
861
=========================== =====================
862
200 (OK)                    Request succeeded
863
400 (Bad Request)           Malformed server id
864
401 (Unauthorized)          Missing or expired user token
865
403 (Forbidden)             Administratively suspended server
866
404 (Not Found)             Server not found
867
500 (Internal Server Error) The request cannot be completed because of an
868
\                           internal error
869
503 (Service Unavailable)   No available backends or service currently
870
\                           unavailable
871
=========================== =====================
872

    
873
|
874

    
875
Response body contents::
876

    
877
  server: {
878
    <server attribute>: <value>,
879
    ...
880
  }
881

    
882
================= ====================== ======== ==========
883
Server Attributes Description            Cyclades OS/Compute
884
================= ====================== ======== ==========
885
id                The server id          ✔        ✔
886
name              The server name        ✔        ✔
887
hostId            Server playground      empty    ✔
888
created           Creation date          ✔        ✔
889
updated           Creation date          ✔        ✔
890
flavor            The flavor id          ✔        ✔
891
image             The image id           ✔        ✔
892
progress          Build progress         ✔        ✔
893
status            Server status          ✔        ✔
894
suspended         If server is suspended ✔        **✘**
895
attachments       Network interfaces     ✔        **✘**
896
addresses         Network interfaces     **✘**    ✔
897
metadata          Server custom metadata ✔        ✔
898
diagnostics       Diagnostic information ✔        **✘**
899
================= ====================== ======== ==========
900

    
901
* **hostId** is not used in Cyclades, but is returned as an empty string for
902
  compatibility
903

    
904
* **progress** is changing while the server is building up and has values
905
  between 0 and 100. When it reaches 100 the server is built.
906

    
907
* **status** refers to `the status <#status-ref>`_ of the server
908

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

    
912
* **attachments** in Cyclades are lists of network interfaces (NICs).
913
  **Attachments** are different to OS/Compute's **addresses**. The former is a
914
  list of the server's `network interface connections <#nic-ref>`_ while the
915
  later is just a list of networks. Thus, a Cyclades virtual server may be
916
  connected to the same network through more than one distinct network
917
  interfaces.
918

    
919
* **diagnostics** is a list of items that contain key:value information useful
920
  for diagnosing the server behavior and may be used by the administrators of
921
  deployed Synnefo setups.
922

    
923
*Example Details for server with id 42042: JSON*
924

    
925
.. code-block:: javascript
926

    
927
  {
928
    "server": {
929
        "attachments": [
930
            {
931
              "network_id": "1888",
932
              "mac_address": "aa:0c:f5:ad:16:41",
933
              "firewallProfile": "DISABLED",
934
              "ipv4": "83.212.112.56",
935
              "ipv6": "2001:648:2ffc:1119:a80c:f5ff:fead:1641",
936
              "id": "nic-42042-0"
937
            }
938
        ],
939
        "links": [
940
            {
941
                "href": "https://example.org/compute/v2.0/servers/42031", 
942
                "rel": "self"
943
            }, 
944
            {
945
                "href": "https://example.org/compute/v2.0/servers/42042",
946
                "rel": "bookmark"
947
            }
948
        ],
949
        "created": "2011-05-02T20:51:08.527759+00:00",
950
        "flavor": {
951
            "id": 1,
952
            "links": [
953
                {
954
                    "href": "https://example.org/compute/v2.0/flavors/1", 
955
                    "rel": "self"
956
                }, 
957
                {
958
                    "href": "https://example.org/compute/v2.0/flavors/1", 
959
                    "rel": "bookmark"
960
                }
961
            ]
962

    
963
        },
964
        "hostId": "",
965
        "id": "42042",
966
        "image": {
967
            "id": "im4g3-1d",
968
            "links": [
969
                {
970
                    "href": "https://example.org/compute/v2.0/images/im4g3-1d", 
971
                    "rel": "self"
972
                }, 
973
                {
974
                    "href": "https://example.org/compute/v2.0/images/im4g3-1d", 
975
                    "rel": "bookmark"
976
                }, 
977
                {
978
                    "href": "https://example.org/image/v1.0/images/im4g3-1d", 
979
                    "rel": "alternate"
980
                }
981
            ]
982
        },
983
        "name": "My Example Server",
984
        "description": "A sample server to showcase server requests",
985
        "progress": "0",
986
        "status": "ACTIVE",
987
        "updated": "2011-05-29T14:59:11.267087+00:00",
988
        "suspended": false,
989
        "diagnostics": [
990
            {
991
                "level": "DEBUG",
992
                "created": "2013-04-18T10:09:52.776920+00:00",
993
                "source": "image-info",
994
                "source_date": "2013-04-18T10:09:52.709791+00:00",
995
                "message": "Image customization finished successfully.",
996
                "details": null
997
            }
998
        ],
999
      }
1000
    }
1001
  }
1002

    
1003
Rename Server
1004
.............
1005

    
1006
Modify the ``name`` attribute of a virtual server. OS/Compute API also features
1007
the modification of IP addresses
1008

    
1009
.. rubric:: Response
1010

    
1011
======================== ====== ======== ==========
1012
URI                      Method Cyclades OS/Compute
1013
======================== ====== ======== ==========
1014
``/servers/<server id>`` PUT    ✔        ✔
1015
======================== ====== ======== ==========
1016

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

    
1019
|
1020

    
1021
==============  ========================= ======== ==========
1022
Request Header  Value                     Cyclades OS/Compute
1023
==============  ========================= ======== ==========
1024
X-Auth-Token    User authentication token required required
1025
Content-Type    Type or request body      required required
1026
Content-Length  Length of request body    required required
1027
==============  ========================= ======== ==========
1028

    
1029
**Example Request Headers**::
1030

    
1031
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
1032
  Content-Type:   application/json
1033
  Content-Length: 54
1034

    
1035
.. note:: Request parameters should be empty
1036

    
1037
Request body contents::
1038

    
1039
  server: {
1040
    <server attribute>: <value>,
1041
    ...
1042
  }
1043

    
1044
=========== ==================== ======== ==========
1045
Attribute   Description          Cyclades OS/Compute
1046
=========== ==================== ======== ==========
1047
name        The server name      ✔        ✔
1048
accessIPv4  IP v4 address        **✘**    ✔
1049
accessIPv6  IP v6 address        **✘**    ✔
1050
=========== ==================== ======== ==========
1051

    
1052
* Cyclades support multiple network connections per virtual server, which
1053
  explains the above differences in request body attributes.
1054

    
1055
*Example Rename Server Request: JSON*
1056

    
1057
.. code-block:: javascript
1058

    
1059
  {"server": {"name": "A new name for my virtual server"}}
1060

    
1061
.. rubric:: Response
1062

    
1063
=========================== =====================
1064
Return Code                 Description
1065
=========================== =====================
1066
204 (OK)                    Request succeeded
1067
400 (Bad Request)           Malformed request or malformed server id
1068
401 (Unauthorized)          Missing or expired user token
1069
403 (Forbidden)             User is not allowed to perform this operation
1070
404 (Not Found)             Server not found
1071
415 (Bad Media Type)
1072
409 (Build In Progress)     Server is not ready yet
1073
500 (Internal Server Error) The request cannot be completed because of an
1074
\                           internal error
1075
503 (Service Unavailable)   No available backends or service currently
1076
\                           unavailable
1077
=========================== =====================
1078

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

    
1083
Delete Server
1084
.............
1085

    
1086
Delete a virtual server. When a server is deleted, all its connections are
1087
deleted as well.
1088

    
1089
.. rubric:: Request
1090

    
1091
======================== ====== ======== ==========
1092
URI                      Method Cyclades OS/Compute
1093
======================== ====== ======== ==========
1094
``/servers/<server id>`` DELETE ✔        ✔
1095
======================== ====== ======== ==========
1096

    
1097
* **server-id** is the identifier of the virtual server.
1098

    
1099
|
1100

    
1101
==============  ========================= ======== ==========
1102
Request Header  Value                     Cyclades OS/Compute
1103
==============  ========================= ======== ==========
1104
X-Auth-Token    User authentication token required required
1105
==============  ========================= ======== ==========
1106

    
1107
.. note:: Request parameters should be empty
1108

    
1109
.. note:: Request body should be empty
1110

    
1111
.. rubric:: Response
1112

    
1113
=========================== =====================
1114
Return Code                 Description
1115
=========================== =====================
1116
204 (OK)                    Request succeeded
1117
400 (Bad Request)           Malformed server id or machine already deleted
1118
401 (Unauthorized)          Missing or expired user token
1119
404 (Not Found)             Server not found
1120
409 (Build In Progress)     Server is not ready yet
1121
500 (Internal Server Error) The request cannot be completed because of an
1122
\                           internal error
1123
503 (Service Unavailable)   Action not supported or service currently
1124
\                           unavailable
1125
=========================== =====================
1126

    
1127
.. note:: In case of a 204 code, response body should be empty
1128

    
1129
List Server Addresses
1130
.....................
1131

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

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

    
1140
.. rubric:: Request
1141

    
1142
============================ ====== ======== ==========
1143
URI                          Method Cyclades OS/Compute
1144
============================ ====== ======== ==========
1145
``/servers/<server id>/ips`` GET    ✔        ✔
1146
============================ ====== ======== ==========
1147

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

    
1150
|
1151

    
1152
==============  ========================= ======== ==========
1153
Request Header  Value                     Cyclades OS/Compute
1154
==============  ========================= ======== ==========
1155
X-Auth-Token    User authentication token required required
1156
==============  ========================= ======== ==========
1157

    
1158
.. note:: Request parameters should be empty
1159

    
1160
.. note:: Request body should be empty
1161

    
1162
.. rubric:: Response
1163

    
1164
=========================== =====================
1165
Return Code                 Description
1166
=========================== =====================
1167
200 (OK)                    Request succeeded
1168
400 (Bad Request)           Malformed server id or machine already deleted
1169
401 (Unauthorized)          Missing or expired user token
1170
404 (Not Found)             Server not found
1171
409 (Build In Progress)     Server is not ready yet
1172
500 (Internal Server Error) The request cannot be completed because of an
1173
\                           internal error
1174
503 (Service Unavailable)   Service currently unavailable
1175
=========================== =====================
1176

    
1177
Response body contents::
1178

    
1179
  addresses: [
1180
    {
1181
      <NIC attribute>: <value>,
1182
      ...
1183
    },
1184
    ...
1185
  ]
1186

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

    
1191
*Example List Addresses: JSON*
1192

    
1193
.. code-block:: javascript
1194

    
1195
  {
1196
    "addresses": [
1197
      {
1198
        "id": "nic-25455-0"
1199
        "network_id": "1",
1200
        "mac_address": "aa:00:03:7a:84:bb",
1201
        "firewallProfile": "DISABLED",
1202
        "ipv4": "192.168.0.27",
1203
        "ipv6": "2001:646:2ffc:1222:a820:3fd:fe7a:84bb",
1204
      }, {
1205
        "id": "nic-25455-1"
1206
        "network_id": "7",
1207
        "mac_address": "aa:00:03:7a:84:cc",
1208
        "firewallProfile": "DISABLED",
1209
        "ipv4": "192.168.0.28",
1210
        "ipv6": "2002:646:2fec:1222:a820:3fd:fe7a:84bc",
1211
      },
1212
    ]
1213
  }
1214

    
1215
Get Server NICs by Network
1216
..........................
1217

    
1218
Return the NIC that connects a server to a network.
1219

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

    
1224
.. rubric:: Request
1225

    
1226
========================================= ====== ======== ==========
1227
URI                                       Method Cyclades OS/Compute
1228
========================================= ====== ======== ==========
1229
``/servers/<server id>/ips/<network id>`` GET    ✔        ✔
1230
========================================= ====== ======== ==========
1231

    
1232
* **server id** is the identifier of the virtual server
1233

    
1234
* **network id** is the identifier of the network
1235

    
1236
|
1237

    
1238
==============  ========================= ======== ==========
1239
Request Header  Value                     Cyclades OS/Compute
1240
==============  ========================= ======== ==========
1241
X-Auth-Token    User authentication token required required
1242
==============  ========================= ======== ==========
1243

    
1244
.. note:: Request parameters should be empty
1245

    
1246
.. note:: Request body should be empty
1247

    
1248
.. rubric:: Response
1249

    
1250
=========================== =====================
1251
Return Code                 Description
1252
=========================== =====================
1253
200 (OK)                    Request succeeded
1254
400 (Bad Request)           Malformed server id or machine already deleted
1255
401 (Unauthorized)          Missing or expired user token
1256
404 (Not Found)             Server not found
1257
409 (Build In Progress)     Server is not ready yet
1258
500 (Internal Server Error) The request cannot be completed because of an
1259
\                           internal error
1260
503 (Service Unavailable)   Service currently unavailable
1261
=========================== =====================
1262

    
1263
|
1264

    
1265
Response body contents::
1266

    
1267
  network: {
1268
    <NIC attributes>: <value>,
1269
    ...
1270
  }
1271

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

    
1274
**List Server NICs Example with server id 25455, network id 7: JSON**
1275

    
1276
.. code-block:: javascript
1277

    
1278
  {
1279
    "network": {
1280
      "id": "nic-25455-0"
1281
      "network_id": "7",
1282
      "mac_address": "aa:00:03:7a:84:bb",
1283
      "firewallProfile": "DISABLED",
1284
      "ipv4": "192.168.0.27",
1285
      "ipv6": "2001:646:2ffc:1222:a820:3fd:fe7a:84bb",
1286
    }
1287
  }
1288

    
1289

    
1290
List Server Metadata
1291
....................
1292

    
1293
List the metadata of a server
1294

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

    
1298
.. rubric:: Request
1299

    
1300
================================= ====== ======== ==========
1301
URI                               Method Cyclades OS/Compute
1302
================================= ====== ======== ==========
1303
``/servers/<server-id>/metadata`` GET    ✔        ✔
1304
================================= ====== ======== ==========
1305

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

    
1308
|
1309

    
1310
==============  ========================= ======== ==========
1311
Request Header  Value                     Cyclades OS/Compute
1312
==============  ========================= ======== ==========
1313
X-Auth-Token    User authentication token required required
1314
==============  ========================= ======== ==========
1315

    
1316
.. note:: Request parameters should be empty
1317

    
1318
.. note:: Request body should be empty
1319

    
1320
.. rubric:: Response
1321

    
1322
=========================== =====================
1323
Return Code                 Description
1324
=========================== =====================
1325
200 (OK)                    Request succeeded
1326
400 (Bad Request)           Invalid server ID or Malformed request
1327
401 (Unauthorized)          Missing or expired user token
1328
403 (Forbidden)             Administratively suspended server
1329
404 (Not Found)             Server not found
1330
500 (Internal Server Error) The request cannot be completed because of an
1331
\                           internal error
1332
503 (Service Unavailable)   The server is not currently available
1333
=========================== =====================
1334

    
1335
Response body contents::
1336

    
1337
  metadata: {
1338
    <key>: <value>,
1339
      ...
1340
  }
1341

    
1342
*Example List Server Metadata: JSON*
1343

    
1344
.. code-block:: javascript
1345

    
1346
  {
1347
    ""metadata": {
1348
      "OS": "Linux",
1349
      "users": "root"
1350
    }
1351
  }
1352

    
1353
Set / Update Server Metadata
1354
............................
1355

    
1356
In Cyclades API, setting new metadata and updating the values of existing ones
1357
is achieved with the same type of request (``POST``), while in OS/Compute API
1358
there are two separate request types (``PUT`` and ``POST`` for
1359
`setting new <http://docs.openstack.org/api/openstack-compute/2/content/Create_or_Replace_Metadata-d1e5358.html>`_
1360
and
1361
`updating existing <http://docs.openstack.org/api/openstack-compute/2/content/Update_Metadata-d1e5208.html>`_
1362
metadata, respectively).
1363

    
1364
In Cyclades API, metadata keys which are not referred by the operation will
1365
remain intact, while metadata referred by the operation will be overwritten.
1366

    
1367
.. rubric:: Request
1368

    
1369
================================= ====== ======== ==========
1370
URI                               Method Cyclades OS/Compute
1371
================================= ====== ======== ==========
1372
``/servers/<server-id>/metadata`` PUT    **✘**    ✔
1373
``/servers/<server-id>/metadata`` POST   ✔       ✔
1374
================================= ====== ======== ==========
1375

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

    
1378
|
1379

    
1380
==============  ========================= ======== ==========
1381
Request Header  Value                     Cyclades OS/Compute
1382
==============  ========================= ======== ==========
1383
X-Auth-Token    User authentication token required required
1384
Content-Type    Type or request body      required required
1385
Content-Length  Length of request body    required required
1386
==============  ========================= ======== ==========
1387

    
1388
**Example Request Headers**::
1389

    
1390
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
1391
  Content-Type:   application/json
1392
  Content-Length: 56
1393

    
1394
.. note:: Request parameters should be empty
1395

    
1396
Request body contents::
1397

    
1398
  metadata: {
1399
    <key>: <value>,
1400
    ...
1401
  }
1402

    
1403
*Example Request Set / Update Server Metadata: JSON*
1404

    
1405
.. code-block:: javascript
1406

    
1407
  {"metadata": {"role": "webmail", "users": "root,maild"}}
1408

    
1409
.. rubric:: Response
1410

    
1411
=========================== =====================
1412
Return Code                 Description
1413
=========================== =====================
1414
201 (OK)                    Request succeeded
1415
400 (Bad Request)           Invalid server ID or Malformed request
1416
401 (Unauthorized)          Missing or expired user token
1417
403 (Forbidden)             Administratively suspended server
1418
404 (Not Found)             Server not found
1419
413 (OverLimit)             Maximum number of metadata exceeded
1420
500 (Internal Server Error) The request cannot be completed because of an
1421
\                           internal error
1422
503 (Service Unavailable)   The server is not currently available
1423
=========================== =====================
1424

    
1425
Response body contents::
1426

    
1427
  metadata: {
1428
    <key>: <value>,
1429
    ...
1430
  }
1431

    
1432
*Example Response Set / Update Server Metadata: JSON*
1433

    
1434
.. code-block:: javascript
1435

    
1436
  {"metadata": {"OS": "Linux", "role": "webmail", "users": "root,maild"}}
1437

    
1438
Get Server Metadata Item
1439
........................
1440

    
1441
Get the value of a specific piece of metadata of a virtual server
1442

    
1443
.. rubric:: Request
1444

    
1445
======================================= ====== ======== ==========
1446
URI                                     Method Cyclades OS/Compute
1447
======================================= ====== ======== ==========
1448
``/servers/<server-id>/metadata/<key>`` GET    ✔        ✔
1449
======================================= ====== ======== ==========
1450

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

    
1453
* **key** is the key of a matadatum ``key``:``value`` pair
1454

    
1455
|
1456

    
1457
==============  ========================= ======== ==========
1458
Request Header  Value                     Cyclades OS/Compute
1459
==============  ========================= ======== ==========
1460
X-Auth-Token    User authentication token required required
1461
==============  ========================= ======== ==========
1462

    
1463
.. note:: Request parameters should be empty
1464

    
1465
.. note:: Request body should be empty
1466

    
1467
.. rubric:: Response
1468

    
1469
=========================== =====================
1470
Return Code                 Description
1471
=========================== =====================
1472
200 (OK)                    Request succeeded
1473
400 (Bad Request)           Invalid server ID or Malformed request
1474
401 (Unauthorized)          Missing or expired user token
1475
403 (Forbidden)             Administratively suspended server
1476
404 (Not Found)             Metadatum key not found
1477
500 (Internal Server Error) The request cannot be completed because of an
1478
\                           internal error
1479
503 (Service Unavailable)   The server is not currently available
1480
=========================== =====================
1481

    
1482
Response body content::
1483

    
1484
  metadata: {<key>: <value>}
1485

    
1486
*Example Get Server Metadatum for Item 'role', JSON*
1487

    
1488
.. code-block:: javascript
1489

    
1490
  {"metadata": {"role": "webmail"}}
1491

    
1492
Update Server Metadatum Item
1493
.............................
1494

    
1495
Set a new or update an existing a metadum value for a virtual server.
1496

    
1497
.. rubric:: Request
1498

    
1499
======================================= ====== ======== ==========
1500
URI                                     Method Cyclades OS/Compute
1501
======================================= ====== ======== ==========
1502
``/servers/<server-id>/metadata/<key>`` PUT    ✔        ✔
1503
======================================= ====== ======== ==========
1504

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

    
1507
* **key** is the key of a ``key``:``value`` pair piece of metadata
1508

    
1509
|
1510

    
1511
==============  ========================= ======== ==========
1512
Request Header  Value                     Cyclades OS/Compute
1513
==============  ========================= ======== ==========
1514
X-Auth-Token    User authentication token required required
1515
Content-Type    Type or request body      required required
1516
Content-Length  Length of request body    required required
1517
==============  ========================= ======== ==========
1518

    
1519
**Example Request Headers**::
1520

    
1521
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
1522
  Content-Type:   application/json
1523
  Content-Length: 29
1524

    
1525
.. note:: Request parameters should be empty
1526

    
1527
Request body content::
1528

    
1529
  metadata: {<key>: <value>}
1530

    
1531
*Example Request to Set or Update Server Metadatum "role": JSON*
1532

    
1533
.. code-block:: javascript
1534

    
1535
  {"metadata": {"role": "gateway"}}
1536

    
1537
.. rubric:: Response
1538

    
1539
=========================== =====================
1540
Return Code                 Description
1541
=========================== =====================
1542
201 (OK)                    Request succeeded
1543
400 (Bad Request)           Invalid server ID or Malformed request
1544
401 (Unauthorized)          Missing or expired user token
1545
403 (Forbidden)             Administratively suspended server
1546
404 (Not Found)             Metadatum key not found
1547
413 (OverLimit)             Maximum number of metadata exceeded
1548
500 (Internal Server Error) The request cannot be completed because of an
1549
\                           internal error
1550
503 (Service Unavailable)   The server is not currently available
1551
=========================== ====================
1552

    
1553
Response body content::
1554

    
1555
  metadata: {<key>: <value>}
1556

    
1557
*Example Set or Update Server Metadatum "role":"gateway": JSON*
1558

    
1559
.. code-block:: javascript
1560

    
1561
  {"metadata": {"role": "gateway"}}
1562

    
1563
Delete Server Metadatum
1564
.......................
1565

    
1566
Delete a metadatum of a virtual server
1567

    
1568
.. rubric:: Request
1569

    
1570
======================================= ====== ======== ==========
1571
URI                                     Method Cyclades OS/Compute
1572
======================================= ====== ======== ==========
1573
``/servers/<server-id>/metadata/<key>`` DELETE ✔        ✔
1574
======================================= ====== ======== ==========
1575

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

    
1578
* **key** is the key of a matadatum ``key``:``value`` pair
1579

    
1580
|
1581

    
1582
==============  ========================= ======== ==========
1583
Request Header  Value                     Cyclades OS/Compute
1584
==============  ========================= ======== ==========
1585
X-Auth-Token    User authentication token required required
1586
==============  ========================= ======== ==========
1587

    
1588
.. note:: Request parameters should be empty
1589

    
1590
.. note:: Request body should be empty
1591

    
1592
.. rubric:: Response
1593

    
1594
=========================== =====================
1595
Return Code                 Description
1596
=========================== =====================
1597
204 (OK)                    Request succeeded
1598
400 (Bad Request)           Invalid server ID
1599
401 (Unauthorized)          Missing or expired user token
1600
403 (Forbidden)             Administratively suspended server
1601
404 (Not Found)             Metadatum key not found
1602
500 (Internal Server Error) The request cannot be completed because of an
1603
\                           internal error
1604
503 (Service Unavailable)   The server is not currently available
1605
=========================== =====================
1606

    
1607
.. note:: In case of a 204 code, response body should be empty
1608

    
1609
Server Actions
1610
--------------
1611

    
1612
Actions are operations that are achieved through the same type of request
1613
(``POST``). There are differences in the implementations of some operations
1614
between Synnefo/Cyclades and OS/Compute. Although this document focuses on
1615
Synnefo/Cyclades, differences and similarities between the APIs are also
1616
briefed.
1617

    
1618
=============================================== ======== ==========
1619
Operations                                      Cyclades OS/Compute
1620
=============================================== ======== ==========
1621
`Start <#start-server>`_                        ✔        **✘**
1622
`Shutdown <#shutdown-server>`_                  ✔        **✘**
1623
`Reboot <#reboot-server>`_                      ✔        ✔
1624
`Get Console <#get-server-console>`_            ✔        **✘**
1625
`Set Firewall <#set-server-firewall-profile>`_  ✔        **✘**
1626
`Reassign <#reassign-server>`_                  ✔        **✘**
1627
`Change Admin Password <#os-compute-specific>`_ **✘**    ✔
1628
`Rebuild <#os-compute-specific>`_               **✘**    ✔
1629
`Resize <#os-compute-specific>`_                **✘**    ✔
1630
`Confirm Resized <#os-compute-specific>`_       **✘**    ✔
1631
`Revert Resized <#os-compute-specific>`_        **✘**    ✔
1632
`Create Image <#os-compute-specific>`_          **✘**    ✔
1633
=============================================== ======== ==========
1634

    
1635
.. rubric:: Request
1636

    
1637
=============================== ====== ======== ==========
1638
URI                             Method Cyclades OS/Compute
1639
=============================== ====== ======== ==========
1640
``/servers/<server id>/action`` POST   ✔        ✔
1641
=============================== ====== ======== ==========
1642

    
1643
|
1644

    
1645
==============  ========================= ======== ==========
1646
Request Header  Value                     Cyclades OS/Compute
1647
==============  ========================= ======== ==========
1648
X-Auth-Token    User authentication token required required
1649
Content-Type    Type or request body      required required
1650
Content-Length  Length of request body    required required
1651
==============  ========================= ======== ==========
1652

    
1653
**Example Request Headers**::
1654

    
1655
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
1656
  Content-Type:   application/json
1657
  Content-Length: 32
1658

    
1659
.. note:: Request parameters should be empty
1660

    
1661
.. note:: Request body varies between operations (see bellow)
1662

    
1663
.. rubric:: Response
1664

    
1665
=========================== =====================
1666
Return Code                 Description
1667
=========================== =====================
1668
200 (OK)                    Request succeeded (for console operation)
1669
202 (OK)                    Request succeeded
1670
400 (Bad Request)           Invalid request or unknown action
1671
401 (Unauthorized)          Missing or expired user token
1672
403 (Forbidden)             User is not allowed to perform this operation
1673
500 (Internal Server Error) The request cannot be completed because of an
1674
\                           internal error
1675
503 (Service Unavailable)   The server is not currently available
1676
=========================== =====================
1677

    
1678
.. note:: Response body varies between operations (see bellow)
1679

    
1680
Start server
1681
................
1682

    
1683
This operation transitions a server from a STOPPED to an ACTIVE state.
1684

    
1685
Request body contents::
1686

    
1687
  start: {}
1688

    
1689
*Example Start Server: JSON*
1690

    
1691
.. code-block:: javascript
1692

    
1693
  {"start": {}}
1694

    
1695
.. note:: Response body should be empty
1696

    
1697
Reboot Server
1698
.............
1699

    
1700
This operation transitions a server from ``ACTIVE`` to ``REBOOT`` and then
1701
``ACTIVE`` again.
1702

    
1703
Synnefo and OS/Compute APIs offer two reboot modes: ``soft``
1704
and ``hard``. OS/Compute distinguishes between the two intermediate states
1705
(``REBOOT`` and ``HARD_REBOOT``) while rebooting, while Synnefo/Cyclades use
1706
only the ``REBOOT`` term. The expected behavior is the same, though.
1707

    
1708
Request body contents::
1709

    
1710
  reboot: {type: <reboot type>}
1711

    
1712
* **reboot type** can be either ``SOFT`` or ``HARD``.
1713

    
1714
*Example (soft) Reboot Server: JSON*
1715

    
1716
.. code-block:: javascript
1717

    
1718
  {"reboot" : { "type": "soft"}}
1719

    
1720
.. note:: Response body should be empty
1721

    
1722
Shutdown server
1723
...............
1724

    
1725
This operation transitions a server from an ACTIVE to a STOPPED state.
1726

    
1727
Request body contents::
1728

    
1729
  shutdown: {}
1730

    
1731
*Example Shutdown Server: JSON*
1732

    
1733
.. code-block:: javascript
1734

    
1735
  {"shutdown": {}}
1736

    
1737
.. note:: Response body should be empty
1738

    
1739
Get Server Console
1740
..................
1741

    
1742
.. note:: This operation is not part of OS/Compute API
1743

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

    
1749
Request body contents::
1750

    
1751
  console: {type: vnc}
1752

    
1753
*Example Get Server Console: JSON*
1754

    
1755
.. code-block:: javascript
1756

    
1757
  {"console": {"type": "vnc" }
1758

    
1759
Response body contents::
1760

    
1761
  console: {
1762
    <vnc attribute>: <value>,
1763
    ...
1764
  }
1765

    
1766
============== ======================
1767
VNC Attributes Description
1768
============== ======================
1769
host           The vncprocy host
1770
port           vncprocy port
1771
password       Temporary password
1772
type           Connection type (only VNC)
1773
============== ======================
1774

    
1775
*Example Action Console Response: JSON*
1776

    
1777
.. code-block:: javascript
1778

    
1779
  {
1780
    "console": {
1781
      "type": "vnc",
1782
      "host": "vm42.example.org",
1783
      "port": 1234,
1784
      "password": "513NR14PN0T"
1785
    }
1786
  }
1787

    
1788
Set Server Firewall Profile
1789
...........................
1790

    
1791
The firewallProfile function sets a firewall profile for the public interface
1792
of a server.
1793

    
1794
Request body contents::
1795

    
1796
  firewallProfile: { profile: <firewall profile>}
1797

    
1798
* **firewall profile** can be ``ENABLED``, ``DISABLED`` or ``PROTECTED``
1799

    
1800
*Example Action firewallProfile: JSON**
1801

    
1802
.. code-block:: javascript
1803

    
1804
  {"firewallProfile": {"profile": "ENABLED"}}
1805

    
1806
.. note:: Response body should be empty
1807

    
1808
Reassign Server
1809
...............
1810

    
1811
This operation assigns the VM to a different project.
1812

    
1813
Request body contents::
1814

    
1815
  reassign: { project: <project-id>}
1816

    
1817
*Example Action reassign: JSON**
1818

    
1819
.. code-block:: javascript
1820

    
1821
  {"reassign": {"project": "9969f2fd-86d8-45d6-9106-5e251f7dd92f"}}
1822

    
1823
.. note:: Response body should be empty
1824

    
1825
OS/Compute Specific
1826
...................
1827

    
1828
The following operations are meaningless or not supported in the context of
1829
Synnefo/Cyclades, but are parts of the OS/Compute API:
1830

    
1831
* `Change Administrator Password <http://docs.openstack.org/api/openstack-compute/2/content/Change_Password-d1e3234.html>`_
1832
* `Rebuild Server <http://docs.openstack.org/api/openstack-compute/2/content/Rebuild_Server-d1e3538.html>`_
1833
* `Resize Server <http://docs.openstack.org/api/openstack-compute/2/content/Resize_Server-d1e3707.html>`_
1834
* `Confirm Resized Server <http://docs.openstack.org/api/openstack-compute/2/content/Confirm_Resized_Server-d1e3868.html>`_
1835
* `Revert Resized Server <http://docs.openstack.org/api/openstack-compute/2/content/Revert_Resized_Server-d1e4024.html>`_
1836
* `Create Image <http://docs.openstack.org/api/openstack-compute/2/content/Create_Image-d1e4655.html>`_
1837

    
1838

    
1839
Flavors
1840
-------
1841

    
1842
A flavor is a hardware configuration for a server.
1843

    
1844
==================================== ======================== ====== ======== ==========
1845
Description                          URI                      Method Cyclades OS/Compute
1846
==================================== ======================== ====== ======== ==========
1847
`List <#list-flavors>`_              ``/flavors``             GET    ✔        ✔
1848
\                                    ``/flavors/detail``      GET    ✔        **✘**
1849
`Get details <#get-flavor-details>`_ ``/flavors/<flavor-id>`` GET    ✔        ✔
1850
==================================== ======================== ====== ======== ==========
1851

    
1852
List Flavors
1853
............
1854

    
1855
List the flavors that are accessible by the user
1856

    
1857
.. rubric:: Request
1858

    
1859
=================== ====== ======== ==========
1860
URI                 Method Cyclades OS/Compute
1861
=================== ====== ======== ==========
1862
``/flavors``        GET    ✔        ✔
1863
``/flavors/detail`` GET    ✔        ✔
1864
=================== ====== ======== ==========
1865

    
1866
|
1867

    
1868
==============  ========================= ======== ==========
1869
Request Header  Value                     Cyclades OS/Compute
1870
==============  ========================= ======== ==========
1871
X-Auth-Token    User authentication token required required
1872
==============  ========================= ======== ==========
1873

    
1874
|
1875

    
1876
================= ===============
1877
Request Parameter Value
1878
================= ===============
1879
json              Respond in json
1880
xml               Respond in xml
1881
================= ===============
1882

    
1883
.. note:: Request body should be empty
1884

    
1885
.. rubric:: Response
1886

    
1887
=========================== =====================
1888
Return Code                 Description
1889
=========================== =====================
1890
200 (OK)                    Request succeeded
1891
400 (Bad Request)           Malformed request
1892
401 (Unauthorized)          Missing or expired user token
1893
403 (Forbidden)             Forbidden to use this flavor
1894
500 (Internal Server Error) The request cannot be completed because of an
1895
\                           internal error
1896
503 (Service Unavailable)   The server is not currently available
1897
=========================== =====================
1898

    
1899
Response code contents::
1900

    
1901
  flavors: [
1902
    {
1903
      <flavor attribute>: <value>,
1904
      ...
1905
    },
1906
    ...
1907
  ]
1908

    
1909
Flavor attributes are `listed here <#flavor-ref>`_. Regular listing contains
1910
only ``id`` and ``name`` attributes.
1911

    
1912
*Example List Flavors (regular): JSON*
1913

    
1914
.. code-block:: javascript
1915

    
1916
  {
1917
    "flavors": [
1918
      {
1919
        "id": 1,
1920
        "name": "One code",
1921
        "links": [
1922
            {
1923
                "href": "https://example.org/compute/v2.0/flavors/1", 
1924
                "rel": "self"
1925
            }, 
1926
            {
1927
                "href": "https://example.org/compute/v2.0/flavors/1", 
1928
                "rel": "bookmark"
1929
            }
1930
        ]
1931
      }, {
1932
        "id": 3,
1933
        "name": "Four core",
1934
        "links": [
1935
            {
1936
                "href": "https://example.org/compute/v2.0/flavors/3", 
1937
                "rel": "self"
1938
            }, 
1939
            {
1940
                "href": "https://example.org/compute/v2.0/flavors/3", 
1941
                "rel": "bookmark"
1942
            }
1943
        ]
1944
      }
1945
    ]
1946
  }
1947

    
1948

    
1949
*Example List Flavors (regular): XML*
1950

    
1951
.. code-block:: xml
1952

    
1953
  <?xml version="1.0" encoding="UTF-8"?>
1954
  <flavors xmlns="http://docs.openstack.org/compute/api/v1"
1955
    xmlns:atom="http://www.w3.org/2005/Atom">
1956
    <flavor id="1" name="One core"/>
1957
    <flavor id="3" name="Four core"/>
1958
  </flavors>
1959

    
1960
*Example List Flavors (detail): JSON*
1961

    
1962
.. code-block:: javascript
1963

    
1964
  {
1965
    "flavors": [
1966
      {
1967
        "id": 1,
1968
        "name": "One core",
1969
        "ram": 1024,
1970
        "SNF:disk_template": "drbd",
1971
        "disk": 20,
1972
        "cpu": 1,
1973
        "links": [
1974
            {
1975
                "href": "https://example.org/compute/v2.0/flavors/1", 
1976
                "rel": "self"
1977
            }, 
1978
            {
1979
                "href": "https://example.org/compute/v2.0/flavors/1", 
1980
                "rel": "bookmark"
1981
            }
1982
        ]
1983
      }, {
1984
        "id": 3,
1985
        "name": "Four core",
1986
        "ram": 1024,
1987
        "SNF:disk_template": "drbd",
1988
        "disk": 40,
1989
        "cpu": 4,
1990
        "links": [
1991
            {
1992
                "href": "https://example.org/compute/v2.0/flavors/3", 
1993
                "rel": "self"
1994
            }, 
1995
            {
1996
                "href": "https://example.org/compute/v2.0/flavors/3", 
1997
                "rel": "bookmark"
1998
            }
1999
        ]
2000
      }
2001
    ]
2002
  }
2003

    
2004
Get Flavor Details
2005
..................
2006

    
2007
Get the configuration of a specific flavor
2008

    
2009
.. rubric:: Request
2010

    
2011
======================= ====== ======== ==========
2012
URI                     Method Cyclades OS/Compute
2013
======================= ====== ======== ==========
2014
``/flavors/<flavor-id`` GET    ✔        ✔
2015
======================= ====== ======== ==========
2016

    
2017
* **flavor-id** is the identifier of the flavor
2018

    
2019
|
2020

    
2021
==============  ========================= ======== ==========
2022
Request Header  Value                     Cyclades OS/Compute
2023
==============  ========================= ======== ==========
2024
X-Auth-Token    User authentication token required required
2025
==============  ========================= ======== ==========
2026

    
2027
|
2028

    
2029
================= ===============
2030
Request Parameter Value
2031
================= ===============
2032
json              Respond in json
2033
xml               Respond in xml
2034
================= ===============
2035

    
2036
.. note:: Request body should be empty
2037

    
2038
.. rubric:: Response
2039

    
2040
=========================== =====================
2041
Return Code                 Description
2042
=========================== =====================
2043
200 (OK)                    Request succeeded
2044
400 (Bad Request)           Malformed flavor ID
2045
401 (Unauthorized)          Missing or expired user token
2046
403 (Forbidden)             Forbidden to use this flavor
2047
404 (Not Found)             Flavor id not founmd
2048
500 (Internal Server Error) The request cannot be completed because of an
2049
\                           internal error
2050
503 (Service Unavailable)   The server is not currently available
2051
=========================== =====================
2052

    
2053
Response code contents::
2054

    
2055
  flavor: {
2056
    <flavor attribute>: <value>,
2057
    ...
2058
  }
2059

    
2060
All flavor attributes are `listed here <flavor-ref>`_.
2061

    
2062
*Example Flavor Details: JSON*
2063

    
2064
.. code-block:: javascript
2065

    
2066
  {
2067
    "flavor": {
2068
      {
2069
        "id": 1,
2070
        "name": "One core",
2071
        "ram": 1024,
2072
        "SNF:disk_template": "drbd",
2073
        "disk": 20,
2074
        "cpu": 1,
2075
        "links": [
2076
            {
2077
                "href": "https://example.org/compute/v2.0/flavors/1", 
2078
                "rel": "self"
2079
            }, 
2080
            {
2081
                "href": "https://example.org/compute/v2.0/flavors/1", 
2082
                "rel": "bookmark"
2083
            }
2084
        ]
2085
      }
2086
    }
2087
  }
2088

    
2089
*Example Flavor Details: XML*
2090

    
2091
.. code-block:: xml
2092

    
2093
  <?xml version="1.0" encoding="UTF-8"?>
2094
  <flavor xmlns="http://docs.openstack.org/compute/api/v1"
2095
    xmlns:atom="http://www.w3.org/2005/Atom"
2096
    id="1" name="One core" ram="1024" disk="20" cpu="1" />
2097

    
2098
Images
2099
------
2100

    
2101
An image is a collection of files used to create or rebuild a server. Synnefo
2102
deployments usually provide pre-built OS images, but custom image creation is
2103
also supported.
2104

    
2105
============================================= ===================================== ====== ======== ==========
2106
Description                                   URI                                   Method Cyclades OS/Compute
2107
============================================= ===================================== ====== ======== ==========
2108
`List <#list-images>`_                        ``/images``                           GET    ✔        ✔
2109
\                                             ``/images/detail``                    GET    ✔        ✔
2110
`Get details <#get-image-details>`_           ``/images/<image-id>``                GET    ✔        ✔
2111
`Delete <#delete-image>`_                     ``/images/<image id>``                DELETE ✔        ✔
2112
`List Metadata <#list-image-metadata>`_       ``/images/<image-id>/metadata``       GET    ✔        ✔
2113
`Update Metadata <#update-image-metadata>`_   ``/images/<image-id>/metadata``       POST   ✔        ✔
2114
\                                             ``/images/<image-id>/metadata``       PUT    **✘**    ✔
2115
`Get Meta Item <#get-image-metadatum>`_       ``/image/<image-id>/metadata/<key>``  GET    ✔        ✔
2116
`Update Metadatum <#update-image-metadatum>`_ ``/images/<image-id>/metadata/<key>`` PUT    ✔        ✔
2117
`Delete Metadatum <#delete-image-metadatum>`_ ``/images/<image-id>/metadata/<key>`` DELETE ✔        ✔
2118
============================================= ===================================== ====== ======== ==========
2119

    
2120

    
2121
List Images
2122
...........
2123

    
2124
List all images accessible by the user
2125

    
2126
.. rubric:: Request
2127

    
2128
=================== ====== ======== ==========
2129
URI                 Method Cyclades OS/Compute
2130
=================== ====== ======== ==========
2131
``/images``        GET    ✔        ✔
2132
``/images/detail`` GET    ✔        ✔
2133
=================== ====== ======== ==========
2134

    
2135
|
2136

    
2137
==============  ========================= ======== ==========
2138
Request Header  Value                     Cyclades OS/Compute
2139
==============  ========================= ======== ==========
2140
X-Auth-Token    User authentication token required required
2141
==============  ========================= ======== ==========
2142

    
2143
|
2144

    
2145
================= ======================== ======== ==========
2146
Request Parameter Value                    Cyclades OS/Compute
2147
================= ======================== ======== ==========
2148
server            Server filter            **✘**    ✔
2149
name              Image name filter        **✘**    ✔
2150
status            Server status filter     **✘**    ✔
2151
changes-since     Change timestamp filter  ✔        ✔
2152
marker            Last list last ID filter **✘**    ✔
2153
limit             Page size filter         **✘**    ✔
2154
type              Request filter type      **✘**    ✔
2155
================= ======================== ======== ==========
2156

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

    
2162
.. note:: Request body should be empty
2163

    
2164
.. rubric:: Response
2165

    
2166
=========================== =====================
2167
Return Code                 Description
2168
=========================== =====================
2169
200 (OK)                    Request succeeded
2170
304 (No images since date)  Can be returned if ``changes-since`` is given
2171
400 (Bad Request)           Invalid or malformed ``changes-since`` parameter
2172
401 (Unauthorized)          Missing or expired user token
2173
403 (Forbidden)             User is not allowed to perform this operation
2174
500 (Internal Server Error) The request cannot be completed because of an
2175
\                           internal error
2176
503 (Service Unavailable)   The server is not currently available
2177
=========================== =====================
2178

    
2179
Response body contents::
2180

    
2181
  images: [
2182
    {
2183
      <image attribute>: <value>,
2184
      ...
2185
      metadata: {
2186
        <image metadatum key>: <value>,
2187
        ...
2188
      },
2189
      ...
2190
    },
2191
    ...
2192
  ]
2193

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

    
2197
*Example List Image (detail): JSON*
2198

    
2199
.. code-block:: javascript
2200

    
2201
  {
2202
    "images: [
2203
      {
2204
        "status": "ACTIVE",
2205
        "updated": "2013-03-02T15:57:03+00:00",
2206
        "name": "edx_saas",
2207
        "created": "2013-03-02T12:21:00+00:00",
2208
        "progress": 100,
2209
        "id": "175716...526236",
2210
        "links": [
2211
          {
2212
            "href": "https://example.org/compute/v2.0/images/175716...526236", 
2213
            "rel": "self"
2214
          }, 
2215
          {
2216
            "href": "https://example.org/compute/v2.0/images/175716...526236", 
2217
            "rel": "bookmark"
2218
          }, 
2219
          {
2220
            "href": "https://example.org/image/v1.0/images/175716...526236", 
2221
            "rel": "alternate"
2222
          }
2223
        ],
2224
        "metadata": {
2225
          "partition_table": "msdos",
2226
          "osfamily": "linux",
2227
          "users": "root saasbook",
2228
          "exclude_task_changepassword": "yes",
2229
          "os": "ubuntu",
2230
          "root_partition": "1",
2231
          "description": "Ubuntu 12.04 LTS"
2232
        }
2233
      }, {
2234
        "status": "ACTIVE",
2235
        "updated": "2013-03-02T15:57:03+00:00",
2236
        "name": "edx_saas",
2237
        "created": "2013-03-02T12:21:00+00:00",
2238
        "progress": 100,
2239
        "id": "1357163d...c526206",
2240
        "links": [
2241
          {
2242
            "href": "https://example.org/compute/v2.0/images/1357163d...c526206", 
2243
            "rel": "self"
2244
          }, 
2245
          {
2246
            "href": "https://example.org/compute/v2.0/images/1357163d...c526206", 
2247
            "rel": "bookmark"
2248
          }, 
2249
          {
2250
            "href": "https://example.org/image/v1.0/images/1357163d...c526206", 
2251
            "rel": "alternate"
2252
          }
2253
        ],
2254
        "metadata": {
2255
          "partition_table": "msdos",
2256
          "osfamily": "windows",
2257
          "users": "Administratior",
2258
          "exclude_task_changepassword": "yes",
2259
          "os": "WinME",
2260
          "root_partition": "1",
2261
          "description": "Rerto Windows"
2262
        }
2263
      }
2264
    ]
2265
  }
2266

    
2267
Get Image Details
2268
.................
2269

    
2270
Get the details of a specific image
2271

    
2272
.. rubric:: Request
2273

    
2274
====================== ====== ======== ==========
2275
URI                    Method Cyclades OS/Compute
2276
====================== ====== ======== ==========
2277
``/images/<image-id>`` GET    ✔        ✔
2278
====================== ====== ======== ==========
2279

    
2280
* **image-id** is the identifier of the virtual image
2281

    
2282
|
2283

    
2284
==============  ========================= ======== ==========
2285
Request Header  Value                     Cyclades OS/Compute
2286
==============  ========================= ======== ==========
2287
X-Auth-Token    User authentication token required required
2288
==============  ========================= ======== ==========
2289

    
2290
.. note:: Request parameters should be empty
2291

    
2292
.. note:: Request body should be empty
2293

    
2294
.. rubric:: Response
2295

    
2296
=========================== =====================
2297
Return Code                 Description
2298
=========================== =====================
2299
200 (OK)                    Request succeeded
2300
400 (Bad Request)           Malformed image id
2301
401 (Unauthorized)          Missing or expired user token
2302
403 (Forbidden)             Not allowed to use this image
2303
404 (Not Found)             Image not found
2304
500 (Internal Server Error) The request cannot be completed because of an
2305
\                           internal error
2306
503 (Service Unavailable)   No available backends or service currently
2307
\                           unavailable
2308
=========================== =====================
2309

    
2310
Response body contents::
2311

    
2312
  image: {
2313
    <image attribute>: <value>,
2314
    ...
2315
    metadata: {
2316
      <image metadatum key>: <value>
2317
    }
2318
  }
2319

    
2320
Image attributes are `listed here <#image-ref>`_.
2321

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

    
2324
.. code-block:: javascript
2325

    
2326
  {
2327
  "image": {
2328
    "id": "6404619d-...-aef57eaff4af",
2329
    "name": "FreeBSD",
2330
    "status": "ACTIVE",
2331
    "updated": "2013-04-24T12:06:02+00:00",
2332
    "created": "2013-04-24T11:52:16+00:00",
2333
    "progress": 100,
2334
    "links": [
2335
      {
2336
        "href": "https://example.org/compute/v2.0/images/6404619d-...-aef57eaff4af", 
2337
        "rel": "self"
2338
      }, 
2339
      {
2340
        "href": "https://example.org/compute/v2.0/images/6404619d-...-aef57eaff4af", 
2341
        "rel": "bookmark"
2342
      }, 
2343
      {
2344
        "href": "https://example.org/image/v1.0/images/6404619d-...-aef57eaff4af", 
2345
        "rel": "alternate"
2346
      }
2347
    ],
2348
    "metadata": {
2349
      "kernel": "9.1 RELEASE",
2350
      "osfamily": "freebsd",
2351
      "users": "root",
2352
      "gui": "No GUI",
2353
      "sortorder": "9",
2354
      "os": "freebsd",
2355
      "root_partition": "2",
2356
      "description": "FreeBSD 9"
2357
      }
2358
    }
2359
  }
2360

    
2361

    
2362
Delete Image
2363
............
2364

    
2365
Delete an image, by changing its status from ``ACTIVE`` to ``DELETED``.
2366

    
2367
.. rubric:: Request
2368

    
2369
====================== ====== ======== ==========
2370
URI                    Method Cyclades OS/Compute
2371
====================== ====== ======== ==========
2372
``/images/<image id>`` DELETE ✔        ✔
2373
====================== ====== ======== ==========
2374

    
2375
* **image id** is the identifier of the image
2376

    
2377
|
2378

    
2379
==============  ========================= ======== ==========
2380
Request Header  Value                     Cyclades OS/Compute
2381
==============  ========================= ======== ==========
2382
X-Auth-Token    User authentication token required required
2383
==============  ========================= ======== ==========
2384

    
2385
.. note:: Request parameters should be empty
2386

    
2387
.. note:: Request body should be empty
2388

    
2389
.. rubric:: Response
2390

    
2391
=========================== =====================
2392
Return Code                 Description
2393
=========================== =====================
2394
204 (OK)                    Request succeeded
2395
400 (Bad Request)           Invalid request or image id
2396
401 (Unauthorized)          Missing or expired user token
2397
404 (Not Found)             Image not found
2398
500 (Internal Server Error) The request cannot be completed because of an
2399
\                           internal error
2400
503 (Service Unavailable)   Action not supported or service currently
2401
\                           unavailable
2402
=========================== =====================
2403

    
2404
.. note:: In case of a 204 code, request body should be empty
2405

    
2406
List Image Metadata
2407
...................
2408

    
2409
.. rubric:: Request
2410

    
2411
=============================== ====== ======== ==========
2412
URI                             Method Cyclades OS/Compute
2413
=============================== ====== ======== ==========
2414
``/images/<image-id>/metadata`` GET    ✔        ✔
2415
=============================== ====== ======== ==========
2416

    
2417
* **image-id** is the identifier of the virtual image
2418

    
2419
|
2420

    
2421
==============  ========================= ======== ==========
2422
Request Header  Value                     Cyclades OS/Compute
2423
==============  ========================= ======== ==========
2424
X-Auth-Token    User authentication token required required
2425
==============  ========================= ======== ==========
2426

    
2427
.. note:: Request parameters should be empty
2428

    
2429
.. note:: Request body should be empty
2430

    
2431
.. rubric:: Response
2432

    
2433
=========================== =====================
2434
Return Code                 Description
2435
=========================== =====================
2436
201 (OK)                    Request succeeded
2437
400 (Bad Request)           Invalid image ID or Malformed request
2438
401 (Unauthorized)          Missing or expired user token
2439
403 (Forbidden)             Administratively suspended server
2440
404 (Not Found)             Server not found
2441
409 (Build In Progress)     The image is not ready yet
2442
500 (Internal Server Error) The request cannot be completed because of an
2443
\                           internal error
2444
503 (Service Unavailable)   The server is not currently available
2445
=========================== =====================
2446

    
2447
Response body content::
2448

    
2449
  metadata: {
2450
    <metadatum key>: <value>,
2451
  ...
2452
  }
2453

    
2454
*Example List Image Metadata: JSON*
2455

    
2456
.. code-block:: javascript
2457

    
2458
  {
2459
    "metadata": {
2460
      "partition_table": "msdos",
2461
      "kernel": "3.2.0",
2462
      "osfamily": "linux",
2463
      "users": "user",
2464
      "gui": "Unity 5",
2465
      "sortorder": "3",
2466
      "os": "ubuntu",
2467
      "root_partition": "1",
2468
      "description": "Ubuntu 12 LTS"
2469
    }
2470
  }
2471

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

    
2474
Update Image Metadata
2475
.....................
2476

    
2477
In Cyclades API, setting new metadata and updating the values of existing ones
2478
is achieved using one type of request (POST), while in OS/Compute API two
2479
different types are used (PUT and POST for
2480
`setting new <http://docs.openstack.org/api/openstack-compute/2/content/Create_or_Replace_Metadata-d1e5358.html>`_
2481
and
2482
`updating existing <http://docs.openstack.org/api/openstack-compute/2/content/Update_Metadata-d1e5208.html>`_
2483
metadata, respectively).
2484

    
2485
In Cyclades API, unmentioned metadata keys will remain intact, while metadata
2486
referred by the operation will be overwritten.
2487

    
2488
.. rubric:: Request
2489

    
2490
=============================== ====== ======== ==========
2491
URI                             Method Cyclades OS/Compute
2492
=============================== ====== ======== ==========
2493
``/images/<image-id>/metadata`` PUT    **✘**    ✔
2494
``/images/<image-id>/metadata`` POST   ✔        ✔
2495
=============================== ====== ======== ==========
2496

    
2497
* **image-id** is the identifier of the virtual image
2498

    
2499
|
2500

    
2501
==============  ========================= ======== ==========
2502
Request Header  Value                     Cyclades OS/Compute
2503
==============  ========================= ======== ==========
2504
X-Auth-Token    User authentication token required required
2505
Content-Type    Type or request body      required required
2506
Content-Length  Length of request body    required required
2507
==============  ========================= ======== ==========
2508

    
2509
**Example Request Headers**::
2510

    
2511
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
2512
  Content-Type:   application/json
2513
  Content-Length: 52
2514

    
2515
.. note:: Request parameters should be empty
2516

    
2517
Request body content::
2518

    
2519
  metadata: {
2520
    <metadatum key>: <value>,
2521
    ...
2522
  }
2523

    
2524
*Example Update Image Metadata Request: JSON*
2525

    
2526
.. code-block:: javascript
2527

    
2528
  {"metadata": {"NewAttr": "NewVal", "os": "Xubuntu'}}
2529

    
2530
.. rubric:: Response
2531

    
2532
=========================== =====================
2533
Return Code                 Description
2534
=========================== =====================
2535
201 (OK)                    Request succeeded
2536
400 (Bad Request)           Malformed request or image id
2537
401 (Unauthorized)          Missing or expired user token
2538
403 (Forbidden)             Not allowed to modify this image
2539
404 (Not Found)             Image or metadatum key not found
2540
413 (OverLimit)             Maximum number of metadata exceeded
2541
500 (Internal Server Error) The request cannot be completed because of an
2542
\                           internal error
2543
503 (Service Unavailable)   The server is not currently available
2544
=========================== =====================
2545

    
2546
Response body content::
2547

    
2548
  metadata: {
2549
    <key>: <value>,
2550
    ...
2551
  }
2552

    
2553
*Example Update Image Response: JSON*
2554

    
2555
.. code-block:: javascript
2556

    
2557
  {
2558
    "metadata": {
2559
      "partition_table": "msdos",
2560
      "kernel": "3.2.0",
2561
      "osfamily": "linux",
2562
      "users": "user",
2563
      "gui": "Unity 5",
2564
      "sortorder": "3",
2565
      "os": "Xubuntu",
2566
      "root_partition": "1",
2567
      "description": "Ubuntu 12 LTS",
2568
      "NewAttr": "NewVal"
2569
    }
2570
  }
2571

    
2572
Get Image Metadatum
2573
...................
2574

    
2575
.. rubric:: Request
2576

    
2577
===================================== ====== ======== ==========
2578
URI                                   Method Cyclades OS/Compute
2579
===================================== ====== ======== ==========
2580
``/images/<image-id>/metadata/<key>`` GET    ✔        ✔
2581
===================================== ====== ======== ==========
2582

    
2583
* **image-id** is the identifier of the image
2584

    
2585
* **key** is the key of a matadatum ``key``:``value`` pair
2586

    
2587
|
2588

    
2589
==============  ========================= ======== ==========
2590
Request Header  Value                     Cyclades OS/Compute
2591
==============  ========================= ======== ==========
2592
X-Auth-Token    User authentication token required required
2593
==============  ========================= ======== ==========
2594

    
2595
.. note:: Request parameters should be empty
2596

    
2597
.. note:: Request body should be empty
2598

    
2599
.. rubric:: Response
2600

    
2601
=========================== =====================
2602
Return Code                 Description
2603
=========================== =====================
2604
200 (OK)                    Request succeeded
2605
400 (Bad Request)           Malformed request or image id
2606
401 (Unauthorized)          Missing or expired user token
2607
403 (Forbidden)             Not allowed to access this information
2608
404 (Not Found)             Metadatum key not found
2609
500 (Internal Server Error) The request cannot be completed because of an
2610
\                           internal error
2611
503 (Service Unavailable)   The server is not currently available
2612
=========================== =====================
2613

    
2614
Response body content::
2615

    
2616
  metadata: {<key>: <value>}
2617

    
2618
*Example Get Image Metadatum Item: JSON*
2619

    
2620
.. code-block:: javascript
2621

    
2622
  {"metadata": {"os": "Xubuntu"}}
2623

    
2624
.. note:: In OS/Compute, ``metadata`` is ``meta``
2625

    
2626
Update Image Metadatum
2627
......................
2628

    
2629
.. rubric:: Request
2630

    
2631
===================================== ====== ======== ==========
2632
URI                                   Method Cyclades OS/Compute
2633
===================================== ====== ======== ==========
2634
``/images/<image-id>/metadata/<key>`` PUT    ✔        ✔
2635
===================================== ====== ======== ==========
2636

    
2637
* **image-id** is the identifier of the image
2638

    
2639
* **key** is the key of a matadatum ``key``:``value`` pair
2640

    
2641
|
2642

    
2643
==============  ========================= ======== ==========
2644
Request Header  Value                     Cyclades OS/Compute
2645
==============  ========================= ======== ==========
2646
X-Auth-Token    User authentication token required required
2647
Content-Type    Type or request body      required required
2648
Content-Length  Length of request body    required required
2649
==============  ========================= ======== ==========
2650

    
2651
**Example Request Headers**::
2652

    
2653
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
2654
  Content-Type:   application/json
2655
  Content-Length: 27
2656

    
2657
|
2658

    
2659
.. note:: Request parameters should be empty
2660

    
2661
Request body content::
2662

    
2663
  metadata: {<key>: <value>}
2664

    
2665
*Example Update Image Metadatum Item Request: JSON*
2666

    
2667
.. code-block:: javascript
2668

    
2669
  {"metadata": {"os": "Kubuntu"}}
2670

    
2671
.. rubric:: Response
2672

    
2673
=========================== =====================
2674
Return Code                 Description
2675
=========================== =====================
2676
201 (OK)                    Request succeeded
2677
400 (Bad Request)           Malformed request or image id
2678
401 (Unauthorized)          Missing or expired user token
2679
403 (Forbidden)             Not allowed to modify this image
2680
404 (Not Found)             Metadatum key not found
2681
413 (OverLimit)             Maximum number of metadata exceeded
2682
500 (Internal Server Error) The request cannot be completed because of an
2683
\                           internal error
2684
503 (Service Unavailable)   The server is not currently available
2685
=========================== =====================
2686

    
2687
Request body content::
2688

    
2689
  metadata: {<key>: <value>}
2690

    
2691
*Example Update Image Metadatum Item Response: JSON*
2692

    
2693
.. code-block:: javascript
2694

    
2695
  {"metadata": {"os": "Kubuntu"}}
2696

    
2697
Delete Image Metadatum
2698
......................
2699

    
2700
Delete an image metadatum by its key.
2701

    
2702
.. rubric:: Request
2703

    
2704
===================================== ====== ======== ==========
2705
URI                                   Method Cyclades OS/Compute
2706
===================================== ====== ======== ==========
2707
``/images/<image-id>/metadata/<key>`` DELETE ✔        ✔
2708
===================================== ====== ======== ==========
2709

    
2710
* **image-id** is the identifier of the image
2711

    
2712
* **key** is the key of a matadatum ``key``:``value`` pair
2713

    
2714
|
2715

    
2716
==============  ========================= ======== ==========
2717
Request Header  Value                     Cyclades OS/Compute
2718
==============  ========================= ======== ==========
2719
X-Auth-Token    User authentication token required required
2720
==============  ========================= ======== ==========
2721

    
2722
.. note:: Request parameters should be empty
2723

    
2724
.. note:: Request body should be empty
2725

    
2726
.. rubric:: Response
2727

    
2728
=========================== =====================
2729
Return Code                 Description
2730
=========================== =====================
2731
204 (OK)                    Request succeeded
2732
400 (Bad Request)           Malformed image ID
2733
401 (Unauthorized)          Missing or expired user token
2734
403 (Forbidden)             Not allowed to modify this image
2735
404 (Not Found)             Metadatum key not found
2736
500 (Internal Server Error) The request cannot be completed because of an
2737
\                           internal error
2738
503 (Service Unavailable)   The server is not currently available
2739
=========================== =====================
2740

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

    
2743
Networks
2744
--------
2745

    
2746
============= ======== ==========
2747
BASE URI      Cyclades OS/Compute
2748
============= ======== ==========
2749
``/networks`` ✔        **✘**
2750
============= ======== ==========
2751

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

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

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

    
2766
=============================================== ================================= ======
2767
Description                                     URI                               Method
2768
=============================================== ================================= ======
2769
`List <#list-networks>`_                        ``/networks``                     GET
2770
\                                               ``/networks/detail``              GET
2771
`Create <#create-network>`_                     ``/networks``                     POST
2772
`Get details <#get-network-details>`_           ``/networks/<network-id>``        GET
2773
`Rename <#rename-network>`_                     ``/networks/<network-id>``        PUT
2774
`Delete <#delete-network>`_                     ``/networks/<network-id>``        DELETE
2775
`Connect <#connect-network-to-server>`_         ``/networks/<network-id>/action`` POST
2776
`Disconnect <#disconnect-network-from-server>`_ ``/networks/<network-id>/action`` POST
2777
`Reassign <#reassign-network>`_                 ``/networks/<network-id>/action`` POST
2778
=============================================== ================================= ======
2779

    
2780

    
2781
List Networks
2782
.............
2783

    
2784
This operation lists the networks associated with a users account
2785

    
2786
.. rubric:: Request
2787

    
2788
==================== ======
2789
URI                  Method
2790
==================== ======
2791
``/networks``        GET
2792
``/networks/detail`` GET
2793
==================== ======
2794

    
2795
|
2796

    
2797
==============  =========================
2798
Request Header  Value
2799
==============  =========================
2800
X-Auth-Token    User authentication token
2801
==============  =========================
2802

    
2803
.. note:: Request parameters should be empty
2804

    
2805
.. note:: Request body should be empty
2806

    
2807
.. rubric:: Response
2808

    
2809
=========================== =====================
2810
Return Code                 Description
2811
=========================== =====================
2812
204 (OK)                    Request succeeded
2813
304 (Not Modified)
2814
400 (Bad Request)           Malformed network id
2815
401 (Unauthorized)          Missing or expired user token
2816
404 (Not Found)             Network not found
2817
409 (Build In Progress)     Server is not ready yet
2818
500 (Internal Server Error) The request cannot be completed because of an
2819
\                           internal error
2820
503 (Service Unavailable)   Action not supported or service currently
2821
\                           unavailable
2822
=========================== =====================
2823

    
2824
Response body content::
2825

    
2826
  networks: [
2827
    {
2828
      <network attribute>: <value>,
2829
      ...
2830
    },
2831
    ...
2832
  }
2833

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

    
2837
*Example Networks List Response: JSON (regular)*
2838

    
2839
.. code-block:: javascript
2840

    
2841
  {
2842
    "networks": [
2843
      {
2844
        "id": "1",
2845
        "name": "public",
2846
        "links": [
2847
            {
2848
                "href": "https://example.org/compute/v2.0/networks/1",
2849
                "rel": "self"
2850
            }, {
2851
                "href": "https://example.org/compute/v2.0/networks/1",
2852
                "rel": "bookmark"
2853
            }
2854
        ], 
2855
      },
2856
      {
2857
        "id": "2",
2858
        "name": "my private network",
2859
        "links": [
2860
            {
2861
                "href": "https://example.org/compute/v2.0/networks/2",
2862
                "rel": "self"
2863
            }, {
2864
                "href": "https://example.org/compute/v2.0/networks/2",
2865
                "rel": "bookmark"
2866
            }
2867
        ],
2868
      }
2869
    ]
2870
  }
2871

    
2872
*Example Networks List Response: JSON (detail)*
2873

    
2874
.. code-block:: javascript
2875

    
2876
  {
2877
    "networks": [
2878
      {
2879
        "id": "1",
2880
        "name": "public",
2881
        "links": [
2882
            {
2883
                "href": "https://example.org/compute/v2.0/networks/1", 
2884
                "rel": "self"
2885
            }, 
2886
            {
2887
                "href": "https://example.org/compute/v2.0/networks/1", 
2888
                "rel": "bookmark"
2889
            }
2890
        ], 
2891
        "created": "2011-04-20T15:31:08.199640+00:00",
2892
        "updated": "2011-05-06T12:47:05.582679+00:00",
2893
        "attachments": ["nic-42-0", "nic-73-0"]
2894
      }, {
2895
        "id": 2,
2896
        "name": "my private network",
2897
        "links": [
2898
            {
2899
                "href": "https://example.org/compute/v2.0/networks/2", 
2900
                "rel": "self"
2901
            }, 
2902
            {
2903
                "href": "https://example.org/compute/v2.0/networks/2", 
2904
                "rel": "bookmark"
2905
            }
2906
        ], 
2907
        "created": "2011-04-20T14:32:08.199640+00:00",
2908
        "updated": "2011-05-06T11:40:05.582679+00:00",
2909
        "attachments": ["nic-42-2", "nic-7-3"]
2910
      }
2911
    ]
2912
  }
2913

    
2914

    
2915
Create Network
2916
..............
2917

    
2918
This operation asynchronously provisions a new network.
2919

    
2920
.. rubric:: Request
2921

    
2922
==================== ======
2923
URI                  Method
2924
==================== ======
2925
``/networks``        POST
2926
==================== ======
2927

    
2928
|
2929

    
2930
==============  =========================
2931
Request Header  Value
2932
==============  =========================
2933
X-Auth-Token    User authentication token
2934
Content-Type    Type or request body     
2935
Content-Length  Length of request body   
2936
==============  =========================
2937

    
2938
**Example Request Headers**::
2939

    
2940
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
2941
  Content-Type:   application/json
2942
  Content-Length: 60
2943

    
2944
.. note:: Request parameters should be empty
2945

    
2946
Request body content::
2947

    
2948
  network: {
2949
    <request attribute>: <value>,
2950
    ...
2951
  }
2952

    
2953
================== ======================= ======== =======
2954
Request Attributes Description             Required Default
2955
================== ======================= ======== =======
2956
name               Network name            ✔
2957
type               Network type            ✔
2958
dhcp               If use DHCP             **✘**    True
2959
cidr               IPv4 CIDR               **✘**    192.168.1.0/2
2960
cidr6              IPv6 CDIR               **✘**    null
2961
gateway            IPv4 gateway address    **✘**    null
2962
gateway6           IPv6 gateway address    **✘**    null
2963
public             If a public network     **✘**    False
2964
project            Project assignment      **✘**    base project
2965
================== ======================= ======== =======
2966

    
2967
* **name** is a string
2968

    
2969
* **type** can be CUSTOM, IP_LESS_ROUTED, MAC_FILTERED, PHYSICAL_VLAN
2970

    
2971
* **dhcp** and **public** are flags
2972

    
2973
* **cidr**, and **gateway** are IPv4 addresses
2974

    
2975
* **cidr6**, and **gateway6** are IPv6 addresses
2976

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

    
2979
* **project** (optional) is the project where the network is to be assigned.
2980
  If not given, user's base project is assumed (identified with the same uuid
2981
  as the user).
2982

    
2983
*Example Create Network Request Body: JSON*
2984

    
2985
.. code-block:: javascript
2986

    
2987
  {"network": {"name": "private_net", "type": "MAC_FILTERED"}}
2988

    
2989
.. rubric:: Response
2990

    
2991
=========================== =====================
2992
Return Code                 Description
2993
=========================== =====================
2994
202 (OK)                    Request succeeded
2995
400 (Bad Request)           Malformed network id or request
2996
401 (Unauthorized)          Missing or expired user token
2997
403 (Forbidden)             Public network is forbidden
2998
404 (Not Found)             Network not found
2999
413 (Over Limit)            Reached networks limit
3000
415 (Bad Media Type)        Bad network type
3001
500 (Internal Server Error) The request cannot be completed because of an
3002
\                           internal error
3003
503 (Service Unavailable)   Failed to allocated network resources
3004
=========================== =====================
3005

    
3006
Response body content::
3007

    
3008
  network: {
3009
    <network attribute>: <value>,
3010
    ...
3011
  }
3012

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

    
3015
*Example Create Network Response: JSON*
3016

    
3017
.. code-block:: javascript
3018

    
3019
  {
3020
    "network": {
3021
      "status": "PENDING",
3022
      "updated": "2013-04-25T13:31:17.165237+00:00",
3023
      "name": "my private network",
3024
      "links": [
3025
        {
3026
            "href": "https://example.org/compute/v2.0/networks/6567",
3027
            "rel": "self"
3028
        }, {
3029
            "href": "https://example.org/compute/v2.0/networks/6567",
3030
            "rel": "bookmark"
3031
        }
3032
      ], 
3033
      "created": "2013-04-25T13:31:17.165088+00:00",
3034
      "cidr6": null,
3035
      "id": "6567",
3036
      "gateway6": null,
3037
      "public": false,
3038
      "dhcp": false,
3039
      "cidr": "192.168.1.0/24",
3040
      "type": "MAC_FILTERED",
3041
      "gateway": null,
3042
      "attachments": []
3043
    }
3044
  }
3045

    
3046
Get Network Details
3047
...................
3048

    
3049
.. rubric:: Request
3050

    
3051
========================== ======
3052
URI                        Method
3053
========================== ======
3054
``/networks/<network-id>`` GET
3055
========================== ======
3056

    
3057
* **network-id** is the identifier of the network
3058

    
3059
|
3060

    
3061
==============  =========================
3062
Request Header  Value
3063
==============  =========================
3064
X-Auth-Token    User authentication token
3065
==============  =========================
3066

    
3067
.. note:: Request parameters should be empty
3068

    
3069
.. note:: Request body should be empty
3070

    
3071
.. rubric:: Response
3072

    
3073
=========================== =====================
3074
Return Code                 Description
3075
=========================== =====================
3076
200 (OK)                    Request succeeded
3077
400 (Bad Request)           Malformed request or network id
3078
401 (Unauthorized)          Missing or expired user token
3079
404 (Not Found)             Network not found
3080
500 (Internal Server Error) The request cannot be completed because of an
3081
\                           internal error
3082
503 (Service Unavailable)   The service is not currently available
3083
=========================== =====================
3084

    
3085
Response code content::
3086

    
3087
  network: {
3088
    <network attribute>: <value>,
3089
    ...
3090
  }
3091

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

    
3094
*Example Get Network Details Response: JSON*
3095

    
3096
.. code-block:: javascript
3097

    
3098
  {
3099
    "network": {
3100
      "status": "PENDING",
3101
      "updated": "2013-04-25T13:31:17.165237+00:00",
3102
      "name": "my private network",
3103
      "links": [
3104
        {
3105
            "href": "https://example.org/compute/v2.0/networks/6567", 
3106
            "rel": "self"
3107
        }, {
3108
            "href": "https://example.org/compute/v2.0/networks/6567", 
3109
            "rel": "bookmark"
3110
        }
3111
      ],
3112
      "created": "2013-04-25T13:31:17.165088+00:00",
3113
      "cidr6": null,
3114
      "id": "6567",
3115
      "gateway6": null,
3116
      "public": false,
3117
      "dhcp": false,
3118
      "cidr": "192.168.1.0/24",
3119
      "type": "MAC_FILTERED",
3120
      "gateway": null,
3121
      "attachments": []
3122
    }
3123
  }
3124

    
3125
Rename Network
3126
..............
3127

    
3128
.. rubric:: Request
3129

    
3130
========================== ======
3131
URI                        Method
3132
========================== ======
3133
``/networks/<network-id>`` PUT
3134
========================== ======
3135

    
3136
* **network-id** is the identifier of the network
3137

    
3138
|
3139

    
3140
==============  =========================
3141
Request Header  Value
3142
==============  =========================
3143
X-Auth-Token    User authentication token
3144
Content-Type    Type or request body
3145
Content-Length  Length of request body
3146
==============  =========================
3147

    
3148
**Example Request Headers**::
3149

    
3150
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
3151
  Content-Type:   application/json
3152
  Content-Length: 33
3153

    
3154
.. note:: Request parameters should be empty
3155

    
3156
Request body content::
3157

    
3158
  network: {name: <new value>}
3159

    
3160
*Example Update Network Name Request: JSON*
3161

    
3162
.. code-block:: javascript
3163

    
3164
  {"network": {"name": "new_name"}}
3165

    
3166
.. rubric:: Response
3167

    
3168
=========================== =====================
3169
Return Code                 Description
3170
=========================== =====================
3171
204 (OK)                    Request succeeded
3172
400 (Bad Request)           Malformed request or network deleted
3173
401 (Unauthorized)          Missing or expired user token
3174
403 (Forbidden)             Administratively suspended server
3175
404 (Not Found)             Network not found
3176
413 (Over Limit)            Network Limit Exceeded
3177
415 (Bad Media Type)        Bad network type
3178
500 (Internal Server Error) The request cannot be completed because of an
3179
\                           internal error
3180
503 (Service Unavailable)   The service is not currently available
3181
=========================== =====================
3182

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

    
3185
Delete Network
3186
..............
3187

    
3188
A network is deleted as long as it is not attached to any virtual servers.
3189

    
3190
.. rubric:: Request
3191

    
3192
========================== ======
3193
URI                        Method
3194
========================== ======
3195
``/networks/<network-id>`` DELETE
3196
========================== ======
3197

    
3198
* **network-id** is the identifier of the network
3199

    
3200
|
3201

    
3202
==============  =========================
3203
Request Header  Value
3204
==============  =========================
3205
X-Auth-Token    User authentication token
3206
==============  =========================
3207

    
3208
.. note:: Request parameters should be empty
3209

    
3210
.. note:: Request body should be empty
3211

    
3212
.. rubric:: Response
3213

    
3214
=========================== =====================
3215
Return Code                 Description
3216
=========================== =====================
3217
204 (OK)                    Request succeeded
3218
400 (Bad Request)           Malformed request or network already deleted
3219
401 (Unauthorized)          Missing or expired user token
3220
403 (Forbidden)             Administratively suspended server
3221
404 (Not Found)             Network not found
3222
421 (Network In Use)        The network is in use and cannot be deleted
3223
500 (Internal Server Error) The request cannot be completed because of an
3224
\                           internal error
3225
503 (Service Unavailable)   The service is not currently available
3226
=========================== =====================
3227

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

    
3230

    
3231
Connect network to Server
3232
..........................
3233

    
3234
Connect a network to a virtual server. The effect of this operation is the
3235
creation of a NIC that connects the two parts.
3236

    
3237
.. rubric:: Request
3238

    
3239
================================= ======
3240
URI                               Method
3241
================================= ======
3242
``/networks/<network-id>/action`` POST
3243
================================= ======
3244

    
3245
* **network-id** is the identifier of the network
3246

    
3247
|
3248

    
3249
==============  =========================
3250
Request Header  Value
3251
==============  =========================
3252
X-Auth-Token    User authentication token
3253
Content-Type    Type or request body
3254
Content-Length  Length of request body
3255
==============  =========================
3256

    
3257
**Example Request Headers**::
3258

    
3259
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
3260
  Content-Type:   application/json
3261
  Content-Length: 28
3262

    
3263
.. note:: Request parameters should be empty
3264

    
3265
Response body content (connect)::
3266

    
3267
  add {serverRef: <server id to connect>}
3268

    
3269
*Example Action Add (connect to): JSON*
3270

    
3271
.. code-block:: javascript
3272

    
3273
  {"add" : {"serverRef" : 42}}
3274

    
3275
.. rubric:: Response
3276

    
3277
=========================== =====================
3278
Return Code                 Description
3279
=========================== =====================
3280
202 (OK)                    Request succeeded
3281
400 (Bad Request)           Malformed request or network already deleted
3282
401 (Unauthorized)          Missing or expired user token
3283
403 (Forbidden)             Not allowed to modify this network (e.g. public)
3284
404 (Not Found)             Network not found
3285
500 (Internal Server Error) The request cannot be completed because of an
3286
\                           internal error
3287
503 (Service Unavailable)   The service is not currently available
3288
=========================== =====================
3289

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

    
3292
Disconnect network from Server
3293
..............................
3294

    
3295
Disconnect a network from a virtual server. The effect of this operation is the
3296
deletion of the NIC that connects the two parts.
3297

    
3298
.. rubric:: Request
3299

    
3300
================================= ======
3301
URI                               Method
3302
================================= ======
3303
``/networks/<network-id>/action`` POST
3304
================================= ======
3305

    
3306
* **network-id** is the identifier of the network
3307

    
3308
|
3309

    
3310
==============  =========================
3311
Request Header  Value
3312
==============  =========================
3313
X-Auth-Token    User authentication token
3314
Content-Type    Type or request body
3315
Content-Length  Length of request body
3316
==============  =========================
3317

    
3318
**Example Request Headers**::
3319

    
3320
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
3321
  Content-Type:   application/json
3322
  Content-Length: 31
3323

    
3324
.. note:: Request parameters should be empty
3325

    
3326
Response body content (disconnect)::
3327

    
3328
  remove {serverRef: <server id to disconnect>}
3329

    
3330
*Example Action Remove (disconnect from): JSON*
3331

    
3332
.. code-block:: javascript
3333

    
3334
  {"remove" : {"serverRef" : 42}}
3335

    
3336
.. rubric:: Response
3337

    
3338
=========================== =====================
3339
Return Code                 Description
3340
=========================== =====================
3341
202 (OK)                    Request succeeded
3342
400 (Bad Request)           Malformed request or network already deleted
3343
401 (Unauthorized)          Missing or expired user token
3344
403 (Forbidden)             Not allowed to modify this network (e.g. public)
3345
404 (Not Found)             Network not found
3346
500 (Internal Server Error) The request cannot be completed because of an
3347
\                           internal error
3348
503 (Service Unavailable)   The service is not currently available
3349
=========================== =====================
3350

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

    
3353
Reassign Network
3354
................
3355

    
3356
Assign a network to a different project.
3357

    
3358
.. rubric:: Request
3359

    
3360
================================= ======
3361
URI                               Method
3362
================================= ======
3363
``/networks/<network-id>/action`` POST
3364
================================= ======
3365

    
3366
* **network-id** is the identifier of the network
3367

    
3368
|
3369

    
3370
==============  =========================
3371
Request Header  Value
3372
==============  =========================
3373
X-Auth-Token    User authentication token
3374
Content-Type    Type or request body
3375
Content-Length  Length of request body
3376
==============  =========================
3377

    
3378
**Example Request Headers**::
3379

    
3380
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
3381
  Content-Type:   application/json
3382
  Content-Length: 31
3383

    
3384
.. note:: Request parameters should be empty
3385

    
3386
Response body content (reassign)::
3387

    
3388
  reassign {project: <project-id>}
3389

    
3390
*Example Action Reassign: JSON*
3391

    
3392
.. code-block:: javascript
3393

    
3394
  {"reassign" : {"project" : "9969f2fd-86d8-45d6-9106-5e251f7dd92f"}}
3395

    
3396
.. rubric:: Response
3397

    
3398
=========================== =====================
3399
Return Code                 Description
3400
=========================== =====================
3401
200 (OK)                    Request succeeded
3402
400 (Bad Request)           Malformed request
3403
401 (Unauthorized)          Missing or expired user token
3404
403 (Forbidden)             Not allowed to modify this network (e.g. public)
3405
404 (Not Found)             Network not found
3406
500 (Internal Server Error) The request cannot be completed because of an
3407
\                           internal error
3408
503 (Service Unavailable)   The service is not currently available
3409
=========================== =====================
3410

    
3411
.. note:: In case of a 200 code, the request body should be empty
3412

    
3413
Index of Attributes
3414
-------------------
3415

    
3416
.. _server-ref:
3417

    
3418
Server Attributes
3419
.................
3420

    
3421
================ ========================== ======== ==========
3422
Server attribute Description                Cyclades OS/Compute
3423
================ ========================== ======== ==========
3424
id               Server ID                  ✔        ✔
3425
name             Server Name                ✔        ✔
3426
status           Server Status              ✔        ✔
3427
updated          Date of last modification  ✔        ✔
3428
created          Date of creation           ✔        ✔
3429
hostId           Physical host              empty    ✔
3430
image            A full image descreption   ✔        ✔
3431
flavor           A full flavor description  ✔        ✔
3432
adminPass        Superuser Password         ✔        ✔
3433
suspended        If server is suspended     ✔        ✔
3434
progress         Build progress             ✔        ✔
3435
metadata         Custom server metadata     ✔        ✔
3436
user_id          Server owner               **✘**    ✔
3437
tenant_id        Server tenant              **✘**    ✔
3438
accessIPv4       Server IPV4 net address    **✘**    ✔
3439
accessIPv6       Server IPV4 net address    **✘**    ✔
3440
addresses        Nets connected on server   **✘**    ✔
3441
links            Server links               **✘**    ✔
3442
================ ========================== ======== ==========
3443

    
3444
* **status** values are described `here <#status-ref>`_
3445

    
3446
* **updated** and **created** are date-formated
3447

    
3448
* **hostId** is always empty in Cyclades and is returned for compatibility reasons
3449

    
3450
* **image** and **flavor** always refer to existing Image and Flavor
3451
  specifications.
3452

    
3453
* **adminPass** in Cyclades it is generated automatically during creation. For
3454
  safety, it is not stored anywhere in the system and it cannot be recovered
3455
  with a query request
3456

    
3457
* **suspended** is True only of the server is suspended by the cloud
3458
  administrations or policy
3459

    
3460
* **progress** is a number between 0 and 100 and reflects the server building
3461
  status
3462

    
3463
* **metadata** are custom key:value pairs refering to the VM. In Cyclades, the
3464
  ``OS`` and ``users`` metadata are automatically retrieved from the servers
3465
  image during creation
3466

    
3467
.. _status-ref:
3468

    
3469
Server Status
3470
.............
3471

    
3472
============= ==================== ======== ==========
3473
Status        Description          Cyclades OS/Compute
3474
============= ==================== ======== ==========
3475
BUILD         Building             ✔        ✔
3476
ACTIVE        Up and running       ✔        ✔
3477
STOPPED       Shut down            ✔        **✘**
3478
REBOOT        Rebooting            ✔        ✔
3479
DELETED       Removed              ✔        ✔
3480
UNKNOWN       Unexpected error     ✔        ✔
3481
ERROR         In error             ✔        ✔
3482
HARD_REBOOT   Hard rebooting       **✘**    ✔
3483
PASSWORD      Resetting password   **✘**    ✔
3484
REBUILD       Rebuilding server    **✘**    ✔
3485
RESCUE        In rescue mode       **✘**    ✔
3486
RESIZE        Resizing             **✘**    ✔
3487
REVERT_RESIZE Failed to resize     **✘**    ✔
3488
SHUTOFF       Shut down by user    **✘**    ✔
3489
SUSPENDED     Suspended            **✘**    ✔
3490
VERIFY_RESIZE Waiting confirmation **✘**    ✔
3491
============= ==================== ======== ==========
3492

    
3493
.. _network-ref:
3494

    
3495
Network
3496
.......
3497

    
3498
.. note:: Networks are features in Cyclades API but not in OS/Compute API
3499

    
3500
================== ===========
3501
Network Attributes Description
3502
================== ===========
3503
id                 Network identifier
3504
name               Network name
3505
created            Date of creation
3506
updates            Date of last update
3507
cidr               IPv4 CIDR Address
3508
cidr6              IPv6 CIDR Address
3509
dhcp               IPv4 DHCP Address
3510
dhcp6              IPv6 DHCP Address
3511
gateway            IPv4 Gateway Address
3512
gateway6           IPv6 Gateway Address
3513
public             If the network is public
3514
status             Network status
3515
attachments        Network Interface Connections (NICs)
3516
================== ===========
3517

    
3518
* **id** and **name** are int and string respectively
3519

    
3520
* **created** and **updated** are ISO8061 date strings
3521

    
3522
* **public** is a boolean flag
3523

    
3524
* **status** can be PENDING, ACTIVE or DELETED
3525

    
3526
* **attachments** refers to the NICs connecting servers on that network.
3527

    
3528
.. _nic-ref:
3529

    
3530
Network Interface Connection (NIC)
3531
..................................
3532

    
3533
A Network Interface Connection (NIC) represents a servers connection to a
3534
network.
3535

    
3536
A NIC is identified by a server and an (obviously unique) mac address. A server
3537
can have multiple NICs, though. In practice, a NIC id is used of reference and
3538
identification.
3539

    
3540
Each NIC is used to connect a specific server to a network. The network is
3541
aware of that connection for as long as it holds. If a NIC is disconnected from
3542
a network, it is destroyed.
3543

    
3544
A NIC specification contains the following information:
3545

    
3546
================= ====================== ======== ==========
3547
Server Attributes Description            Cyclades OS/Compute
3548
================= ====================== ======== ==========
3549
id                The NIC id             ✔        **✘**
3550
mac_address       NIC's mac address      ✔        **✘**
3551
network_id        Network of connection  ✔        **✘**
3552
firewallProfile   The firewall profile   ✔        **✘**
3553
ipv4              IP v4 address          ✔        **✘**
3554
ipv6              IP v6 address          ✔        **✘**
3555
================= ====================== ======== ==========
3556

    
3557
* **id** is the unique identified of the NIC. It consists of the server id and
3558
  an ordinal number nic-<server-id>-<ordinal number> , e.g. for a server with
3559
  id 42::
3560

    
3561
    nic-42-0, nic-42-1, ...
3562

    
3563
* **mac_address** is the unique mac address of the interface
3564

    
3565
* **network_id** is the id of the network this nic connects to.
3566

    
3567
* **firewallProfile** , if set, refers to the mode of the firewall. Valid
3568
  firewall profile values::
3569

    
3570
    ENABLED, DISABLED, PROTECTED
3571

    
3572
* **ipv4** and **ipv6** are the IP addresses (versions 4 and 6 respectively) of
3573
  the specific network connection for that machine.
3574

    
3575
.. _flavor-ref:
3576

    
3577
Flavor
3578
......
3579

    
3580
A flavor is a hardware configuration for a server. It contains the following
3581
information:
3582

    
3583
================= ==================== ======== ==========
3584
Flavor Attributes Description          Cyclades OS/Compute
3585
================= ==================== ======== ==========
3586
id                The flavor id        ✔        ✔
3587
name              The flavor name      ✔        ✔
3588
ram               Server RAM size      ✔        ✔
3589
SNF:disk_template Storage mechanism    ✔        **✘**
3590
disk              Server disk size     ✔        ✔
3591
vcpus             # of Virtual CPUs    ✔        ✔
3592
links rel         Atom link rel field  **✘**    ✔
3593
links href        Atom link href field **✘**    ✔
3594
================= ==================== ======== ==========
3595

    
3596
* **id** is the flavor unique id (a possitive integer)
3597

    
3598
* **name** is the flavor name (a string)
3599

    
3600
* **ram** is the server RAM size in MB
3601

    
3602
* **SNF:disk_template** is a reference to the underlying storage mechanism
3603
  used by the Cyclades server. It is Cyclades specific.
3604

    
3605
* **disk** the servers disk size in GB
3606

    
3607
* **vcpus** refer to the number of virtual CPUs assigned to a server
3608

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

    
3612
.. _image-ref:
3613

    
3614
Image
3615
.....
3616

    
3617
An image is a collection of files you use to create or rebuild a server.
3618

    
3619
An image item may have the fields presented bellow:
3620

    
3621
================= ====================== ======== ==========
3622
Server Attributes Description            Cyclades OS/Compute
3623
================= ====================== ======== ==========
3624
id                Image ID               ✔        ✔
3625
name              Image name             ✔        ✔
3626
updated           Last update date       ✔        ✔
3627
created           Image creation date    ✔        ✔
3628
progress          Ready status progress  ✔        **✘**
3629
status            Image status           **✘**    ✔
3630
tenant_id         Image creator          **✘**    ✔
3631
user_id           Image users            **✘**    ✔
3632
metadata          Custom metadata        ✔        ✔
3633
links             Atom links             **✘**    ✔
3634
minDisk           Minimum required disk  **✘**    ✔
3635
minRam            Minimum required RAM   **✘**    ✔
3636
================= ====================== ======== ==========
3637

    
3638
* **id** is the image id and **name** is the image name. They are both strings.
3639

    
3640
* **updated** and **created** are both ISO8601 date strings
3641

    
3642
* **progress** varies between 0 and 100 and denotes the status of the image
3643

    
3644
* **metadata** is a collection of ``key``:``values`` pairs of custom metadata,
3645
  under the tag ``values`` which lies under the tag ``metadata``.
3646

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