Alerting: Allow pausing alerts from provisioning (#62263)
* Allow pausing alerts from provisioning * Update swagger * Add IsPaused to provision export endpoints * Add pause field in sample.yml * Add exception for reset state in first loop iteration of scheduler if rule is paused * Update provision definition and swagger docs * Fix provisioning export tests * Suggestion: Simplify if condition * Add more context to a comment
This commit is contained in:
@@ -134,6 +134,8 @@ type ProvisionedAlertRule struct {
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
// readonly: true
|
||||
Provenance models.Provenance `json:"provenance,omitempty"`
|
||||
// example: false
|
||||
IsPaused bool `json:"isPaused"`
|
||||
}
|
||||
|
||||
func (a *ProvisionedAlertRule) UpstreamModel() (models.AlertRule, error) {
|
||||
@@ -152,6 +154,7 @@ func (a *ProvisionedAlertRule) UpstreamModel() (models.AlertRule, error) {
|
||||
For: time.Duration(a.For),
|
||||
Annotations: a.Annotations,
|
||||
Labels: a.Labels,
|
||||
IsPaused: a.IsPaused,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -172,6 +175,7 @@ func NewAlertRule(rule models.AlertRule, provenance models.Provenance) Provision
|
||||
Annotations: rule.Annotations,
|
||||
Labels: rule.Labels,
|
||||
Provenance: provenance,
|
||||
IsPaused: rule.IsPaused,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user