Revision fa382f9e docs/developers/clients-api.rst
b/docs/developers/clients-api.rst | ||
---|---|---|
1 | 1 |
Creating applications with kamaki API |
2 | 2 |
===================================== |
3 | 3 |
|
4 |
Kamaki features a clients API for building third-party client applications that |
|
5 |
communicate with OpenStack and / or Synnefo cloud services. The package is |
|
6 |
called kamaki.clients and servers as a lib. |
|
4 | 7 |
|
5 |
Kamaki features a clients API for building third-party client applications that communicate with OpenStack and / or Synnefo cloud services. The package is called kamaki.clients and contains a number of |
|
8 |
A showcase of an application built on kamaki.clients is kamaki.cli, the command |
|
9 |
line interface of kamaki. |
|
6 | 10 |
|
7 |
A good example of an application build on kamaki.clients is kamaki.cli, the command line interface of kamaki. |
|
8 |
|
|
9 |
Since synnefo services are build as OpenStack extensions, an inheritance approach has been chosen for implementing clients for both. In specific, the *compute*, *storage* and *image* modules are clients of the OS compute, OS storage, respectively. On the contrary, all the other modules are Synnefo extensions (*cyclades* extents *compute*, *pithos* and *pithos_rest_api* extent *storage*) or novel synnefo services (e.g. *astakos* for IM, *image* for *plankton*). |
|
11 |
Since synnefo services are build as OpenStack extensions, an inheritance |
|
12 |
approach has been chosen for implementing clients for both. In specific, |
|
13 |
the *compute*, *storage* and *image* modules are clients of the OS compute, OS |
|
14 |
object-store, respectively. On the contrary, all the other modules are Synnefo |
|
15 |
extensions (*cyclades* extents *compute*, *pithos* and *pithos_rest_api* |
|
16 |
extent *storage*) or novel synnefo services (e.g. *astakos* for IM, *image* |
|
17 |
for *plankton*). |
|
10 | 18 |
|
11 | 19 |
Setup a client instance |
12 | 20 |
----------------------- |
... | ... | |
25 | 33 |
my_cyclades_client = CycladesClient(base_url, token) |
26 | 34 |
my_pithos_client = PithosClient(base_url, token, account, container) |
27 | 35 |
|
28 |
.. note:: *cyclades* and *pithos* clients inherit all methods of *compute* and *storage* clients respectively. Separate compute or storage objects should be used only when implementing applications for strict OS Compute or OS Storage services. |
|
36 |
.. note:: *cyclades* and *pithos* clients inherit all methods of *compute* |
|
37 |
and *storage* clients respectively. Separate compute or storage objects |
|
38 |
should be used only when implementing applications for strict OS Compute or |
|
39 |
OS Storage services. |
|
29 | 40 |
|
30 | 41 |
.. note:: *account* variable is usually acquired by the following user call |
31 | 42 |
|
... | ... | |
38 | 49 |
Use client methods |
39 | 50 |
------------------ |
40 | 51 |
|
41 |
Client methods can now be called. Developers are advised to consult :ref:`the-client-api-ref` for details on the available methods and how to use them. |
|
52 |
Client methods can now be called. Developers are advised to |
|
53 |
consult :ref:`the-client-api-ref` for details on the available methods and how |
|
54 |
to use them. |
|
42 | 55 |
|
43 |
In the following example, the *cyclades* and *pithos* clients of example 1.1 are used to extract some information, that is then printed to the standard output. |
|
56 |
In the following example, the *cyclades* and *pithos* clients of example 1.1 |
|
57 |
are used to extract some information, that is then printed to the standard |
|
58 |
output. |
|
44 | 59 |
|
45 | 60 |
|
46 | 61 |
.. code-block:: python |
... | ... | |
73 | 88 |
Error handling |
74 | 89 |
-------------- |
75 | 90 |
|
76 |
The kamaki.clients standard error is ClientError. A ClientError is raised for any kind of kamaki.clients errors (errors reported by servers, type errors in arguments, etc.). |
|
91 |
The kamaki.clients standard error is ClientError. A ClientError is raised for |
|
92 |
any kind of kamaki.clients errors (errors reported by servers, type errors in |
|
93 |
arguments, etc.). |
|
77 | 94 |
|
78 | 95 |
A ClientError contains:: |
79 | 96 |
|
Also available in: Unified diff