'Retrieve a console url of a server.
:param server: server to get console url for
:param console_type: type can be novnc/xvpvnc for protocol vnc;
spice-html5 for protocol spice; rdp-html5 for
protocol rdp; serial for protocol serial.
webmks for protocol mks (since version 2.8).'

@api_versions.wraps('2.6')
def get_console_url(self, server, console_type):

    if (self.api_version < api_versions.APIVersion('2.8')):
        if (console_type == 'webmks'):
            raise exceptions.UnsupportedConsoleType(console_type)
    protocol = self._get_protocol(console_type)
    body = {'remote_console': {'protocol': protocol, 'type': console_type}}
    url = ('/servers/%s/remote-consoles' % base.getid(server))
    (resp, body) = self.api.client.post(url, body=body)
    return self.convert_into_with_meta(body, resp)
