blob: ab9482b457e22d3588ba9c9a87e7124b7eaca936 [file] [log] [blame]
from neutronv2.common import send
from neutronv2.arg_converter import get_by_name_or_uuid_multiple
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
@get_by_name_or_uuid_multiple([('port', 'port_id')])
@send('get')
def port_get_details(port_id, **kwargs):
url = '/ports/{}?{}'.format(port_id, urlencode(kwargs))
return url, {}
@get_by_name_or_uuid_multiple([('port', 'port_id')])
@send('put')
def port_update(port_id, **kwargs):
url = '/ports/{}'.format(port_id)
json = {
'port': kwargs,
}
return url, {'json': json}
@get_by_name_or_uuid_multiple([('port', 'port_id')])
@send('delete')
def port_delete(port_id, **kwargs):
url = '/port/{}'.format(port_id)
return url, {}
@send('post')
def port_create(**kwargs):
url = '/ports'
json = {
'port': kwargs,
}
return url, {'json': json}