Files
grafana/pkg/api/alerting.go
Yuri Tseretyan c36b2ae191 Alerting: v0 schema for integrations (mimir) (#110908)
* generate schema for mimir integrations from schema on front-end
* review and fix the settings
* Update GetAvailableNotifiersV2 to return mimir as v0
* add version argument to GetSecretKeysForContactPointType
* update TestGetSecretKeysForContactPointType to include v0
* add type alias field to contain alternate types that different from Grafana's
* add support for msteamsv2
* update ConfigForIntegrationType to look for alternate type
* update IntegrationConfigFromType to use new result of ConfigForIntegrationType
* add reference to parent plugin to NotifierPluginVersion to allow getting plugin type by it's alias
* add tests to ensure consistency
* make API response stable
* add tests against snapshot + omit optional fields
2025-09-17 09:25:56 -04:00

24 lines
754 B
Go

package api
import (
"net/http"
"slices"
"strings"
"github.com/grafana/grafana/pkg/api/response"
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
"github.com/grafana/grafana/pkg/services/ngalert/notifier/channels_config"
)
func (hs *HTTPServer) GetAlertNotifiers() func(*contextmodel.ReqContext) response.Response {
return func(r *contextmodel.ReqContext) response.Response {
if r.Query("version") == "2" {
v2 := slices.SortedFunc(channels_config.GetAvailableNotifiersV2(), func(a, b *channels_config.VersionedNotifierPlugin) int {
return strings.Compare(a.Type, b.Type)
})
return response.JSON(http.StatusOK, v2)
}
return response.JSON(http.StatusOK, channels_config.GetAvailableNotifiers())
}
}