File: delegate-apis.inc

package info (click to toggle)
adjutant 11.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,452 kB
  • sloc: python: 13,364; makefile: 44; sh: 32
file content (433 lines) | stat: -rw-r--r-- 10,685 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
*************************************
OpenStack Style DelegateAPI Endpoints
*************************************

A response of 'task created' means that the task requires admin approval and
a response of 'created token' indicates that the task has been auto-approved
and awaits the submission of an emailed token.

List users
========================
.. rest_method:: GET /v1/openstack/users

Authentication: Project Moderator or Admin

List current and pending users in the current project.

Request Example
----------------
.. code-block:: bash

    curl -H "X-Auth-Token: $NOS_TOKEN" http://0.0.0.0:5050/v1/openstack/users

Response Example
-----------------
.. code-block:: javascript

    {
        "users": [
            {
                "cohort": "Member",
                "email": "demo@example.com",
                "id": "",
                "manageable": false,
                "name": "demo",
                "roles": [
                    "project_admin",
                    "_member_"
                ],
                "status": "Active"
            }
        ]
    }


Invite User
============
.. rest_method:: POST /v1/openstack/users

Authentication: Project Moderator or Admin

An auto-approved task that will add a user to the project. If the user already
exists it will add them directly, otherwise it will create a user when the
invitee submits a token sent to them though email

.. rest_parameters:: parameters.yaml

    - roles: roles
    - email: email
    - username: username

Request Example
-----------------
.. code-block:: bash

    curl -H "X-Auth-Token: $NOS_TOKEN" http://0.0.0.0:5050/v1/openstack/users \
     -H 'Content-Type: application/json' \
    -d '{"roles": ["member"], "email": "new@example.com"}'

Response Example
-----------------
.. code-block:: javascript

    {
      "notes": ["created token"]
    }

User Details
=============
.. rest_method:: GET /v1/openstack/users/<user_id>

Authentication: Project Moderator or Admin

Get details on the given user including their roles on your project

.. rest_parameters:: parameters.yaml

    - user_id: user_id

Cancel User Invite
==================
.. rest_method:: DELETE /v1/openstack/users/<user_id>

Authentication: Project Moderator or Admin

Cancel a pending user invitation. Current users can be removed from your
project by removing all of their roles.

.. rest_parameters:: parameters.yaml

    - user_id: user_id

List User Roles
==================
.. rest_method:: GET /v1/openstack/users/<user_id>/roles

Authentication: Project Moderator or Admin

List all roles the user has on the current project

.. rest_parameters:: parameters.yaml

    - user_id: user_id

Add User Roles
==================
.. rest_method:: PUT /v1/openstack/users/<user_id>/roles

Authentication: Project Moderator or Admin

Add the specified roles to the user on the current project.

There is additional authentication in the forms of what roles can be edited
by the current user. If the target user has any role not editable by the
current user the user will not be able to edit any of their roles.
Editiable roles can be found at the ``List available roles`` endpoint.


.. rest_parameters:: parameters.yaml

    - user_id: user_id
    - roles: roles

Request Example
-----------------
.. code-block:: bash

    curl -H "X-Auth-Token: $NOS_TOKEN" -H 'Content-Type: application/json' \
    -d '{"roles": ["project_mod"]}' -X PUT \
    http://0.0.0.0:5050/v1/openstack/users/5123ca764f3d40d79e3589e91f1ccb8f/roles

Response Example
-----------------
.. code-block:: javascript

    {
        "notes": [
            "Task completed successfully."
        ]
    }

Remove User Roles
==================
.. rest_method:: DELETE /v1/openstack/users/<user_id>/roles

Authentication: Project Moderator or Admin

Remove the specified roles from the user on the current project.

A project moderator will not be able to change the roles of a project admin.

.. rest_parameters:: parameters.yaml

    - user_id: user_id
    - roles: roles

Request Example
-----------------
.. code-block:: bash

    curl -H "X-Auth-Token: $NOS_TOKEN" -H 'Content-Type: application/json' \
    -d '{"roles": ["project_mod"]}' -X DELETE \
    http://0.0.0.0:5050/v1/openstack/users/5123ca764f3d40d79e3589e91f1ccb8f/roles

Response Example
-----------------
.. code-block:: javascript

    {
        "notes": [
            "Task completed successfully."
        ]
    }


List Available Roles
=====================
.. rest_method:: GET /v1/openstack/roles

Authentication: Project Moderator or Admin

List the roles available for the current user to modify.

Request Example
----------------
.. code-block:: bash

    curl -H "X-Auth-Token: $NOS_TOKEN" http://0.0.0.0:5050/v1/openstack/roles/

