2016-04-26 23:36:50 +08:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
2021-11-29 17:18:01 +08:00
|
|
|
"net/http"
|
2025-08-29 02:46:30 +08:00
|
|
|
"slices"
|
2016-07-21 16:29:11 +08:00
|
|
|
|
2021-01-15 21:43:20 +08:00
|
|
|
"github.com/grafana/grafana/pkg/api/response"
|
2023-01-27 15:50:36 +08:00
|
|
|
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
|
2022-07-21 01:58:36 +08:00
|
|
|
"github.com/grafana/grafana/pkg/services/ngalert/notifier/channels_config"
|
2016-04-26 23:36:50 +08:00
|
|
|
)
|
|
|
|
|
2024-01-05 07:01:57 +08:00
|
|
|
func (hs *HTTPServer) GetAlertNotifiers() func(*contextmodel.ReqContext) response.Response {
|
2025-08-29 02:46:30 +08:00
|
|
|
return func(r *contextmodel.ReqContext) response.Response {
|
|
|
|
if r.Query("version") == "2" {
|
|
|
|
return response.JSON(http.StatusOK, slices.Collect(channels_config.GetAvailableNotifiersV2()))
|
|
|
|
}
|
2024-01-05 07:01:57 +08:00
|
|
|
return response.JSON(http.StatusOK, channels_config.GetAvailableNotifiers())
|
|
|
|
}
|
|
|
|
}
|