Statistics
| Branch: | Tag: | Revision:

root / docs / compute-api-guide.rst @ 8b5a2fc0

History | View | Annotate | Download (90.6 kB)

1
.. _compute-api-guide:
2

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

    
6
`Cyclades <cyclades.html>`_ is the Compute Service of `Synnefo
7
<http://www.synnefo.org>`_. The Cyclades/Compute API complies with
8
`OpenStack Compute <http://docs.openstack.org/api/openstack-compute/2/content>`_
9
with custom extensions when needed.
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
18
`kamaki <http://www.synnefo.org/docs/kamaki/latest/index.html>`_ command-line
19
client and associated python library, instead of making direct calls.
20

    
21
Overview
22
========
23

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

    
29
General API Information
30
=======================
31

    
32
Authentication
33
--------------
34

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

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

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

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

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

    
51
Limitations
52
-----------
53

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

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

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

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

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

    
66
* Pagination is currently not supported.
67

    
68
* Cached responses are currently not supported.
69

    
70
* Limits are currently not supported.
71

    
72
* Extensions are currently not supported.
73

    
74

    
75
API Operations
76
==============
77

    
78
.. rubric:: Servers
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 Connections <#list-server-connections>`_     ``/servers/<server id>/ips``              GET    ✔        ✔
92
`Get Connection <#connection-with-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-metadata-item>`_ ``/servers/<server-id>/metadata/<key>``   PUT    ✔        ✔
98
`Delete Meta Item <#delete-server-metadata>`_      ``/servers/<server-id>/metadata/<key>``   DELETE ✔        ✔
99
`Actions <#server-actions>`_                       ``servers/<server id>/action``            POST   ✔        ✔
100
================================================== ========================================= ====== ======== ==========
101

    
102
.. rubric:: Flavors
103

    
104
==================================== ======================== ====== ======== ==========
105
Description                          URI                      Method Cyclades OS/Compute
106
==================================== ======================== ====== ======== ==========
107
`List <#list-flavors>`_              ``/flavors``             GET    ✔        ✔
108
\                                    ``/flavors/detail``      GET    ✔        **✘**
109
`Get details <#get-flavor-details>`_ ``/flavors/<flavor-id>`` GET    ✔        ✔
110
==================================== ======================== ====== ======== ==========
111

    
112
.. rubric:: Images
113

    
114
=========================================== ===================================== ====== ======== ==========
115
Description                                 URI                                   Method Cyclades OS/Compute
116
=========================================== ===================================== ====== ======== ==========
117
`List <#list-images>`_                      ``/images``                           GET    ✔        ✔
118
\                                           ``/images/detail``                    GET    ✔        ✔
119
`Get details <#get-image-details>`_         ``/images/<image-id>``                GET    ✔        ✔
120
`Delete <#delete-image>`_                   ``/images/<image id>``                DELETE ✔        ✔
121
`List Metadata <#list-image-metadata>`_     ``/images/<image-id>/metadata``       GET    ✔        ✔
122
`Update Metadata <#update-image-metadata>`_ ``/images/<image-id>/metadata``       POST   ✔        ✔
123
\                                           ``/images/<image-id>/metadata``       PUT    **✘**    ✔
124
`Get Meta Item <#get-image-metadata>`_      ``/image/<image-id>/metadata/<key>``  GET    ✔        ✔
125
`Update Metadata <#update-image-metadata>`_ ``/images/<image-id>/metadata/<key>`` PUT    ✔        ✔
126
`Delete Metadata <#delete-image-metadata>`_ ``/images/<image-id>/metadata/<key>`` DELETE ✔        ✔
127
=========================================== ===================================== ====== ======== ==========
128

    
129
List Servers
130
------------
131

    
132
List all virtual servers owned by the user.
133

    
134
.. rubric:: Request
135

    
136
=================== ====== ======== ==========
137
URI                 Method Cyclades OS/Compute
138
=================== ====== ======== ==========
139
``/servers``        GET    ✔        ✔
140
``/servers/detail`` GET    ✔        ✔
141
=================== ====== ======== ==========
142

    
143
* Both requests return a list of servers. The first returns just ``id``,
144
  ``name`` and ``links``, while the second returns the full collections of
145
  server attributes.
146

    
147
|
148
==============  ========================= ======== ==========
149
Request Header  Value                     Cyclades OS/Compute
150
==============  ========================= ======== ==========
151
X-Auth-Token    User authentication token required required
152
==============  ========================= ======== ==========
153

    
154
|
155
================= =================================== ======== ==========
156
Request Parameter Value                               Cyclades OS/Compute
157
================= =================================== ======== ==========
158
json              Respond in json                     default  **✘**
159
xml               Respond in xml                      ✔        **✘**
160
changes-since     Servers delete since that timestamp ✔        ✔
161
image             Image reference                     **✘**    ✔
162
flavor            VM flavor reference                 **✘**    ✔
163
server            Server flavor reference             **✘**    ✔
164
status            Server status                       **✘**    ✔
165
marker            Last list last ID                   **✘**    ✔
166
limit             Page size                           **✘**    ✔
167
================= =================================== ======== ==========
168

    
169
* **json** and **xml** parameters are mutually exclusive. If none supported,
170
the response will be formated in json.
171

    
172
* **status** refers to the `server status <#status-ref>`_
173

    
174
* **changes-since** must be an ISO8601 date string
175

    
176
.. rubric:: Response
177

    
178
=========================== =====================
179
Return Code                 Description
180
=========================== =====================
181
200 (OK)                    Request succeeded
182
304 (No servers since date) Can be returned if ``changes-since`` is given
183
400 (Bad Request)           Invalid or malformed ``changes-since`` parameter
184
401 (Unauthorized)          Missing or expired user token
185
403 (Forbidden)             User is not allowed to perform this operation
186
500 (Internal Server Error) The request cannot be completed because of an
187
\                           internal error
188
503 (Service Unavailable)   The server is not currently available
189
=========================== =====================
190

    
191
|
192

    
193
Response body contents::
194

    
195
  servers: [
196
    {
197
      <server attribute>: <value>,
198
      ...
199
    }, ...
200
  ]
201

    
202
The server attributes are listed `here <#server-ref>`_
203

    
204
*Example List Servers: JSON (regular)*
205

    
206
.. code-block:: javascript
207

    
208
  GET https://example.org/compute/v2.0/servers
209

    
210

    
211
  {
212
    "servers": [
213
      {
214
        "links": [
215
          {
216
            "href": "https://example.org/compute/v2.0/servers/42", 
217
            "rel": "self"
218
          }, {
219
            "href": "https://example.org/compute/v2.0/servers/42", 
220
            "rel": "bookmark"
221
          }
222
        ],
223
        "id": "42",
224
        "name": "My Server",
225
      }, {
226
        "links": [
227
          {
228
            "href": "https://example.org/compute/v2.0/servers/43", 
229
            "rel": "self"
230
          }, {
231
            "href": "https://example.org/compute/v2.0/servers/43", 
232
            "rel": "bookmark"
233
          }
234
        ],
235
        "id": "84",
236
        "name": "My Server",
237
      }
238
    ]
239
  }
240

    
241
*Example List Servers: JSON (detail)*
242

    
243
  GET https://example.org/compute/v2.0/servers/detail
