Statistics
| Branch: | Tag: | Revision:

root / docs / cyclades-api-guide.rst @ 701eab3b

History | View | Annotate | Download (113.5 kB)

1
.. _cyclades-api-guide:
2

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

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

    
11
This document's goals are:
12

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
65
* Pagination is currently not supported.
66

    
67
* Cached responses are currently not supported.
68

    
69
* Limits are currently not supported.
70

    
71
* Extensions are currently not supported.
72

    
73

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

    
77
Servers
78
-------
79

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

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

    
104
List all virtual servers owned by the user.
105

    
106
.. rubric:: Request
107

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

    
115
* Both requests return a list of servers. The first returns just ``id``,
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
=========== ==================== ======== ==========
457

    
458
* **name** can be any string
459

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

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

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

    
473
====================== =================== ======== ==========
474
Personality Attributes Description         Cyclades OS/Compute
475
====================== =================== ======== ==========
476
path                   File path on server ✔        ✔
477
contents               Data to inject      ✔        ✔
478
group                  User group          ✔        **✘**
479
mode                   File access mode    ✔        **✘**
480
owner                  File owner          ✔        **✘**
481
====================== =================== ======== ==========
482

    
483
*Example Create Server Request: JSON*
484

    
485
.. code-block:: javascript
486

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

    
514
.. rubric:: Response
515

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

    
533
|
534

    
535
Response body contents::
536

    
537
  server: {
538
    <server attribute>: <value>,
539
    ...
540
  }
541

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

    
544
*Example Create Server Response: JSON*
545

    
546
.. code-block:: javascript
547

    
548
  {
549
    "server": {
550
      "addresses": 
551
      "id": 28130,
552
        "links": [
553
            {
554
                "href": "https://example.org/compute/v2.0/servers/42", 
555
                "rel": "self"
556
            }, 
557
            {
558
                "href": "https://example.org/compute/v2.0/servers/42", 
559
                "rel": "bookmark"
560
            }
561
        ],
562

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

    
605
*Example Create Server Response: XML*
606

    
607
.. code-block:: xml
608

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

    
623
Get Server Stats
624
................
625

    
626
.. note:: This operation is not part of OS/Compute v2.
627

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

    
630
.. rubric:: Request
631

    
632
============================== ====== ======== ==========
633
URI                            Method Cyclades OS/Compute
634
============================== ====== ======== ==========
635
``/servers/<server-id>/stats`` GET    ✔        **✘**
636
============================== ====== ======== ==========
637

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

    
640
|
641

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

    
648
|
649

    
650
================= ===============
651
Request Parameter Value          
652
================= ===============
653
json              Respond in json
654
xml               Respond in xml 
655
================= ===============
656

    
657
* **json** and **xml** parameters are mutually exclusive. If none supported,
658
the response will be formated in json.
659

    
660
.. note:: Request body should be empty
661

    
662
.. rubric:: Response
663

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

    
677
|
678

    
679
Response body contents::
680

    
681
  stats: {<parameter>: <value> }
682

    
683
============= ======================
684
Parameter     Description
685
============= ======================
686
serverRef     Server ID
687
refresh       Refresh frequency
688
cpuBar        Latest CPU load graph URL
689
cpuTimeSeries CPU load / time graph URL
690
netBar        Latest Network load graph URL
691
netTimeSeries Network load / time graph URL
692
============= ======================
693

    
694
* **refresh** is the recommended sampling rate
695

    
696
*Example Get Server Stats Response: JSON*
697

    
698
.. code-block:: javascript
699

    
700
  {
701
    "stats": {
702
      "serverRef": 1,
703
      "refresh": 60,
704
      "cpuBar": "http://stats.okeanos.grnet.gr/b9a...048c/cpu-bar.png",
705
      "cpuTimeSeries": "http://stats.okeanos.grnet.gr/b9a...048c/cpu-ts.png",
706
      "netBar": "http://stats.okeanos.grnet.gr/b9a...048c/net-bar.png",
707
      "netTimeSeries": "http://stats.okeanos.grnet.gr/b9a...048c/net-ts.png"
708
    }
709
  }
710

    
711
*Example Get Network Details Response: XML*
712

    
713
.. code-block:: xml
714

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

    
726
Get Server Diagnostics
727
......................
728

    
729
.. note:: This operation is not part of OS/Compute v2.
730

    
731
This operation returns diagnostic information (logs) for a server.
732

    
733
.. rubric:: Request
734

    
735
==================================== ====== ======== ==========
736
URI                                  Method Cyclades OS/Compute
737
==================================== ====== ======== ==========
738
``/servers/<server-id>/diagnostics`` GET    ✔        **✘**
739
==================================== ====== ======== ==========
740

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

    
743
|
744

    
745
==============  ========================= ======== ==========
746
Request Header  Value                     Cyclades OS/Compute
747
==============  ========================= ======== ==========
748
X-Auth-Token    User authentication token required required
749
==============  ========================= ======== ==========
750

    
751
.. note:: Request parameters should be empty
752

    
753
.. note:: Request body should be empty
754

    
755
.. rubric:: Response
756

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

    
770
|
771

    
772
Response body contents::
773

    
774
  [
775
    {
776
      <diagnostic attribute}: <value>,
777
      ...
778
    }, {
779
      <diagnostic attribute}: <value>,
780
      ...
781
    },
782
    ...
783
  ]
784

    
785
==================== ===========
786
Diagnostic attribute Description
787
==================== ===========
788
level                Debug level
789
created              Log entry timestamp
790
source               Log source proccess
791
source_date          Log source date
792
message              Log description
793
details              Detailed log description
794
==================== ===========
795

    
796
*Example Get Server Diagnostics Response: JSON*
797

    
798
.. code-block:: javascript
799

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

    
825
Get Server Details
826
..................
827

    
828
This operation returns detailed information for a virtual server
829

    
830
.. rubric:: Request
831

    
832
======================== ====== ======== ==========
833
URI                      Method Cyclades OS/Compute
834
======================== ====== ======== ==========
835
``/servers/<server id>`` GET    ✔        ✔
836
======================== ====== ======== ==========
837

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

    
840
|
841

    
842
==============  ========================= ======== ==========
843
Request Header  Value                     Cyclades OS/Compute
844
==============  ========================= ======== ==========
845
X-Auth-Token    User authentication token required required
846
==============  ========================= ======== ==========
847

    
848
.. note:: Request parameters should be empty
849

    
850
.. note:: Request body should be empty
851

    
852
.. rubric:: Response
853

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

    
868
|
869

    
870
Response body contents::
871

    
872
  server: {
873
    <server attribute>: <value>,
874
    ...
875
  }
876

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

    
896
* **hostId** is not used in Cyclades, but is returned as an empty string for
897
  compatibility
898

    
899
* **progress** is changing while the server is building up and has values
900
  between 0 and 100. When it reaches 100 the server is built.
901

    
902
* **status** refers to `the status <#status-ref>`_ of the server
903

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

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

    
914
* **diagnostics** is a list of items that contain key:value information useful
915
  for diagnosing the server behavior and may be used by the administrators of
916
  deployed Synnefo setups.
917

    
918
*Example Details for server with id 42042: JSON*
919

    
920
.. code-block:: javascript
921

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

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

    
998
Rename Server
999
.............
1000

    
1001
Modify the ``name`` attribute of a virtual server. OS/Compute API also features
1002
the modification of IP addresses
1003

    
1004
.. rubric:: Response
1005

    
1006
======================== ====== ======== ==========
1007
URI                      Method Cyclades OS/Compute
1008
======================== ====== ======== ==========
1009
``/servers/<server id>`` PUT    ✔        ✔
1010
======================== ====== ======== ==========
1011

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

    
1014
|
1015

    
1016
==============  ========================= ======== ==========
1017
Request Header  Value                     Cyclades OS/Compute
1018
==============  ========================= ======== ==========
1019
X-Auth-Token    User authentication token required required
1020
Content-Type    Type or request body      required required
1021
Content-Length  Length of request body    required required
1022
==============  ========================= ======== ==========
1023

    
1024
**Example Request Headers**::
1025

    
1026
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
1027
  Content-Type:   application/json
1028
  Content-Length: 54
1029

    
1030
.. note:: Request parameters should be empty
1031

    
1032
Request body contents::
1033

    
1034
  server: {
1035
    <server attribute>: <value>,
1036
    ...
1037
  }
1038

    
1039
=========== ==================== ======== ==========
1040
Attribute   Description          Cyclades OS/Compute
1041
=========== ==================== ======== ==========
1042
name        The server name      ✔        ✔
1043
accessIPv4  IP v4 address        **✘**    ✔
1044
accessIPv6  IP v6 address        **✘**    ✔
1045
=========== ==================== ======== ==========
1046

    
1047
* Cyclades support multiple network connections per virtual server, which
1048
  explains the above differences in request body attributes.
1049

    
1050
*Example Rename Server Request: JSON*
1051

    
1052
.. code-block:: javascript
1053

    
1054
  {"server": {"name": "A new name for my virtual server"}}
1055

    
1056
.. rubric:: Response
1057

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

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

    
1078
Delete Server
1079
.............
1080

    
1081
Delete a virtual server. When a server is deleted, all its connections are
1082
deleted as well.
1083

    
1084
.. rubric:: Request
1085

    
1086
======================== ====== ======== ==========
1087
URI                      Method Cyclades OS/Compute
1088
======================== ====== ======== ==========
1089
``/servers/<server id>`` DELETE ✔        ✔
1090
======================== ====== ======== ==========
1091

    
1092
* **server-id** is the identifier of the virtual server.
1093

    
1094
|
1095

    
1096
==============  ========================= ======== ==========
1097
Request Header  Value                     Cyclades OS/Compute
1098
==============  ========================= ======== ==========
1099
X-Auth-Token    User authentication token required required
1100
==============  ========================= ======== ==========
1101

    
1102
.. note:: Request parameters should be empty
1103

    
1104
.. note:: Request body should be empty
1105

    
1106
.. rubric:: Response
1107

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

    
1122
.. note:: In case of a 204 code, response body should be empty
1123

    
1124
List Server Addresses
1125
.....................
1126

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

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

    
1135
.. rubric:: Request
1136

    
1137
============================ ====== ======== ==========
1138
URI                          Method Cyclades OS/Compute
1139
============================ ====== ======== ==========
1140
``/servers/<server id>/ips`` GET    ✔        ✔
1141
============================ ====== ======== ==========
1142

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

    
1145
|
1146

    
1147
==============  ========================= ======== ==========
1148
Request Header  Value                     Cyclades OS/Compute
1149
==============  ========================= ======== ==========
1150
X-Auth-Token    User authentication token required required
1151
==============  ========================= ======== ==========
1152

    
1153
.. note:: Request parameters should be empty
1154

    
1155
.. note:: Request body should be empty
1156

    
1157
.. rubric:: Response
1158

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

    
1172
Response body contents::
1173

    
1174
  addresses: [
1175
    {
1176
      <NIC attribute>: <value>,
1177
      ...
1178
    },
1179
    ...
1180
  ]
