Statistics
| Branch: | Tag: | Revision:

root / docs / astakos-api-guide.rst @ 19246578

History | View | Annotate | Download (14.1 kB)

1
Astakos API
2
===========
3

    
4
This is Astakos API guide.
5

    
6
Overview
7
--------
8

    
9

    
10
Astakos service co-ordinates the access to resources (and the subsequent
11
permission model) and acts as the single point of registry and entry to the
12
GRNET cloud services.
13

    
14
This document's goals is to describe the APIs to the outer world.
15
Make sure you have read the :ref:`astakos` general architecture first.
16

    
17
Document Revisions
18
^^^^^^^^^^^^^^^^^^
19

    
20
=========================  ================================
21
Revision                   Description
22
=========================  ================================
23
0.13 (January 21, 2013)    Extend api to export user presentation & quota information.
24
0.6 (June 06, 2012)        Split service and admin API.
25
0.1 (Feb 10, 2012)         Initial release.
26
=========================  ================================
27

    
28
Get Services
29
^^^^^^^^^^^^
30

    
31
Returns a json formatted list containing information about the supported cloud services.
32

    
33
==================== =========  ==================
34
Uri                  Method     Description
35
==================== =========  ==================
36
``/im/get_services`` GET        Get cloud services
37
==================== =========  ==================
38

    
39
Example reply:
40

    
41
::
42

    
43
    [{"url": "/", "icon": "home-icon.png", "name": "grnet cloud", "id": "1"},
44
    {"url": "/okeanos.html", "name": "~okeanos", "id": "2"},
45
    {"url": "/ui/", "name": "pithos+", "id": "3"}]
46

    
47

    
48
Get Menu
49
^^^^^^^^
50

    
51
Returns a json formatted list containing the cloud bar links.
52

    
53
==================== =========  ==================
54
Uri                  Method     Description
55
==================== =========  ==================
56
``/im/get_menu``     GET        Get cloud bar menu
57
==================== =========  ==================
58

    
59
Example reply if request user is not authenticated:
60

    
61
::
62

    
63
    [{"url": "/im/", "name": "Sign in"}]
64

    
65
Example reply if request user is authenticated:
66

    
67
::
68

    
69
    [{"url": "/im/login", "name": "user@example.com"},
70
    {"url": "/im/profile", "name": "My account"},
71
    {"url": "/im/logout", "name": "Sign out"}]
72

    
73
Admin API Operations
74
--------------------
75

    
76
The operations described in this chapter allow users to authenticate themselves, send feedback and get user uuid/displayname mappings.
77

    
78
All the operations require a valid user token.
79

    
80
.. _authenticate-api-label:
81

    
82
Authenticate
83
^^^^^^^^^^^^
84

    
85
Authenticate API requests require a token. An application that wishes to connect to Astakos, but does not have a token, should redirect the user to ``/login``. (see :ref:`authentication-label`)
86

    
87
==================== =========  ==================
88
Uri                  Method     Description
89
==================== =========  ==================
90
``/im/authenticate`` GET        Authenticate user using token
91
==================== =========  ==================
92

    
93
|
94

    
95
====================  ===========================
96
Request Header Name   Value
97
====================  ===========================
98
X-Auth-Token          User authentication token
99
====================  ===========================
100

    
101
|
102

    
103
======================  =========================
104
Request Parameter Name  Value
105
======================  =========================
106
usage                    (optional)
107
======================  =========================
108

    
109
Extended information on the user serialized in the json format will be returned:
110

    
111
===========================  ============================
112
Name                         Description
113
===========================  ============================
114
displayname                     User displayname
115
uuid                         User unique identifier
116
email                        List with user emails
117
name                         User full name
118
auth_token_created           Token creation date
119
auth_token_expires           Token expiration date
120
usage                        List of user resource usage (if usage request parameter is present)
121
===========================  ============================
122

    
123
Example reply without `usage` request parameter:
124

    
125
::
126

    
127
  {"id": "12",
128
  "displayname": "user@example.com",
129
  "uuid": "a9dc21d2-bcb2-4104-9a9e-402b7c70d6d8",
130
  "email": "[user@example.com]",
131
  "name": "Firstname Lastname",
132
  "auth_token_created": "Wed, 30 May 2012 10:03:37 GMT",
133
  "auth_token_expires": "Fri, 29 Jun 2012 10:03:37 GMT"}