244

    
245

    
246
.. code-block:: javascript
247

    
248
  {
249
    "servers": [
250
      {
251
        "addresses": [
252
          "2718": [
253
            {
254
              "version": 6,
255
              "addr": "2001:443:2dfc:1232:a810:3cf:fe9b:21ab",
256
              "OS-EXT-IPS:type": "fixed"
257
            }
258
          ],
259
          "2719": [
260
            {
261
              "version": 4,
262
              "addr": "192.168.1.2",
263
              "OS-EXT-IPS:type": "floating"
264
            }
265
          ]
266
        ],
267
        "attachments": [
268
            {
269
              "id": "18",
270
              "network_id": "2718",
271
              "mac_address": "aa:01:02:6c:34:ab",
272
              "firewallProfile": "DISABLED",
273
              "ipv4": "",
274
              "ipv6": "2001:443:2dfc:1232:a810:3cf:fe9b:21ab"
275
              "OS-EXT-IPS:type": "fixed"
276
            }, {
277
              "id": "19",
278
              "network_id": "2719",
279
              "mac_address": "aa:00:0c:6d:34:bb",
280
              "firewallProfile": "PROTECTED",
281
              "ipv4": "192.168.1.2",
282
              "ipv6": ""
283
              "OS-EXT-IPS:type": "floating"
284
            }
285
        ],
286
        "links": [
287
          {
288
            "href": "https://example.org/compute/v2.0/servers/42", 
289
            "rel": "self"
290
          }, {
291
            "href": "https://example.org/compute/v2.0/servers/42", 
292
            "rel": "bookmark"
293
          }
294
        ],
295
        "image": {
296
          "id": "im4g3-1d",
297
          "links": [
298
            {
299
              "href": "https://example.org/compute/v2.0/images/im4g3-1d", 
300
              "rel": "self"
301
            }, {
302
              "href": "https://example.org/compute/v2.0/images/im4g3-1d", 
303
              "rel": "bookmark"
304
            }, {
305
              "href": "https://example.org/image/v1.0/images/im4g3-1d", 
306
              "rel": "alternate"
307
            }
308
          ]
309
        },
310
        "suspended": false,
311
        "created': '2011-04-19T10:18:52.085737+00:00',
312
        "flavor": {
313
          "id": 1",
314
          "links": [
315
            {
316
              "href": "https://example.org/compute/v2.0/flavors/1", 
317
              "rel": "self"
318
            }, {
319
              "href": "https://example.org/compute/v2.0/flavors/1", 
320
              "rel": "bookmark"
321
            }
322
          ]
323
        },
324
        "id": "42",
325
        "security_groups": [{"name": "default"}],
326
        "user_id": "s0m5-u5e7-1d",
327
        "accessIPv4": "",
328
        "accessIPv6": "",
329
        "progress": 100,
330
        "config_drive": "",
331
        "status": "ACTIVE",
332
        "updated": "2011-05-29T14:07:07.037602+00:00",
333
        "hostId": "",
334
        "SNF:fqdn": "snf-42.vm.example.org",
335
        "key_name": null,
336
        "name": "My Server",
337
        "created": "2014-02-12T08:31:37.834542+00:00",
338
        "tenant_id": "s0m5-u5e7-1d",
339
        "SNF:port_forwarding": {},
340
        "SNF:task_state": "",
341
        "diagnostics": [
342
            {
343
                "level": "DEBUG",
344
                "created": "2014-02-12T08:31:37.834542+00:00",
345
                "source": "image-info",
346
                "source_date": "2014-02-12T08:32:35.929507+00:00",
347
                "message": "Image customization finished successfully.",
348
                "details": null
349
            }
350
        ],
351
        "metadata": {
352
            "os": "debian",
353
            "users": "root"
354
        }
355
      }, {
356
      {
357
        "addresses": [
358
          "2718": [
359
            {
360
              "version": 6,
361
              "addr": "2001:443:2dfc:1232:a810:3cf:fe9b:21cd",
362
              "OS-EXT-IPS:type": "fixed"
363
            }
364
          ],
365
          "4178": [
366
            {
367
              "version": 4,
368
              "addr": "192.168.1.3",
369
              "OS-EXT-IPS:type": "floating"
370
            }
371
          ]
372
        ],
373
        "attachments": [
374
            {
375
              "id": "36",
376
              "network_id": "2718",
377
              "mac_address": "aa:01:02:6c:34:cd",
378
              "firewallProfile": "DISABLED",
379
              "ipv4": "",
380
              "ipv6": "2001:443:2dfc:1232:a810:3cf:fe9b:21cd"
381
              "OS-EXT-IPS:type": "fixed"
382
            }, {
383
              "id": "38",
384
              "network_id": "4178",
385
              "mac_address": "aa:00:0c:6d:34:cc",
386
              "firewallProfile": "PROTECTED",
387
              "ipv4": "192.168.1.3",
388
              "ipv6": ""
389
              "OS-EXT-IPS:type": "floating"
390
            }
391
        ],
392
        "links": [
393
          {
394
            "href": "https://example.org/compute/v2.0/servers/84", 
395
            "rel": "self"
396
          }, {
397
            "href": "https://example.org/compute/v2.0/servers/84", 
398
            "rel": "bookmark"
399
          }
400
        ],
401
        "image": {
402
          "id": "im4g3-1d",
403
          "links": [
404
            {
405
              "href": "https://example.org/compute/v2.0/images/im4g3-1d", 
406
              "rel": "self"
407
            }, {
408
              "href": "https://example.org/compute/v2.0/images/im4g3-1d", 
409
              "rel": "bookmark"
410
            }, {
411
              "href": "https://example.org/image/v1.0/images/im4g3-1d", 
412
              "rel": "alternate"
413
            }
414
          ]
415
        },
416
        "suspended": false,
417
        "created': '2011-04-21T10:18:52.085737+00:00',
418
        "flavor": {
419
          "id": 3",
420
          "links": [
421
            {
422
              "href": "https://example.org/compute/v2.0/flavors/3", 
423
              "rel": "self"
424
            }, {
425
              "href": "https://example.org/compute/v2.0/flavors/3", 
426
              "rel": "bookmark"
427
            }
428
          ]
429
        },
430
        "id": "84",
431
        "security_groups": [{"name": "default"}],
432
        "user_id": "s0m5-u5e7-1d",
433
        "accessIPv4": "",
434
        "accessIPv6": "",
435
        "progress": 100,
436
        "config_drive": "",
437
        "status": "ACTIVE",
438
        "updated": "2011-05-30T14:07:07.037602+00:00",
439
        "hostId": "",
440
        "SNF:fqdn": "snf-84.vm.example.org",
441
        "key_name": null,
442
        "name": "My Other Server",
443
        "created": "2014-02-21T08:31:37.834542+00:00",
444
        "tenant_id": "s0m5-u5e7-1d",
445
        "SNF:port_forwarding": {},
446
        "SNF:task_state": "",
447
        "diagnostics": [
448
          {
449
            "level": "DEBUG",
450
            "created": "2014-02-21T08:31:37.834542+00:00",
451
            "source": "image-info",
452
            "source_date": "2014-02-21T08:32:35.929507+00:00",
453
            "message": "Image customization finished successfully.",
454
            "details": null
455
          }
456
        ],
457
        "metadata": {
458
          "os": "debian",
459
          "users": "root"
460
        }
461
      }
462
    ]
463
  }
464

    
465

    
466
Create Server
467
-------------
468

    
469
Create a new virtual server
470

    
471
.. rubric:: Request
472

    
473
============ ====== ======== ==========
474
URI          Method Cyclades OS/Compute
475
============ ====== ======== ==========
476
``/servers`` POST   ✔        ✔
477
============ ====== ======== ==========
478

    
479
|
480
==============  ========================= ======== ==========
481
Request Header  Value                     Cyclades OS/Compute
482
==============  ========================= ======== ==========
483
X-Auth-Token    User authentication token required required
484
Content-Type    Type or request body      required required
485
Content-Length  Length of request body    required required
486
==============  ========================= ======== ==========
487

    
488
|
489
================= ===============
490
Request Parameter Value
491
================= ===============
492
json              Respond in json
493
xml               Respond in xml
494
================= ===============
495

    
496
Request body contents::
497

    
498
  server: {
499
      <server attribute>: <value>,
500
      ...
501
      personality: [
502
        ...
503
      ],
504
      networks: [
505
        ...
506
      ]
507
      ...
508
  }
509

    
510
=========== ====================== ======== ==========
511
Attributes  Description            Cyclades OS/Compute
512
=========== ====================== ======== ==========
513
name        The server name        ✔        ✔
514
imageRef    Image id               ✔        ✔
515
flavorRef   Resources flavor       ✔        ✔
516
personality Personality contents   ✔        ✔
517
metadata    Custom metadata        ✔        ✔
518
networks    Connection information ✔        ✔
519
project     Project UUID           ✔        **✘**
520
=========== ====================== ======== ==========
521

    
522
* **name** can be any string
523

    
524
* **imageRed** and **flavorRed** should refer to existing images and hardware
525
  flavors accessible by the user
526

    
527
* **metadata** are ``key``:``value`` pairs of custom server-specific metadata.
528
  There are no semantic limitations, although the ``OS`` and ``USERS`` values
529
  should rather be defined
530

    
531
* **personality** (optional) is a list of
532
  `personality injections <#personality-ref>`_
533

    
534
* **networks** (optional) is a list of
535
  `network connections <#network-on-vm-ref>`_.
536

    
537
.. rubric:: Response
538

    
539
=========================== =====================
540
Return Code                 Description
541
=========================== =====================
542
200 (OK)                    Request succeeded
543
400 (Bad Request)           Malformed request data
544
401 (Unauthorized)          Missing or expired user token
545
403 (Forbidden)             User is not allowed to perform this operation
546
404 (Not Found)             Image or Flavor not found
547
413 (Over Limit)            Exceeded some resource limit
548
415 (Bad Media Type)        
549
500 (Internal Server Error) The request cannot be completed because of an
550
\                           internal error
551
503 (Service Unavailable)   No available backends or service currently
552
\                           unavailable
553
=========================== =====================
554

    
555
|
556

    
557
Response body contents::
558

    
559
  server: {
560
    <server attribute>: <value>,
561
    ...
562
  }
563

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

    
566
.. note:: The ``adminPass`` attribute is generated in the response. This is the
567
    only case where this attribute appears in a response.
568

    
569
*Example Create Server Response: JSON*
570

    
571
.. code-block:: javascript
572

    
573
  POST https://example.org/compute/v2.0/servers
574

    
575

    
576
  {
577
    "server": {
578
      "name": "My Example Server",
579
      "id": 5678,
580
      "status": "BUILD",
581
      "created": "2013-04-10T13:52:17.085402+00:00",
582
      "updated": "2013-04-10T13:52:17.085402+00:00",
583
      "adminPass": "fKCqlZe2at",
584
      "progress": 0
585
      "metadata": {
586
        "OS": "debian",
587
        "USERS": "root"
588
      },
589
      ...
590
    }
591
  }
592

    
593
.. _personality-ref:
594

    
595
Personality: injecting files while creating a virtual server
596
............................................................
597

    
598
The term "personality" refers to a mechanism for injecting data as files into
599
the file system of a virtual server while the server is being created. This
600
mechanism has many application e.g., the injection of ``ssh keys`` for secure
601
password-less access, automation in user profile configuration, etc.
602

    
603
A personality injection contains the following attributes:
604

    
605
====================== =================== ======== ==========
606
Personality Attributes Description         Cyclades OS/Compute
607
====================== =================== ======== ==========
608
path                   File path on server ✔        ✔
609
contents               Data to inject      ✔        ✔
610
group                  User group          ✔        **✘**
611
mode                   File access mode    ✔        **✘**
612
owner                  File owner          ✔        **✘**
613
====================== =================== ======== ==========
614

    
615
* **path** is the path (including name) for the file on the remote server. If
616
  the file does not exist, it will be created
617
* **contents** is the data to be injected, must not exceed 10240 *bytes* and
618
  must be base64-encoded
619
* **mode** is the access mode of the created remote file and must be a number
620
  (usually octal or decimal)
621

    
622
*Example Create Server Request: JSON*
623

    
624
.. code-block:: javascript
625

    
626
  POST https://example.org/compute/v2.0/servers
627
  {
628
    "server": {
629
      "name": "My Password-less Server",
630
      "personality": [
631
        {
632
          "path": "/home/someuser/.ssh/authorized_keys",
633
          "contents": "Some users public key",
634
          "group": "users",
635
          "mode": 0600,
636
          "owner": "someuser"
637
        }, {
638
          "path": "/home/someuser/.bashrc",
639
          "contents": "bash configuration",
640
          "group": "users",
641
          "mode": 0777,
642
          "owner": "someuser"
643
        }
644
      ],
645
      ...
646
    }
647
  }
648

    
649
.. _network-on-vm-ref:
650

    
651
Network connections on virtual server creation
652
..............................................
653

    
654
A network connection is established by creating a port that connects a virtual
655
device with a network. There are five cases:
656

    
657
* The ``network`` attribute is not provided. In that case, the service will
658
  apply its default policy (e.g., automatic public network and IP assignment)
659
* The ``network`` attribute is an empty list. In that case, the virtual server
660
  will not have any network connections
661
* Provide an existing network ID. In that case, the virtual server will be
662
  connected to that network.
663
* Provide an existing network ID and an IP (which is already associated to that
664
  network). In that case, the virtual server will be connected to that network
665
  with this specific IP attached.
666
* Provide an existing port ID to establish a connection through it.
667

    
668
========================================= ======== ==========
669
Network attributes on server construction Cyclades OS/Compute
670
========================================= ======== ==========
671
uuid                                      ✔        ✔
672
fixed_ip                                  ✔        ✔
673
port                                      ✔        ✔
674
========================================= ======== ==========
675

    
676
E.g., the following example connects a public network with an IP (2719) and a
677
private network (9876) on the virtual server under construction:
678

    
679
* Example Connect server on various networks*
680

    
681
.. code-block:: python
682

    
683
  POST https://example.org/compute/v2.0/servers
684
  {
685
    "server": {
686
      "networks": [
687
        {"uuid": 9876},
688
        {"uuid": 2719, "fixed_ip": "192.168.1.2"},
689
      ],
690
      ...
691
    }
692
  }
693

    
694

    
695
Get Server Stats
696
----------------
697

    
698
.. note:: This operation is not part of OS/Compute v2.
699

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

    
702
.. rubric:: Request
703

    
704
============================== ====== ======== ==========
705
URI                            Method Cyclades OS/Compute
706
============================== ====== ======== ==========
707
``/servers/<server-id>/stats`` GET    ✔        **✘**
708
============================== ====== ======== ==========
709

    
710
|
711
==============  ========================= ======== ==========
712
Request Header  Value                     Cyclades OS/Compute
713
==============  ========================= ======== ==========
714
X-Auth-Token    User authentication token required required
715
==============  ========================= ======== ==========
716

    
717
|
718
================= ===============
719
Request Parameter Value          
720
================= ===============
721
json              Respond in json
722
xml               Respond in xml 
723
================= ===============
724

    
725
* **json** and **xml** parameters are mutually exclusive. If none supported,
726
the response will be formated in json.
727

    
728
.. rubric:: Response
729

    
730
=========================== =====================
731
Return Code                 Description
732
=========================== =====================
733
200 (OK)                    Request succeeded
734
400 (Bad Request)           Invalid server ID or Server deleted
735
401 (Unauthorized)          Missing or expired user token
736
403 (Forbidden)             Administratively suspended server
737
404 (Not Found)             Server not found
738
500 (Internal Server Error) The request cannot be completed because of an
739
\                           internal error
740
503 (Service Unavailable)   The server is not currently available
741
=========================== =====================
742

    
743
|
744

    
745
Response body contents::
746

    
747
  stats: {<parameter>: <value> }
748

    
749
============= ======================
750
Parameter     Description
751
============= ======================
752
serverRef     Server ID
753
refresh       Refresh frequency
754
cpuBar        Latest CPU load graph URL
755
cpuTimeSeries CPU load / time graph URL
756
netBar        Latest Network load graph URL
757
netTimeSeries Network load / time graph URL
758
============= ======================
759

    
760
* **refresh** is the recommended sampling rate
761

    
762
*Example Get Server Stats Response: JSON*
763

    
764
.. code-block:: javascript
765
  GET https://example.org/compute/v2.0/servers/5678/stats
766
  {
767
    "stats": {
768
      "serverRef": 5678,
769
      "refresh": 60,
770
      "cpuBar": "http://stats.okeanos.grnet.gr/b9a...048c/cpu-bar.png",
771
      "cpuTimeSeries": "http://stats.okeanos.grnet.gr/b9a...048c/cpu-ts.png",
772
      "netBar": "http://stats.okeanos.grnet.gr/b9a...048c/net-bar.png",
773
      "netTimeSeries": "http://stats.okeanos.grnet.gr/b9a...048c/net-ts.png"
774
    }
775
  }
776

    
777
Get Server Diagnostics
778
----------------------
779

    
780
.. note:: This operation is not part of OS/Compute v2.
781

    
782
This operation returns diagnostic information (logs) for a server.
783

    
784
.. rubric:: Request
785

    
786
==================================== ====== ======== ==========
787
URI                                  Method Cyclades OS/Compute
788
==================================== ====== ======== ==========
789
``/servers/<server-id>/diagnostics`` GET    ✔        **✘**
790
==================================== ====== ======== ==========
791

    
792
|
793
==============  ========================= ======== ==========
794
Request Header  Value                     Cyclades OS/Compute
795
==============  ========================= ======== ==========
796
X-Auth-Token    User authentication token required required
797
==============  ========================= ======== ==========
798

    
799
.. rubric:: Response
800

    
801
=========================== =====================
802
Return Code                 Description
803
=========================== =====================
804
200 (OK)                    Request succeeded
805
400 (Bad Request)           Invalid server ID or Server deleted
806
401 (Unauthorized)          Missing or expired user token
807
403 (Forbidden)             Administratively suspended server
808
404 (Not Found)             Server not found
809
500 (Internal Server Error) The request cannot be completed because of an
810
\                           internal error
811
503 (Service Unavailable)   The server is not currently available
812
=========================== =====================
813

    
814
|
815

    
816
Response body contents::
817

    
818
  [
819
    {
820
      <diagnostic attribute}: <value>,
821
      ...
822
    },
823
    ...
824
  ]
