Ejemplo n.º 1
0
func V1GetCollectors(c *middleware.Context, query m.GetProbesQuery) {
	query.OrgId = c.OrgId
	probes, err := sqlstore.GetProbes(&query)
	if err != nil {
		handleError(c, err)
		return
	}
	c.JSON(200, probes)
	return
}
Ejemplo n.º 2
0
func V1GetCollectorLocations(c *middleware.Context) {
	query := m.GetProbesQuery{
		OrgId: c.OrgId,
	}

	probes, err := sqlstore.GetProbes(&query)
	if err != nil {
		handleError(c, err)
		return
	}

	locations := make([]m.ProbeLocationDTO, len(probes))
	for i, c := range probes {
		locations[i] = m.ProbeLocationDTO{
			Key:       c.Slug,
			Latitude:  c.Latitude,
			Longitude: c.Longitude,
			Name:      c.Name,
		}
	}

	c.JSON(200, locations)
	return
}