def info(gandi, resource, stat): """Display information about a PaaS instance. Resource can be a vhost, a hostname, or an ID Cache statistics are based on 24 hours data. """ output_keys = ['name', 'type', 'size', 'memory', 'console', 'vhost', 'dc', 'sftp_server', 'git_server', 'snapshot'] paas = gandi.paas.info(resource) paas_hosts = [] list_vhost = gandi.vhost.list({'paas_id': paas['id']}) df = gandi.paas.quota(paas['id']) paas.update({'df': df}) if stat: cache = gandi.paas.cache(paas['id']) paas.update({'cache': cache}) for host in list_vhost: paas_hosts.append(host['name']) output_paas(gandi, paas, [], paas_hosts, output_keys) return paas
def list(gandi, state, id, vhosts, type, limit): """List PaaS instances.""" options = { 'items_per_page': limit, } if state: options['state'] = state output_keys = ['name', 'state'] if id: output_keys.append('id') if vhosts: output_keys.append('vhost') if type: output_keys.append('type') paas_hosts = {} result = gandi.paas.list(options) for paas in result: paas_hosts[paas['id']] = [] if vhosts: list_vhost = gandi.vhost.list({'paas_id': paas['id']}) for host in list_vhost: paas_hosts[paas['id']].append(host['name']) gandi.separator_line() output_paas(gandi, paas, [], paas_hosts[paas['id']], output_keys) return result
def list(gandi, state, id, vhosts, type, limit): """List PaaS instances.""" options = { 'items_per_page': limit, } if state: options['state'] = state output_keys = ['name', 'state'] if id: output_keys.append('id') if vhosts: output_keys.append('vhost') if type: output_keys.append('type') paas_hosts = {} result = gandi.paas.list(options) for num, paas in enumerate(result): paas_hosts[paas['id']] = [] if vhosts: list_vhost = gandi.vhost.list({'paas_id': paas['id']}) for host in list_vhost: paas_hosts[paas['id']].append(host['name']) if num: gandi.separator_line() output_paas(gandi, paas, [], paas_hosts[paas['id']], output_keys) return result
def list(gandi, state, id, vhosts, type, limit): """List PaaS instances.""" options = {"items_per_page": limit} if state: options["state"] = state output_keys = ["name", "state"] if id: output_keys.append("id") if vhosts: output_keys.append("vhost") if type: output_keys.append("type") paas_hosts = {} result = gandi.paas.list(options) for num, paas in enumerate(result): paas_hosts[paas["id"]] = [] if vhosts: list_vhost = gandi.vhost.list({"paas_id": paas["id"]}) for host in list_vhost: paas_hosts[paas["id"]].append(host["name"]) if num: gandi.separator_line() output_paas(gandi, paas, [], paas_hosts[paas["id"]], output_keys) return result
def info(gandi, resource): """Display information about a PaaS instance. Resource can be a vhost, a hostname, or an ID """ output_keys = ["name", "type", "size", "memory", "console", "vhost", "dc", "ftp_server", "git_server"] paas = gandi.paas.info(resource) paas_hosts = [] list_vhost = gandi.vhost.list({"paas_id": paas["id"]}) for host in list_vhost: paas_hosts.append(host["name"]) output_paas(gandi, paas, [], paas_hosts, output_keys) return paas
def info(gandi, resource): """Display information about a PaaS instance. Resource can be a vhost, a hostname, or an ID """ output_keys = ['name', 'type', 'size', 'memory', 'console', 'vhost', 'dc', 'sftp_server', 'git_server'] paas = gandi.paas.info(resource) paas_hosts = [] list_vhost = gandi.vhost.list({'paas_id': paas['id']}) for host in list_vhost: paas_hosts.append(host['name']) output_paas(gandi, paas, [], paas_hosts, output_keys) return paas
def info(gandi, resource): """Display information about a PaaS instance. Resource can be a vhost, a hostname, or an ID """ output_keys = ['name', 'type', 'size', 'memory', 'console', 'vhost', 'dc', 'ftp_server', 'git_server'] paas = gandi.paas.info(resource) paas_hosts = [] list_vhost = gandi.vhost.list({'paas_id': paas['id']}) for host in list_vhost: paas_hosts.append(host['name']) output_paas(gandi, paas, [], paas_hosts, output_keys) return paas