825

    
826
==================== ===========
827
Diagnostic attribute Description
828
==================== ===========
829
level                Debug level
830
created              Log entry timestamp
831
source               Log source proccess
832
source_date          Log source date
833
message              Log description
834
details              Detailed log description
835
==================== ===========
836

    
837
*Example Get Server Diagnostics Response: JSON*
838

    
839
.. code-block:: javascript
840

    
841
  GET https://example.org/compute/v2.0/servers/5678/diagnostics
842
  [
843
    {
844
      "level": "DEBUG",
845
      "created": "2013-04-09T15:25:53.965144+00:00",
846
      "source": "image-helper-task-start",
847
      "source_date": "2013-04-09T15:25:53.954695+00:00",
848
      "message": "FixPartitionTable",
849
      "details": null
850
    }, {
851
      "level": "DEBUG",
852
      "created": "2013-04-09T15:25:46.413718+00:00",
853
      "source": "image-info",
854
      "source_date": "2013-04-09T15:25:46.404477+00:00",
855
      "message": "Starting customization VM...",
856
      "details": null
857
    }
858
  ]
859

    
860
Get Server Details
861
------------------
862

    
863
This operation returns detailed information for a virtual server
864

    
865
.. rubric:: Request
866

    
867
======================== ====== ======== ==========
868
URI                      Method Cyclades OS/Compute
869
======================== ====== ======== ==========
870
``/servers/<server id>`` GET    ✔        ✔
871
======================== ====== ======== ==========
872

    
873
|
874

    
875
==============  ========================= ======== ==========
876
Request Header  Value                     Cyclades OS/Compute
877
==============  ========================= ======== ==========
878
X-Auth-Token    User authentication token required required
879
==============  ========================= ======== ==========
880

    
881
.. rubric:: Response
882

    
883
=========================== =====================
884
Return Code                 Description
885
=========================== =====================
886
200 (OK)                    Request succeeded
887
400 (Bad Request)           Malformed server id
888
401 (Unauthorized)          Missing or expired user token
889
403 (Forbidden)             Administratively suspended server
890
404 (Not Found)             Server not found
891
500 (Internal Server Error) The request cannot be completed because of an
892
\                           internal error
893
503 (Service Unavailable)   No available backends or service currently
894
\                           unavailable
895
=========================== =====================
896

    
897
|
898

    
899
Response body contents::
900

    
901
  server: {
902
    <server attribute>: <value>,
903
    ...
904
  }
905

    
906
Server attributes are explained `here <#server-ref>`_
907

    
908
*Example get server Details*
909

    
910
.. code-block:: javascript
911

    
912
  GET https://example.org/compute/v2.0/servers/84
913

    
914

    
915
  {
916
    "server": {
917
      "addresses": [
918
        "2718": [
919
          {
920
            "version": 6,
921
            "addr": "2001:443:2dfc:1232:a810:3cf:fe9b:21cd",
922
            "OS-EXT-IPS:type": "fixed"
923
          }
924
        ],
925
        "4178": [
926
          {
927
            "version": 4,
928
            "addr": "192.168.1.3",
929
            "OS-EXT-IPS:type": "floating"
930
          }
931
        ]
932
      ],
933
      "attachments": [
934
          {
935
            "id": "36",
936
            "network_id": "2718",
937
            "mac_address": "aa:01:02:6c:34:cd",
938
            "firewallProfile": "DISABLED",
939
            "ipv4": "",
940
            "ipv6": "2001:443:2dfc:1232:a810:3cf:fe9b:21cd"
941
            "OS-EXT-IPS:type": "fixed"
942
          }, {
943
            "id": "38",
944
            "network_id": "4178",
945
            "mac_address": "aa:00:0c:6d:34:cc",
946
            "firewallProfile": "PROTECTED",
947
            "ipv4": "192.168.1.3",
948
            "ipv6": ""
949
            "OS-EXT-IPS:type": "floating"
950
          }
951
      ],
952
      "links": [
953
        {
954
          "href": "https://example.org/compute/v2.0/servers/84", 
955
          "rel": "self"
956
        }, {
957
          "href": "https://example.org/compute/v2.0/servers/84", 
958
          "rel": "bookmark"
959
        }
960
      ],
961
      "image": {
962
        "id": "im4g3-1d",
963
        "links": [
964
          {
965
            "href": "https://example.org/compute/v2.0/images/im4g3-1d", 
966
            "rel": "self"
967
          }, {
968
            "href": "https://example.org/compute/v2.0/images/im4g3-1d", 
969
            "rel": "bookmark"
970
          }, {
971
            "href": "https://example.org/image/v1.0/images/im4g3-1d", 
972
            "rel": "alternate"
973
          }
974
        ]
975
      },
976
      "suspended": false,
977
      "created': '2011-04-21T10:18:52.085737+00:00',
978
      "flavor": {
979
        "id": 3",
980
        "links": [
981
          {
982
            "href": "https://example.org/compute/v2.0/flavors/3", 
983
            "rel": "self"
984
          }, {
985
            "href": "https://example.org/compute/v2.0/flavors/3", 
986
            "rel": "bookmark"
987
          }
988
        ]
989
      },
990
      "id": "84",
991
      "security_groups": [{"name": "default"}],
992
      "user_id": "s0m5-u5e7-1d",
993
      "accessIPv4": "",
994
      "accessIPv6": "",
995
      "progress": 100,
996
      "config_drive": "",
997
      "status": "ACTIVE",
998
      "updated": "2011-05-30T14:07:07.037602+00:00",
999
      "hostId": "",
1000
      "SNF:fqdn": "snf-84.vm.example.org",
1001
      "key_name": null,
1002
      "name": "My Other Server",
1003
      "created": "2014-02-21T08:31:37.834542+00:00",
1004
      "tenant_id": "s0m5-u5e7-1d",
1005
      "SNF:port_forwarding": {},
1006
      "SNF:task_state": "",
1007
      "diagnostics": [
1008
        {
1009
          "level": "DEBUG",
1010
          "created": "2014-02-21T08:31:37.834542+00:00",
1011
          "source": "image-info",
1012
          "source_date": "2014-02-21T08:32:35.929507+00:00",
1013
          "message": "Image customization finished successfully.",
1014
          "details": null
1015
        }
1016
      ],
1017
      "metadata": {
1018
        "os": "debian",
1019
        "users": "root"
1020
      }
1021
    }
1022
  }
1023

    
1024
Rename Server
1025
-------------
1026

    
1027
In Synnefo/Cyclades, only the ``name`` attribute of a virtual server can be
1028
modified with this call.
1029

    
1030
.. rubric:: Response
1031

    
1032
======================== ====== ======== ==========
1033
URI                      Method Cyclades OS/Compute
1034
======================== ====== ======== ==========
1035
``/servers/<server id>`` PUT    ✔        ✔
1036
======================== ====== ======== ==========
1037

    
1038
|
1039
==============  ========================= ======== ==========
1040
Request Header  Value                     Cyclades OS/Compute
1041
==============  ========================= ======== ==========
1042
X-Auth-Token    User authentication token required required
1043
Content-Type    Type or request body      required required
1044
Content-Length  Length of request body    required required
1045
==============  ========================= ======== ==========
1046

    
1047
Request body contents::
1048

    
1049
  server: {
1050
    <server attribute>: <value>,
1051
    ...
1052
  }
1053

    
1054
=========== ==================== ======== ==========
1055
Attribute   Description          Cyclades OS/Compute
1056
=========== ==================== ======== ==========
1057
name        The server name      ✔        ✔
1058
accessIPv4  IP v4 address        **✘**    ✔
1059
accessIPv6  IP v6 address        **✘**    ✔
1060
=========== ==================== ======== ==========
1061

    
1062
* **accessIPv4** and **accessIPv6** are ignored. Cyclades features a different
1063
  `mechanism for managing network connections <network-api-guide.html>`_ on