1181

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

    
1186
*Example List Addresses: JSON*
1187

    
1188
.. code-block:: javascript
1189

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

    
1210
Get Server NICs by Network
1211
..........................
1212

    
1213
Return the NIC that connects a server to a network.
1214

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

    
1219
.. rubric:: Request
1220

    
1221
========================================= ====== ======== ==========
1222
URI                                       Method Cyclades OS/Compute
1223
========================================= ====== ======== ==========
1224
``/servers/<server id>/ips/<network id>`` GET    ✔        ✔
1225
========================================= ====== ======== ==========
1226

    
1227
* **server id** is the identifier of the virtual server
1228

    
1229
* **network id** is the identifier of the network
1230

    
1231
|
1232

    
1233
==============  ========================= ======== ==========
1234
Request Header  Value                     Cyclades OS/Compute
1235
==============  ========================= ======== ==========
1236
X-Auth-Token    User authentication token required required
1237
==============  ========================= ======== ==========
1238

    
1239
.. note:: Request parameters should be empty
1240

    
1241
.. note:: Request body should be empty
1242

    
1243
.. rubric:: Response
1244

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

    
1258
|
1259

    
1260
Response body contents::
1261

    
1262
  network: {
1263
    <NIC attributes>: <value>,
1264
    ...
1265
  }
1266

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

    
1269
**List Server NICs Example with server id 25455, network id 7: JSON**
1270

    
1271
.. code-block:: javascript
1272

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

    
1284

    
1285
List Server Metadata
1286
....................
1287

    
1288
List the metadata of a server
1289

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

    
1293
.. rubric:: Request
1294

    
1295
================================= ====== ======== ==========
1296
URI                               Method Cyclades OS/Compute
1297
================================= ====== ======== ==========
1298
``/servers/<server-id>/metadata`` GET    ✔        ✔
1299
================================= ====== ======== ==========
1300

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

    
1303
|
1304

    
1305
==============  ========================= ======== ==========
1306
Request Header  Value                     Cyclades OS/Compute
1307
==============  ========================= ======== ==========
1308
X-Auth-Token    User authentication token required required
1309
==============  ========================= ======== ==========
1310

    
1311
.. note:: Request parameters should be empty
1312

    
1313
.. note:: Request body should be empty
1314

    
1315
.. rubric:: Response
1316

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

    
1330
Response body contents::
1331

    
1332
  metadata: {
1333
    <key>: <value>,
1334
      ...
1335
  }
1336

    
1337
*Example List Server Metadata: JSON*
1338

    
1339
.. code-block:: javascript
1340

    
1341
  {
1342
    ""metadata": {
1343
      "OS": "Linux",
1344
      "users": "root"
1345
    }
1346
  }
1347

    
1348
Set / Update Server Metadata
1349
............................
1350

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

    
1359
In Cyclades API, metadata keys which are not referred by the operation will
1360
remain intact, while metadata referred by the operation will be overwritten.
1361

    
1362
.. rubric:: Request
1363

    
1364
================================= ====== ======== ==========
1365
URI                               Method Cyclades OS/Compute
1366
================================= ====== ======== ==========
1367
``/servers/<server-id>/metadata`` PUT    **✘**    ✔
1368
``/servers/<server-id>/metadata`` POST   ✔       ✔
1369
================================= ====== ======== ==========
1370

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

    
1373
|
1374

    
1375
==============  ========================= ======== ==========
1376
Request Header  Value                     Cyclades OS/Compute
1377
==============  ========================= ======== ==========
1378
X-Auth-Token    User authentication token required required
1379
Content-Type    Type or request body      required required
1380
Content-Length  Length of request body    required required
1381
==============  ========================= ======== ==========
1382

    
1383
**Example Request Headers**::
1384

    
1385
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
1386
  Content-Type:   application/json
1387
  Content-Length: 56
1388

    
1389
.. note:: Request parameters should be empty
1390

    
1391
Request body contents::
1392

    
1393
  metadata: {
1394
    <key>: <value>,
1395
    ...
1396
  }
1397

    
1398
*Example Request Set / Update Server Metadata: JSON*
1399

    
1400
.. code-block:: javascript
1401

    
1402
  {"metadata": {"role": "webmail", "users": "root,maild"}}
1403

    
1404
.. rubric:: Response
1405

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

    
1420
Response body contents::
1421

    
1422
  metadata: {
1423
    <key>: <value>,
1424
    ...
1425
  }
1426

    
1427
*Example Response Set / Update Server Metadata: JSON*
1428

    
1429
.. code-block:: javascript
1430

    
1431
  {"metadata": {"OS": "Linux", "role": "webmail", "users": "root,maild"}}
1432

    
1433
Get Server Metadata Item
1434
........................
1435

    
1436
Get the value of a specific piece of metadata of a virtual server
1437

    
1438
.. rubric:: Request
1439

    
1440
======================================= ====== ======== ==========
1441
URI                                     Method Cyclades OS/Compute
1442
======================================= ====== ======== ==========
1443
``/servers/<server-id>/metadata/<key>`` GET    ✔        ✔
1444
======================================= ====== ======== ==========
1445

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

    
1448
* **key** is the key of a matadatum ``key``:``value`` pair
1449

    
1450
|
1451

    
1452
==============  ========================= ======== ==========
1453
Request Header  Value                     Cyclades OS/Compute
1454
==============  ========================= ======== ==========
1455
X-Auth-Token    User authentication token required required
1456
==============  ========================= ======== ==========
1457

    
1458
.. note:: Request parameters should be empty
1459

    
1460
.. note:: Request body should be empty
1461

    
1462
.. rubric:: Response
1463

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

    
1477
Response body content::
1478

    
1479
  metadata: {<key>: <value>}
1480

    
1481
*Example Get Server Metadatum for Item 'role', JSON*
1482

    
1483
.. code-block:: javascript
1484

    
1485
  {"metadata": {"role": "webmail"}}
1486

    
1487
Update Server Metadatum Item
1488
.............................
1489

    
1490
Set a new or update an existing a metadum value for a virtual server.
1491

    
1492
.. rubric:: Request
1493

    
1494
======================================= ====== ======== ==========
1495
URI                                     Method Cyclades OS/Compute
1496
======================================= ====== ======== ==========
1497
``/servers/<server-id>/metadata/<key>`` PUT    ✔        ✔
1498
======================================= ====== ======== ==========
1499

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

    
1502
* **key** is the key of a ``key``:``value`` pair piece of metadata
1503

    
1504
|
1505

    
1506
==============  ========================= ======== ==========
1507
Request Header  Value                     Cyclades OS/Compute
1508
==============  ========================= ======== ==========
1509
X-Auth-Token    User authentication token required required
1510
Content-Type    Type or request body      required required
1511
Content-Length  Length of request body    required required
1512
==============  ========================= ======== ==========
1513

    
1514
**Example Request Headers**::
1515

    
1516
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
1517
  Content-Type:   application/json
1518
  Content-Length: 29
1519

    
1520
.. note:: Request parameters should be empty
1521

    
1522
Request body content::
1523

    
1524
  metadata: {<key>: <value>}
1525

    
1526
*Example Request to Set or Update Server Metadatum "role": JSON*
1527

    
1528
.. code-block:: javascript
1529

    
1530
  {"metadata": {"role": "gateway"}}
1531

    
1532
.. rubric:: Response
1533

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

    
1548
Response body content::
1549

    
1550
  metadata: {<key>: <value>}
1551

    
1552
*Example Set or Update Server Metadatum "role":"gateway": JSON*
1553

    
1554
.. code-block:: javascript
1555

    
1556
  {"metadata": {"role": "gateway"}}
1557

    
1558
Delete Server Metadatum
1559
.......................
1560

    
1561
Delete a metadatum of a virtual server
1562

    
1563
.. rubric:: Request
1564

    
1565
======================================= ====== ======== ==========
1566
URI                                     Method Cyclades OS/Compute
1567
======================================= ====== ======== ==========
1568
``/servers/<server-id>/metadata/<key>`` DELETE ✔        ✔
1569
======================================= ====== ======== ==========
1570

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

    
1573
* **key** is the key of a matadatum ``key``:``value`` pair
1574

    
1575
|
1576

    
1577
==============  ========================= ======== ==========
1578
Request Header  Value                     Cyclades OS/Compute
1579
==============  ========================= ======== ==========
1580
X-Auth-Token    User authentication token required required
1581
==============  ========================= ======== ==========
1582

    
1583
.. note:: Request parameters should be empty
1584

    
1585
.. note:: Request body should be empty
1586

    
1587
.. rubric:: Response
1588

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

    
1602
.. note:: In case of a 204 code, response body should be empty
1603

    
1604
Server Actions
1605
--------------
1606

    
1607
Actions are operations that are achieved through the same type of request
1608
(``POST``). There are differences in the implementations of some operations
1609
between Synnefo/Cyclades and OS/Compute. Although this document focuses on
1610
Synnefo/Cyclades, differences and similarities between the APIs are also
1611
briefed.
1612

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

    
1629
.. rubric:: Request
1630

    
1631
=============================== ====== ======== ==========
1632
URI                             Method Cyclades OS/Compute
1633
=============================== ====== ======== ==========
1634
``/servers/<server id>/action`` POST   ✔        ✔
1635
=============================== ====== ======== ==========
1636

    
1637
|
1638

    
1639
==============  ========================= ======== ==========
1640
Request Header  Value                     Cyclades OS/Compute
1641
==============  ========================= ======== ==========
1642
X-Auth-Token    User authentication token required required
1643
Content-Type    Type or request body      required required
1644
Content-Length  Length of request body    required required
1645
==============  ========================= ======== ==========
1646

    
1647
**Example Request Headers**::
1648

    
1649
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
1650
  Content-Type:   application/json
