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
This commit is contained in:
+5
-1
@@ -3,6 +3,7 @@ package api
|
||||
import (
|
||||
"net/http"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/grafana/grafana/pkg/api/response"
|
||||
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
|
||||
@@ -12,7 +13,10 @@ import (
|
||||
func (hs *HTTPServer) GetAlertNotifiers() func(*contextmodel.ReqContext) response.Response {
|
||||
return func(r *contextmodel.ReqContext) response.Response {
|
||||
if r.Query("version") == "2" {
|
||||
return response.JSON(http.StatusOK, slices.Collect(channels_config.GetAvailableNotifiersV2()))
|
||||
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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user