1064
  servers
1065

    
1066
*Example Rename Server Request: JSON*
1067

    
1068
.. code-block:: javascript
1069

    
1070
  {"server": {"name": "New name"}}
1071

    
1072
.. rubric:: Response
1073

    
1074
=========================== =====================
1075
Return Code                 Description
1076
=========================== =====================
1077
204 (OK)                    Request succeeded
1078
400 (Bad Request)           Malformed request or malformed server id
1079
401 (Unauthorized)          Missing or expired user token
1080
403 (Forbidden)             User is not allowed to perform this operation
1081
404 (Not Found)             Server not found
1082
415 (Bad Media Type)
1083
409 (Build In Progress)     Server is not ready yet
1084
500 (Internal Server Error) The request cannot be completed because of an
1085
\                           internal error
1086
503 (Service Unavailable)   No available backends or service currently
1087
\                           unavailable
1088
=========================== =====================
1089

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

    
1094
Delete Server
1095
-------------
1096

    
1097
Delete a virtual server. When a server is deleted, all its attachments (ports)
1098
are deleted as well.
1099

    
1100
.. rubric:: Request
1101

    
1102
======================== ====== ======== ==========
1103
URI                      Method Cyclades OS/Compute
1104
======================== ====== ======== ==========
1105
``/servers/<server id>`` DELETE ✔        ✔
1106
======================== ====== ======== ==========
1107

    
1108
* **server-id** is the identifier of the virtual server.
1109

    
1110
|
1111
==============  ========================= ======== ==========
1112
Request Header  Value                     Cyclades OS/Compute
1113
==============  ========================= ======== ==========
1114
X-Auth-Token    User authentication token required required
1115
==============  ========================= ======== ==========
1116

    
1117
.. rubric:: Response
1118

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

    
1133
List Server Connections
1134
-----------------------
1135

    
1136
List a server's network connections. In Cyclades, connections are ports between
1137
a network and the server.
1138

    
1139
.. rubric:: Request
1140

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

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

    
1154
.. rubric:: Response
1155

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

    
1169
Response body contents::
1170

    
1171
  addresses: [
1172
    <network id>: [
1173
      {
1174
        version: <4 or 6>,
1175
        addr: <IP address, if any>
1176
        OS-EXT-TYPE:type: <floating or fixed>
1177
      },
1178
      ...
1179
    ],
1180
    ...
1181
  ],
1182
  attachments: [
1183
    {
1184
      <attachment attribute>: ...,
1185
      ...
1186
    },
1187
    ...
1188
  ]
1189

    
1190
Attachment attributes are explained `here <#attachments-ref>`_
1191

    
1192
*Example List Addresses: JSON*
1193

    
1194
.. code-block:: javascript
1195

    
1196
  GET https://example.org/compute/v2.0/servers/84/ips/
1197

    
1198
  {
1199
      "addresses": [
1200
        "2718": [
1201
          {
1202
            "version": 6,
1203
            "addr": "2001:443:2dfc:1232:a810:3cf:fe9b:21cd",
1204
            "OS-EXT-IPS:type": "fixed"
1205
          }
1206
        ],
1207
        "4178": [
1208
          {
1209
            "version": 4,
1210
            "addr": "192.168.1.3",
1211
            "OS-EXT-IPS:type": "floating"
1212
          }
1213
        ]
1214
      ],
1215
      "attachments": [
1216
          {
1217
            "id": "36",
1218
            "network_id": "2718",
1219
            "mac_address": "aa:01:02:6c:34:cd",
1220
            "firewallProfile": "DISABLED",
1221
            "ipv4": "",
1222
            "ipv6": "2001:443:2dfc:1232:a810:3cf:fe9b:21cd"
1223
            "OS-EXT-IPS:type": "fixed"
1224
          }, {
1225
            "id": "38",
1226
            "network_id": "4178",
1227
            "mac_address": "aa:00:0c:6d:34:cc",
1228
            "firewallProfile": "PROTECTED",
1229
            "ipv4": "192.168.1.3",
1230
            "ipv6": ""
1231
            "OS-EXT-IPS:type": "floating"
1232
          }
1233
      ]
1234
  }
1235

    
1236
Connection with network
1237
-----------------------
1238

    
1239
Get information on a network connected on a server
1240

    
1241
.. rubric:: Request
1242

    
1243
========================================= ====== ======== ==========
1244
URI                                       Method Cyclades OS/Compute
1245
========================================= ====== ======== ==========
1246
``/servers/<server id>/ips/<network id>`` GET    ✔        ✔
1247
========================================= ====== ======== ==========
1248

    
1249
|
1250
==============  ========================= ======== ==========
1251
Request Header  Value                     Cyclades OS/Compute
1252
==============  ========================= ======== ==========
1253
X-Auth-Token    User authentication token required required
1254
==============  ========================= ======== ==========
1255

    
1256
.. rubric:: Response
1257

    
1258
=========================== =====================
1259
Return Code                 Description
1260
=========================== =====================
1261
200 (OK)                    Request succeeded
1262
400 (Bad Request)           Malformed server id or machine already deleted
1263
401 (Unauthorized)          Missing or expired user token
1264
404 (Not Found)             Server not found
1265
409 (Build In Progress)     Server is not ready yet
1266
500 (Internal Server Error) The request cannot be completed because of an
1267
\                           internal error
1268
503 (Service Unavailable)   Service currently unavailable
1269
=========================== =====================
1270

    
1271
|
1272

    
1273
Response body contents::
1274

    
1275
  network: {
1276
    <network id>: [
1277
      {
1278
        version: <4 or 6>,
1279
        addr: <IP address, if any>
1280
        OS-EXT-TYPE:type: <floating or fixed>
1281
      },
1282
  }
1283

    
1284
**Example**
1285

    
1286
.. code-block:: javascript
1287

    
1288
  GET https://example.org/compute/v2.0/servers/84/ips/2718
1289

    
1290

    
1291
  "network": {
1292
    "2718": [
1293
      {
1294
        "version": 6,
1295
        "addr": "2001:443:2dfc:1232:a810:3cf:fe9b:21cd",
1296
        "OS-EXT-IPS:type": "fixed"
1297
      }
1298
    ]
1299
  }
1300

    
1301
List Server Metadata
1302
--------------------
1303

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

    
1307
.. rubric:: Request
1308

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

    
1315
|
1316
==============  ========================= ======== ==========
1317
Request Header  Value                     Cyclades OS/Compute
1318
==============  ========================= ======== ==========
1319
X-Auth-Token    User authentication token required required
1320
==============  ========================= ======== ==========
1321

    
1322
.. rubric:: Response
1323

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

    
1337
Response body contents::
1338

    
1339
  metadata: {
1340
    <key>: <value>,
1341
      ...
1342
  }
1343

    
1344
* Key is in uppercase by convention
1345

    
1346
*Example List Server Metadata: JSON*
1347

    
1348
.. code-block:: javascript
1349

    
1350
  {
1351
    ""metadata": {
1352
      "OS": "Linux",
1353
      "USERS": "root"
1354
    }
1355
  }
1356

    
1357
Set / Update Server Metadata
1358
----------------------------
1359

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

    
1368
In Cyclades API, metadata keys which are not referred by the operation will
1369
remain intact, while metadata referred by the operation will be overwritten.
1370

    
1371
.. rubric:: Request
1372

    
1373
================================= ====== ======== ==========
1374
URI                               Method Cyclades OS/Compute
1375
================================= ====== ======== ==========
1376
``/servers/<server-id>/metadata`` PUT    **✘**    ✔
1377
``/servers/<server-id>/metadata`` POST   ✔       ✔
1378
================================= ====== ======== ==========
1379

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

    
1389
Request body contents::
1390

    
1391
  metadata: {
1392
    <key>: <value>,
1393
    ...
1394
  }
1395

    
1396
*Example Request Set / Update Server Metadata: JSON*
1397

    
1398
.. code-block:: javascript
1399

    
1400
  {"metadata": {"role": "webmail", "users": "root,maild"}}
1401

    
1402
.. rubric:: Response
1403

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

    
1418
Response body contents::
1419

    
1420
  metadata: {
1421
    <key>: <value>,
1422
    ...
1423
  }
1424

    
1425
*Example Response Set / Update Server Metadata: JSON*
1426

    
1427
.. code-block:: javascript
1428

    
1429
  {"metadata": {"OS": "Linux", "role": "webmail", "users": "root,maild"}}
1430

    
1431
Get Server Metadata Item
1432
------------------------
1433

    
1434
Get the value of a specific piece of metadata of a virtual server
1435

    
1436
.. rubric:: Request
1437

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

    
1444
|
1445
==============  ========================= ======== ==========
1446
Request Header  Value                     Cyclades OS/Compute
1447
==============  ========================= ======== ==========
1448
X-Auth-Token    User authentication token required required
1449
==============  ========================= ======== ==========
1450

    
1451
.. rubric:: Response
1452

    
1453
=========================== =====================
1454
Return Code                 Description
1455
=========================== =====================
1456
200 (OK)                    Request succeeded
1457
400 (Bad Request)           Invalid server ID or Malformed request
1458
401 (Unauthorized)          Missing or expired user token
1459
403 (Forbidden)             Administratively suspended server
1460
404 (Not Found)             Meta key not found
1461
500 (Internal Server Error) The request cannot be completed because of an
1462
\                           internal error
1463
503 (Service Unavailable)   The server is not currently available
1464
=========================== =====================
1465

    
1466
Response body content::
1467

    
1468
  metadata: {<key>: <value>}
1469

    
1470
*Example Get Server Metadata for Item 'role', JSON*
1471

    
1472
.. code-block:: javascript
1473

    
1474
  {"metadata": {"role": "webmail"}}
1475

    
1476
Update Server Metadata Item
1477
---------------------------
1478

    
1479
Set a new or update an existing a metadum value for a virtual server.
1480

    
1481
.. rubric:: Request
1482

    
1483
======================================= ====== ======== ==========
1484
URI                                     Method Cyclades OS/Compute
1485
======================================= ====== ======== ==========
1486
``/servers/<server-id>/metadata/<key>`` PUT    ✔        ✔
1487
======================================= ====== ======== ==========
1488

    
1489
|
1490

    
1491
==============  ========================= ======== ==========
1492
Request Header  Value                     Cyclades OS/Compute
1493
==============  ========================= ======== ==========
1494
X-Auth-Token    User authentication token required required
1495
Content-Type    Type or request body      required required
1496
Content-Length  Length of request body    required required
1497
==============  ========================= ======== ==========
1498

    
1499
Request body content::
1500

    
1501
  metadata: {<key>: <value>}
1502

    
1503
*Example Request to Set or Update Server Metadata "role": JSON*
1504

    
1505
.. code-block:: javascript
1506

    
1507
  {"metadata": {"role": "gateway"}}