1651
  Content-Length: 32
1652

    
1653
.. note:: Request parameters should be empty
1654

    
1655
.. note:: Request body varies between operations (see bellow)
1656

    
1657
.. rubric:: Response
1658

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

    
1672
.. note:: Response body varies between operations (see bellow)
1673

    
1674
Start server
1675
................
1676

    
1677
This operation transitions a server from a STOPPED to an ACTIVE state.
1678

    
1679
Request body contents::
1680

    
1681
  start: {}
1682

    
1683
*Example Start Server: JSON*
1684

    
1685
.. code-block:: javascript
1686

    
1687
  {"start": {}}
1688

    
1689
.. note:: Response body should be empty
1690

    
1691
Reboot Server
1692
.............
1693

    
1694
This operation transitions a server from ``ACTIVE`` to ``REBOOT`` and then
1695
``ACTIVE`` again.
1696

    
1697
Synnefo and OS/Compute APIs offer two reboot modes: ``soft``
1698
and ``hard``. OS/Compute distinguishes between the two intermediate states
1699
(``REBOOT`` and ``HARD_REBOOT``) while rebooting, while Synnefo/Cyclades use
1700
only the ``REBOOT`` term. The expected behavior is the same, though.
1701

    
1702
Request body contents::
1703

    
1704
  reboot: {type: <reboot type>}
1705

    
1706
* **reboot type** can be either ``SOFT`` or ``HARD``.
1707

    
1708
*Example (soft) Reboot Server: JSON*
1709

    
1710
.. code-block:: javascript
1711

    
1712
  {"reboot" : { "type": "soft"}}
1713

    
1714
.. note:: Response body should be empty
1715

    
1716
Shutdown server
1717
...............
1718

    
1719
This operation transitions a server from an ACTIVE to a STOPPED state.
1720

    
1721
Request body contents::
1722

    
1723
  shutdown: {}
1724

    
1725
*Example Shutdown Server: JSON*
1726

    
1727
.. code-block:: javascript
1728

    
1729
  {"shutdown": {}}
1730

    
1731
.. note:: Response body should be empty
1732

    
1733
Get Server Console
1734
..................
1735

    
1736
.. note:: This operation is not part of OS/Compute API
1737

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

    
1743
Request body contents::
1744

    
1745
  console: {type: vnc}
