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