1508

    
1509
.. rubric:: Response
1510

    
1511
=========================== =====================
1512
Return Code                 Description
1513
=========================== =====================
1514
201 (OK)                    Request succeeded
1515
400 (Bad Request)           Invalid server ID or Malformed request
1516
401 (Unauthorized)          Missing or expired user token
1517
403 (Forbidden)             Administratively suspended server
1518
404 (Not Found)             Meta key not found
1519
413 (OverLimit)             Maximum number of metadata exceeded
1520
500 (Internal Server Error) The request cannot be completed because of an
1521
\                           internal error
1522
503 (Service Unavailable)   The server is not currently available
1523
=========================== ====================
1524

    
1525
Response body content::
1526

    
1527
  metadata: {<key>: <value>}
1528

    
1529
*Example Set or Update Server Metadata "role":"gateway": JSON*
1530

    
1531
.. code-block:: javascript
1532

    
1533
  {"metadata": {"role": "gateway"}}
1534

    
1535
Delete Server Metadata
1536
----------------------
1537

    
1538
Delete a metadata of a virtual server
1539

    
1540
.. rubric:: Request
1541

    
1542
======================================= ====== ======== ==========
1543
URI                                     Method Cyclades OS/Compute
1544
======================================= ====== ======== ==========
1545
``/servers/<server-id>/metadata/<key>`` DELETE ✔        ✔
1546
======================================= ====== ======== ==========
1547

    
1548
|
1549
==============  ========================= ======== ==========
1550
Request Header  Value                     Cyclades OS/Compute
1551
==============  ========================= ======== ==========
1552
X-Auth-Token    User authentication token required required
1553
==============  ========================= ======== ==========
1554

    
1555
.. rubric:: Response
1556

    
1557
=========================== =====================
1558
Return Code                 Description
1559
=========================== =====================
1560
204 (OK)                    Request succeeded
1561
400 (Bad Request)           Invalid server ID
1562
401 (Unauthorized)          Missing or expired user token
1563
403 (Forbidden)             Administratively suspended server
1564
404 (Not Found)             Metadata key not found
1565
500 (Internal Server Error) The request cannot be completed because of an
1566
\                           internal error
1567
503 (Service Unavailable)   The server is not currently available
1568
=========================== =====================
1569

    
1570
Server Actions
1571
--------------
1572

    
1573
Actions are operations that are achieved through the same type of request
1574
(``POST``). There are differences in the implementations of some operations
1575
between Synnefo/Cyclades and OS/Compute. Although this document focuses on
1576
Synnefo/Cyclades, differences and similarities between the APIs are also
1577
briefed.
1578

    
1579
=============================================== ======== ==========
1580
Operations                                      Cyclades OS/Compute
1581
=============================================== ======== ==========
1582
`Start <#start-server>`_                        ✔        **✘**
1583
`Shutdown <#shutdown-server>`_                  ✔        **✘**
1584
`Reboot <#reboot-server>`_                      ✔        ✔
1585
`Get Console <#get-server-console>`_            ✔        **✘**
1586
`Set Firewall <#set-server-firewall-profile>`_  ✔        **✘**
1587
`Change Admin Password <#os-compute-specific>`_ **✘**    ✔
1588
`Rebuild <#os-compute-specific>`_               **✘**    ✔
1589
`Resize <#resize-server>`_                      ✔        ✔
1590
`Confirm Resized <#os-compute-specific>`_       **✘**    ✔
1591
`Revert Resized <#os-compute-specific>`_        **✘**    ✔
1592
`Create Image <#os-compute-specific>`_          **✘**    ✔
1593
=============================================== ======== ==========
1594

    
1595
.. rubric:: Request
1596

    
1597
=============================== ====== ======== ==========
1598
URI                             Method Cyclades OS/Compute
1599
=============================== ====== ======== ==========
1600
``/servers/<server id>/action`` POST   ✔        ✔
1601
=============================== ====== ======== ==========
1602

    
1603
|
1604
==============  ========================= ======== ==========
1605
Request Header  Value                     Cyclades OS/Compute
1606
==============  ========================= ======== ==========
1607
X-Auth-Token    User authentication token required required
1608
Content-Type    Type or request body      required required
1609
Content-Length  Length of request body    required required
1610
==============  ========================= ======== ==========
1611

    
1612
.. rubric:: Response
1613

    
1614
=========================== =====================
1615
Return Code                 Description
1616
=========================== =====================
1617
200 (OK)                    Request succeeded (for console operation)
1618
202 (OK)                    Request succeeded
1619
400 (Bad Request)           Invalid request or unknown action
1620
401 (Unauthorized)          Missing or expired user token
1621
403 (Forbidden)             User is not allowed to perform this operation
1622
500 (Internal Server Error) The request cannot be completed because of an
1623
\                           internal error
1624
503 (Service Unavailable)   The server is not currently available
1625
=========================== =====================
1626

    
1627
.. note:: Response body varies between operations (see bellow)
1628

    
1629
Start server
1630
................
1631

    
1632
This operation transitions a server from a STOPPED to an ACTIVE state.
1633

    
1634
Request body contents::
1635

    
1636
  start: {}
1637

    
1638
*Example Start Server: JSON*
1639

    
1640
.. code-block:: javascript
1641

    
1642
  {"start": {}}
1643

    
1644
Reboot Server
1645
.............
1646

    
1647
This operation transitions a server from ``ACTIVE`` to ``REBOOT`` and then
1648
``ACTIVE`` again.
1649

    
1650
Synnefo and OS/Compute APIs offer two reboot modes: ``soft``
1651
and ``hard``. OS/Compute distinguishes between the two intermediate states
1652
(``REBOOT`` and ``HARD_REBOOT``) while rebooting, while Synnefo/Cyclades use
1653
only the ``REBOOT`` term. The expected behavior is the same, though.
1654

    
1655
Request body contents::
1656

    
1657
  reboot: {type: <reboot type>}
1658

    
1659
* **reboot type** can be either ``SOFT`` or ``HARD``.
1660

    
1661
*Example (soft) Reboot Server: JSON*
1662

    
1663
.. code-block:: javascript
1664

    
1665
  {"reboot" : { "type": "soft"}}
1666

    
1667
Resize Server
1668
.............
1669

    
1670
This operation changes the flavor of the server, which is the equivalent of
1671
upgrading the hardware of a physical machine.
1672

    
1673
Request body contents::
1674

    
1675
  resize: {flavorRef: <flavor ID>}
1676

    
1677
.. code-block:: javascript
1678

    
1679
  {"resize" : { "flavorRef": 153}}
1680

    
1681
Shutdown server
1682
...............
1683

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

    
1686
Request body contents::
1687

    
1688
  shutdown: {}
1689

    
1690
*Example Shutdown Server: JSON*
1691

    
1692
.. code-block:: javascript
1693

    
1694
  {"shutdown": {}}
1695

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

    
1698
Get Server Console
1699
..................
1700

    
1701
.. note:: This operation is not part of OS/Compute API
1702

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

    
1708
Request body contents::
1709

    
1710
  console: {type: vnc}
