mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Alerting: Add an empty Forked Alertmanager * Alerting: Add methods for silences to the forked Alertmanager * check for errors in tests * make linter happy * Alerting: Add methods for alerts to the forked Alertmanager * Alerting: Add methods for receivers to the forked Alertmanager * make linter happy * separate into both forked AMs * fix tests * rename testErr -> expErr
86 lines
3.2 KiB
Go
86 lines
3.2 KiB
Go
package remote
|
|
|
|
import (
|
|
"context"
|
|
|
|
apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
|
"github.com/grafana/grafana/pkg/services/ngalert/models"
|
|
"github.com/grafana/grafana/pkg/services/ngalert/notifier"
|
|
)
|
|
|
|
type RemoteSecondaryForkedAlertmanager struct {
|
|
internal notifier.Alertmanager
|
|
remote notifier.Alertmanager
|
|
}
|
|
|
|
func NewRemoteSecondaryForkedAlertmanager(internal, remote notifier.Alertmanager) *RemoteSecondaryForkedAlertmanager {
|
|
return &RemoteSecondaryForkedAlertmanager{
|
|
internal: internal,
|
|
remote: remote,
|
|
}
|
|
}
|
|
|
|
func (fam *RemoteSecondaryForkedAlertmanager) ApplyConfig(ctx context.Context, config *models.AlertConfiguration) error {
|
|
return nil
|
|
}
|
|
|
|
func (fam *RemoteSecondaryForkedAlertmanager) SaveAndApplyConfig(ctx context.Context, config *apimodels.PostableUserConfig) error {
|
|
return nil
|
|
}
|
|
|
|
func (fam *RemoteSecondaryForkedAlertmanager) SaveAndApplyDefaultConfig(ctx context.Context) error {
|
|
return nil
|
|
}
|
|
|
|
func (fam *RemoteSecondaryForkedAlertmanager) GetStatus() apimodels.GettableStatus {
|
|
return apimodels.GettableStatus{}
|
|
}
|
|
|
|
func (fam *RemoteSecondaryForkedAlertmanager) CreateSilence(ctx context.Context, silence *apimodels.PostableSilence) (string, error) {
|
|
return fam.internal.CreateSilence(ctx, silence)
|
|
}
|
|
|
|
func (fam *RemoteSecondaryForkedAlertmanager) DeleteSilence(ctx context.Context, id string) error {
|
|
return fam.internal.DeleteSilence(ctx, id)
|
|
}
|
|
|
|
func (fam *RemoteSecondaryForkedAlertmanager) GetSilence(ctx context.Context, id string) (apimodels.GettableSilence, error) {
|
|
return fam.internal.GetSilence(ctx, id)
|
|
}
|
|
|
|
func (fam *RemoteSecondaryForkedAlertmanager) ListSilences(ctx context.Context, filter []string) (apimodels.GettableSilences, error) {
|
|
return fam.internal.ListSilences(ctx, filter)
|
|
}
|
|
|
|
func (fam *RemoteSecondaryForkedAlertmanager) GetAlerts(ctx context.Context, active, silenced, inhibited bool, filter []string, receiver string) (apimodels.GettableAlerts, error) {
|
|
return fam.internal.GetAlerts(ctx, active, silenced, inhibited, filter, receiver)
|
|
}
|
|
|
|
func (fam *RemoteSecondaryForkedAlertmanager) GetAlertGroups(ctx context.Context, active, silenced, inhibited bool, filter []string, receiver string) (apimodels.AlertGroups, error) {
|
|
return fam.internal.GetAlertGroups(ctx, active, silenced, inhibited, filter, receiver)
|
|
}
|
|
|
|
func (fam *RemoteSecondaryForkedAlertmanager) PutAlerts(ctx context.Context, alerts apimodels.PostableAlerts) error {
|
|
return fam.internal.PutAlerts(ctx, alerts)
|
|
}
|
|
|
|
func (fam *RemoteSecondaryForkedAlertmanager) GetReceivers(ctx context.Context) ([]apimodels.Receiver, error) {
|
|
return fam.internal.GetReceivers(ctx)
|
|
}
|
|
|
|
func (fam *RemoteSecondaryForkedAlertmanager) TestReceivers(ctx context.Context, c apimodels.TestReceiversConfigBodyParams) (*notifier.TestReceiversResult, error) {
|
|
return fam.internal.TestReceivers(ctx, c)
|
|
}
|
|
|
|
func (fam *RemoteSecondaryForkedAlertmanager) TestTemplate(ctx context.Context, c apimodels.TestTemplatesConfigBodyParams) (*notifier.TestTemplatesResults, error) {
|
|
return ¬ifier.TestTemplatesResults{}, nil
|
|
}
|
|
|
|
func (fam *RemoteSecondaryForkedAlertmanager) CleanUp() {}
|
|
|
|
func (fam *RemoteSecondaryForkedAlertmanager) StopAndWait() {}
|
|
|
|
func (fam *RemoteSecondaryForkedAlertmanager) Ready() bool {
|
|
return false
|
|
}
|