mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 13:09:22 -06:00
f64a89727e
* Allow provenance None in alert rule update and rule group replace * Allow provenance None in contact point update * Allow updating policies to none by sending x-disable-provenance header * Allow mute timings to disable provenance with x-disable-provenance header * Allow disabling provenance by using x-disable-provenance header * Add provenance helper to lower the cyclomatic complexity * Do not downgrade provenance except un ReplaceRuleGroup * Add function explanation and change error handling * Add docs for x-disable-provenance changes (#66300) * Add docs for x-disable-provenance changes * Apply suggestions from code review Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> * Update _index.md --------- Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> * Update docs/sources/alerting/set-up/provision-alerting-resources/_index.md Co-authored-by: George Robinson <george.robinson@grafana.com> * Add error message check in tests * Change docs --------- Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> Co-authored-by: George Robinson <george.robinson@grafana.com>
14 lines
574 B
Go
14 lines
574 B
Go
package provisioning
|
|
|
|
import (
|
|
"github.com/grafana/grafana/pkg/services/ngalert/models"
|
|
)
|
|
|
|
// canUpdateProvenanceInRuleGroup checks if a provenance can be updated for a rule group and its alerts.
|
|
// ReplaceRuleGroup function intends to replace an entire rule group: inserting, updating, and removing rules.
|
|
func canUpdateProvenanceInRuleGroup(storedProvenance, provenance models.Provenance) bool {
|
|
return storedProvenance == provenance ||
|
|
storedProvenance == models.ProvenanceNone ||
|
|
(storedProvenance == models.ProvenanceAPI && provenance == models.ProvenanceNone)
|
|
}
|