func RestGetHostsForResourcePool(w *rest.ResponseWriter, r *rest.Request, client *serviced.ControlClient) { var poolHosts []*dao.PoolHost poolId, err := url.QueryUnescape(r.PathParam("poolId")) if err != nil { glog.V(1).Infof("Unable to acquire pool ID: %v", err) RestBadRequest(w) return } err = client.GetHostsForResourcePool(poolId, &poolHosts) if err != nil { glog.Errorf("Could not get hosts: %v", err) RestServerError(w) return } if poolHosts == nil { glog.V(3).Info("Pool hosts was nil, returning empty list instead") poolHosts = []*dao.PoolHost{} } glog.V(2).Infof("Returning %d hosts for pool %s", len(poolHosts), poolId) w.WriteJson(&poolHosts) }