d0f79ee60d
* update alerting module * replace compat with ones from alerting * update type references Receiver and Integration to *Status * update route in provisioning test that is invalid after recent change * use right type for LINE ingtegration
34 lines
817 B
Go
34 lines
817 B
Go
package notifier
|
|
|
|
import (
|
|
alertingNotify "github.com/grafana/alerting/notify"
|
|
|
|
"github.com/grafana/grafana/pkg/services/ngalert/models"
|
|
)
|
|
|
|
// Silence-specific compat functions to convert between grafana/alerting and model types.
|
|
|
|
func GettableSilenceToSilence(s alertingNotify.GettableSilence) *models.Silence {
|
|
sil := models.Silence(s)
|
|
return &sil
|
|
}
|
|
|
|
func GettableSilencesToSilences(silences alertingNotify.GettableSilences) []*models.Silence {
|
|
res := make([]*models.Silence, 0, len(silences))
|
|
for _, sil := range silences {
|
|
res = append(res, GettableSilenceToSilence(*sil))
|
|
}
|
|
return res
|
|
}
|
|
|
|
func SilenceToPostableSilence(s models.Silence) *alertingNotify.PostableSilence {
|
|
var id string
|
|
if s.ID != nil {
|
|
id = *s.ID
|
|
}
|
|
return &alertingNotify.PostableSilence{
|
|
ID: id,
|
|
Silence: s.Silence,
|
|
}
|
|
}
|