Statistics
| Branch: | Tag: | Revision:

root / docs / cyclades-api-guide.rst @ 91a2a94e

History | View | Annotate | Download (103.8 kB)

1
.. _cyclades-api-guide:
2

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

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

    
11
This document's goals are:
12

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
65
* Pagination is currently not supported.
66

    
67
* Cached responses are currently not supported.
68

    
69
* Limits are currently not supported.
70

    
71
* Extensions are currently not supported.
72

    
73

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

    
77
Servers
78
-------
79

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

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

    
104
List all virtual servers owned by the user.
105

    
106
.. rubric:: Request
107

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

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

    
119
|
120

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

    
127
|
128

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

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

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

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

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

    
152
.. rubric:: Response
153

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

    
167
|
168

    
169
Response body contents::
170

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

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

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

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

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

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

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

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

    
219
*Example List Servers: JSON*
220

    
221
.. code-block:: javascript
222

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

    
282

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

    
286
Create a new virtual server
287

    
288
.. rubric:: Request
289

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

    
296
|
297

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

    
306
*Example Request Headers*::
307

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

    
312
|
313

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

    
321
Request body contents::
322

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

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

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

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

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

    
354
* **personality** (optional) is a list of personality injections. A personality
355
  injection is a way to add a file into a virtual server while creating it.
356
  Each change modifies/creates a file on the virtual server. The injected data
357
  (``contents``) should not exceed 10240 *bytes* in size and must be base64
358
  encoded. The file mode should be a number, not a string. A personality
359
  injection contains the following attributes:
