Returned information is a JSON representation of a map with
name node host name as the key and block pool Id as the value
482965
@Override // DataNodeMXBean
  public String getNamenodeAddresses() {
    final Map<String, Integer> info = new HashMap<String, Integer>();
    for (NamespaceService ns : namespaceManager.getAllNamenodeThreads()) {
      if (ns != null && ns.initialized()) {
        info.put(ns.getNNSocketAddress().getAddress().getHostAddress(), ns.getNamespaceId());
      }
    }
    return JSON.toString(info);
  }
614458
private HashMap<String, JSONObject> buildKeyMap(String content) throws ConnectionException {
        HashMap<String, JSONObject> retMap = new HashMap<String, JSONObject>();
        JSONObject jwksPayload = new JSONObject(content);
        JSONArray keysArray = jwksPayload.getJSONArray("keys");

        for (int i=0;i<keysArray.length();i++) {
            JSONObject object = keysArray.getJSONObject(i);
            String keyId = object.getString("kid");
            retMap.put(keyId,object);
        }
        return retMap;
    }
4282
def info(hosts=None, profile=None):
    '''
    
    '''
    es = _get_instance(hosts, profile)

    try:
        return es.info()
    except elasticsearch.TransportError as e:
        raise CommandExecutionError("Cannot retrieve server information, server returned code {0} with message {1}".format(e.status_code, e.error))
1202945
def get_name_at(name, block_id, include_expired=False, hostport=None, proxy=None):
    
    assert hostport or proxy, 'Need hostport or proxy'
    if proxy is None:
        proxy = connect_hostport(hostport)

    namerec_schema = {
        'type': 'object',
        'properties': NAMEOP_SCHEMA_PROPERTIES,
        'required': NAMEOP_SCHEMA_REQUIRED
    }

    namerec_list_schema = {
        'type': 'object',
        'properties': {
            'records': {
                'anyOf': [
                    {
                        'type': 'array',
                        'items': namerec_schema
                    },
                    {
                        'type': 'null',
                    },
                ],
            },
        },
        'required': [
            'records'
        ],
    }

    resp_schema = json_response_schema( namerec_list_schema )
    resp = {}
    try:
        if include_expired:
            resp = proxy.get_historic_name_at(name, block_id)
        if not include_expired or 'KeyError' in resp.get('error', ''):
            resp = proxy.get_name_at(name, block_id)

        assert resp, "No such name {} at block {}".format(name, block_id)

        resp = json_validate(resp_schema, resp)
        if json_is_error(resp):
            return resp

    except ValidationError as e:
        if BLOCKSTACK_DEBUG:
            log.exception(e)

        resp = {'error': 'Server response did not match expected schema.  You are likely communicating with an out-of-date Blockstack node.', 'http_status': 502}
        return resp

    except socket.timeout:
        log.error("Connection timed out")
        resp = {'error': 'Connection to remote host timed out.', 'http_status': 503}
        return resp

    except socket.error as se:
        log.error("Connection error {}".format(se.errno))
        resp = {'error': 'Connection to remote host failed.', 'http_status': 502}
        return resp

    except Exception as ee:
        if BLOCKSTACK_DEBUG:
            log.exception(ee)

        log.error("Caught exception while connecting to Blockstack node: {}".format(ee))
        resp = {'error': 'Failed to contact Blockstack node.  Try again with `--debug`.', 'http_status': 500}
        return resp

    return resp['records']
575261
private static JSONObject toJSON(Mapping c) {
        JSONObject o = new JSONObject();
        o.put("offlineNodes", nodesToJSON(c.getOfflineNodes()));
        o.put("readyVMs", vmsToJSON(c.getReadyVMs()));

        JSONObject ons = new JSONObject();
        for (Node n : c.getOnlineNodes()) {
            JSONObject w = new JSONObject();
            w.put("runningVMs", vmsToJSON(c.getRunningVMs(n)));
            w.put("sleepingVMs", vmsToJSON(c.getSleepingVMs(n)));
            ons.put(Integer.toString(n.id()), w);
        }
        o.put("onlineNodes", ons);
        return o;
    }
1281013
function toObjectFromDynamoDBMap(dynamoDBMap) {
  if (!dynamoDBMap || typeof dynamoDBMap !== 'object') {
    return dynamoDBMap;
  }
  const object = {};
  const keys = Object.getOwnPropertyNames(dynamoDBMap);
  for (let i = 0; i < keys.length; ++i) {
    const key = keys[i];
    object[key] = toValueFromAttributeValue(dynamoDBMap[key]);
  }
  return object;
}
1373219
def get(security_token=None, key=None):
    
    if security_token is None:
        security_token = nago.core.get_my_info()['host_name']
    data = node_data.get(security_token, {})
    if not key:
        return data
    else:
        return data.get(key)
1183948
def nodes_simple_info(self, params={}, **kwargs):
        
        h = ['name', 'pid', 'http_address', 'version', 'jdk', 'disk.total', 'disk.used_percent', 'heap.current',
             'heap.percent', 'ram.current', 'ram.percent', 'uptime', 'node.role']
        result = self.client.cat.nodes(v=True, h=h, **kwargs, params=params)
        result = [x.strip().split(' ') for x in result.split('\n')]
        # Clean up the space
        result.remove(result[-1])
        for i in range(len(result)):
            result[i] = list(filter(lambda x: x != '', result[i]))
        # Packing into the dictionary
        dicts = []
        for i in range(len(result) - 1):
            dict = {}
            for k, v in zip(result[0], result[i + 1]):
                dict[k] = v
            dicts.append(dict)

        logger.info('Acquire simple information of the nodes is done succeeded: %s' % len(dicts))
        return dicts
