blob: 513018564c342fbe278156c2c8d7163f34109dbd [file] [log] [blame]
Oleksiy Petrenkoa5eb0602018-07-26 15:12:25 +03001from ironicv1.common import send
2try:
3 from urllib.parse import urlencode
4except ImportError:
5 from urllib import urlencode
6
7
8@send('get')
9def port_list(**kwargs):
10 url = '/ports?{}'.format(urlencode(kwargs))
11 return url, {}
12
13
14@send('post')
15def 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')
26def port_list_details(**kwargs):
27 url = '/ports/detail?{}'.format(urlencode(kwargs))
28 return url, {}
29
30
31@send('get')
32def port_get_details(port_id, **kwargs):
33 url = '/ports/{}?{}'.format(port_id, urlencode(kwargs))
34 return url, {}
35
36
37@send('patch')
38def port_update(port_id, properties, **kwargs):
39 url = '/ports/{}'.format(port_id)
40 return url, {'json': properties}
41
42
43@send('delete')
44def port_delete(port_id, **kwargs):
45 url = '/ports/{}'.format(port_id)
46 return url, {}