Vasyl Saienko | 4eda4f2 | 2018-04-26 19:30:39 +0300 | [diff] [blame] | 1 | from keystonev3.common import send |
| 2 | |
| 3 | try: |
| 4 | from urllib.parse import urlencode |
| 5 | except ImportError: |
| 6 | from urllib import urlencode |
| 7 | |
| 8 | |
| 9 | @send('get') |
| 10 | def endpoint_get_details(endpoint_id, **kwargs): |
| 11 | url = '/endpoints/{}?{}'.format(endpoint_id, urlencode(kwargs)) |
| 12 | return url, None |
| 13 | |
| 14 | |
| 15 | @send('patch') |
| 16 | def endpoint_update(endpoint_id, **kwargs): |
| 17 | url = '/endpoints/{}'.format(endpoint_id) |
| 18 | json = { |
| 19 | 'endpoint': kwargs, |
| 20 | } |
| 21 | return url, json |
| 22 | |
| 23 | |
| 24 | @send('delete') |
| 25 | def endpoint_delete(endpoint_id, **kwargs): |
| 26 | url = '/endpoints/{}'.format(endpoint_id) |
| 27 | return url, None |
| 28 | |
| 29 | |
| 30 | @send('get') |
| 31 | def endpoint_list(**kwargs): |
| 32 | url = '/endpoints?{}'.format(urlencode(kwargs)) |
| 33 | return url, None |
| 34 | |
| 35 | |
| 36 | @send('post') |
| 37 | def endpoint_create(**kwargs): |
| 38 | url = '/endpoints' |
| 39 | json = { |
| 40 | 'endpoint': kwargs, |
| 41 | } |
| 42 | return url, json |