1746

    
1747
*Example Get Server Console: JSON*
1748

    
1749
.. code-block:: javascript
1750

    
1751
  {"console": {"type": "vnc" }
1752

    
1753
Response body contents::
1754

    
1755
  console: {
1756
    <vnc attribute>: <value>,
1757
    ...
1758
  }
1759

    
1760
============== ======================
1761
VNC Attributes Description
1762
============== ======================
1763
host           The vncprocy host
1764
port           vncprocy port
1765
password       Temporary password
1766
type           Connection type (only VNC)
1767
============== ======================
1768

    
1769
*Example Action Console Response: JSON*
1770

    
1771
.. code-block:: javascript
1772

    
1773
  {
1774
    "console": {
1775
      "type": "vnc",
1776
      "host": "vm42.example.org",
1777
      "port": 1234,
1778
      "password": "513NR14PN0T"
1779
    }
1780
  }
1781

    
1782
Set Server Firewall Profile
1783
...........................
1784

    
1785
The firewallProfile function sets a firewall profile for the public interface
1786
of a server.
1787

    
1788
Request body contents::
1789

    
1790
  firewallProfile: { profile: <firewall profile>}
1791

    
1792
* **firewall profile** can be ``ENABLED``, ``DISABLED`` or ``PROTECTED``
1793

    
1794
*Example Action firewallProfile: JSON**
1795

    
1796
.. code-block:: javascript
1797

    
1798
  {"firewallProfile": {"profile": "ENABLED"}}
1799

    
1800
.. note:: Response body should be empty
1801

    
1802
OS/Compute Specific
1803
...................
1804

    
1805
The following operations are meaningless or not supported in the context of
1806
Synnefo/Cyclades, but are parts of the OS/Compute API:
1807

    
1808
* `Change Administrator Password <http://docs.openstack.org/api/openstack-compute/2/content/Change_Password-d1e3234.html>`_
1809
* `Rebuild Server <http://docs.openstack.org/api/openstack-compute/2/content/Rebuild_Server-d1e3538.html>`_
1810
* `Resize Server <http://docs.openstack.org/api/openstack-compute/2/content/Resize_Server-d1e3707.html>`_
1811
* `Confirm Resized Server <http://docs.openstack.org/api/openstack-compute/2/content/Confirm_Resized_Server-d1e3868.html>`_
1812
* `Revert Resized Server <http://docs.openstack.org/api/openstack-compute/2/content/Revert_Resized_Server-d1e4024.html>`_
1813
* `Create Image <http://docs.openstack.org/api/openstack-compute/2/content/Create_Image-d1e4655.html>`_
1814

    
1815

    
1816
Flavors
1817
-------
1818

    
1819
A flavor is a hardware configuration for a server.
1820

    
1821
==================================== ======================== ====== ======== ==========
1822
Description                          URI                      Method Cyclades OS/Compute
1823
==================================== ======================== ====== ======== ==========
1824
`List <#list-flavors>`_              ``/flavors``             GET    ✔        ✔
1825
\                                    ``/flavors/detail``      GET    ✔        **✘**
1826
`Get details <#get-flavor-details>`_ ``/flavors/<flavor-id>`` GET    ✔        ✔
1827
==================================== ======================== ====== ======== ==========
1828

    
1829
List Flavors
1830
............
1831

    
1832
List the flavors that are accessible by the user
1833

    
1834
.. rubric:: Request
1835

    
1836
=================== ====== ======== ==========
1837
URI                 Method Cyclades OS/Compute
1838
=================== ====== ======== ==========
1839
``/flavors``        GET    ✔        ✔
1840
``/flavors/detail`` GET    ✔        ✔
1841
=================== ====== ======== ==========
1842

    
1843
|
1844

    
1845
==============  ========================= ======== ==========
1846
Request Header  Value                     Cyclades OS/Compute
1847
==============  ========================= ======== ==========
1848
X-Auth-Token    User authentication token required required
1849
==============  ========================= ======== ==========
1850

    
1851
|
1852

    
1853
================= ===============
1854
Request Parameter Value
1855
================= ===============
1856
json              Respond in json
1857
xml               Respond in xml
1858
================= ===============
1859

    
1860
.. note:: Request body should be empty
1861

    
1862
.. rubric:: Response
1863

    
1864
=========================== =====================
1865
Return Code                 Description
1866
=========================== =====================
1867
200 (OK)                    Request succeeded
1868
400 (Bad Request)           Malformed request
1869
401 (Unauthorized)          Missing or expired user token
1870
403 (Forbidden)             Forbidden to use this flavor
1871
500 (Internal Server Error) The request cannot be completed because of an
1872
\                           internal error
1873
503 (Service Unavailable)   The server is not currently available
1874
=========================== =====================
1875

    
1876
Response code contents::
1877

    
1878
  flavors: [
1879
    {
1880
      <flavor attribute>: <value>,
1881
      ...
1882
    },
1883
    ...
1884
  ]
1885

    
1886
Flavor attributes are `listed here <#flavor-ref>`_. Regular listing contains
1887
only ``id`` and ``name`` attributes.
1888

    
1889
*Example List Flavors (regular): JSON*
1890

    
1891
.. code-block:: javascript
1892

    
1893
  {
1894
    "flavors": [
1895
      {
1896
        "id": 1,
1897
        "name": "One code",
1898
        "links": [
1899
            {
1900
                "href": "https://example.org/compute/v2.0/flavors/1", 
1901
                "rel": "self"
1902
            }, 
1903
            {
1904
                "href": "https://example.org/compute/v2.0/flavors/1", 
1905
                "rel": "bookmark"
1906
            }
1907
        ]
1908
      }, {
1909
        "id": 3,
1910
        "name": "Four core",
1911
        "links": [
1912
            {
1913
                "href": "https://example.org/compute/v2.0/flavors/3", 
1914
                "rel": "self"
1915
            }, 
1916
            {
1917
                "href": "https://example.org/compute/v2.0/flavors/3", 
1918
                "rel": "bookmark"
1919
            }
1920
        ]
1921
      }
1922
    ]
1923
  }
1924

    
1925

    
1926
*Example List Flavors (regular): XML*
1927

    
1928
.. code-block:: xml
1929

    
1930
  <?xml version="1.0" encoding="UTF-8"?>
1931
  <flavors xmlns="http://docs.openstack.org/compute/api/v1"
1932
    xmlns:atom="http://www.w3.org/2005/Atom">
1933
    <flavor id="1" name="One core"/>
1934
    <flavor id="3" name="Four core"/>
1935
  </flavors>
1936

    
1937
*Example List Flavors (detail): JSON*
1938

    
1939
.. code-block:: javascript
1940

    
1941
  {
1942
    "flavors": [
1943
      {
1944
        "id": 1,
1945
        "name": "One core",
1946
        "ram": 1024,
1947
        "SNF:disk_template": "drbd",
1948
        "disk": 20,
1949
        "cpu": 1,
1950
        "links": [
1951
            {
1952
                "href": "https://example.org/compute/v2.0/flavors/1", 
1953
                "rel": "self"
1954
            }, 
1955
            {
1956
                "href": "https://example.org/compute/v2.0/flavors/1", 
1957
                "rel": "bookmark"
1958
            }
1959
        ]
1960
      }, {
1961
        "id": 3,
1962
        "name": "Four core",
1963
        "ram": 1024,
1964
        "SNF:disk_template": "drbd",
1965
        "disk": 40,
1966
        "cpu": 4,
1967
        "links": [
1968
            {
1969
                "href": "https://example.org/compute/v2.0/flavors/3", 
1970
                "rel": "self"
1971
            }, 
1972
            {
1973
                "href": "https://example.org/compute/v2.0/flavors/3", 
1974
                "rel": "bookmark"
1975
            }
1976
        ]
1977
      }
1978
    ]
1979
  }
1980

    
1981
Get Flavor Details
1982
..................
1983

    
1984
Get the configuration of a specific flavor
1985

    
1986
.. rubric:: Request
1987

    
1988
======================= ====== ======== ==========
1989
URI                     Method Cyclades OS/Compute
1990
======================= ====== ======== ==========
1991
``/flavors/<flavor-id`` GET    ✔        ✔
1992
======================= ====== ======== ==========
1993

    
1994
* **flavor-id** is the identifier of the flavor
1995

    
1996
|
1997

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

    
2004
|
2005

    
2006
================= ===============
2007
Request Parameter Value
2008
================= ===============
2009
json              Respond in json
2010
xml               Respond in xml
2011
================= ===============
2012

    
2013
.. note:: Request body should be empty
2014

    
2015
.. rubric:: Response
2016

    
2017
=========================== =====================
2018
Return Code                 Description
2019
=========================== =====================
2020
200 (OK)                    Request succeeded
2021
400 (Bad Request)           Malformed flavor ID
2022
401 (Unauthorized)          Missing or expired user token
2023
403 (Forbidden)             Forbidden to use this flavor
2024
404 (Not Found)             Flavor id not founmd
2025
500 (Internal Server Error) The request cannot be completed because of an
2026
\                           internal error
2027
503 (Service Unavailable)   The server is not currently available
2028
=========================== =====================
2029

    
2030
Response code contents::
2031

    
2032
  flavor: {
2033
    <flavor attribute>: <value>,
2034
    ...
2035
  }
2036

    
2037
All flavor attributes are `listed here <flavor-ref>`_.
2038

    
2039
*Example Flavor Details: JSON*
2040

    
2041
.. code-block:: javascript
2042

    
2043
  {
2044
    "flavor": {
2045
      {
2046
        "id": 1,
2047
        "name": "One core",
2048
        "ram": 1024,
2049
        "SNF:disk_template": "drbd",
2050
        "disk": 20,
2051
        "cpu": 1,
2052
        "links": [
2053
            {
2054
                "href": "https://example.org/compute/v2.0/flavors/1", 
2055
                "rel": "self"
2056
            }, 
2057
            {
2058
                "href": "https://example.org/compute/v2.0/flavors/1", 
2059
                "rel": "bookmark"
2060
            }
2061
        ]
2062
      }
2063
    }
2064
  }
2065

    
2066
*Example Flavor Details: XML*
2067

    
2068
.. code-block:: xml
2069

    
2070
  <?xml version="1.0" encoding="UTF-8"?>
2071
  <flavor xmlns="http://docs.openstack.org/compute/api/v1"
2072
    xmlns:atom="http://www.w3.org/2005/Atom"
2073
    id="1" name="One core" ram="1024" disk="20" cpu="1" />
2074

    
2075
Images
2076
------
2077

    
2078
An image is a collection of files used to create or rebuild a server. Synnefo
2079
deployments usually provide pre-built OS images, but custom image creation is
2080
also supported.
2081

    
2082
============================================= ===================================== ====== ======== ==========
2083
Description                                   URI                                   Method Cyclades OS/Compute
2084
============================================= ===================================== ====== ======== ==========
2085
`List <#list-images>`_                        ``/images``                           GET    ✔        ✔
2086
\                                             ``/images/detail``                    GET    ✔        ✔
2087
`Get details <#get-image-details>`_           ``/images/<image-id>``                GET    ✔        ✔
2088
`Delete <#delete-image>`_                     ``/images/<image id>``                DELETE ✔        ✔
2089
`List Metadata <#list-image-metadata>`_       ``/images/<image-id>/metadata``       GET    ✔        ✔
2090
`Update Metadata <#update-image-metadata>`_   ``/images/<image-id>/metadata``       POST   ✔        ✔
2091
\                                             ``/images/<image-id>/metadata``       PUT    **✘**    ✔
2092
`Get Meta Item <#get-image-metadatum>`_       ``/image/<image-id>/metadata/<key>``  GET    ✔        ✔
2093
`Update Metadatum <#update-image-metadatum>`_ ``/images/<image-id>/metadata/<key>`` PUT    ✔        ✔
2094
`Delete Metadatum <#delete-image-metadatum>`_ ``/images/<image-id>/metadata/<key>`` DELETE ✔        ✔
2095
============================================= ===================================== ====== ======== ==========
2096

    
2097

    
2098
List Images
2099
...........
2100

    
2101
List all images accessible by the user
2102

    
2103
.. rubric:: Request
2104

    
2105
=================== ====== ======== ==========
2106
URI                 Method Cyclades OS/Compute
2107
=================== ====== ======== ==========
2108
``/images``        GET    ✔        ✔
2109
``/images/detail`` GET    ✔        ✔
2110
=================== ====== ======== ==========
2111

    
2112
|
2113

    
2114
==============  ========================= ======== ==========
2115
Request Header  Value                     Cyclades OS/Compute
2116
==============  ========================= ======== ==========
2117
X-Auth-Token    User authentication token required required
2118
==============  ========================= ======== ==========
2119

    
2120
|
2121

    
2122
================= ======================== ======== ==========
2123
Request Parameter Value                    Cyclades OS/Compute
2124
================= ======================== ======== ==========
2125
server            Server filter            **✘**    ✔
2126
name              Image name filter        **✘**    ✔
2127
status            Server status filter     **✘**    ✔
2128
changes-since     Change timestamp filter  ✔        ✔
2129
marker            Last list last ID filter **✘**    ✔
2130
limit             Page size filter         **✘**    ✔
2131
type              Request filter type      **✘**    ✔
2132
================= ======================== ======== ==========
2133

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

    
2139
.. note:: Request body should be empty
2140

    
2141
.. rubric:: Response
2142

    
2143
=========================== =====================
2144
Return Code                 Description
2145
=========================== =====================
2146
200 (OK)                    Request succeeded
2147
304 (No images since date)  Can be returned if ``changes-since`` is given
2148
400 (Bad Request)           Invalid or malformed ``changes-since`` parameter
2149
401 (Unauthorized)          Missing or expired user token
2150
403 (Forbidden)             User is not allowed to perform this operation
2151
500 (Internal Server Error) The request cannot be completed because of an
2152
\                           internal error
2153
503 (Service Unavailable)   The server is not currently available
2154
=========================== =====================
2155

    
2156
Response body contents::
2157

    
2158
  images: [
2159
    {
2160
      <image attribute>: <value>,
2161
      ...
2162
      metadata: {
2163
        <image metadatum key>: <value>,
2164
        ...
2165
      },
2166
      ...
2167
    },
2168
    ...
2169
  ]
2170

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

    
2174
*Example List Image (detail): JSON*
2175

    
2176
.. code-block:: javascript
2177

    
2178
  {
2179
    "images: [
2180
      {
2181
        "status": "ACTIVE",
2182
        "updated": "2013-03-02T15:57:03+00:00",
2183
        "name": "edx_saas",
2184
        "created": "2013-03-02T12:21:00+00:00",
2185
        "progress": 100,
2186
        "id": "175716...526236",
2187
        "links": [
2188
          {
2189
            "href": "https://example.org/compute/v2.0/images/175716...526236", 
2190
            "rel": "self"
2191
          }, 
2192
          {
2193
            "href": "https://example.org/compute/v2.0/images/175716...526236", 
2194
            "rel": "bookmark"
2195
          }, 
2196
          {
2197
            "href": "https://example.org/image/v1.0/images/175716...526236", 
2198
            "rel": "alternate"
2199
          }
2200
        ],
2201
        "metadata": {
2202
          "partition_table": "msdos",
2203
          "osfamily": "linux",
2204
          "users": "root saasbook",
2205
          "exclude_task_changepassword": "yes",
2206
          "os": "ubuntu",
2207
          "root_partition": "1",
2208
          "description": "Ubuntu 12.04 LTS"
2209
        }
2210
      }, {
2211
        "status": "ACTIVE",
2212
        "updated": "2013-03-02T15:57:03+00:00",
2213
        "name": "edx_saas",
2214
        "created": "2013-03-02T12:21:00+00:00",
2215
        "progress": 100,
2216
        "id": "1357163d...c526206",
2217
        "links": [
2218
          {
2219
            "href": "https://example.org/compute/v2.0/images/1357163d...c526206", 
2220
            "rel": "self"
2221
          }, 
2222
          {
2223
            "href": "https://example.org/compute/v2.0/images/1357163d...c526206", 
2224
            "rel": "bookmark"
2225
          }, 
2226
          {
2227
            "href": "https://example.org/image/v1.0/images/1357163d...c526206", 
2228
            "rel": "alternate"
2229
          }
2230
        ],
2231
        "metadata": {
2232
          "partition_table": "msdos",
2233
          "osfamily": "windows",
2234
          "users": "Administratior",
2235
          "exclude_task_changepassword": "yes",
2236
          "os": "WinME",
2237
          "root_partition": "1",
2238
          "description": "Rerto Windows"
2239
        }
2240
      }
2241
    ]
2242
  }
2243

    
2244
Get Image Details
2245
.................
2246

    
2247
Get the details of a specific image
2248

    
2249
.. rubric:: Request
2250

    
2251
====================== ====== ======== ==========
2252
URI                    Method Cyclades OS/Compute
2253
====================== ====== ======== ==========
2254
``/images/<image-id>`` GET    ✔        ✔
2255
====================== ====== ======== ==========
2256

    
2257
* **image-id** is the identifier of the virtual image
2258

    
2259
|
2260

    
2261
==============  ========================= ======== ==========
2262
Request Header  Value                     Cyclades OS/Compute
2263
==============  ========================= ======== ==========
2264
X-Auth-Token    User authentication token required required
2265
==============  ========================= ======== ==========
2266

    
2267
.. note:: Request parameters should be empty
2268

    
2269
.. note:: Request body should be empty
2270

    
2271
.. rubric:: Response
2272

    
2273
=========================== =====================
2274
Return Code                 Description
2275
=========================== =====================
2276
200 (OK)                    Request succeeded
2277
400 (Bad Request)           Malformed image id
2278
401 (Unauthorized)          Missing or expired user token
2279
403 (Forbidden)             Not allowed to use this image
2280
404 (Not Found)             Image not found
2281
500 (Internal Server Error) The request cannot be completed because of an
2282
\                           internal error
2283
503 (Service Unavailable)   No available backends or service currently
2284
\                           unavailable
2285
=========================== =====================
2286

    
2287
Response body contents::
2288

    
2289
  image: {
2290
    <image attribute>: <value>,
2291
    ...
2292
    metadata: {
2293
      <image metadatum key>: <value>
2294
    }
2295
  }