81060
private String[] arrayMap(JsonObject node, int n) {
    String[] res = new String[n];
    for (int i = 0; i < n; i++) {
      res[i] = node.get(Integer.toString(i + 1)).getAsString();
    }
    return res;
  }
970377
private JSONObject map2JSON(JSONObject jo, Map<String, Object> map) {
        for (Entry<String, Object> entry : map.entrySet()) {
            String subkeys = null;
            String key = null;
            Object value = entry.getValue();
            int i = entry.getKey().indexOf(".");
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "raw key, index", new Object[] { entry.getKey(), i });
            }
            if (i > -1) {
                subkeys = entry.getKey().substring(i + 1);
                key = entry.getKey().substring(0, i);
            } else {
                key = entry.getKey();
            }
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "key, subkeys", new Object[] { key, subkeys });
            }
            if (subkeys == null) { // simple key
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "simple key: " + entry.getKey());
                }
                if (value == null) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "value is null");
                    }
                    jo.put(key, "null");
                } else if (value instanceof Map) { // value is a Map
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "value is a Map, calling map2JSON", value);
                    }
                    jo.put(key, map2JSON(new JSONObject(), (Map<String, Object>) value));
                } else if (value.getClass().isArray()) { // value is an array
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "value is an array, calling array2JSON", value);
                    }
                    jo.put(key, array2JSON(new JSONArray(), (Object[]) value));
                } else { // else value is a "simple" value
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "simple value, adding to jo", value);
                    }
                    jo.put(key, value);
                }
            } else { // compound key
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "compound key: " + entry.getKey());
                }
                JSONObject jsonSubstruc = (JSONObject) jo.get(key);
                if (jsonSubstruc == null) {
                    jsonSubstruc = new JSONObject();
                    jo.put(key, jsonSubstruc);
                }
                Map<String, Object> submap = new TreeMap<String, Object>();
                submap.put(subkeys, value);
                map2JSON(jsonSubstruc, submap);
            }
        }
        return jo;
    }
939079
def json_data(self, instance, default=None):
        
        value = self.get(instance)
        if value and self.is_multi_valued():
            return map(api.get_url_info, value)
        elif value and not self.is_multi_valued():
            return api.get_url_info(value)
        return value or default
661797
private String string(JsonObject node, String key, String default_) {
    JsonElement value = node.get(key);
    if (value != null && value.isJsonPrimitive()) {
      return value.getAsString();
    }
    return default_;
  }
698839
@Deprecated
  public DatanodeDescriptor getDatanodeByName(String name) {
    if (name == null) {
      return null;
    }
    int colon = name.indexOf(":");
    String host;
    if (colon < 0) {
      host = name;
    } else {
      host = name.substring(0, colon);
    }
    hostmapLock.readLock().lock();
    try {
      DatanodeDescriptor[] nodes = map.get(host);
      // no entry
      if (nodes == null) {
        return null;
      }
      for (DatanodeDescriptor containedNode : nodes) {
        if (name.equals(containedNode.getName())) {
          return containedNode;
        }
      }
      return null;
    } finally {
      hostmapLock.readLock().unlock();
    }
  }
50850
def pool(self, host, port, db, pools={}, **options):
        '''
        
        '''
        key = (host, port, db)
        rval = pools.get(key)
        if not isinstance(rval, ConnectionPool):
            rval = ConnectionPool(host=host, port=port, db=db, **options)
            pools[key] = rval

        return rval
769288
def host_info(host=None):
    '''
    
    '''
    data = query(host, quiet=True)
    for id_ in data:
        if 'vm_info' in data[id_]:
            data[id_].pop('vm_info')
    __jid_event__.fire_event({'data': data, 'outputter': 'nested'}, 'progress')
    return data
920501
private int getBlockInfo(String[] argv, int i) throws IOException {
  	long blockId = Long.valueOf(argv[i++]);
  	LocatedBlockWithFileName locatedBlock = 
  			getDFS().getClient().getBlockInfo(blockId);
  
  	if (null == locatedBlock) {
  		System.err.println("Could not find the block with id : " + blockId);
  		return -1;
  	}
  	
  	StringBuilder sb = new StringBuilder();
  	sb.append("block: ")
  				.append(locatedBlock.getBlock()).append("\n")
  				.append("filename: ")
  				.append(locatedBlock.getFileName()).append("\n")
  				.append("locations: ");
  	
  	DatanodeInfo[] locs = locatedBlock.getLocations();
  	for (int k=0; k<locs.length; k++) {
  		if (k > 0) {
  			sb.append(" , ");
  		}
  		sb.append(locs[k].getHostName());
  	}
  				
  	System.out.println(sb.toString());  	
  	return 0;
  }
720284
public Node getNode(String name) {
    Node n = hostnameToNodeMap.get(name);

    // it's ok if multiple threads try to resolve the same host at the same time
    // the assumption is that resolve() will return a canonical node object and
    // the put operation is therefore idempotent
    if (n == null) {
      n = resolveAndGetNode(name);
      hostnameToNodeMap.put(name, n);
      // Make an entry for the node at the max level in the cache
      nodesAtMaxLevel.add(
        getParentNode(n, NetworkTopology.DEFAULT_HOST_LEVEL - 1));
    }

    return n;
  }