blob: 643a46db57f4a37df58b188512e5ac5dbef0189a [file] [log] [blame]
Oleksiy Petrenkoe03e2c72018-08-10 13:24:32 +03001from keystonev3.common import send
2from keystonev3.arg_converter import get_by_name_or_uuid_multiple
3
Vasyl Saienko4eda4f22018-04-26 19:30:39 +03004try:
5 from urllib.parse import urlencode
6except ImportError:
7 from urllib import urlencode
8
9
Oleksiy Petrenkoe03e2c72018-08-10 13:24:32 +030010@get_by_name_or_uuid_multiple([('project', 'project_id')])
Vasyl Saienko4eda4f22018-04-26 19:30:39 +030011@send('get')
12def project_get_details(project_id, **kwargs):
13 url = '/projects/{}?{}'.format(project_id, urlencode(kwargs))
14 return url, None
15
16
Oleksiy Petrenkoe03e2c72018-08-10 13:24:32 +030017@get_by_name_or_uuid_multiple([('project', 'project_id')])
Vasyl Saienko4eda4f22018-04-26 19:30:39 +030018@send('patch')
19def project_update(project_id, **kwargs):
20 url = '/projects/{}'.format(project_id)
21 json = {
22 'project': kwargs,
23 }
24 return url, json
25
26
Oleksiy Petrenkoe03e2c72018-08-10 13:24:32 +030027@get_by_name_or_uuid_multiple([('project', 'project_id')])
Vasyl Saienko4eda4f22018-04-26 19:30:39 +030028@send('delete')
29def project_delete(project_id, **kwargs):
30 url = '/projects/{}'.format(project_id)
31 return url, None
32
33
Oleksiy Petrenkoe03e2c72018-08-10 13:24:32 +030034@get_by_name_or_uuid_multiple([('domain', 'domain_id')])
Vasyl Saienko4eda4f22018-04-26 19:30:39 +030035@send('post')
Oleksiy Petrenkoe03e2c72018-08-10 13:24:32 +030036def project_create(domain_id, name,**kwargs):
Vasyl Saienko4eda4f22018-04-26 19:30:39 +030037 url = '/projects'
38 json = {
Oleksiy Petrenkoe03e2c72018-08-10 13:24:32 +030039 'project': {
40 'name': name,
41 'domain_id': domain_id,
42 }
Vasyl Saienko4eda4f22018-04-26 19:30:39 +030043 }
Oleksiy Petrenkoe03e2c72018-08-10 13:24:32 +030044 json['project'].update(kwargs)
Vasyl Saienko4eda4f22018-04-26 19:30:39 +030045 return url, json