Oleksiy Petrenko | a5eb060 | 2018-07-26 15:12:25 +0300 | [diff] [blame^] | 1 | from ironicv1.common import send |
| 2 | try: |
| 3 | from urllib.parse import urlencode |
| 4 | except ImportError: |
| 5 | from urllib import urlencode |
| 6 | |
| 7 | |
| 8 | @send('get') |
| 9 | def port_list(**kwargs): |
| 10 | url = '/ports?{}'.format(urlencode(kwargs)) |
| 11 | return url, {} |
| 12 | |
| 13 | |
| 14 | @send('post') |
| 15 | def port_create(node_uuid, address, **kwargs): |
| 16 | url = '/ports' |
| 17 | json = { |
| 18 | 'node_uuid': node_uuid, |
| 19 | 'address': address, |
| 20 | } |
| 21 | json.update(kwargs) |
| 22 | return url, {'json': json} |
| 23 | |
| 24 | |
| 25 | @send('get') |
| 26 | def port_list_details(**kwargs): |
| 27 | url = '/ports/detail?{}'.format(urlencode(kwargs)) |
| 28 | return url, {} |
| 29 | |
| 30 | |
| 31 | @send('get') |
| 32 | def port_get_details(port_id, **kwargs): |
| 33 | url = '/ports/{}?{}'.format(port_id, urlencode(kwargs)) |
| 34 | return url, {} |
| 35 | |
| 36 | |
| 37 | @send('patch') |
| 38 | def port_update(port_id, properties, **kwargs): |
| 39 | url = '/ports/{}'.format(port_id) |
| 40 | return url, {'json': properties} |
| 41 | |
| 42 | |
| 43 | @send('delete') |
| 44 | def port_delete(port_id, **kwargs): |
| 45 | url = '/ports/{}'.format(port_id) |
| 46 | return url, {} |