2021-01-18 20:57:17 +02:00
|
|
|
package ngalert
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/grafana/grafana/pkg/api/response"
|
|
|
|
|
"github.com/grafana/grafana/pkg/models"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// listAlertInstancesEndpoint handles GET /api/alert-instances.
|
2021-03-03 17:52:19 +02:00
|
|
|
func (api *apiImpl) listAlertInstancesEndpoint(c *models.ReqContext) response.Response {
|
2021-01-18 20:57:17 +02:00
|
|
|
cmd := listAlertInstancesQuery{DefinitionOrgID: c.SignedInUser.OrgId}
|
|
|
|
|
|
2021-03-03 17:52:19 +02:00
|
|
|
if err := api.store.listAlertInstances(&cmd); err != nil {
|
2021-01-18 20:57:17 +02:00
|
|
|
return response.Error(500, "Failed to list alert instances", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return response.JSON(200, cmd.Result)
|
|
|
|
|
}
|