360

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

    
371
*Example Create Server Request: JSON*
372

    
373
.. code-block:: javascript
374

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

    
402
.. rubric:: Response
403

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

    
421
|
422

    
423
Response body contents::
424

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

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

    
432
*Example Create Server Response: JSON*
433

    
434
.. code-block:: javascript
435

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

    
456
*Example Create Server Response: XML*
457

    
458
.. code-block:: xml
459

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

    
475
Get Server Stats
476
................
477

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

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

    
482
.. rubric:: Request
483

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

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

    
492
|
493

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

    
500
|
501

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

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

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

    
514
.. rubric:: Response
515

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

    
529
|
530

    
531
Response body contents::
532

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

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

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

    
548
*Example Get Server Stats Response: JSON*
549

    
550
.. code-block:: javascript
551

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

    
563
*Example Get Network Details Response: XML*
564

    
565
.. code-block:: xml
566

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

    
578
Get Server Diagnostics
579
......................
580

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

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

    
585
.. rubric:: Request
586

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

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

    
595
|
596

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

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

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

    
607
.. rubric:: Response
608

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

    
622
|
623

    
624
Response body contents::
625

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

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

    
648
*Example Get Server Diagnostics Response: JSON*
649

    
650
.. code-block:: javascript
651

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

    
677
Get Server Details
678
..................
679

    
680
This operation returns detailed information for a virtual server
681

    
682
.. rubric:: Request
683

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

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

    
692
|
693

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

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

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

    
704
.. rubric:: Response
705

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

    
720
|
721

    
722
Response body contents::
723

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

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

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

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

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

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

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

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

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

    
772
.. code-block:: javascript
773

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

    
813
Rename Server
814
.............
815

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

    
819
.. rubric:: Response
820

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

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

    
829
|
830

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

    
839
**Example Request Headers**::
840

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

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

    
847
Request body contents::
848

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

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

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

    
865
*Example Rename Server Request: JSON*
866

    
867
.. code-block:: javascript
868

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

    
871
.. rubric:: Response
872

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

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

    
893
Delete Server
894
.............
895

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

    
899
.. rubric:: Request
900

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

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

    
909
|
910

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

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

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

    
921
.. rubric:: Response
922

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

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

    
939
List Server Addresses
940
.....................
941

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

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

    
950
.. rubric:: Request
951

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

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

    
960
|
961

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

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

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

    
972
.. rubric:: Response
973

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

    
987
Response body contents::
988

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

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

    
1001
*Example List Addresses: JSON*
1002

    
1003
.. code-block:: javascript
1004

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

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

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

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

    
1034
.. rubric:: Request
1035

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

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

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

    
1046
|
1047

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

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

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

    
1058
.. rubric:: Response
1059

    
1060
=========================== =====================
1061
Return Code                 Description
1062
=========================== =====================
1063
200 (OK)                    Request succeeded
1064
400 (Bad Request)           Malformed server id or machine already deleted
1065
401 (Unauthorized)          Missing or expired user token
1066
404 (Not Found)             Server not found
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)   Service currently unavailable
1071
=========================== =====================
1072

    
1073
|
1074

    
1075
Response body contents::
1076

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

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

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

    
1086
.. code-block:: javascript
1087

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

    
1099

    
1100
List Server Metadata
1101
....................
1102

    
1103
List the metadata of a server
1104

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

    
1108
.. rubric:: Request
1109

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

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

    
1118
|
1119

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

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

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

    
1130
.. rubric:: Response
1131

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

    
1145
Response body contents::
1146

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

    
1152
*Example List Server Metadata: JSON*
1153

    
1154
.. code-block:: javascript
1155

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

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

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

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

    
1177
.. rubric:: Request
1178

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

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

    
1188
|
1189

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

    
1198
**Example Request Headers**::
1199

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

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

    
1206
Request body contents::
1207

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

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

    
1215
.. code-block:: javascript
1216

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

    
1219
.. rubric:: Response
1220

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

    
1235
Response body contents::
1236

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

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

    
1244
.. code-block:: javascript
1245

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

    
1248
Get Server Metadata Item
1249
........................
1250

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

    
1253
.. rubric:: Request
1254

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

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

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

    
1265
|
1266

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

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

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

    
1277
.. rubric:: Response
1278

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

    
1292
Response body content::
1293

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

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

    
1298
.. code-block:: javascript
1299

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

    
1302
Update Server Metadatum Item
1303
.............................
1304

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

    
1307
.. rubric:: Request
1308

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

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

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

    
1319
|
1320

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

    
1329
**Example Request Headers**::
1330

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

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

    
1337
Request body content::
1338

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

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

    
1343
.. code-block:: javascript
1344

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

    
1347
.. rubric:: Response
1348

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

    
1363
Response body content::
1364

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

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

    
1369
.. code-block:: javascript
1370

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

    
1373
Delete Server Metadatum
1374
.......................
1375

    
1376
Delete a metadatum of a virtual server
1377

    
1378
.. rubric:: Request
1379

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

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

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

    
1390
|
1391

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

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

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

    
1402
.. rubric:: Response
1403

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

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

    
1419
Server Actions
1420
--------------
1421

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

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

    
1444
.. rubric:: Request
1445

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

    
1452
|
1453

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

    
1462
**Example Request Headers**::
1463

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

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

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

    
1472
.. rubric:: Response
1473

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

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

    
1489
Start server
1490
................
1491

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

    
1494
Request body contents::
1495

    
1496
  start: {}
1497

    
1498
*Example Start Server: JSON*
1499

    
1500
.. code-block:: javascript
1501

    
1502
  {"start": {}}
1503

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

    
1506
Reboot Server
1507
.............
1508

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

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

    
1517
Request body contents::
1518

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

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

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

    
1525
.. code-block:: javascript
1526

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

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

    
1531
Shutdown server
1532
...............
1533

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

    
1536
Request body contents::
1537

    
1538
  shutdown: {}
1539

    
1540
*Example Shutdown Server: JSON*
1541

    
1542
.. code-block:: javascript
1543

    
1544
  {"shutdown": {}}
1545

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

    
1548
Get Server Console
1549
..................
1550

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

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

    
1558
Request body contents::
1559

    
1560
  console: {type: vnc}