134

    
135
Example reply with `usage` request parameter:
136

    
137
::
138

    
139
  {"id": "12",
140
  "displayname": "user@example.com",
141
  "uuid": "a9dc21d2-bcb2-4104-9a9e-402b7c70d6d8",
142
  "email": "[user@example.com]",
143
  "name": "Firstname Lastname",
144
  "auth_token_created": "Wed, 30 May 2012 10:03:37 GMT",
145
  "auth_token_expires": "Fri, 29 Jun 2012 10:03:37 GMT",
146
  "usage": [{"currValue": 4536392,
147
             "display_name": "Storage Space",
148
             "description": "Pithos account diskspace",
149
             "verbose_name": "Storage Space",
150
             "help_text_input_each": "This is the total amount of space on Pithos that will be granted to each user of this Project ", "maxValue": 5368710653,
151
             "pluralized_display_name": "Storage Space",
152
             "report_desc": "Storage Space",
153
             "help_text": "This is the space on Pithos for storing files and VM Images. ",
154
             "is_abbreviation": false,
155
             "placeholder": "eg. 10GB",
156
             "unit": "bytes",
157
             "name": "pithos+.diskspace"},
158
            {"currValue": 0,
159
             "display_name": "System Disk",
160
             "description": "Virtual machine disk size",
161
             "verbose_name": "System Disk",
162
             "help_text_input_each": "This is the total amount of System Disk that will be granted to each user of this Project (this refers to the total System Disk of all VMs, not each VM's System Disk)  ",
163
             "maxValue": 53687091200,
164
             "pluralized_display_name": "System Disk",
165
             "report_desc": "System Disk",
166
             "help_text": "This is the System Disk that the VMs have that run the OS ",
167
             "is_abbreviation": false,
168
             "placeholder": "eg. 5GB, 2GB etc",
169
             "unit": "bytes",
170
             "name": "cyclades.disk"},
171
            {"currValue": 0,
172
             "display_name": "CPU",
173
             "description": "Number of virtual machine processors",
174
             "verbose_name": "cpu",
175
             "help_text_input_each": "This is the total number of CPUs that will be granted to each user of this Project (on all VMs)  ", "maxValue": 6, "pluralized_display_name": "CPUs",
176
             "report_desc": "CPUs",
177
             "help_text": "CPUs used by VMs ",
178
             "is_abbreviation": true,
179
             "placeholder": "eg. 1",
180
             "unit": "",
181
             "name": "cyclades.cpu"},
182
            {"currValue": 0,
183
             "display_name": "RAM",
184
             "description": "Virtual machines",
185
             "verbose_name": "ram",
186
             "help_text_input_each": "This is the total amount of RAM that will be granted to each user of this Project (on all VMs)  ", "maxValue": 6442450944,
187
             "pluralized_display_name": "RAM",
188
             "report_desc": "RAM",
189
             "help_text": "RAM used by VMs ",
190
             "is_abbreviation": true,
191
             "placeholder": "eg. 4GB",
192
             "unit": "bytes", "name": "cyclades.ram"},
193
            {"currValue": 0, "display_name": "VM",
194
             "description": "Number of virtual machines",
195
             "verbose_name": "vm", "help_text_input_each": "This is the total number of VMs that will be granted to each user of this Project ", "maxValue": 2,
196
             "pluralized_display_name": "VMs",
197
             "report_desc": "Virtual Machines",
198
             "help_text": "These are the VMs one can create on the Cyclades UI ",
199
             "is_abbreviation": true, "placeholder": "eg. 2",
200
             "unit": "",
201
             "name": "cyclades.vm"},
202
            {"currValue": 0,
203
             "display_name": "private network",
204
             "description": "Private networks",
205
             "verbose_name": "private network",
206
             "help_text_input_each": "This is the total number of Private Networks that will be granted to each user of this Project ",
207
             "maxValue": 1,
208
             "pluralized_display_name": "private networks",
209
             "report_desc": "Private Networks",
210
             "help_text": "These are the Private Networks one can create on the Cyclades UI. ",
211
             "is_abbreviation": false,
212
             "placeholder": "eg. 1",
213
             "unit": "",
214
             "name": "cyclades.network.private"}]}
