blob: 9582eef878f1c8543e691c57f180cd5f6bd6f473 [file] [log] [blame]
Vasyl Saienko4eda4f22018-04-26 19:30:39 +03001from keystonev3.common import get_by_name_or_uuid, send
2try:
3 from urllib.parse import urlencode
4except ImportError:
5 from urllib import urlencode
6
7
8@send('get')
9def user_list(**kwargs):
10 url = '/users?{}'.format(urlencode(kwargs))
11 return url, None
12
13
14@get_by_name_or_uuid(user_list, 'users', 'user_id')
15@send('get')
16def user_get_details(user_id, **kwargs):
17 url = '/users/{}?{}'.format(user_id, urlencode(kwargs))
18 return url, None
19
20
21@get_by_name_or_uuid(user_list, 'users', 'user_id')
22@send('patch')
23def user_update(user_id, **kwargs):
24 url = '/users/{}'.format(user_id)
25 json = {
26 'user': kwargs,
27 }
28 return url, json
29
30
31@get_by_name_or_uuid(user_list, 'users', 'user_id')
32@send('delete')
33def user_delete(user_id, **kwargs):
34 url = '/users/{}'.format(user_id)
35 return url, None
36
37
38@send('post')
39def user_create(**kwargs):
40 url = '/users'
41 json = {
42 'user': kwargs,
43 }
44 return url, json