1561

    
1562
*Example Get Server Console: JSON*
1563

    
1564
.. code-block:: javascript
1565

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

    
1568
Response body contents::
1569

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

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

    
1584
*Example Action Console Response: JSON*
1585

    
1586
.. code-block:: javascript
1587

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

    
1597
Set Server Firewall Profile
1598
...........................
1599

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

    
1603
Request body contents::
1604

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

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

    
1609
*Example Action firewallProfile: JSON**
1610

    
1611
.. code-block:: javascript
1612

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

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

    
1617
OS/Compute Specific
1618
...................
1619

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

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

    
1630

    
1631
Flavors
1632
-------
1633

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

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

    
1644
List Flavors
1645
............
1646

    
1647
List the flavors that are accessible by the user
1648

    
1649
.. rubric:: Request
1650

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

    
1658
|
1659

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

    
1666
|
1667

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

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

    
1677
.. rubric:: Response
1678

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

    
1691
Response code contents::
1692

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

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

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

    
1706
.. code-block:: javascript
1707

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

    
1720

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

    
1723
.. code-block:: xml
1724

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

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

    
1734
.. code-block:: javascript
1735

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

    
1756
Get Flavor Details
1757
..................
1758

    
1759
Get the configuration of a specific flavor
1760

    
1761
.. rubric:: Request
1762

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

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

    
1771
|
1772

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

    
1779
|
1780

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

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

    
1790
.. rubric:: Response
1791

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

    
1805
Response code contents::
1806

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

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

    
1814
*Example Flavor Details: JSON*
1815

    
1816
.. code-block:: javascript
1817

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

    
1831
*Example Flavor Details: XML*
1832

    
1833
.. code-block:: xml
1834

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

    
1840
Images
1841
------
1842

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

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

    
1862

    
1863
List Images
1864
...........
1865

    
1866
List all images accessible by the user
1867

    
1868
.. rubric:: Request
1869

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

    
1877
|
1878

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

    
1885
|
1886

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

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

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

    
1906
.. rubric:: Response
1907

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

    
1921
Response body contents::
1922

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

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

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

    
1941
.. code-block:: javascript
1942

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

    
1981
Get Image Details
1982
.................
1983

    
1984
Get the details of a specific image
1985

    
1986
.. rubric:: Request
1987

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

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

    
1996
|
1997

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

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

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

    
2008
.. rubric:: Response
2009

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

    
2024
Response body contents::
2025

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

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

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

    
2038
.. code-block:: javascript
2039

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

    
2061

    
2062
Delete Image
2063
............
2064

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

    
2067
.. rubric:: Request
2068

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

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

    
2077
|
2078

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

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

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

    
2089
.. rubric:: Response
2090

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

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

    
2106
List Image Metadata
2107
...................
2108

    
2109
.. rubric:: Request
2110

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

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

    
2119
|
2120

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

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

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

    
2131
.. rubric:: Response
2132

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

    
2147
Response body content::
2148

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

    
2154
*Example List Image Metadata: JSON*
2155

    
2156
.. code-block:: javascript
2157

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

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

    
2174
Update Image Metadata
2175
.....................
2176

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

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

    
2188
.. rubric:: Request
2189

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

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

    
2199
|
2200

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

    
2209
**Example Request Headers**::
2210

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

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

    
2217
Request body content::
2218

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

    
2224
*Example Update Image Metadata Request: JSON*
2225

    
2226
.. code-block:: javascript
2227

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

    
2230
.. rubric:: Response
2231

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

    
2246
Response body content::
2247

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

    
2253
*Example Update Image Response: JSON*
2254

    
2255
.. code-block:: javascript
2256

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

    
2272
Get Image Metadatum
2273
...................
2274

    
2275
.. rubric:: Request
2276

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

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

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

    
2287
|
2288

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

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

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

    
2299
.. rubric:: Response
2300

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

    
2314
Response body content::
2315

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

    
2318
*Example Get Image Metadatum Item: JSON*
2319

    
2320
.. code-block:: javascript
2321

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

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

    
2326
Update Image Metadatum
2327
......................
2328

    
2329
.. rubric:: Request
2330

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

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

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

    
2341
|
2342

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

    
2351
**Example Request Headers**::
2352

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

    
2357
|
2358

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

    
2361
Request body content::
2362

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

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

    
2367
.. code-block:: javascript
2368

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

    
2371
.. rubric:: Response
2372

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

    
2387
Request body content::
2388

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

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

    
2393
.. code-block:: javascript
2394

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

    
2397
Delete Image Metadatum
2398
......................
2399

    
2400
Delete an image metadatum by its key.
2401

    
2402
.. rubric:: Request
2403

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

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

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

    
2414
|
2415

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

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

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

    
2426
.. rubric:: Response
2427

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

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

    
2443
Networks
2444
--------
2445

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

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

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

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

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

    
2479

    
2480
List Networks
2481
.............
2482

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

    
2485
.. rubric:: Request
2486

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

    
2494
|
2495

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

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

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

    
2506
.. rubric:: Response
2507

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

    
2523
Response body content::
2524

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

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

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

    
2538
.. code-block:: javascript
2539

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

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

    
2549
.. code-block:: javascript
2550

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

    
2569

    
2570
Create Network
2571
..............
2572

    
2573
This operation asynchronously provisions a new network.
2574

    
2575
.. rubric:: Request
2576

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

    
2583
|
2584

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

    
2593
**Example Request Headers**::
2594

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

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

    
2601
Request body content::
2602

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

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

    
2621
* **name** is a string
2622

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

    
2625
* **dhcp** and **public** are flags
2626

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

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

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

    
2633
*Example Create Network Request Body: JSON*
2634

    
2635
.. code-block:: javascript
2636

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

    
2639
.. rubric:: Response
2640

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

    
2656
Response body content::
2657

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

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

    
2665
*Example Create Network Response: JSON*
2666

    
2667
.. code-block:: javascript
2668

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

    
2687
Get Network Details
2688
...................
2689

    
2690
.. rubric:: Request
2691

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

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

    
2700
|
2701

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

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

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

    
2712
.. rubric:: Response
2713

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

    
2726
Response code content::
2727

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

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

    
2735
*Example Get Network Details Response: JSON*
2736

    
2737
.. code-block:: javascript
2738

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

    
2757
Rename Network
2758
..............
2759

    
2760
.. rubric:: Request
2761

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

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

    
2770
|
2771

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

    
2780
**Example Request Headers**::
2781

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

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

    
2788
Request body content::
2789

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

    
2792
*Example Update Network Name Request: JSON*
2793

    
2794
.. code-block:: javascript
2795

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

    
2798
.. rubric:: Response
2799

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

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

    
2817
Delete Network
2818
..............
2819

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

    
2822
.. rubric:: Request
2823

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

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

    
2832
|
2833

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

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

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

    
2844
.. rubric:: Response
2845

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

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

    
2862

    
2863
Connect network to Server
2864
..........................
2865

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

    
2869
.. rubric:: Request
2870

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

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

    
2879
|
2880

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

    
2889
**Example Request Headers**::
2890

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

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

    
2897
Response body content (connect)::
2898

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

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

    
2903
.. code-block:: javascript
2904

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

    
2907
.. rubric:: Response
2908

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

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

    
2924
Disconnect network from Server
2925
..............................
2926

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

    
2930
.. rubric:: Request
2931

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

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

    
2940
|
2941

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

    
2950
**Example Request Headers**::
2951

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

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

    
2958
Response body content (disconnect)::
2959

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

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

    
2964
.. code-block:: javascript
2965

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

    
2968
.. rubric:: Response
2969

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

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

    
2985
Index of Attributes
2986
-------------------
2987

    
2988
.. _server-ref:
2989

    
2990
Server Attributes
2991
.................
2992

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

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

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

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

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

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

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

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

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

    
3039
.. _status-ref:
3040

    
3041
Server Status
3042
.............
3043

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

    
3065
.. _network-ref:
3066

    
3067
Network
3068
.......
3069

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

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

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

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

    
3094
* **public** is a boolean flag
3095

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

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

    
3100
.. _nic-ref:
3101

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

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

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

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

    
3116
A NIC specification contains the following information:
3117

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

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

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

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

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

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

    
3142
    ENABLED, DISABLED, PROTECTED
3143

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

    
3147
.. _flavor-ref:
3148

    
3149
Flavor
3150
......
3151

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

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

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

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

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

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

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

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

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

    
3184
.. _image-ref:
3185

    
3186
Image
3187
.....
3188

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

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

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

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

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

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

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

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