215

    
216

    
217
|
218

    
219
=========================== =====================
220
Return Code                 Description
221
=========================== =====================
222
204 (No Content)            The request succeeded
223
400 (Bad Request)           Method not allowed or no user found
224
401 (Unauthorized)          Missing token or inactive user or penging approval terms
225
500 (Internal Server Error) The request cannot be completed because of an internal error
226
=========================== =====================
227

    
228

    
229
Send feedback
230
^^^^^^^^^^^^^
231

    
232
Post user feedback.
233

    
234
========================= =========  ==================
235
Uri                       Method     Description
236
========================= =========  ==================
237
``/feedback``             POST       Send feedback
238
========================= =========  ==================
239

    
240
|
241

    
242
====================  ============================
243
Request Header Name   Value
244
====================  ============================
245
X-Auth-Token          User authentication token
246
====================  ============================
247

    
248
|
249

    
250
======================  =========================
251
Request Parameter Name  Value
252
======================  =========================
253
feedback_msg            Feedback message
254
feedback_data           Additional information about service client status
255
======================  =========================
256

    
257
|
258

    
259
=========================== =====================
260
Return Code                 Description
261
=========================== =====================
262
200 (OK)                    The request succeeded
263
502 (Bad Gateway)           Send feedback failure
264
400 (Bad Request)           Method not allowed or invalid message data
265
401 (Unauthorized)          Missing or expired user token
266
500 (Internal Server Error) The request cannot be completed because of an internal error
267
=========================== =====================
268

    
269
Get User catalogs
270
^^^^^^^^^^^^^^^^^
271

    
272
Return a json formatted dictionary containing information about a specific user
273

    
274
================================ =========  ==================
275
Uri                              Method     Description
276
================================ =========  ==================
277
``/user_catalogs``               POST       Get 2 catalogs containing uuid to displayname mapping and the opposite
278
================================ =========  ==================
279

    
280
|
281

    
282
====================  ============================
283
Request Header Name   Value
284
====================  ============================
285
X-Auth-Token          User authentication token
286
====================  ============================
287

    
288
|
289

    
290
The request body is a json formatted dictionary containing a list with uuids and another list of displaynames to translate.
291

    
292
Example request content:
293

    
294
::
295

    
296
  {"displaynames": ["user1@example.com", "user2@example.com"],
297
   "uuids":["ff53baa9-c025-4d56-a6e3-963db0438830", "a9dc21d2-bcb2-4104-9a9e-402b7c70d6d8"]}
298

    
299
Example reply:
300

    
301
::
302

    
303
  {"displayname_catalog": {"user1@example.com": "a9dc21d2-bcb2-4104-9a9e-402b7c70d6d8",
304
                           "user2@example.com": "816351c7-7405-4f26-a968-6380cf47ba1f"},
305
  'uuid_catalog': {"a9dc21d2-bcb2-4104-9a9e-402b7c70d6d8": "user1@example.com",
306
                   "ff53baa9-c025-4d56-a6e3-963db0438830": "user2@example.com"}}
307

    
308

    
309
|
310

    
311
=========================== =====================
312
Return Code                 Description
313
=========================== =====================
314
200 (OK)                    The request succeeded
315
400 (Bad Request)           Method not allowed or request body is not json formatted
316
401 (Unauthorized)          Missing or expired or invalid user token
317
500 (Internal Server Error) The request cannot be completed because of an internal error
318
=========================== =====================
319

    
320
Service API Operations
321
----------------------
322

    
323
The operations described in this chapter allow services to get user uuid/displayname mappings.
324

    
325
All the operations require a valid service token.
326

    
327
Get User catalogs
328
^^^^^^^^^^^^^^^^^
329

    
330
Return a json formatted dictionary containing information about a specific user
331

    
332
================================ =========  ==================
333
Uri                              Method     Description
334
================================ =========  ==================
335
``/user_catalogs``               POST       Get 2 catalogs containing uuid to displayname mapping and the opposite
336
================================ =========  ==================
337

    
338
|
339

    
340
====================  ============================
341
Request Header Name   Value
342
====================  ============================
343
X-Auth-Token          Service authentication token
344
====================  ============================
345

    
346
|
347

    
348
The request body is a json formatted dictionary containing a list with uuids and another list of displaynames to translate.
349
If instead of list null is passed then the response contains the information for all the system users (For discretion purposes
350
this behavior is **not** exposed in the respective call of the User API).
351

    
352
Example request content:
353

    
354
::
355

    
356
  {"displaynames": ["user1@example.com", "user2@example.com"],
357
   "uuids":["ff53baa9-c025-4d56-a6e3-963db0438830", "a9dc21d2-bcb2-4104-9a9e-402b7c70d6d8"]}
358

    
359
Example reply:
360

    
361
::
362

    
363
  {"displayname_catalog": {"user1@example.com": "a9dc21d2-bcb2-4104-9a9e-402b7c70d6d8",
364
                           "user2@example.com": "816351c7-7405-4f26-a968-6380cf47ba1f"},
365
  'uuid_catalog': {"a9dc21d2-bcb2-4104-9a9e-402b7c70d6d8": "user1@example.com",
366
                   "ff53baa9-c025-4d56-a6e3-963db0438830": "user2@example.com"}}
367

    
368

    
369
|
370

    
371
=========================== =====================
372
Return Code                 Description
373
=========================== =====================
374
200 (OK)                    The request succeeded
375
400 (Bad Request)           Method not allowed or request body is not json formatted
376
401 (Unauthorized)          Missing or expired or invalid service token
377
500 (Internal Server Error) The request cannot be completed because of an internal error
378
=========================== =====================