blob: 26e44fe2bd51a0aebb403df446d9c338b638fecd [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 project_list(**kwargs):
10 url = '/projects?{}'.format(urlencode(kwargs))
11 return url, None
12
13
14@get_by_name_or_uuid(project_list, 'projects', 'project_id')
15@send('get')
16def project_get_details(project_id, **kwargs):
17 url = '/projects/{}?{}'.format(project_id, urlencode(kwargs))
18 return url, None
19
20
21@get_by_name_or_uuid(project_list, 'projects', 'project_id')
22@send('patch')
23def project_update(project_id, **kwargs):
24 url = '/projects/{}'.format(project_id)
25 json = {
26 'project': kwargs,
27 }
28 return url, json
29
30
31@get_by_name_or_uuid(project_list, 'projects', 'project_id')
32@send('delete')
33def project_delete(project_id, **kwargs):
34 url = '/projects/{}'.format(project_id)
35 return url, None
36
37
38@send('post')
39def project_create(**kwargs):
40 url = '/projects'
41 json = {
42 'project': kwargs,
43 }
44 return url, json