1711

    
1712
*Example Get Server Console: JSON*
1713

    
1714
.. code-block:: javascript
1715

    
1716
  {"console": {"type": "vnc" }
1717

    
1718
Response body contents::
1719

    
1720
  console: {
1721
    <vnc attribute>: <value>,
1722
    ...
1723
  }
1724

    
1725
============== ======================
1726
VNC Attributes Description
1727
============== ======================
1728
host           The vncprocy host
1729
port           vncprocy port
1730
password       Temporary password
1731
type           Connection type (only VNC)
1732
============== ======================
1733

    
1734
*Example Action Console Response: JSON*
1735

    
1736
.. code-block:: javascript
1737

    
1738
  {
1739
    "console": {
1740
      "type": "vnc",
1741
      "host": "vm42.example.org",
1742
      "port": 1234,
1743
      "password": "513NR14PN0T"
1744
    }
1745
  }
1746

    
1747
Set Server Firewall Profile
1748
...........................
1749

    
1750
The firewallProfile function sets a firewall profile for the public interface
1751
of a server.
1752

    
1753
Request body contents::
1754

    
1755
  firewallProfile: {profile: <firewall profile>, nic: <nic id>}
1756

    
1757
* **firewall profile** can be ``ENABLED``, ``DISABLED`` or ``PROTECTED``
1758

    
1759
*Example Action firewallProfile: JSON**
1760

    
1761
.. code-block:: javascript
1762

    
1763
  {"firewallProfile": {"profile": "ENABLED", "nic": 123}}
1764

    
1765
.. note:: Response body should be empty
1766

    
1767
OS/Compute Specific
1768
...................
1769

    
1770
The following operations are meaningless or not supported in the context of
1771
Synnefo/Cyclades, but are parts of the OS/Compute API:
1772

    
1773
* `Change Administrator Password <http://docs.openstack.org/api/openstack-compute/2/content/Change_Password-d1e3234.html>`_
1774
* `Rebuild Server <http://docs.openstack.org/api/openstack-compute/2/content/Rebuild_Server-d1e3538.html>`_
1775
* `Confirm Resized Server <http://docs.openstack.org/api/openstack-compute/2/content/Confirm_Resized_Server-d1e3868.html>`_
1776
* `Revert Resized Server <http://docs.openstack.org/api/openstack-compute/2/content/Revert_Resized_Server-d1e4024.html>`_
1777
* `Create Image <http://docs.openstack.org/api/openstack-compute/2/content/Create_Image-d1e4655.html>`_
1778

    
1779
List Flavors
1780
------------
1781

    
1782
List the flavors that are accessible by the user
1783

    
1784
.. rubric:: Request
1785

    
1786
=================== ====== ======== ==========
1787
URI                 Method Cyclades OS/Compute
1788
=================== ====== ======== ==========
1789
``/flavors``        GET    ✔        ✔
1790
``/flavors/detail`` GET    ✔        ✔
1791
=================== ====== ======== ==========
1792

    
1793
|
1794
==============  ========================= ======== ==========
1795
Request Header  Value                     Cyclades OS/Compute
1796
==============  ========================= ======== ==========
1797
X-Auth-Token    User authentication token required required
1798
==============  ========================= ======== ==========
1799

    
1800
|
1801
================= ===============
1802
Request Parameter Value
1803
================= ===============
1804
json              Respond in json
1805
xml               Respond in xml
1806
================= ===============
1807

    
1808
.. note:: Request body should be empty
1809

    
1810
.. rubric:: Response
1811

    
1812
=========================== =====================
1813
Return Code                 Description
1814
=========================== =====================
1815
200 (OK)                    Request succeeded
1816
400 (Bad Request)           Malformed request
1817
401 (Unauthorized)          Missing or expired user token
1818
403 (Forbidden)             Forbidden to use this flavor
1819
500 (Internal Server Error) The request cannot be completed because of an
1820
\                           internal error
1821
503 (Service Unavailable)   The server is not currently available
1822
=========================== =====================
1823

    
1824
Response code contents::
1825

    
1826
  flavors: [
1827
    {
1828
      <flavor attribute>: <value>,
1829
      ...
1830
    },
1831
    ...
1832
  ]
1833

    
1834
Flavor attributes are `listed here <#flavor-ref>`_. Regular listing contains
1835
only ``id`` and ``name`` attributes.
1836

    
1837
*Example List Flavors (regular): JSON*
1838

    
1839
.. code-block:: javascript
1840

    
1841
  {
1842
    "flavors": [
1843
      {
1844
        "id": 1,
1845
        "name": "One code",
1846
        "links": [
1847
            {
1848
                "href": "https://example.org/compute/v2.0/flavors/1", 
1849
                "rel": "self"
1850
            }, 
1851
            {
1852
                "href": "https://example.org/compute/v2.0/flavors/1", 
1853
                "rel": "bookmark"
1854
            }
1855
        ]
1856
      }, {
1857
        "id": 3,
1858
        "name": "Four core",
1859
        "links": [
1860
            {
1861
                "href": "https://example.org/compute/v2.0/flavors/3", 
1862
                "rel": "self"
1863
            }, 
1864
            {
1865
                "href": "https://example.org/compute/v2.0/flavors/3", 
1866
                "rel": "bookmark"
1867
            }
1868
        ]
1869
      }
1870
    ]
1871
  }
1872

    
1873

    
1874
*Example List Flavors (regular): XML*
1875

    
1876
.. code-block:: xml
1877

    
1878
  <?xml version="1.0" encoding="UTF-8"?>
1879
  <flavors xmlns="http://docs.openstack.org/compute/api/v1"
1880
    xmlns:atom="http://www.w3.org/2005/Atom">
1881
    <flavor id="1" name="One core"/>
1882
    <flavor id="3" name="Four core"/>
1883
  </flavors>
1884

    
1885
*Example List Flavors (detail): JSON*
1886

    
1887
.. code-block:: javascript
1888

    
1889
  {
1890
    "flavors": [
1891
      {
1892
        "id": 1,
1893
        "name": "One core",
1894
        "ram": 1024,
1895
        "SNF:disk_template": "drbd",
1896
        "disk": 20,
1897
        "cpu": 1,
1898
        "links": [
1899
            {
1900
                "href": "https://example.org/compute/v2.0/flavors/1", 
1901
                "rel": "self"
1902
            }, 
1903
            {
1904
                "href": "https://example.org/compute/v2.0/flavors/1", 
1905
                "rel": "bookmark"
1906
            }
1907
        ]
1908
      }, {
1909
        "id": 3,
1910
        "name": "Four core",
1911
        "ram": 1024,
1912
        "SNF:disk_template": "drbd",
1913
        "disk": 40,
1914
        "cpu": 4,
1915
        "links": [
1916
            {
1917
                "href": "https://example.org/compute/v2.0/flavors/3", 
1918
                "rel": "self"
1919
            }, 
1920
            {
1921
                "href": "https://example.org/compute/v2.0/flavors/3", 
1922
                "rel": "bookmark"
1923
            }
1924
        ]
1925
      }
1926
    ]
1927
  }
1928

    
1929
Get Flavor Details
1930
------------------
1931

    
1932
Get the configuration of a specific flavor
1933

    
1934
.. rubric:: Request
1935

    
1936
======================= ====== ======== ==========
1937
URI                     Method Cyclades OS/Compute
1938
======================= ====== ======== ==========
1939
``/flavors/<flavor-id`` GET    ✔        ✔
1940
======================= ====== ======== ==========
1941

    
1942
* **flavor-id** is the identifier of the flavor
1943

    
1944
|
1945

    
1946
==============  ========================= ======== ==========
1947
Request Header  Value                     Cyclades OS/Compute
1948
==============  ========================= ======== ==========
1949
X-Auth-Token    User authentication token required required
1950
==============  ========================= ======== ==========
1951

    
1952
|
1953

    
1954
================= ===============
1955
Request Parameter Value
1956
================= ===============
1957
json              Respond in json
1958
xml               Respond in xml
1959
================= ===============
1960

    
1961
.. note:: Request body should be empty
1962

    
1963
.. rubric:: Response
1964

    
1965
=========================== =====================
1966
Return Code                 Description
1967
=========================== =====================
1968
200 (OK)                    Request succeeded
1969
400 (Bad Request)           Malformed flavor ID
1970
401 (Unauthorized)          Missing or expired user token
1971
403 (Forbidden)             Forbidden to use this flavor
1972
404 (Not Found)             Flavor id not founmd
1973
500 (Internal Server Error) The request cannot be completed because of an
1974
\                           internal error
1975
503 (Service Unavailable)   The server is not currently available
1976
=========================== =====================
1977

    
1978
Response code contents::
1979

    
1980
  flavor: {
1981
    <flavor attribute>: <value>,
1982
    ...
1983
  }
1984

    
1985
All flavor attributes are `listed here <#flavor-ref>`_.
1986

    
1987
*Example Flavor Details: JSON*
1988

    
1989
.. code-block:: javascript
1990

    
1991
  {
1992
    "flavor": {
1993
      {
1994
        "id": 1,
1995
        "name": "One core",
1996
        "ram": 1024,
1997
        "SNF:disk_template": "drbd",
1998
        "disk": 20,
1999
        "cpu": 1,
2000
        "links": [
2001
            {
2002
                "href": "https://example.org/compute/v2.0/flavors/1", 
2003
                "rel": "self"
2004
            }, 
2005
            {
2006
                "href": "https://example.org/compute/v2.0/flavors/1", 
2007
                "rel": "bookmark"
2008
            }
2009
        ]
2010
      }
2011
    }
2012
  }
2013

    
2014
*Example Flavor Details: XML*
2015

    
2016
.. code-block:: xml
2017

    
2018
  <?xml version="1.0" encoding="UTF-8"?>
2019
  <flavor xmlns="http://docs.openstack.org/compute/api/v1"
2020
    xmlns:atom="http://www.w3.org/2005/Atom"
2021
    id="1" name="One core" ram="1024" disk="20" cpu="1" />
2022

    
2023
List Images
2024
-----------
2025

    
2026
List all images accessible by the user
2027

    
2028
.. rubric:: Request
2029

    
2030
=================== ====== ======== ==========
2031
URI                 Method Cyclades OS/Compute
2032
=================== ====== ======== ==========
2033
``/images``        GET    ✔        ✔
2034
``/images/detail`` GET    ✔        ✔
2035
=================== ====== ======== ==========
2036

    
2037
|
2038

    
2039
==============  ========================= ======== ==========
2040
Request Header  Value                     Cyclades OS/Compute
2041
==============  ========================= ======== ==========
2042
X-Auth-Token    User authentication token required required
2043
==============  ========================= ======== ==========
2044

    
2045
|
2046

    
2047
================= ======================== ======== ==========
2048
Request Parameter Value                    Cyclades OS/Compute
2049
================= ======================== ======== ==========
2050
server            Server filter            **✘**    ✔
2051
name              Image name filter        **✘**    ✔
2052
status            Server status filter     **✘**    ✔
2053
changes-since     Change timestamp filter  ✔        ✔
2054
marker            Last list last ID filter **✘**    ✔
2055
limit             Page size filter         **✘**    ✔
2056
type              Request filter type      **✘**    ✔
2057
================= ======================== ======== ==========
2058

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

    
2064
.. note:: Request body should be empty
2065

    
2066
.. rubric:: Response
2067

    
2068
=========================== =====================
2069
Return Code                 Description
2070
=========================== =====================
2071
200 (OK)                    Request succeeded
2072
304 (No images since date)  Can be returned if ``changes-since`` is given
2073
400 (Bad Request)           Invalid or malformed ``changes-since`` parameter
2074
401 (Unauthorized)          Missing or expired user token
2075
403 (Forbidden)             User is not allowed to perform this operation
2076
500 (Internal Server Error) The request cannot be completed because of an
2077
\                           internal error
2078
503 (Service Unavailable)   The server is not currently available
2079
=========================== =====================
2080

    
2081
Response body contents::
2082

    
2083
  images: [
2084
    {
2085
      <image attribute>: <value>,
2086
      ...
2087
      metadata: {
2088
        <image meta key>: <value>,
2089
        ...
2090
      },
2091
      ...
2092
    },
2093
    ...
2094
  ]
2095

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

    
2099
*Example List Image (detail): JSON*
2100

    
2101
.. code-block:: javascript
2102

    
2103
  {
2104
    "images: [
2105
      {
2106
        "status": "ACTIVE",
2107
        "updated": "2013-03-02T15:57:03+00:00",
2108
        "name": "edx_saas",
2109
        "created": "2013-03-02T12:21:00+00:00",
2110
        "progress": 100,
2111
        "id": "175716...526236",
2112
        "links": [
2113
          {
2114
            "href": "https://example.org/compute/v2.0/images/175716...526236", 
2115
            "rel": "self"
2116
          }, 
2117
          {
2118
            "href": "https://example.org/compute/v2.0/images/175716...526236", 
2119
            "rel": "bookmark"
2120
          }, 
2121
          {
2122
            "href": "https://example.org/image/v1.0/images/175716...526236", 
2123
            "rel": "alternate"
2124
          }
2125
        ],
2126
        "metadata": {
2127
          "partition_table": "msdos",
2128
          "osfamily": "linux",
2129
          "users": "root saasbook",
2130
          "exclude_task_changepassword": "yes",
2131
          "os": "ubuntu",
2132
          "root_partition": "1",
2133
          "description": "Ubuntu 12.04 LTS"
2134
        }
2135
      }, {
2136
        "status": "ACTIVE",
2137
        "updated": "2013-03-02T15:57:03+00:00",
2138
        "name": "edx_saas",
2139
        "created": "2013-03-02T12:21:00+00:00",
2140
        "progress": 100,
2141
        "id": "1357163d...c526206",
2142
        "links": [
2143
          {
2144
            "href": "https://example.org/compute/v2.0/images/1357163d...c526206", 
2145
            "rel": "self"
2146
          }, 
2147
          {
2148
            "href": "https://example.org/compute/v2.0/images/1357163d...c526206", 
2149
            "rel": "bookmark"
2150
          }, 
2151
          {
2152
            "href": "https://example.org/image/v1.0/images/1357163d...c526206", 
2153
            "rel": "alternate"
2154
          }
2155
        ],
2156
        "metadata": {
2157
          "partition_table": "msdos",
2158
          "osfamily": "windows",
2159
          "users": "Administratior",
2160
          "exclude_task_changepassword": "yes",
2161
          "os": "WinME",
2162
          "root_partition": "1",
2163
          "description": "Rerto Windows"
2164
        }
2165
      }
2166
    ]
2167
  }