2296

    
2297
Image attributes are `listed here <#image-ref>`_.
2298

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

    
2301
.. code-block:: javascript
2302

    
2303
  {
2304
  "image": {
2305
    "id": "6404619d-...-aef57eaff4af",
2306
    "name": "FreeBSD",
2307
    "status": "ACTIVE",
2308
    "updated": "2013-04-24T12:06:02+00:00",
2309
    "created": "2013-04-24T11:52:16+00:00",
2310
    "progress": 100,
2311
    "links": [
2312
      {
2313
        "href": "https://example.org/compute/v2.0/images/6404619d-...-aef57eaff4af", 
2314
        "rel": "self"
2315
      }, 
2316
      {
2317
        "href": "https://example.org/compute/v2.0/images/6404619d-...-aef57eaff4af", 
2318
        "rel": "bookmark"
2319
      }, 
2320
      {
2321
        "href": "https://example.org/image/v1.0/images/6404619d-...-aef57eaff4af", 
2322
        "rel": "alternate"
2323
      }
2324
    ],
2325
    "metadata": {
2326
      "kernel": "9.1 RELEASE",
2327
      "osfamily": "freebsd",
2328
      "users": "root",
2329
      "gui": "No GUI",
2330
      "sortorder": "9",
2331
      "os": "freebsd",
2332
      "root_partition": "2",
2333
      "description": "FreeBSD 9"
2334
      }
2335
    }
2336
  }
2337

    
2338

    
2339
Delete Image
2340
............
2341

    
2342
Delete an image, by changing its status from ``ACTIVE`` to ``DELETED``.
2343

    
2344
.. rubric:: Request
2345

    
2346
====================== ====== ======== ==========
2347
URI                    Method Cyclades OS/Compute
2348
====================== ====== ======== ==========
2349
``/images/<image id>`` DELETE ✔        ✔
2350
====================== ====== ======== ==========
2351

    
2352
* **image id** is the identifier of the image
2353

    
2354
|
2355

    
2356
==============  ========================= ======== ==========
2357
Request Header  Value                     Cyclades OS/Compute
2358
==============  ========================= ======== ==========
2359
X-Auth-Token    User authentication token required required
2360
==============  ========================= ======== ==========
2361

    
2362
.. note:: Request parameters should be empty
2363

    
2364
.. note:: Request body should be empty
2365

    
2366
.. rubric:: Response
2367

    
2368
=========================== =====================
2369
Return Code                 Description
2370
=========================== =====================
2371
204 (OK)                    Request succeeded
2372
400 (Bad Request)           Invalid request or image id
2373
401 (Unauthorized)          Missing or expired user token
2374
404 (Not Found)             Image not found
2375
500 (Internal Server Error) The request cannot be completed because of an
2376
\                           internal error
2377
503 (Service Unavailable)   Action not supported or service currently
2378
\                           unavailable
2379
=========================== =====================
2380

    
2381
.. note:: In case of a 204 code, request body should be empty
2382

    
2383
List Image Metadata
2384
...................
2385

    
2386
.. rubric:: Request
2387

    
2388
=============================== ====== ======== ==========
2389
URI                             Method Cyclades OS/Compute
2390
=============================== ====== ======== ==========
2391
``/images/<image-id>/metadata`` GET    ✔        ✔
2392
=============================== ====== ======== ==========
2393

    
2394
* **image-id** is the identifier of the virtual image
2395

    
2396
|
2397

    
2398
==============  ========================= ======== ==========
2399
Request Header  Value                     Cyclades OS/Compute
2400
==============  ========================= ======== ==========
2401
X-Auth-Token    User authentication token required required
2402
==============  ========================= ======== ==========
2403

    
2404
.. note:: Request parameters should be empty
2405

    
2406
.. note:: Request body should be empty
2407

    
2408
.. rubric:: Response
2409

    
2410
=========================== =====================
2411
Return Code                 Description
2412
=========================== =====================
2413
201 (OK)                    Request succeeded
2414
400 (Bad Request)           Invalid image ID or Malformed request
2415
401 (Unauthorized)          Missing or expired user token
2416
403 (Forbidden)             Administratively suspended server
2417
404 (Not Found)             Server not found
2418
409 (Build In Progress)     The image is not ready yet
2419
500 (Internal Server Error) The request cannot be completed because of an
2420
\                           internal error
2421
503 (Service Unavailable)   The server is not currently available
2422
=========================== =====================
2423

    
2424
Response body content::
2425

    
2426
  metadata: {
2427
    <metadatum key>: <value>,
2428
  ...
2429
  }
2430

    
2431
*Example List Image Metadata: JSON*
2432

    
2433
.. code-block:: javascript
2434

    
2435
  {
2436
    "metadata": {
2437
      "partition_table": "msdos",
2438
      "kernel": "3.2.0",
2439
      "osfamily": "linux",
2440
      "users": "user",
2441
      "gui": "Unity 5",
2442
      "sortorder": "3",
2443
      "os": "ubuntu",
2444
      "root_partition": "1",
2445
      "description": "Ubuntu 12 LTS"
2446
    }
2447
  }
2448

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

    
2451
Update Image Metadata
2452
.....................
2453

    
2454
In Cyclades API, setting new metadata and updating the values of existing ones
2455
is achieved using one type of request (POST), while in OS/Compute API two
2456
different types are used (PUT and POST for
2457
`setting new <http://docs.openstack.org/api/openstack-compute/2/content/Create_or_Replace_Metadata-d1e5358.html>`_
2458
and
2459
`updating existing <http://docs.openstack.org/api/openstack-compute/2/content/Update_Metadata-d1e5208.html>`_
2460
metadata, respectively).
2461

    
2462
In Cyclades API, unmentioned metadata keys will remain intact, while metadata
2463
referred by the operation will be overwritten.
2464

    
2465
.. rubric:: Request
2466

    
2467
=============================== ====== ======== ==========
2468
URI                             Method Cyclades OS/Compute
2469
=============================== ====== ======== ==========
2470
``/images/<image-id>/metadata`` PUT    **✘**    ✔
2471
``/images/<image-id>/metadata`` POST   ✔        ✔
2472
=============================== ====== ======== ==========
2473

    
2474
* **image-id** is the identifier of the virtual image
2475

    
2476
|
2477

    
2478
==============  ========================= ======== ==========
2479
Request Header  Value                     Cyclades OS/Compute
2480
==============  ========================= ======== ==========
2481
X-Auth-Token    User authentication token required required
2482
Content-Type    Type or request body      required required
2483
Content-Length  Length of request body    required required
2484
==============  ========================= ======== ==========
2485

    
2486
**Example Request Headers**::
2487

    
2488
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
2489
  Content-Type:   application/json
2490
  Content-Length: 52
2491

    
2492
.. note:: Request parameters should be empty
2493

    
2494
Request body content::
2495

    
2496
  metadata: {
2497
    <metadatum key>: <value>,
2498
    ...
2499
  }
