Alerting: Endpoints for provisioning mute timings (#49635) (#49735)

* Add validator for mute timing and make it provisionable

* Add tests to ensure prometheus validators are running and errors are propagated

* Internal API for manipulating mute timings

* Define and generate API layer

* Wire up generated code

* Implement API handlers

* Tests for golang layer

* Fix reference bug

* Fix linter and auth tests

* Resolve semantic errors and regenerate

* Remove pointless comment

* Extract out provisioning path param keys, simplify

* Expected number of paths

(cherry picked from commit 909ebcf979)

Co-authored-by: Alexander Weaver <weaver.alex.d@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2022-05-26 16:06:52 -05:00
committed by GitHub
co-authored by Alexander Weaver
parent ccd1270f28
commit 7e4327d254
14 changed files with 1003 additions and 132 deletions
+8 -26
View File
@@ -1439,26 +1439,9 @@
"type": "object",
"x-go-package": "github.com/prometheus/alertmanager/config"
},
"MuteTiming": {
"properties": {
"name": {
"type": "string",
"x-go-name": "Name"
},
"time_intervals": {
"items": {
"$ref": "#/definitions/TimeInterval"
},
"type": "array",
"x-go-name": "TimeIntervals"
}
},
"type": "object",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"MuteTimings": {
"items": {
"$ref": "#/definitions/MuteTiming"
"$ref": "#/definitions/MuteTimeInterval"
},
"type": "array",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
@@ -3392,7 +3375,6 @@
"type": "array"
},
"gettableSilence": {
"description": "GettableSilence gettable silence",
"properties": {
"comment": {
"description": "comment",
@@ -3444,7 +3426,9 @@
"status",
"updatedAt"
],
"type": "object"
"type": "object",
"x-go-name": "GettableSilence",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"gettableSilences": {
"items": {
@@ -3581,6 +3565,7 @@
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"postableSilence": {
"description": "PostableSilence postable silence",
"properties": {
"comment": {
"description": "comment",
@@ -3620,11 +3605,10 @@
"matchers",
"startsAt"
],
"type": "object",
"x-go-name": "PostableSilence",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
"type": "object"
},
"receiver": {
"description": "Receiver receiver",
"properties": {
"name": {
"description": "name",
@@ -3635,9 +3619,7 @@
"required": [
"name"
],
"type": "object",
"x-go-name": "Receiver",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
"type": "object"
},
"silence": {
"description": "Silence silence",