2168

    
2169
Get Image Details
2170
-----------------
2171

    
2172
Get the details of a specific image
2173

    
2174
.. rubric:: Request
2175

    
2176
====================== ====== ======== ==========
2177
URI                    Method Cyclades OS/Compute
2178
====================== ====== ======== ==========
2179
``/images/<image-id>`` GET    ✔        ✔
2180
====================== ====== ======== ==========
2181

    
2182
* **image-id** is the identifier of the virtual image
2183

    
2184
|
2185

    
2186
==============  ========================= ======== ==========
2187
Request Header  Value                     Cyclades OS/Compute
2188
==============  ========================= ======== ==========
2189
X-Auth-Token    User authentication token required required
2190
==============  ========================= ======== ==========
2191

    
2192
.. note:: Request parameters should be empty
2193

    
2194
.. note:: Request body should be empty
2195

    
2196
.. rubric:: Response
2197

    
2198
=========================== =====================
2199
Return Code                 Description
2200
=========================== =====================
2201
200 (OK)                    Request succeeded
2202
400 (Bad Request)           Malformed image id
2203
401 (Unauthorized)          Missing or expired user token
2204
403 (Forbidden)             Not allowed to use this image
2205
404 (Not Found)             Image not found
2206
500 (Internal Server Error) The request cannot be completed because of an
2207
\                           internal error
2208
503 (Service Unavailable)   No available backends or service currently
2209
\                           unavailable
2210
=========================== =====================
2211

    
2212
Response body contents::
2213

    
2214
  image: {
2215
    <image attribute>: <value>,
2216
    ...
2217
    metadata: {
2218
      <image meta key>: <value>
2219
    }
2220
  }
2221

    
2222
Image attributes are `listed here <#image-ref>`_.
2223

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

    
2226
.. code-block:: javascript
2227

    
2228
  {
2229
  "image": {
2230
    "id": "6404619d-...-aef57eaff4af",
2231
    "name": "FreeBSD",
2232
    "status": "ACTIVE",
2233
    "updated": "2013-04-24T12:06:02+00:00",
2234
    "created": "2013-04-24T11:52:16+00:00",
2235
    "progress": 100,
2236
    "links": [
2237
      {
2238
        "href": "https://example.org/compute/v2.0/images/6404619d-...-aef57eaff4af", 
2239
        "rel": "self"
2240
      }, 
2241
      {
2242
        "href": "https://example.org/compute/v2.0/images/6404619d-...-aef57eaff4af", 
2243
        "rel": "bookmark"
2244
      }, 
2245
      {
2246
        "href": "https://example.org/image/v1.0/images/6404619d-...-aef57eaff4af", 
2247
        "rel": "alternate"
2248
      }
2249
    ],
2250
    "metadata": {
2251
      "kernel": "9.1 RELEASE",
2252
      "osfamily": "freebsd",
2253
      "users": "root",
2254
      "gui": "No GUI",
2255
      "sortorder": "9",
2256
      "os": "freebsd",
2257
      "root_partition": "2",
2258
      "description": "FreeBSD 9"
2259
      }
2260
    }
2261
  }
2262

    
2263

    
2264
Delete Image
2265
------------
2266

    
2267
Delete an image, by changing its status from ``ACTIVE`` to ``DELETED``.
2268

    
2269
.. rubric:: Request
2270

    
2271
====================== ====== ======== ==========
2272
URI                    Method Cyclades OS/Compute
2273
====================== ====== ======== ==========
2274
``/images/<image id>`` DELETE ✔        ✔
2275
====================== ====== ======== ==========
2276

    
2277
* **image id** is the identifier of the image
2278

    
2279
|
2280

    
2281
==============  ========================= ======== ==========
2282
Request Header  Value                     Cyclades OS/Compute
2283
==============  ========================= ======== ==========
2284
X-Auth-Token    User authentication token required required
2285
==============  ========================= ======== ==========
2286

    
2287
.. note:: Request parameters should be empty
2288

    
2289
.. note:: Request body should be empty
2290

    
2291
.. rubric:: Response
2292

    
2293
=========================== =====================
2294
Return Code                 Description
2295
=========================== =====================
2296
204 (OK)                    Request succeeded
2297
400 (Bad Request)           Invalid request or image id
2298
401 (Unauthorized)          Missing or expired user token
2299
404 (Not Found)             Image not found
2300
500 (Internal Server Error) The request cannot be completed because of an
2301
\                           internal error
2302
503 (Service Unavailable)   Action not supported or service currently
2303
\                           unavailable
2304
=========================== =====================
2305

    
2306
.. note:: In case of a 204 code, request body should be empty
2307

    
2308
List Image Metadata
2309
-------------------
2310

    
2311
.. rubric:: Request
2312

    
2313
=============================== ====== ======== ==========
2314
URI                             Method Cyclades OS/Compute
2315
=============================== ====== ======== ==========
2316
``/images/<image-id>/metadata`` GET    ✔        ✔
2317
=============================== ====== ======== ==========
2318

    
2319
* **image-id** is the identifier of the virtual image
2320

    
2321
|
2322
==============  ========================= ======== ==========
2323
Request Header  Value                     Cyclades OS/Compute
2324
==============  ========================= ======== ==========
2325
X-Auth-Token    User authentication token required required
2326
==============  ========================= ======== ==========
2327

    
2328
.. note:: Request parameters should be empty
2329

    
2330
.. note:: Request body should be empty
2331

    
2332
.. rubric:: Response
2333

    
2334
=========================== =====================
2335
Return Code                 Description
2336
=========================== =====================
2337
201 (OK)                    Request succeeded
2338
400 (Bad Request)           Invalid image ID or Malformed request
2339
401 (Unauthorized)          Missing or expired user token
2340
403 (Forbidden)             Administratively suspended server
2341
404 (Not Found)             Server not found
2342
409 (Build In Progress)     The image is not ready yet
2343
500 (Internal Server Error) The request cannot be completed because of an
2344
\                           internal error
2345
503 (Service Unavailable)   The server is not currently available
2346
=========================== =====================
2347

    
2348
Response body content::
2349

    
2350
  metadata: {
2351
    <meta key>: <value>,
2352
  ...
2353
  }
2354

    
2355
*Example List Image Metadata: JSON*
2356

    
2357
.. code-block:: javascript
2358

    
2359
  {
2360
    "metadata": {
2361
      "partition_table": "msdos",
2362
      "kernel": "3.2.0",
2363
      "osfamily": "linux",
2364
      "users": "user",
2365
      "gui": "Unity 5",
2366
      "sortorder": "3",
2367
      "os": "ubuntu",
2368
      "root_partition": "1",
2369
      "description": "Ubuntu 12 LTS"
2370
    }
2371
  }
2372

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

    
2375
Update Image Metadata
2376
---------------------
2377

    
2378
In Cyclades API, setting new metadata and updating the values of existing ones
2379
is achieved using one type of request (POST), while in OS/Compute API two
2380
different types are used (PUT and POST for
2381
`setting new <http://docs.openstack.org/api/openstack-compute/2/content/Create_or_Replace_Metadata-d1e5358.html>`_
2382
and
2383
`updating existing <http://docs.openstack.org/api/openstack-compute/2/content/Update_Metadata-d1e5208.html>`_
2384
metadata, respectively).
2385

    
2386
In Cyclades API, unmentioned metadata keys will remain intact, while metadata
2387
referred by the operation will be overwritten.
2388

    
2389
.. rubric:: Request
2390

    
2391
=============================== ====== ======== ==========
2392
URI                             Method Cyclades OS/Compute
2393
=============================== ====== ======== ==========
2394
``/images/<image-id>/metadata`` PUT    **✘**    ✔
2395
``/images/<image-id>/metadata`` POST   ✔        ✔
2396
=============================== ====== ======== ==========
2397

    
2398
* **image-id** is the identifier of the virtual image
2399

    
2400
|
2401
==============  ========================= ======== ==========
2402
Request Header  Value                     Cyclades OS/Compute
2403
==============  ========================= ======== ==========
2404
X-Auth-Token    User authentication token required required
2405
Content-Type    Type or request body      required required
2406
Content-Length  Length of request body    required required
2407
==============  ========================= ======== ==========
2408

    
2409
**Example Request Headers**::
2410

    
2411
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
2412
  Content-Type:   application/json
2413
  Content-Length: 52
2414

    
2415
.. note:: Request parameters should be empty
2416

    
2417
Request body content::
2418

    
2419
  metadata: {
2420
    <meta key>: <value>,
2421
    ...
2422
  }