2500

    
2501
*Example Update Image Metadata Request: JSON*
2502

    
2503
.. code-block:: javascript
2504

    
2505
  {"metadata": {"NewAttr": "NewVal", "os": "Xubuntu'}}
2506

    
2507
.. rubric:: Response
2508

    
2509
=========================== =====================
2510
Return Code                 Description
2511
=========================== =====================
2512
201 (OK)                    Request succeeded
2513
400 (Bad Request)           Malformed request or image id
2514
401 (Unauthorized)          Missing or expired user token
2515
403 (Forbidden)             Not allowed to modify this image
2516
404 (Not Found)             Image or metadatum key not found
2517
413 (OverLimit)             Maximum number of metadata exceeded
2518
500 (Internal Server Error) The request cannot be completed because of an
2519
\                           internal error
2520
503 (Service Unavailable)   The server is not currently available
2521
=========================== =====================
2522

    
2523
Response body content::
2524

    
2525
  metadata: {
2526
    <key>: <value>,
2527
    ...
2528
  }
2529

    
2530
*Example Update Image Response: JSON*
2531

    
2532
.. code-block:: javascript
2533

    
2534
  {
2535
    "metadata": {
2536
      "partition_table": "msdos",
2537
      "kernel": "3.2.0",
2538
      "osfamily": "linux",
2539
      "users": "user",
2540
      "gui": "Unity 5",
2541
      "sortorder": "3",
2542
      "os": "Xubuntu",
2543
      "root_partition": "1",
2544
      "description": "Ubuntu 12 LTS",
2545
      "NewAttr": "NewVal"
2546
    }
2547
  }
2548

    
2549
Get Image Metadatum
2550
...................
2551

    
2552
.. rubric:: Request
2553

    
2554
===================================== ====== ======== ==========
2555
URI                                   Method Cyclades OS/Compute
2556
===================================== ====== ======== ==========
2557
``/images/<image-id>/metadata/<key>`` GET    ✔        ✔
2558
===================================== ====== ======== ==========
2559

    
2560
* **image-id** is the identifier of the image
2561

    
2562
* **key** is the key of a matadatum ``key``:``value`` pair
2563

    
2564
|
2565

    
2566
==============  ========================= ======== ==========
2567
Request Header  Value                     Cyclades OS/Compute
2568
==============  ========================= ======== ==========
2569
X-Auth-Token    User authentication token required required
2570
==============  ========================= ======== ==========
2571

    
2572
.. note:: Request parameters should be empty
2573

    
2574
.. note:: Request body should be empty
2575

    
2576
.. rubric:: Response
2577

    
2578
=========================== =====================
2579
Return Code                 Description
2580
=========================== =====================
2581
200 (OK)                    Request succeeded
2582
400 (Bad Request)           Malformed request or image id
2583
401 (Unauthorized)          Missing or expired user token
2584
403 (Forbidden)             Not allowed to access this information
2585
404 (Not Found)             Metadatum key not found
2586
500 (Internal Server Error) The request cannot be completed because of an
2587
\                           internal error
2588
503 (Service Unavailable)   The server is not currently available
2589
=========================== =====================
2590

    
2591
Response body content::
2592

    
2593
  metadata: {<key>: <value>}
2594

    
2595
*Example Get Image Metadatum Item: JSON*
2596

    
2597
.. code-block:: javascript
2598

    
2599
  {"metadata": {"os": "Xubuntu"}}
2600

    
2601
.. note:: In OS/Compute, ``metadata`` is ``meta``
2602

    
2603
Update Image Metadatum
2604
......................
2605

    
2606
.. rubric:: Request
2607

    
2608
===================================== ====== ======== ==========
2609
URI                                   Method Cyclades OS/Compute
2610
===================================== ====== ======== ==========
2611
``/images/<image-id>/metadata/<key>`` PUT    ✔        ✔
2612
===================================== ====== ======== ==========
2613

    
2614
* **image-id** is the identifier of the image
2615

    
2616
* **key** is the key of a matadatum ``key``:``value`` pair
2617

    
2618
|
2619

    
2620
==============  ========================= ======== ==========
2621
Request Header  Value                     Cyclades OS/Compute
2622
==============  ========================= ======== ==========
2623
X-Auth-Token    User authentication token required required
2624
Content-Type    Type or request body      required required
2625
Content-Length  Length of request body    required required
2626
==============  ========================= ======== ==========
2627

    
2628
**Example Request Headers**::
2629

    
2630
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
2631
  Content-Type:   application/json
2632
  Content-Length: 27
2633

    
2634
|
2635

    
2636
.. note:: Request parameters should be empty
2637

    
2638
Request body content::
2639

    
2640
  metadata: {<key>: <value>}
2641

    
2642
*Example Update Image Metadatum Item Request: JSON*
2643

    
2644
.. code-block:: javascript
2645

    
2646
  {"metadata": {"os": "Kubuntu"}}
2647

    
2648
.. rubric:: Response
2649

    
2650
=========================== =====================
2651
Return Code                 Description
2652
=========================== =====================
2653
201 (OK)                    Request succeeded
2654
400 (Bad Request)           Malformed request or image id
2655
401 (Unauthorized)          Missing or expired user token
2656
403 (Forbidden)             Not allowed to modify this image
2657
404 (Not Found)             Metadatum key not found
2658
413 (OverLimit)             Maximum number of metadata exceeded
2659
500 (Internal Server Error) The request cannot be completed because of an
2660
\                           internal error
2661
503 (Service Unavailable)   The server is not currently available
2662
=========================== =====================
2663

    
2664
Request body content::
2665

    
2666
  metadata: {<key>: <value>}
2667

    
2668
*Example Update Image Metadatum Item Response: JSON*
2669

    
2670
.. code-block:: javascript
2671

    
2672
  {"metadata": {"os": "Kubuntu"}}
2673

    
2674
Delete Image Metadatum
2675
......................
2676

    
2677
Delete an image metadatum by its key.
2678

    
2679
.. rubric:: Request
2680

    
2681
===================================== ====== ======== ==========
2682
URI                                   Method Cyclades OS/Compute
2683
===================================== ====== ======== ==========
2684
``/images/<image-id>/metadata/<key>`` DELETE ✔        ✔
2685
===================================== ====== ======== ==========
2686

    
2687
* **image-id** is the identifier of the image
2688

    
2689
* **key** is the key of a matadatum ``key``:``value`` pair
2690

    
2691
|
2692

    
2693
==============  ========================= ======== ==========
2694
Request Header  Value                     Cyclades OS/Compute
2695
==============  ========================= ======== ==========
2696
X-Auth-Token    User authentication token required required
2697
==============  ========================= ======== ==========
2698

    
2699
.. note:: Request parameters should be empty
2700

    
2701
.. note:: Request body should be empty
2702

    
2703
.. rubric:: Response
2704

    
2705
=========================== =====================
2706
Return Code                 Description
2707
=========================== =====================
2708
204 (OK)                    Request succeeded
2709
400 (Bad Request)           Malformed image ID
2710
401 (Unauthorized)          Missing or expired user token
2711
403 (Forbidden)             Not allowed to modify this image
2712
404 (Not Found)             Metadatum key not found
2713
500 (Internal Server Error) The request cannot be completed because of an
2714
\                           internal error
2715
503 (Service Unavailable)   The server is not currently available
2716
=========================== =====================
2717

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

    
2720
Networks
2721
--------
2722

    
2723
============= ======== ==========
2724
BASE URI      Cyclades OS/Compute
2725
============= ======== ==========
2726
``/networks`` ✔        **✘**
2727
============= ======== ==========
2728

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

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

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

    
2743
=============================================== ================================= ======
2744
Description                                     URI                               Method
2745
=============================================== ================================= ======
2746
`List <#list-networks>`_                        ``/networks``                     GET
2747
\                                               ``/networks/detail``              GET
2748
`Create <#create-network>`_                     ``/networks``                     POST
2749
`Get details <#get-network-details>`_           ``/networks/<network-id>``        GET
2750
`Rename <#rename-network>`_                     ``/networks/<network-id>``        PUT
2751
`Delete <#delete-network>`_                     ``/networks/<network-id>``        DELETE
2752
`Connect <#connect-network-to-server>`_         ``/networks/<network-id>/action`` POST
2753
`Disconnect <#disconnect-network-from-server>`_ ``/networks/<network-id>/action`` POST
2754
=============================================== ================================= ======
2755

    
2756

    
2757
List Networks
2758
.............
2759

    
2760
This operation lists the networks associated with a users account
2761

    
2762
.. rubric:: Request
2763

    
2764
==================== ======
2765
URI                  Method
2766
==================== ======
2767
``/networks``        GET
2768
``/networks/detail`` GET
2769
==================== ======
2770

    
2771
|
2772

    
2773
==============  =========================
2774
Request Header  Value
2775
==============  =========================
2776
X-Auth-Token    User authentication token
2777
==============  =========================
2778

    
2779
.. note:: Request parameters should be empty
2780

    
2781
.. note:: Request body should be empty
2782

    
2783
.. rubric:: Response
2784

    
2785
=========================== =====================
2786
Return Code                 Description
2787
=========================== =====================
2788
204 (OK)                    Request succeeded
2789
304 (Not Modified)
2790
400 (Bad Request)           Malformed network id
2791
401 (Unauthorized)          Missing or expired user token
2792
404 (Not Found)             Network not found
2793
409 (Build In Progress)     Server is not ready yet
2794
500 (Internal Server Error) The request cannot be completed because of an
2795
\                           internal error
2796
503 (Service Unavailable)   Action not supported or service currently
2797
\                           unavailable
2798
=========================== =====================
2799

    
2800
Response body content::
2801

    
2802
  networks: [
2803
    {
2804
      <network attribute>: <value>,
2805
      ...
2806
    },
2807
    ...
2808
  }
2809

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

    
2813
*Example Networks List Response: JSON (regular)*
2814

    
2815
.. code-block:: javascript
2816

    
2817
  {
2818
    "networks": [
2819
      {
2820
        "id": "1",
2821
        "name": "public",
2822
        "links": [
2823
            {
2824
                "href": "https://example.org/compute/v2.0/networks/1",
2825
                "rel": "self"
2826
            }, {
2827
                "href": "https://example.org/compute/v2.0/networks/1",
2828
                "rel": "bookmark"
2829
            }
2830
        ], 
2831
      },
2832
      {
2833
        "id": "2",
2834
        "name": "my private network",
2835
        "links": [
2836
            {
2837
                "href": "https://example.org/compute/v2.0/networks/2",
2838
                "rel": "self"
2839
            }, {
2840
                "href": "https://example.org/compute/v2.0/networks/2",
2841
                "rel": "bookmark"
2842
            }
2843
        ],
2844
      }
2845
    ]
2846
  }
2847

    
2848
*Example Networks List Response: JSON (detail)*
2849

    
2850
.. code-block:: javascript
2851

    
2852
  {
2853
    "networks": [
2854
      {
2855
        "id": "1",
2856
        "name": "public",
2857
        "links": [
2858
            {
2859
                "href": "https://example.org/compute/v2.0/networks/1", 
2860
                "rel": "self"
2861
            }, 
2862
            {
2863
                "href": "https://example.org/compute/v2.0/networks/1", 
2864
                "rel": "bookmark"
2865
            }
2866
        ], 
2867
        "created": "2011-04-20T15:31:08.199640+00:00",
2868
        "updated": "2011-05-06T12:47:05.582679+00:00",
2869
        "attachments": ["nic-42-0", "nic-73-0"]
2870
      }, {
2871
        "id": 2,
2872
        "name": "my private network",
2873
        "links": [
2874
            {
2875
                "href": "https://example.org/compute/v2.0/networks/2", 
2876
                "rel": "self"
2877
            }, 
2878
            {
2879
                "href": "https://example.org/compute/v2.0/networks/2", 
2880
                "rel": "bookmark"
2881
            }
2882
        ], 
2883
        "created": "2011-04-20T14:32:08.199640+00:00",
2884
        "updated": "2011-05-06T11:40:05.582679+00:00",
2885
        "attachments": ["nic-42-2", "nic-7-3"]
2886
      }
2887
    ]
2888
  }
2889

    
2890

    
2891
Create Network
2892
..............
2893

    
2894
This operation asynchronously provisions a new network.
2895

    
2896
.. rubric:: Request
2897

    
2898
==================== ======
2899
URI                  Method
2900
==================== ======
2901
``/networks``        POST
2902
==================== ======
2903

    
2904
|
2905

    
2906
==============  =========================
2907
Request Header  Value
2908
==============  =========================
2909
X-Auth-Token    User authentication token
2910
Content-Type    Type or request body     
2911
Content-Length  Length of request body   
2912
==============  =========================
2913

    
2914
**Example Request Headers**::
2915

    
2916
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
2917
  Content-Type:   application/json
2918
  Content-Length: 60
2919

    
2920
.. note:: Request parameters should be empty
2921

    
2922
Request body content::
2923

    
2924
  network: {
2925
    <request attribute>: <value>,
2926
    ...
2927
  }
2928

    
2929
================== ======================= ======== =======
2930
Request Attributes Description             Required Default
2931
================== ======================= ======== =======
2932
name               Network name            ✔
2933
type               Network type            ✔
2934
dhcp               If use DHCP             **✘**    True
2935
cidr               IPv4 CIDR               **✘**    192.168.1.0/2
2936
cidr6              IPv6 CDIR               **✘**    null
2937
gateway            IPv4 gateway address    **✘**    null
2938
gateway6           IPv6 gateway address    **✘**    null
2939
public             If a public network     **✘**    False
2940
================== ======================= ======== =======
2941

    
2942
* **name** is a string
2943

    
2944
* **type** can be CUSTOM, IP_LESS_ROUTED, MAC_FILTERED, PHYSICAL_VLAN
2945

    
2946
* **dhcp** and **public** are flags
2947

    
2948
* **cidr**, and **gateway** are IPv4 addresses
2949

    
2950
* **cidr6**, and **gateway6** are IPv6 addresses
2951

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

    
2954
*Example Create Network Request Body: JSON*
2955

    
2956
.. code-block:: javascript
2957

    
2958
  {"network": {"name": "private_net", "type": "MAC_FILTERED"}}
2959

    
2960
.. rubric:: Response
2961

    
2962
=========================== =====================
2963
Return Code                 Description
2964
=========================== =====================
2965
202 (OK)                    Request succeeded
2966
400 (Bad Request)           Malformed network id or request
2967
401 (Unauthorized)          Missing or expired user token
2968
403 (Forbidden)             Public network is forbidden
2969
404 (Not Found)             Network not found
2970
413 (Over Limit)            Reached networks limit
2971
415 (Bad Media Type)        Bad network type
2972
500 (Internal Server Error) The request cannot be completed because of an
2973
\                           internal error
2974
503 (Service Unavailable)   Failed to allocated network resources
2975
=========================== =====================
2976

    
2977
Response body content::
2978

    
2979
  network: {
2980
    <network attribute>: <value>,
2981
    ...
2982
  }
2983

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

    
2986
*Example Create Network Response: JSON*
2987

    
2988
.. code-block:: javascript
2989

    
2990
  {
2991
    "network": {
2992
      "status": "PENDING",
2993
      "updated": "2013-04-25T13:31:17.165237+00:00",
2994
      "name": "my private network",
2995
      "links": [
2996
        {
2997
            "href": "https://example.org/compute/v2.0/networks/6567",
2998
            "rel": "self"
2999
        }, {
3000
            "href": "https://example.org/compute/v2.0/networks/6567",
3001
            "rel": "bookmark"
3002
        }
3003
      ], 
3004
      "created": "2013-04-25T13:31:17.165088+00:00",
3005
      "cidr6": null,
3006
      "id": "6567",
3007
      "gateway6": null,
3008
      "public": false,
3009
      "dhcp": false,
3010
      "cidr": "192.168.1.0/24",
3011
      "type": "MAC_FILTERED",
3012
      "gateway": null,
3013
      "attachments": []
3014
    }
3015
  }
3016

    
3017
Get Network Details
3018
...................
3019

    
3020
.. rubric:: Request
3021

    
3022
========================== ======
3023
URI                        Method
3024
========================== ======
3025
``/networks/<network-id>`` GET
3026
========================== ======
3027

    
3028
* **network-id** is the identifier of the network
3029

    
3030
|
3031

    
3032
==============  =========================
3033
Request Header  Value
3034
==============  =========================
3035
X-Auth-Token    User authentication token
3036
==============  =========================
3037

    
3038
.. note:: Request parameters should be empty
3039

    
3040
.. note:: Request body should be empty
3041

    
3042
.. rubric:: Response
3043

    
3044
=========================== =====================
3045
Return Code                 Description
3046
=========================== =====================
3047
200 (OK)                    Request succeeded
3048
400 (Bad Request)           Malformed request or network id
3049
401 (Unauthorized)          Missing or expired user token
3050
404 (Not Found)             Network not found
3051
500 (Internal Server Error) The request cannot be completed because of an
3052
\                           internal error
3053
503 (Service Unavailable)   The service is not currently available
3054
=========================== =====================
3055

    
3056
Response code content::
3057

    
3058
  network: {
3059
    <network attribute>: <value>,
3060
    ...
3061
  }
3062

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

    
3065
*Example Get Network Details Response: JSON*
3066

    
3067
.. code-block:: javascript
3068

    
3069
  {
3070
    "network": {
3071
      "status": "PENDING",
3072
      "updated": "2013-04-25T13:31:17.165237+00:00",
3073
      "name": "my private network",
3074
      "links": [
3075
        {
3076
            "href": "https://example.org/compute/v2.0/networks/6567", 
3077
            "rel": "self"
3078
        }, {
3079
            "href": "https://example.org/compute/v2.0/networks/6567", 
3080
            "rel": "bookmark"
3081
        }
3082
      ],
3083
      "created": "2013-04-25T13:31:17.165088+00:00",
3084
      "cidr6": null,
3085
      "id": "6567",
3086
      "gateway6": null,
3087
      "public": false,
3088
      "dhcp": false,
3089
      "cidr": "192.168.1.0/24",
3090
      "type": "MAC_FILTERED",
3091
      "gateway": null,
3092
      "attachments": []
3093
    }
3094
  }
3095

    
3096
Rename Network
3097
..............
3098

    
3099
.. rubric:: Request
3100

    
3101
========================== ======
3102
URI                        Method
3103
========================== ======
3104
``/networks/<network-id>`` PUT
3105
========================== ======
3106

    
3107
* **network-id** is the identifier of the network
3108

    
3109
|
3110

    
3111
==============  =========================
3112
Request Header  Value
3113
==============  =========================
3114
X-Auth-Token    User authentication token
3115
Content-Type    Type or request body
3116
Content-Length  Length of request body
3117
==============  =========================
3118

    
3119
**Example Request Headers**::
3120

    
3121
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
3122
  Content-Type:   application/json
3123
  Content-Length: 33
3124

    
3125
.. note:: Request parameters should be empty
3126

    
3127
Request body content::
3128

    
3129
  network: {name: <new value>}
3130

    
3131
*Example Update Network Name Request: JSON*
3132

    
3133
.. code-block:: javascript
3134

    
3135
  {"network": {"name": "new_name"}}
3136

    
3137
.. rubric:: Response
3138

    
3139
=========================== =====================
3140
Return Code                 Description
3141
=========================== =====================
3142
204 (OK)                    Request succeeded
3143
400 (Bad Request)           Malformed request or network deleted
3144
401 (Unauthorized)          Missing or expired user token
3145
403 (Forbidden)             Administratively suspended server
3146
404 (Not Found)             Network not found
3147
413 (Over Limit)            Network Limit Exceeded
3148
415 (Bad Media Type)        Bad network type
3149
500 (Internal Server Error) The request cannot be completed because of an
3150
\                           internal error
3151
503 (Service Unavailable)   The service is not currently available
3152
=========================== =====================
3153

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

    
3156
Delete Network
3157
..............
3158

    
3159
A network is deleted as long as it is not attached to any virtual servers.
3160

    
3161
.. rubric:: Request
3162

    
3163
========================== ======
3164
URI                        Method
3165
========================== ======
3166
``/networks/<network-id>`` DELETE
3167
========================== ======
3168

    
3169
* **network-id** is the identifier of the network
3170

    
3171
|
3172

    
3173
==============  =========================
3174
Request Header  Value
3175
==============  =========================
3176
X-Auth-Token    User authentication token
3177
==============  =========================
3178

    
3179
.. note:: Request parameters should be empty
3180

    
3181
.. note:: Request body should be empty
3182

    
3183
.. rubric:: Response
3184

    
3185
=========================== =====================
3186
Return Code                 Description
3187
=========================== =====================
3188
204 (OK)                    Request succeeded
3189
400 (Bad Request)           Malformed request or network already deleted
3190
401 (Unauthorized)          Missing or expired user token
3191
403 (Forbidden)             Administratively suspended server
3192
404 (Not Found)             Network not found
3193
421 (Network In Use)        The network is in use and cannot be deleted
3194
500 (Internal Server Error) The request cannot be completed because of an
3195
\                           internal error
3196
503 (Service Unavailable)   The service is not currently available
3197
=========================== =====================
3198

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

    
3201

    
3202
Connect network to Server
3203
..........................
3204

    
3205
Connect a network to a virtual server. The effect of this operation is the
3206
creation of a NIC that connects the two parts.
3207

    
3208
.. rubric:: Request
3209

    
3210
================================= ======
3211
URI                               Method
3212
================================= ======
3213
``/networks/<network-id>/action`` POST
3214
================================= ======
3215

    
3216
* **network-id** is the identifier of the network
3217

    
3218
|
3219

    
3220
==============  =========================
3221
Request Header  Value
3222
==============  =========================
3223
X-Auth-Token    User authentication token
3224
Content-Type    Type or request body
3225
Content-Length  Length of request body
3226
==============  =========================
3227

    
3228
**Example Request Headers**::
3229

    
3230
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
3231
  Content-Type:   application/json
3232
  Content-Length: 28
3233

    
3234
.. note:: Request parameters should be empty
3235

    
3236
Response body content (connect)::
3237

    
3238
  add {serverRef: <server id to connect>}
3239

    
3240
*Example Action Add (connect to): JSON*
3241

    
3242
.. code-block:: javascript
3243

    
3244
  {"add" : {"serverRef" : 42}}
3245

    
3246
.. rubric:: Response
3247

    
3248
=========================== =====================
3249
Return Code                 Description
3250
=========================== =====================
3251
202 (OK)                    Request succeeded
3252
400 (Bad Request)           Malformed request or network already deleted
3253
401 (Unauthorized)          Missing or expired user token
3254
403 (Forbidden)             Not allowed to modify this network (e.g. public)
3255
404 (Not Found)             Network not found
3256
500 (Internal Server Error) The request cannot be completed because of an
3257
\                           internal error
3258
503 (Service Unavailable)   The service is not currently available
3259
=========================== =====================
3260

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

    
3263
Disconnect network from Server
3264
..............................
3265

    
3266
Disconnect a network from a virtual server. The effect of this operation is the
3267
deletion of the NIC that connects the two parts.
3268

    
3269
.. rubric:: Request
3270

    
3271
================================= ======
3272
URI                               Method
3273
================================= ======
3274
``/networks/<network-id>/action`` POST
3275
================================= ======
3276

    
3277
* **network-id** is the identifier of the network
3278

    
3279
|
3280

    
3281
==============  =========================
3282
Request Header  Value
3283
==============  =========================
3284
X-Auth-Token    User authentication token
3285
Content-Type    Type or request body
3286
Content-Length  Length of request body
3287
==============  =========================
3288

    
3289
**Example Request Headers**::
3290

    
3291
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
3292
  Content-Type:   application/json
3293
  Content-Length: 31
3294

    
3295
.. note:: Request parameters should be empty
3296

    
3297
Response body content (disconnect)::
3298

    
3299
  remove {serverRef: <server id to disconnect>}
3300

    
3301
*Example Action Remove (disconnect from): JSON*
3302

    
3303
.. code-block:: javascript
3304

    
3305
  {"remove" : {"serverRef" : 42}}
3306

    
3307
.. rubric:: Response
3308

    
3309
=========================== =====================
3310
Return Code                 Description
3311
=========================== =====================
3312
202 (OK)                    Request succeeded
3313
400 (Bad Request)           Malformed request or network already deleted
3314
401 (Unauthorized)          Missing or expired user token
3315
403 (Forbidden)             Not allowed to modify this network (e.g. public)
3316
404 (Not Found)             Network not found
3317
500 (Internal Server Error) The request cannot be completed because of an
3318
\                           internal error
3319
503 (Service Unavailable)   The service is not currently available
3320
=========================== =====================
3321

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

    
3324
Index of Attributes
3325
-------------------
3326

    
3327
.. _server-ref:
3328

    
3329
Server Attributes
3330
.................
3331

    
3332
================ ========================== ======== ==========
3333
Server attribute Description                Cyclades OS/Compute
3334
================ ========================== ======== ==========
3335
id               Server ID                  ✔        ✔
3336
name             Server Name                ✔        ✔
3337
status           Server Status              ✔        ✔
3338
updated          Date of last modification  ✔        ✔
3339
created          Date of creation           ✔        ✔
3340
hostId           Physical host              empty    ✔
3341
image            A full image descreption   ✔        ✔
3342
flavor           A full flavor description  ✔        ✔
3343
adminPass        Superuser Password         ✔        ✔
3344
suspended        If server is suspended     ✔        ✔
3345
progress         Build progress             ✔        ✔
3346
metadata         Custom server metadata     ✔        ✔
3347
user_id          Server owner               **✘**    ✔
3348
tenant_id        Server tenant              **✘**    ✔
3349
accessIPv4       Server IPV4 net address    **✘**    ✔
3350
accessIPv6       Server IPV4 net address    **✘**    ✔
3351
addresses        Nets connected on server   **✘**    ✔
3352
links            Server links               **✘**    ✔
3353
================ ========================== ======== ==========
3354

    
3355
* **status** values are described `here <#status-ref>`_
3356

    
3357
* **updated** and **created** are date-formated
3358

    
3359
* **hostId** is always empty in Cyclades and is returned for compatibility reasons
3360

    
3361
* **image** and **flavor** always refer to existing Image and Flavor
3362
  specifications.
3363

    
3364
* **adminPass** in Cyclades it is generated automatically during creation. For
3365
  safety, it is not stored anywhere in the system and it cannot be recovered
3366
  with a query request
3367

    
3368
* **suspended** is True only of the server is suspended by the cloud
3369
  administrations or policy
3370

    
3371
* **progress** is a number between 0 and 100 and reflects the server building
3372
  status
3373

    
3374
* **metadata** are custom key:value pairs refering to the VM. In Cyclades, the
3375
  ``OS`` and ``users`` metadata are automatically retrieved from the servers
3376
  image during creation
3377

    
3378
.. _status-ref:
3379

    
3380
Server Status
3381
.............
3382

    
3383
============= ==================== ======== ==========
3384
Status        Description          Cyclades OS/Compute
3385
============= ==================== ======== ==========
3386
BUILD         Building             ✔        ✔
3387
ACTIVE        Up and running       ✔        ✔
3388
STOPPED       Shut down            ✔        **✘**
3389
REBOOT        Rebooting            ✔        ✔
3390
DELETED       Removed              ✔        ✔
3391
UNKNOWN       Unexpected error     ✔        ✔
3392
ERROR         In error             ✔        ✔
3393
HARD_REBOOT   Hard rebooting       **✘**    ✔
3394
PASSWORD      Resetting password   **✘**    ✔
3395
REBUILD       Rebuilding server    **✘**    ✔
3396
RESCUE        In rescue mode       **✘**    ✔
3397
RESIZE        Resizing             **✘**    ✔
3398
REVERT_RESIZE Failed to resize     **✘**    ✔
3399
SHUTOFF       Shut down by user    **✘**    ✔
3400
SUSPENDED     Suspended            **✘**    ✔
3401
VERIFY_RESIZE Waiting confirmation **✘**    ✔
3402
============= ==================== ======== ==========
3403

    
3404
.. _network-ref:
3405

    
3406
Network
3407
.......
3408

    
3409
.. note:: Networks are features in Cyclades API but not in OS/Compute API
3410

    
3411
================== ===========
3412
Network Attributes Description
3413
================== ===========
3414
id                 Network identifier
3415
name               Network name
3416
created            Date of creation
3417
updates            Date of last update
3418
cidr               IPv4 CIDR Address
3419
cidr6              IPv6 CIDR Address
3420
dhcp               IPv4 DHCP Address
3421
dhcp6              IPv6 DHCP Address
3422
gateway            IPv4 Gateway Address
3423
gateway6           IPv6 Gateway Address
3424
public             If the network is public
3425
status             Network status
3426
attachments        Network Interface Connections (NICs)
3427
================== ===========
3428

    
3429
* **id** and **name** are int and string respectively
3430

    
3431
* **created** and **updated** are ISO8061 date strings
3432

    
3433
* **public** is a boolean flag
3434

    
3435
* **status** can be PENDING, ACTIVE or DELETED
3436

    
3437
* **attachments** refers to the NICs connecting servers on that network.
3438

    
3439
.. _nic-ref:
3440

    
3441
Network Interface Connection (NIC)
3442
..................................
3443

    
3444
A Network Interface Connection (NIC) represents a servers connection to a
3445
network.
3446

    
3447
A NIC is identified by a server and an (obviously unique) mac address. A server
3448
can have multiple NICs, though. In practice, a NIC id is used of reference and
3449
identification.
3450

    
3451
Each NIC is used to connect a specific server to a network. The network is
3452
aware of that connection for as long as it holds. If a NIC is disconnected from
3453
a network, it is destroyed.
3454

    
3455
A NIC specification contains the following information:
3456

    
3457
================= ====================== ======== ==========
3458
Server Attributes Description            Cyclades OS/Compute
3459
================= ====================== ======== ==========
3460
id                The NIC id             ✔        **✘**
3461
mac_address       NIC's mac address      ✔        **✘**
3462
network_id        Network of connection  ✔        **✘**
3463
firewallProfile   The firewall profile   ✔        **✘**
3464
ipv4              IP v4 address          ✔        **✘**
3465
ipv6              IP v6 address          ✔        **✘**
3466
================= ====================== ======== ==========
3467

    
3468
* **id** is the unique identified of the NIC. It consists of the server id and
3469
  an ordinal number nic-<server-id>-<ordinal number> , e.g. for a server with
3470
  id 42::
3471

    
3472
    nic-42-0, nic-42-1, ...
3473

    
3474
* **mac_address** is the unique mac address of the interface
3475

    
3476
* **network_id** is the id of the network this nic connects to.
3477

    
3478
* **firewallProfile** , if set, refers to the mode of the firewall. Valid
3479
  firewall profile values::
3480

    
3481
    ENABLED, DISABLED, PROTECTED
3482

    
3483
* **ipv4** and **ipv6** are the IP addresses (versions 4 and 6 respectively) of
3484
  the specific network connection for that machine.
3485

    
3486
.. _flavor-ref:
3487

    
3488
Flavor
3489
......
3490

    
3491
A flavor is a hardware configuration for a server. It contains the following
3492
information:
3493

    
3494
================= ==================== ======== ==========
3495
Flavor Attributes Description          Cyclades OS/Compute
3496
================= ==================== ======== ==========
3497
id                The flavor id        ✔        ✔
3498
name              The flavor name      ✔        ✔
3499
ram               Server RAM size      ✔        ✔
3500
SNF:disk_template Storage mechanism    ✔        **✘**
3501
disk              Server disk size     ✔        ✔
3502
vcpus             # of Virtual CPUs    ✔        ✔
3503
links rel         Atom link rel field  **✘**    ✔
3504
links href        Atom link href field **✘**    ✔
3505
================= ==================== ======== ==========
3506

    
3507
* **id** is the flavor unique id (a possitive integer)
3508

    
3509
* **name** is the flavor name (a string)
3510

    
3511
* **ram** is the server RAM size in MB
3512

    
3513
* **SNF:disk_template** is a reference to the underlying storage mechanism
3514
  used by the Cyclades server. It is Cyclades specific.
3515

    
3516
* **disk** the servers disk size in GB
3517

    
3518
* **vcpus** refer to the number of virtual CPUs assigned to a server
3519

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

    
3523
.. _image-ref:
3524

    
3525
Image
3526
.....
3527

    
3528
An image is a collection of files you use to create or rebuild a server.
3529

    
3530
An image item may have the fields presented bellow:
3531

    
3532
================= ====================== ======== ==========
3533
Server Attributes Description            Cyclades OS/Compute
3534
================= ====================== ======== ==========
3535
id                Image ID               ✔        ✔
3536
name              Image name             ✔        ✔
3537
updated           Last update date       ✔        ✔
3538
created           Image creation date    ✔        ✔
3539
progress          Ready status progress  ✔        **✘**
3540
status            Image status           **✘**    ✔
3541
tenant_id         Image creator          **✘**    ✔
3542
user_id           Image users            **✘**    ✔
3543
metadata          Custom metadata        ✔        ✔
3544
links             Atom links             **✘**    ✔
3545
minDisk           Minimum required disk  **✘**    ✔
3546
minRam            Minimum required RAM   **✘**    ✔
3547
================= ====================== ======== ==========
3548

    
3549
* **id** is the image id and **name** is the image name. They are both strings.
3550

    
3551
* **updated** and **created** are both ISO8601 date strings
3552

    
3553
* **progress** varies between 0 and 100 and denotes the status of the image
3554

    
3555
* **metadata** is a collection of ``key``:``values`` pairs of custom metadata,
3556
  under the tag ``values`` which lies under the tag ``metadata``.
3557

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