Oleksiy Petrenko | e03e2c7 | 2018-08-10 13:24:32 +0300 | [diff] [blame] | 1 | from keystonev3.common import send |
| 2 | from keystonev3.arg_converter import get_by_name_or_uuid_multiple |
Vasyl Saienko | 4eda4f2 | 2018-04-26 19:30:39 +0300 | [diff] [blame] | 3 | |
| 4 | try: |
| 5 | from urllib.parse import urlencode |
| 6 | except ImportError: |
| 7 | from urllib import urlencode |
| 8 | |
| 9 | |
Oleksiy Petrenko | e03e2c7 | 2018-08-10 13:24:32 +0300 | [diff] [blame] | 10 | @get_by_name_or_uuid_multiple([('service', 'service_id')]) |
Vasyl Saienko | 4eda4f2 | 2018-04-26 19:30:39 +0300 | [diff] [blame] | 11 | @send('get') |
| 12 | def service_get_details(service_id, **kwargs): |
| 13 | url = '/services/{}?{}'.format(service_id, urlencode(kwargs)) |
| 14 | return url, None |
| 15 | |
| 16 | |
Oleksiy Petrenko | e03e2c7 | 2018-08-10 13:24:32 +0300 | [diff] [blame] | 17 | @get_by_name_or_uuid_multiple([('service', 'service_id')]) |
Vasyl Saienko | 4eda4f2 | 2018-04-26 19:30:39 +0300 | [diff] [blame] | 18 | @send('patch') |
| 19 | def service_update(service_id, **kwargs): |
| 20 | url = '/services/{}'.format(service_id) |
| 21 | json = { |
| 22 | 'service': kwargs, |
| 23 | } |
| 24 | return url, json |
| 25 | |
| 26 | |
Oleksiy Petrenko | e03e2c7 | 2018-08-10 13:24:32 +0300 | [diff] [blame] | 27 | @get_by_name_or_uuid_multiple([('service', 'service_id')]) |
Vasyl Saienko | 4eda4f2 | 2018-04-26 19:30:39 +0300 | [diff] [blame] | 28 | @send('delete') |
| 29 | def service_delete(service_id, **kwargs): |
| 30 | url = '/services/{}'.format(service_id) |
| 31 | return url, None |
| 32 | |
| 33 | |
| 34 | @send('post') |
| 35 | def service_create(**kwargs): |
| 36 | url = '/services' |
| 37 | json = { |
| 38 | 'service': kwargs, |
| 39 | } |
| 40 | return url, json |