Response Example
-----------------
.. code-block:: javascript

    {
        "roles": [
            {
                "domain_id": null,
                "id": "b81efc1e23a043d0976dc39b3e2727c3",
                "links": {
                    "self": "http://identity/v3/roles/b81efc1e23a043d0976dc39b3e2727c3"
                },
                "name": "project_mod"
            },
            {
                "domain_id": null,
                "id": "9fe2ff9ee4384b1894a90878d3e92bab",
                "links": {
                    "self": "http://identity/v3/roles/9fe2ff9ee4384b1894a90878d3e92bab"
                },
                "name": "member"
            },
        ]
    }

Password Reset
===================
.. rest_method:: POST /v1/openstack/users/password-reset

Authentication: Unauthenticated

Unauthenticated for forgotten password requests. If the email has an associated
user a token will be sent to them to use to reset their password with.

.. rest_parameters:: parameters.yaml

    - email: email_password
    - username: username_password

Request Example
----------------
.. code-block:: bash

    curl -d '{"email": "demo@example.org"}' http://0.0.0.0:5050/v1/openstack/users/password-reset

Response Example
-----------------
.. code-block:: javascript

    {
      "notes": ["If user with email exists, reset token will be issued."]
    }

Update Email Address
=====================
.. rest_method:: POST /v1/openstack/email-update

Authentication: Authenticated

Submit a new email address for the current user. A submission token will be
sent to the new address, and a notification to the old email address. The
account address will not change until the token submission.

.. rest_parameters:: parameters.yaml

    - email: email

Sign Up
========
.. rest_method:: POST /v1/openstack/sign-up

Authentication: Unauthenticated

Account creation endpoint.


.. rest_parameters:: parameters.yaml

    - email: email
    - username: username
    - project_name: project_name
    - setup_network: setup_network
    - region: region

Request Example
----------------
.. code-block:: bash

  curl -H 'X-Auth-Token: $OS_TOKEN' -H 'Content-Type: application/json' -d '{
      "email": "example@example.com", "project_name": "example_project"}'
      -X POST  http://0.0.0.0:5050/v1/openstack/sign-up

Response Example
-----------------
.. code-block:: javascript

    {
      "notes": ["task created"]
    }


Show Quota Details
========================
.. rest_method:: GET /v1/openstack/quotas

Authentication: Project Moderator or Admin

List details of the quota for the current project.


.. rest_parameters:: parameters.yaml

    - region: region

Request Example
----------------
.. code-block:: bash

    curl -H "X-Auth-Token: $NOS_TOKEN" http://0.0.0.0:5050/v1/openstack/quotas

Response Example
-----------------
.. code-block:: javascript

    {
        "active_quota_tasks": [],
        "quota_size_order": [
            "small",
            "medium",
            "large"
        ],
        "quota_sizes": {
            "large": {
                "cinder": {
                    "gigabytes": 50000,
                    "snapshots": 600,
                    "volumes": 200
                },
                "neutron": {
                    "floatingip": 50,
                    "network": 10,
                    "port": 500,
                    ...
                },
                "nova": {
                    "cores": 200,
                    "fixed_ips": 0,
                    "floating_ips": 50,
                    "injected_file_content_bytes": 10240,
                    ...
                }
            },
            'small': { ... },
            'medium': { ... }
        },
        "regions": [
            {
                "current_quota": {
                    "cinder": {
                        "backup_gigabytes": 1000,
                        "backups": 10,
                        "gigabytes": 1000,
                        ...
                    },
                    "neutron": {
                        "floatingip": 50,
                        "network": 10,
                        "port": 50,
                        ...
                    },
                    "nova": {
                        "cores": 20,
                        "fixed_ips": -1,
                        "floating_ips": 10,
                        "injected_file_content_bytes": 10240,
                        ...
                    }
                },
                "current_quota_size": "custom",
                "current_usage": {
                    "cinder": {
                        "gigabytes": 1,
                        "snapshots": 0,
                        "volumes": 1
                    },
                    "neutron": {
                        "floatingip": 0,
                        "network": 1,
                        "port": 2,
                        "router": 1
                        ...
                    },
                    "nova": {
                        "cores": 0,
                        "floating_ips": 0,
                        ...
                    }
                },
                "quota_change_options": [],
                "region": "RegionOne"
            }
        ]
    }



Update Quota
========================
.. rest_method:: POST /v1/openstack/quotas

Authentication: Project Moderator or Admin

Starts an update quota task. If regions are not specified it will update
the quota across all regions.

.. rest_parameters:: parameters.yaml

    - regions: regions
    - size: size

Request Example
----------------
.. code-block:: bash

    curl -H "X-Auth-Token: $NOS_TOKEN" http://0.0.0.0:5050/v1/openstack/quotas
      -d '{"region": "RegionOne", "size": "small"}' -H "Content-Type: application/json"


Response Example
-----------------
.. code-block:: javascript

  {
    "notes": ["Task processed. Awaiting Aprroval."]
  }