mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
removes unused db method (#34082)
This commit is contained in:
@@ -18,13 +18,6 @@ type GetLatestAlertmanagerConfigurationQuery struct {
|
||||
Result *AlertConfiguration
|
||||
}
|
||||
|
||||
// GetAlertmanagerConfigurationQuery is the query to get the latest alertmanager configuration.
|
||||
type GetAlertmanagerConfigurationQuery struct {
|
||||
ID int64
|
||||
|
||||
Result *AlertConfiguration
|
||||
}
|
||||
|
||||
// SaveAlertmanagerConfigurationCmd is the command to save an alertmanager configuration.
|
||||
type SaveAlertmanagerConfigurationCmd struct {
|
||||
AlertmanagerConfiguration string
|
||||
|
||||
@@ -13,20 +13,6 @@ var (
|
||||
ErrNoAlertmanagerConfiguration = fmt.Errorf("could not find an Alertmanager configuration")
|
||||
)
|
||||
|
||||
func getAlertmanagerConfigurationByID(sess *sqlstore.DBSession, id int64) (*models.AlertConfiguration, error) {
|
||||
c := &models.AlertConfiguration{}
|
||||
|
||||
has, err := sess.ID(id).Get(c)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !has {
|
||||
return nil, ErrNoAlertmanagerConfiguration
|
||||
}
|
||||
|
||||
return c, nil
|
||||
}
|
||||
|
||||
func getLatestAlertmanagerConfiguration(sess *sqlstore.DBSession) (*models.AlertConfiguration, error) {
|
||||
c := &models.AlertConfiguration{}
|
||||
// The ID is already an auto incremental column, using the ID as an order should guarantee the latest.
|
||||
@@ -55,19 +41,6 @@ func (st *DBstore) GetLatestAlertmanagerConfiguration(query *models.GetLatestAle
|
||||
})
|
||||
}
|
||||
|
||||
// GetAlertmanagerConfiguration returns the alertmanager configuration identified by the query.
|
||||
// It returns ErrNoAlertmanagerConfiguration if no such configuration is found.
|
||||
func (st *DBstore) GetAlertmanagerConfiguration(query *models.GetAlertmanagerConfigurationQuery) error {
|
||||
return st.SQLStore.WithDbSession(context.Background(), func(sess *sqlstore.DBSession) error {
|
||||
c, err := getAlertmanagerConfigurationByID(sess, query.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
query.Result = c
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// SaveAlertmanagerConfiguration creates an alertmanager configuration.
|
||||
func (st *DBstore) SaveAlertmanagerConfiguration(cmd *models.SaveAlertmanagerConfigurationCmd) error {
|
||||
return st.SQLStore.WithDbSession(context.Background(), func(sess *sqlstore.DBSession) error {
|
||||
|
||||
@@ -17,7 +17,6 @@ const AlertDefinitionMaxTitleLength = 190
|
||||
// AlertingStore is the database interface used by the Alertmanager service.
|
||||
type AlertingStore interface {
|
||||
GetLatestAlertmanagerConfiguration(*models.GetLatestAlertmanagerConfigurationQuery) error
|
||||
GetAlertmanagerConfiguration(*models.GetAlertmanagerConfigurationQuery) error
|
||||
SaveAlertmanagerConfiguration(*models.SaveAlertmanagerConfigurationCmd) error
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user