blob: ab9482b457e22d3588ba9c9a87e7124b7eaca936 [file] [log] [blame]
Ann Taraday8204f722018-12-12 16:38:57 +04001from neutronv2.common import send
2from neutronv2.arg_converter import get_by_name_or_uuid_multiple
3
4try:
5 from urllib.parse import urlencode
6except ImportError:
7 from urllib import urlencode
8
9
10@get_by_name_or_uuid_multiple([('port', 'port_id')])
11@send('get')
12def port_get_details(port_id, **kwargs):
13 url = '/ports/{}?{}'.format(port_id, urlencode(kwargs))
14 return url, {}
15
16
17@get_by_name_or_uuid_multiple([('port', 'port_id')])
18@send('put')
19def port_update(port_id, **kwargs):
20 url = '/ports/{}'.format(port_id)
21 json = {
22 'port': kwargs,
23 }
24 return url, {'json': json}
25
26
27@get_by_name_or_uuid_multiple([('port', 'port_id')])
28@send('delete')
29def port_delete(port_id, **kwargs):
30 url = '/port/{}'.format(port_id)
31 return url, {}
32
33
34@send('post')
35def port_create(**kwargs):
36 url = '/ports'
37 json = {
38 'port': kwargs,
39 }
40 return url, {'json': json}