def get(config, output_format, poids): """ get an object from peeringdb """ pdb = client.PeeringDB() codec = munge.get_codec(output_format)() for poid in poids: res = parse_objid(poid) data = pdb.get(res[0], res[1]) codec.dump(data, sys.stdout)
def get(config, depth, output_format, poids): """ get an object from peeringdb """ pdb = client.PeeringDB(conf_dir=config) codec = munge.get_codec(output_format)() for poid in poids: (typ, pk) = util.split_ref(poid) data = pdb.get(typ, pk, depth=depth) codec.dump(data, sys.stdout)
def try_dump_obj(args): res = parse_objid(args.cmd) if not res: return False pdb = client.PeeringDB() data = pdb.get(res[0], res[1]) codec = munge.get_codec(args.output_format)() codec.dump(data, sys.stdout) return True
def conf_dump(config, output_format): """ output current config """ cfg = peeringdb.config.get_config(config) codec = munge.get_codec(output_format)() codec.dump(cfg, sys.stdout) return 0