2423

    
2424
*Example Update Image Metadata Request: JSON*
2425

    
2426
.. code-block:: javascript
2427

    
2428
  {"metadata": {"NewAttr": "NewVal", "os": "Xubuntu'}}
2429

    
2430
.. rubric:: Response
2431

    
2432
=========================== =====================
2433
Return Code                 Description
2434
=========================== =====================
2435
201 (OK)                    Request succeeded
2436
400 (Bad Request)           Malformed request or image id
2437
401 (Unauthorized)          Missing or expired user token
2438
403 (Forbidden)             Not allowed to modify this image
2439
404 (Not Found)             Image or meta key not found
2440
413 (OverLimit)             Maximum number of metadata exceeded
2441
500 (Internal Server Error) The request cannot be completed because of an
2442
\                           internal error
2443
503 (Service Unavailable)   The server is not currently available
2444
=========================== =====================
2445

    
2446
Response body content::
2447

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

    
2453
*Example Update Image Response: JSON*
2454

    
2455
.. code-block:: javascript
2456

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

    
2472
Get Image Metadata
2473
------------------
2474

    
2475
.. rubric:: Request
2476

    
2477
===================================== ====== ======== ==========
2478
URI                                   Method Cyclades OS/Compute
2479
===================================== ====== ======== ==========
2480
``/images/<image-id>/metadata/<key>`` GET    ✔        ✔
2481
===================================== ====== ======== ==========
2482

    
2483
* **image-id** is the identifier of the image
2484

    
2485
* **key** is the key of a mata ``key``:``value`` pair
2486

    
2487
|
2488

    
2489
==============  ========================= ======== ==========
2490
Request Header  Value                     Cyclades OS/Compute
2491
==============  ========================= ======== ==========
2492
X-Auth-Token    User authentication token required required
2493
==============  ========================= ======== ==========
2494

    
2495
.. note:: Request parameters should be empty
2496

    
2497
.. note:: Request body should be empty
2498

    
2499
.. rubric:: Response
2500

    
2501
=========================== =====================
2502
Return Code                 Description
2503
=========================== =====================
2504
200 (OK)                    Request succeeded
2505
400 (Bad Request)           Malformed request or image id
2506
401 (Unauthorized)          Missing or expired user token
2507
403 (Forbidden)             Not allowed to access this information
2508
404 (Not Found)             Meta key not found
2509
500 (Internal Server Error) The request cannot be completed because of an
2510
\                           internal error
2511
503 (Service Unavailable)   The server is not currently available
2512
=========================== =====================
2513

    
2514
Response body content::
2515

    
2516
  metadata: {<key>: <value>}
2517

    
2518
*Example Get Image Metadata Item: JSON*
2519

    
2520
.. code-block:: javascript
2521

    
2522
  {"metadata": {"os": "Xubuntu"}}
2523

    
2524
.. note:: In OS/Compute, ``metadata`` is ``meta``
2525

    
2526
Update Image Metadata
2527
---------------------
2528

    
2529
.. rubric:: Request
2530

    
2531
===================================== ====== ======== ==========
2532
URI                                   Method Cyclades OS/Compute
2533
===================================== ====== ======== ==========
2534
``/images/<image-id>/metadata/<key>`` PUT    ✔        ✔
2535
===================================== ====== ======== ==========
2536

    
2537
* **image-id** is the identifier of the image
2538

    
2539
* **key** is the key of a matadata ``key``:``value`` pair
2540

    
2541
|
2542

    
2543
==============  ========================= ======== ==========
2544
Request Header  Value                     Cyclades OS/Compute
2545
==============  ========================= ======== ==========
2546
X-Auth-Token    User authentication token required required
2547
Content-Type    Type or request body      required required
2548
Content-Length  Length of request body    required required
2549
==============  ========================= ======== ==========
2550

    
2551
**Example Request Headers**::
2552

    
2553
  X-Auth-Token:   z31uRXUn1LZy45p1r7V==
2554
  Content-Type:   application/json
2555
  Content-Length: 27
2556

    
2557
|
2558

    
2559
.. note:: Request parameters should be empty
2560

    
2561
Request body content::
2562

    
2563
  metadata: {<key>: <value>}
2564

    
2565
*Example Update Image Metadata Item Request: JSON*
2566

    
2567
.. code-block:: javascript
2568

    
2569
  {"metadata": {"os": "Kubuntu"}}
2570

    
2571
.. rubric:: Response
2572

    
2573
=========================== =====================
2574
Return Code                 Description
2575
=========================== =====================
2576
201 (OK)                    Request succeeded
2577
400 (Bad Request)           Malformed request or image id
2578
401 (Unauthorized)          Missing or expired user token
2579
403 (Forbidden)             Not allowed to modify this image
2580
404 (Not Found)             Metadata key not found
2581
413 (OverLimit)             Maximum number of metadata exceeded
2582
500 (Internal Server Error) The request cannot be completed because of an
2583
\                           internal error
2584
503 (Service Unavailable)   The server is not currently available
2585
=========================== =====================
2586

    
2587
Request body content::
2588

    
2589
  metadata: {<key>: <value>}
2590

    
2591
*Example Update Image Metadata Item Response: JSON*
2592

    
2593
.. code-block:: javascript
2594

    
2595
  {"metadata": {"os": "Kubuntu"}}
2596

    
2597
Delete Image Metadata
2598
---------------------
2599

    
2600
Delete an image metadata by its key.
2601

    
2602
.. rubric:: Request
2603

    
2604
===================================== ====== ======== ==========
2605
URI                                   Method Cyclades OS/Compute
2606
===================================== ====== ======== ==========
2607
``/images/<image-id>/metadata/<key>`` DELETE ✔        ✔
2608
===================================== ====== ======== ==========
2609

    
2610
* **image-id** is the identifier of the image
2611

    
2612
* **key** is the key of a mata ``key``:``value`` pair
2613

    
2614
|
2615
==============  ========================= ======== ==========
2616
Request Header  Value                     Cyclades OS/Compute
2617
==============  ========================= ======== ==========
2618
X-Auth-Token    User authentication token required required
2619
==============  ========================= ======== ==========
2620

    
2621
.. note:: Request parameters should be empty
2622

    
2623
.. note:: Request body should be empty
2624

    
2625
.. rubric:: Response
2626

    
2627
=========================== =====================
2628
Return Code                 Description
2629
=========================== =====================
2630
204 (OK)                    Request succeeded
2631
400 (Bad Request)           Malformed image ID
2632
401 (Unauthorized)          Missing or expired user token
2633
403 (Forbidden)             Not allowed to modify this image
2634
404 (Not Found)             Metadata key not found
2635
500 (Internal Server Error) The request cannot be completed because of an
2636
\                           internal error
2637
503 (Service Unavailable)   The server is not currently available
2638
=========================== =====================
2639

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

    
2642
Index of Attributes
2643
-------------------
2644

    
2645
.. _server-ref:
2646

    
2647
Server Attributes
2648
.................
2649

    
2650
=================== ======== ==========
2651
Server attribute    Cyclades OS/Compute
2652
=================== ======== ==========
2653
id                  ✔        ✔
2654
name                ✔        ✔
2655
addresses           ✔        ✔
2656
links               ✔        ✔
2657
image               ✔        ✔
2658
flavor              ✔        ✔
2659
user_id             ✔        ✔
2660
tenant_id           ✔        ✔
2661
accessIPv4          ✔        ✔
2662
accessIPv6          ✔        ✔
2663
progress            ✔        ✔
2664
status              ✔        ✔
2665
updated             ✔        ✔
2666
hostId              ✔        ✔
2667
created             ✔        ✔
2668
adminPass           ✔        ✔
2669
metadata            ✔        ✔
2670
suspended           ✔        **✘**
2671
security_groups     ✔        **✘**
2672
attachments         ✔        **✘**
2673
config_drive        ✔        **✘**
2674
SNF:fqdn            ✔        **✘**
2675
key_name            ✔        **✘**
2676
SNF:port_forwarding ✔        **✘**
2677
SNF:task_state      ✔        **✘**
2678
diagnostics         ✔        **✘**
2679
deleted             ✔        **✘**
2680
=================== ======== ==========
2681

    
2682
* **addresses** Networks related to this server. All information in this field
2683
  is redundant, since it can be infered from the ``attachments`` field, but
2684
  it is used for compatibility with OS/Computet
2685

    
2686
* **user_id** The UUID of the owner of the virtual server
2687

    
2688
* **tenant_id** The UUID of the project that defines this resource
2689

    
2690
* *hostId*, **accessIPv4** and **accessIPv6** are always empty and are used for
2691
  compatibility with OS/Compute
2692

    
2693
* **progress** Shows the building progress of a virtual server. After the server
2694
  is built, it is always ``100``
2695

    
2696
* **status** values are described `here <#status-ref>`_
2697

    
2698
* **updated** and **created** are date-formated
2699

    
2700
* **adminPass** is shown only once (in ``create server`` response). This
2701
  information is not preserved in a clear text form, so it is not recoverable
2702

    
2703
* **suspended** is True only if the server is suspended by the cloud
2704
  administrations or policy
2705

    
2706
* **progress** is a number between 0 and 100 and reflects the server building
2707
  status
2708

    
2709
* **metadata** are custom key:value pairs. In Cyclades, the ``OS`` and
2710
  ``USERS`` metadata are automatically retrieved from the servers image during
2711
  creation
2712

    
2713
* **attachments** List of connection ports. Details `here <#attachments-ref>`_.
2714

    
2715
.. _status-ref:
2716

    
2717
Server Status
2718
.............
2719

    
2720
============= ==================== ======== ==========
2721
Status        Description          Cyclades OS/Compute
2722
============= ==================== ======== ==========
2723
BUILD         Building             ✔        ✔
2724
ACTIVE        Up and running       ✔        ✔
2725
STOPPED       Shut down            ✔        **✘**
2726
REBOOT        Rebooting            ✔        ✔
2727
DELETED       Removed              ✔        ✔
2728
UNKNOWN       Unexpected error     ✔        ✔
2729
ERROR         In error             ✔        ✔
2730
HARD_REBOOT   Hard rebooting       **✘**    ✔
2731
PASSWORD      Resetting password   **✘**    ✔
2732
REBUILD       Rebuilding server    **✘**    ✔
2733
RESCUE        In rescue mode       **✘**    ✔
2734
RESIZE        Resizing             **✘**    ✔
2735
REVERT_RESIZE Failed to resize     **✘**    ✔
2736
SHUTOFF       Shut down by user    **✘**    ✔
2737
SUSPENDED     Suspended            **✘**    ✔
2738
VERIFY_RESIZE Waiting confirmation **✘**    ✔
2739
============= ==================== ======== ==========
2740

    
2741
.. _attachments-ref:
2742

    
2743
Attachments (ports)
2744
...................
2745

    
2746
In Cyclades, a port connects a virtual server to a public or private network.
2747

    
2748
Ports can be handled separately through the Cyclades/Network API.
2749

    
2750
In a virtual server context, a port may contain the following information:
2751

    
2752
================= ======================
2753
Port Attributes    Description          
2754
================= ======================
2755
id                Port id            
2756
mac_address       NIC's mac address     
2757
network_id        Network ID
2758
OS-EXT-IPS:type   ``fixed`` or ``floating``
2759
firewallProfile   ``ENABLED``, ``DISABLED``, ``PROTECTED``
2760
ipv4              IP v4 address
2761
ipv6              IP v6 address
2762
================= ======================
2763

    
2764
* **ipv4** and **ipv6** are mutually exclusive in practice, since a port
2765
    either handles an IPv4, an IPv6, or none, but not both.
2766

    
2767
.. _flavor-ref:
2768

    
2769
Flavor
2770
......
2771

    
2772
A flavor is a hardware configuration for a server. It contains the following
2773
information:
2774

    
2775
================= ==================== ======== ==========
2776
Flavor Attributes Description          Cyclades OS/Compute
2777
================= ==================== ======== ==========
2778
id                The flavor id        ✔        ✔
2779
name              The flavor name      ✔        ✔
2780
ram               Server RAM size      ✔        ✔
2781
SNF:disk_template Storage mechanism    ✔        **✘**
2782
disk              Server disk size     ✔        ✔
2783
vcpus             # of Virtual CPUs    ✔        ✔
2784
links rel         Atom link rel field  **✘**    ✔
2785
links href        Atom link href field **✘**    ✔
2786
================= ==================== ======== ==========
2787

    
2788
* **id** is the flavor unique id (a possitive integer)
2789

    
2790
* **name** is the flavor name (a string)
2791

    
2792
* **ram** is the server RAM size in MB
2793

    
2794
* **SNF:disk_template** is a reference to the underlying storage mechanism
2795
  used by the Cyclades server. It is Cyclades specific.
2796

    
2797
* **disk** the servers disk size in GB
2798

    
2799
* **vcpus** refer to the number of virtual CPUs assigned to a server
2800

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

    
2804
.. _image-ref:
2805

    
2806
Image
2807
.....
2808

    
2809
An image is a collection of files you use to create or rebuild a server.
2810

    
2811
An image item may have the fields presented bellow:
2812

    
2813
================ ====================== ======== ==========
2814
Image Attributes Description            Cyclades OS/Compute
2815
================ ====================== ======== ==========
2816
id               Image ID               ✔        ✔
2817
name             Image name             ✔        ✔
2818
updated          Last update date       ✔        ✔
2819
created          Image creation date    ✔        ✔
2820
progress         Ready status progress  ✔        **✘**
2821
status           Image status           **✘**    ✔:
2822
tenant_id        Image creator          **✘**    ✔
2823
user_id          Image users            **✘**    ✔
2824
metadata         Custom metadata        ✔        ✔
2825
links            Atom links             **✘**    ✔
2826
minDisk          Minimum required disk  **✘**    ✔
2827
minRam           Minimum required RAM   **✘**    ✔
2828
================ ====================== ======== ==========
2829

    
2830
* **id** is the image id and **name** is the image name. They are both strings.
2831

    
2832
* **updated** and **created** are both ISO8601 date strings
2833

    
2834
* **progress** varies between 0 and 100 and denotes the status of the image
2835

    
2836
* **metadata** is a collection of ``key``:``values`` pairs of custom metadata,
2837
  under the tag ``values`` which lies under the tag ``metadata``.
2838

    
2839
* **tenant_id** The UUID of the project that defines this resource
2840

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