mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: remove feature toggle for provisioning API (#50167)
* Alerting: remove feature toggle for provisioning API * remove missed code parts * remove unused import * remove empty line * mark routes as stable
This commit is contained in:
committed by
GitHub
parent
4cc8c6f745
commit
4b8a4449ed
@@ -147,11 +147,6 @@ var (
|
||||
Description: "Configurable storage for dashboards, datasources, and resources",
|
||||
State: FeatureStateAlpha,
|
||||
},
|
||||
{
|
||||
Name: "alertProvisioning",
|
||||
Description: "Provisioning-friendly routes for alerting",
|
||||
State: FeatureStateAlpha,
|
||||
},
|
||||
{
|
||||
Name: "export",
|
||||
Description: "Export grafana instance (to git, etc)",
|
||||
|
||||
@@ -111,10 +111,6 @@ const (
|
||||
// Configurable storage for dashboards, datasources, and resources
|
||||
FlagStorage = "storage"
|
||||
|
||||
// FlagAlertProvisioning
|
||||
// Provisioning-friendly routes for alerting
|
||||
FlagAlertProvisioning = "alertProvisioning"
|
||||
|
||||
// FlagExport
|
||||
// Export grafana instance (to git, etc)
|
||||
FlagExport = "export"
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||
"github.com/grafana/grafana/pkg/services/datasourceproxy"
|
||||
"github.com/grafana/grafana/pkg/services/datasources"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/eval"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/metrics"
|
||||
@@ -136,14 +135,12 @@ func (api *API) RegisterAPIEndpoints(m *metrics.API) {
|
||||
},
|
||||
), m)
|
||||
|
||||
if api.Cfg.IsFeatureToggleEnabled(featuremgmt.FlagAlertProvisioning) {
|
||||
api.RegisterProvisioningApiEndpoints(NewForkedProvisioningApi(&ProvisioningSrv{
|
||||
log: logger,
|
||||
policies: api.Policies,
|
||||
contactPointService: api.ContactPointService,
|
||||
templates: api.Templates,
|
||||
muteTimings: api.MuteTimings,
|
||||
alertRules: api.AlertRules,
|
||||
}), m)
|
||||
}
|
||||
api.RegisterProvisioningApiEndpoints(NewForkedProvisioningApi(&ProvisioningSrv{
|
||||
log: logger,
|
||||
policies: api.Policies,
|
||||
contactPointService: api.ContactPointService,
|
||||
templates: api.Templates,
|
||||
muteTimings: api.MuteTimings,
|
||||
alertRules: api.AlertRules,
|
||||
}), m)
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ import (
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||
acMock "github.com/grafana/grafana/pkg/services/accesscontrol/mock"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/metrics"
|
||||
ngmodels "github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||
@@ -531,9 +530,6 @@ func createMultiOrgAlertmanager(t *testing.T) *notifier.MultiOrgAlertmanager {
|
||||
DefaultConfiguration: setting.GetAlertmanagerDefaultConfiguration(),
|
||||
DisabledOrgs: map[int64]struct{}{5: {}},
|
||||
}, // do not poll in tests.
|
||||
IsFeatureToggleEnabled: func(key string) bool {
|
||||
return key == featuremgmt.FlagAlertProvisioning
|
||||
},
|
||||
}
|
||||
|
||||
mam, err := notifier.NewMultiOrgAlertmanager(cfg, &configStore, &orgStore, kvStore, provStore, decryptFn, m.GetMultiOrgAlertmanagerMetrics(), nil, log.New("testlogger"), secretsService)
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||
)
|
||||
|
||||
// swagger:route GET /api/v1/provisioning/alert-rules/{UID} provisioning RouteGetAlertRule
|
||||
// swagger:route GET /api/v1/provisioning/alert-rules/{UID} provisioning stable RouteGetAlertRule
|
||||
//
|
||||
// Get a specific alert rule by UID.
|
||||
//
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
// 200: AlertRule
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route POST /api/v1/provisioning/alert-rules provisioning RoutePostAlertRule
|
||||
// swagger:route POST /api/v1/provisioning/alert-rules provisioning stable RoutePostAlertRule
|
||||
//
|
||||
// Create a new alert rule.
|
||||
//
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
// 201: AlertRule
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route PUT /api/v1/provisioning/alert-rules/{UID} provisioning RoutePutAlertRule
|
||||
// swagger:route PUT /api/v1/provisioning/alert-rules/{UID} provisioning stable RoutePutAlertRule
|
||||
//
|
||||
// Update an existing alert rule.
|
||||
//
|
||||
@@ -33,7 +33,7 @@ import (
|
||||
// 200: AlertRule
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route DELETE /api/v1/provisioning/alert-rules/{UID} provisioning RouteDeleteAlertRule
|
||||
// swagger:route DELETE /api/v1/provisioning/alert-rules/{UID} provisioning stable RouteDeleteAlertRule
|
||||
//
|
||||
// Delete a specific alert rule by UID.
|
||||
//
|
||||
@@ -110,7 +110,7 @@ func NewAlertRule(rule models.AlertRule, provenance models.Provenance) AlertRule
|
||||
}
|
||||
}
|
||||
|
||||
// swagger:route PUT /api/v1/provisioning/folder/{FolderUID}/rule-groups/{Group} provisioning RoutePutAlertRuleGroup
|
||||
// swagger:route PUT /api/v1/provisioning/folder/{FolderUID}/rule-groups/{Group} provisioning stable RoutePutAlertRuleGroup
|
||||
//
|
||||
// Update the interval of a rule group.
|
||||
//
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/notifier/channels"
|
||||
)
|
||||
|
||||
// swagger:route GET /api/v1/provisioning/contact-points provisioning RouteGetContactpoints
|
||||
// swagger:route GET /api/v1/provisioning/contact-points provisioning stable RouteGetContactpoints
|
||||
//
|
||||
// Get all the contact points.
|
||||
//
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
// 200: Route
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route POST /api/v1/provisioning/contact-points provisioning RoutePostContactpoints
|
||||
// swagger:route POST /api/v1/provisioning/contact-points provisioning stable RoutePostContactpoints
|
||||
//
|
||||
// Create a contact point.
|
||||
//
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
// 202: Ack
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route PUT /api/v1/provisioning/contact-points/{UID} provisioning RoutePutContactpoint
|
||||
// swagger:route PUT /api/v1/provisioning/contact-points/{UID} provisioning stable RoutePutContactpoint
|
||||
//
|
||||
// Update an existing contact point.
|
||||
//
|
||||
@@ -37,7 +37,7 @@ import (
|
||||
// 202: Ack
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route DELETE /api/v1/provisioning/contact-points/{UID} provisioning RouteDeleteContactpoints
|
||||
// swagger:route DELETE /api/v1/provisioning/contact-points/{UID} provisioning stable RouteDeleteContactpoints
|
||||
//
|
||||
// Delete a contact point.
|
||||
//
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"github.com/prometheus/alertmanager/config"
|
||||
)
|
||||
|
||||
// swagger:route GET /api/v1/provisioning/mute-timings provisioning RouteGetMuteTimings
|
||||
// swagger:route GET /api/v1/provisioning/mute-timings provisioning stable RouteGetMuteTimings
|
||||
//
|
||||
// Get all the mute timings.
|
||||
//
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
// 200: MuteTimings
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/v1/provisioning/mute-timings/{name} provisioning RouteGetMuteTiming
|
||||
// swagger:route GET /api/v1/provisioning/mute-timings/{name} provisioning stable RouteGetMuteTiming
|
||||
//
|
||||
// Get a mute timing.
|
||||
//
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
// 200: MuteTimeInterval
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route POST /api/v1/provisioning/mute-timings provisioning RoutePostMuteTiming
|
||||
// swagger:route POST /api/v1/provisioning/mute-timings provisioning stable RoutePostMuteTiming
|
||||
//
|
||||
// Create a new mute timing.
|
||||
//
|
||||
@@ -32,7 +32,7 @@ import (
|
||||
// 201: MuteTimeInterval
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route PUT /api/v1/provisioning/mute-timings/{name} provisioning RoutePutMuteTiming
|
||||
// swagger:route PUT /api/v1/provisioning/mute-timings/{name} provisioning stable RoutePutMuteTiming
|
||||
//
|
||||
// Replace an existing mute timing.
|
||||
//
|
||||
@@ -43,7 +43,7 @@ import (
|
||||
// 200: MuteTimeInterval
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route DELETE /api/v1/provisioning/mute-timings/{name} provisioning RouteDeleteMuteTiming
|
||||
// swagger:route DELETE /api/v1/provisioning/mute-timings/{name} provisioning stable RouteDeleteMuteTiming
|
||||
//
|
||||
// Delete a mute timing.
|
||||
//
|
||||
@@ -55,7 +55,7 @@ import (
|
||||
// swagger:model
|
||||
type MuteTimings []MuteTimeInterval
|
||||
|
||||
// swagger:parameters RouteGetTemplate RouteGetMuteTiming RoutePutMuteTiming RouteDeleteMuteTiming
|
||||
// swagger:parameters RouteGetTemplate RouteGetMuteTiming RoutePutMuteTiming stable RouteDeleteMuteTiming
|
||||
type RouteGetMuteTimingParam struct {
|
||||
// Template Name
|
||||
// in:path
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package definitions
|
||||
|
||||
// swagger:route GET /api/v1/provisioning/policies provisioning RouteGetPolicyTree
|
||||
// swagger:route GET /api/v1/provisioning/policies provisioning stable RouteGetPolicyTree
|
||||
//
|
||||
// Get the notification policy tree.
|
||||
//
|
||||
@@ -8,7 +8,7 @@ package definitions
|
||||
// 200: Route
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route PUT /api/v1/provisioning/policies provisioning RoutePutPolicyTree
|
||||
// swagger:route PUT /api/v1/provisioning/policies provisioning stable RoutePutPolicyTree
|
||||
//
|
||||
// Sets the notification policy tree.
|
||||
//
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||
)
|
||||
|
||||
// swagger:route GET /api/v1/provisioning/templates provisioning RouteGetTemplates
|
||||
// swagger:route GET /api/v1/provisioning/templates provisioning stable RouteGetTemplates
|
||||
//
|
||||
// Get all message templates.
|
||||
//
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
// 200: MessageTemplate
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/v1/provisioning/templates/{name} provisioning RouteGetTemplate
|
||||
// swagger:route GET /api/v1/provisioning/templates/{name} provisioning stable RouteGetTemplate
|
||||
//
|
||||
// Get a message template.
|
||||
//
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
// 200: MessageTemplate
|
||||
// 404: NotFound
|
||||
|
||||
// swagger:route PUT /api/v1/provisioning/templates/{name} provisioning RoutePutTemplate
|
||||
// swagger:route PUT /api/v1/provisioning/templates/{name} provisioning stable RoutePutTemplate
|
||||
//
|
||||
// Updates an existing template.
|
||||
//
|
||||
@@ -31,7 +31,7 @@ import (
|
||||
// 202: Ack
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route DELETE /api/v1/provisioning/templates/{name} provisioning RouteDeleteTemplate
|
||||
// swagger:route DELETE /api/v1/provisioning/templates/{name} provisioning stable RouteDeleteTemplate
|
||||
//
|
||||
// Delete a template.
|
||||
//
|
||||
|
||||
@@ -813,6 +813,13 @@
|
||||
"type": "array",
|
||||
"x-go-name": "InhibitRules"
|
||||
},
|
||||
"muteTimeProvenances": {
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/Provenance"
|
||||
},
|
||||
"type": "object",
|
||||
"x-go-name": "MuteTimeProvenances"
|
||||
},
|
||||
"mute_time_intervals": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/MuteTimeInterval"
|
||||
@@ -3248,6 +3255,7 @@
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"alertGroup": {
|
||||
"description": "AlertGroup alert group",
|
||||
"properties": {
|
||||
"alerts": {
|
||||
"description": "alerts",
|
||||
@@ -3269,9 +3277,7 @@
|
||||
"labels",
|
||||
"receiver"
|
||||
],
|
||||
"type": "object",
|
||||
"x-go-name": "AlertGroup",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
"type": "object"
|
||||
},
|
||||
"alertGroups": {
|
||||
"description": "AlertGroups alert groups",
|
||||
@@ -3398,7 +3404,6 @@
|
||||
"$ref": "#/definitions/Duration"
|
||||
},
|
||||
"gettableAlert": {
|
||||
"description": "GettableAlert gettable alert",
|
||||
"properties": {
|
||||
"annotations": {
|
||||
"$ref": "#/definitions/labelSet"
|
||||
@@ -3457,18 +3462,18 @@
|
||||
"status",
|
||||
"updatedAt"
|
||||
],
|
||||
"type": "object"
|
||||
"type": "object",
|
||||
"x-go-name": "GettableAlert",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"gettableAlerts": {
|
||||
"description": "GettableAlerts gettable alerts",
|
||||
"items": {
|
||||
"$ref": "#/definitions/gettableAlert"
|
||||
},
|
||||
"type": "array",
|
||||
"x-go-name": "GettableAlerts",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
"type": "array"
|
||||
},
|
||||
"gettableSilence": {
|
||||
"description": "GettableSilence gettable silence",
|
||||
"properties": {
|
||||
"comment": {
|
||||
"description": "comment",
|
||||
@@ -3520,14 +3525,17 @@
|
||||
"status",
|
||||
"updatedAt"
|
||||
],
|
||||
"type": "object"
|
||||
"type": "object",
|
||||
"x-go-name": "GettableSilence",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"gettableSilences": {
|
||||
"description": "GettableSilences gettable silences",
|
||||
"items": {
|
||||
"$ref": "#/definitions/gettableSilence"
|
||||
},
|
||||
"type": "array"
|
||||
"type": "array",
|
||||
"x-go-name": "GettableSilences",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"labelSet": {
|
||||
"additionalProperties": {
|
||||
@@ -3656,7 +3664,6 @@
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"postableSilence": {
|
||||
"description": "PostableSilence postable silence",
|
||||
"properties": {
|
||||
"comment": {
|
||||
"description": "comment",
|
||||
@@ -3696,10 +3703,11 @@
|
||||
"matchers",
|
||||
"startsAt"
|
||||
],
|
||||
"type": "object"
|
||||
"type": "object",
|
||||
"x-go-name": "PostableSilence",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"receiver": {
|
||||
"description": "Receiver receiver",
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "name",
|
||||
@@ -3710,7 +3718,9 @@
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"type": "object"
|
||||
"type": "object",
|
||||
"x-go-name": "Receiver",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"silence": {
|
||||
"description": "Silence silence",
|
||||
|
||||
@@ -1670,7 +1670,8 @@
|
||||
"/api/v1/provisioning/alert-rules": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"provisioning"
|
||||
"provisioning",
|
||||
"stable"
|
||||
],
|
||||
"summary": "Create a new alert rule.",
|
||||
"operationId": "RoutePostAlertRule",
|
||||
@@ -1702,7 +1703,8 @@
|
||||
"/api/v1/provisioning/alert-rules/{UID}": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"provisioning"
|
||||
"provisioning",
|
||||
"stable"
|
||||
],
|
||||
"summary": "Get a specific alert rule by UID.",
|
||||
"operationId": "RouteGetAlertRule",
|
||||
@@ -1734,7 +1736,8 @@
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"provisioning"
|
||||
"provisioning",
|
||||
"stable"
|
||||
],
|
||||
"summary": "Update an existing alert rule.",
|
||||
"operationId": "RoutePutAlertRule",
|
||||
@@ -1770,7 +1773,8 @@
|
||||
},
|
||||
"delete": {
|
||||
"tags": [
|
||||
"provisioning"
|
||||
"provisioning",
|
||||
"stable"
|
||||
],
|
||||
"summary": "Delete a specific alert rule by UID.",
|
||||
"operationId": "RouteDeleteAlertRule",
|
||||
@@ -1798,7 +1802,8 @@
|
||||
"/api/v1/provisioning/contact-points": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"provisioning"
|
||||
"provisioning",
|
||||
"stable"
|
||||
],
|
||||
"summary": "Get all the contact points.",
|
||||
"operationId": "RouteGetContactpoints",
|
||||
@@ -1822,7 +1827,8 @@
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"provisioning"
|
||||
"provisioning",
|
||||
"stable"
|
||||
],
|
||||
"summary": "Create a contact point.",
|
||||
"operationId": "RoutePostContactpoints",
|
||||
@@ -1857,7 +1863,8 @@
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"provisioning"
|
||||
"provisioning",
|
||||
"stable"
|
||||
],
|
||||
"summary": "Update an existing contact point.",
|
||||
"operationId": "RoutePutContactpoint",
|
||||
@@ -1897,7 +1904,8 @@
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"provisioning"
|
||||
"provisioning",
|
||||
"stable"
|
||||
],
|
||||
"summary": "Delete a contact point.",
|
||||
"operationId": "RouteDeleteContactpoints",
|
||||
@@ -1932,7 +1940,8 @@
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"provisioning"
|
||||
"provisioning",
|
||||
"stable"
|
||||
],
|
||||
"summary": "Update the interval of a rule group.",
|
||||
"operationId": "RoutePutAlertRuleGroup",
|
||||
@@ -1976,7 +1985,8 @@
|
||||
"/api/v1/provisioning/mute-timings": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"provisioning"
|
||||
"provisioning",
|
||||
"stable"
|
||||
],
|
||||
"summary": "Get all the mute timings.",
|
||||
"operationId": "RouteGetMuteTimings",
|
||||
@@ -2000,7 +2010,8 @@
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"provisioning"
|
||||
"provisioning",
|
||||
"stable"
|
||||
],
|
||||
"summary": "Create a new mute timing.",
|
||||
"operationId": "RoutePostMuteTiming",
|
||||
@@ -2032,7 +2043,8 @@
|
||||
"/api/v1/provisioning/mute-timings/{name}": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"provisioning"
|
||||
"provisioning",
|
||||
"stable"
|
||||
],
|
||||
"summary": "Get a mute timing.",
|
||||
"operationId": "RouteGetMuteTiming",
|
||||
@@ -2066,7 +2078,8 @@
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"provisioning"
|
||||
"provisioning",
|
||||
"stable"
|
||||
],
|
||||
"summary": "Replace an existing mute timing.",
|
||||
"operationId": "RoutePutMuteTiming",
|
||||
@@ -2104,7 +2117,8 @@
|
||||
},
|
||||
"delete": {
|
||||
"tags": [
|
||||
"provisioning"
|
||||
"provisioning",
|
||||
"stable"
|
||||
],
|
||||
"summary": "Delete a mute timing.",
|
||||
"operationId": "RouteDeleteMuteTiming",
|
||||
@@ -2131,7 +2145,8 @@
|
||||
"/api/v1/provisioning/policies": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"provisioning"
|
||||
"provisioning",
|
||||
"stable"
|
||||
],
|
||||
"summary": "Get the notification policy tree.",
|
||||
"operationId": "RouteGetPolicyTree",
|
||||
@@ -2155,7 +2170,8 @@
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"provisioning"
|
||||
"provisioning",
|
||||
"stable"
|
||||
],
|
||||
"summary": "Sets the notification policy tree.",
|
||||
"operationId": "RoutePutPolicyTree",
|
||||
@@ -2187,7 +2203,8 @@
|
||||
"/api/v1/provisioning/templates": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"provisioning"
|
||||
"provisioning",
|
||||
"stable"
|
||||
],
|
||||
"summary": "Get all message templates.",
|
||||
"operationId": "RouteGetTemplates",
|
||||
@@ -2210,7 +2227,8 @@
|
||||
"/api/v1/provisioning/templates/{name}": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"provisioning"
|
||||
"provisioning",
|
||||
"stable"
|
||||
],
|
||||
"summary": "Get a message template.",
|
||||
"operationId": "RouteGetTemplate",
|
||||
@@ -2244,7 +2262,8 @@
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"provisioning"
|
||||
"provisioning",
|
||||
"stable"
|
||||
],
|
||||
"summary": "Updates an existing template.",
|
||||
"operationId": "RoutePutTemplate",
|
||||
@@ -2282,7 +2301,8 @@
|
||||
},
|
||||
"delete": {
|
||||
"tags": [
|
||||
"provisioning"
|
||||
"provisioning",
|
||||
"stable"
|
||||
],
|
||||
"summary": "Delete a template.",
|
||||
"operationId": "RouteDeleteTemplate",
|
||||
@@ -3192,6 +3212,13 @@
|
||||
},
|
||||
"x-go-name": "InhibitRules"
|
||||
},
|
||||
"muteTimeProvenances": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/Provenance"
|
||||
},
|
||||
"x-go-name": "MuteTimeProvenances"
|
||||
},
|
||||
"mute_time_intervals": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
@@ -5627,6 +5654,7 @@
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"alertGroup": {
|
||||
"description": "AlertGroup alert group",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"alerts",
|
||||
@@ -5649,8 +5677,6 @@
|
||||
"$ref": "#/definitions/receiver"
|
||||
}
|
||||
},
|
||||
"x-go-name": "AlertGroup",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
|
||||
"$ref": "#/definitions/alertGroup"
|
||||
},
|
||||
"alertGroups": {
|
||||
@@ -5779,7 +5805,6 @@
|
||||
"$ref": "#/definitions/Duration"
|
||||
},
|
||||
"gettableAlert": {
|
||||
"description": "GettableAlert gettable alert",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"labels",
|
||||
@@ -5839,19 +5864,19 @@
|
||||
"x-go-name": "UpdatedAt"
|
||||
}
|
||||
},
|
||||
"x-go-name": "GettableAlert",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
|
||||
"$ref": "#/definitions/gettableAlert"
|
||||
},
|
||||
"gettableAlerts": {
|
||||
"description": "GettableAlerts gettable alerts",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/gettableAlert"
|
||||
},
|
||||
"x-go-name": "GettableAlerts",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
|
||||
"$ref": "#/definitions/gettableAlerts"
|
||||
},
|
||||
"gettableSilence": {
|
||||
"description": "GettableSilence gettable silence",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"comment",
|
||||
@@ -5904,14 +5929,17 @@
|
||||
"x-go-name": "UpdatedAt"
|
||||
}
|
||||
},
|
||||
"x-go-name": "GettableSilence",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
|
||||
"$ref": "#/definitions/gettableSilence"
|
||||
},
|
||||
"gettableSilences": {
|
||||
"description": "GettableSilences gettable silences",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/gettableSilence"
|
||||
},
|
||||
"x-go-name": "GettableSilences",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
|
||||
"$ref": "#/definitions/gettableSilences"
|
||||
},
|
||||
"labelSet": {
|
||||
@@ -6041,7 +6069,6 @@
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"postableSilence": {
|
||||
"description": "PostableSilence postable silence",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"comment",
|
||||
@@ -6082,10 +6109,11 @@
|
||||
"x-go-name": "StartsAt"
|
||||
}
|
||||
},
|
||||
"x-go-name": "PostableSilence",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
|
||||
"$ref": "#/definitions/postableSilence"
|
||||
},
|
||||
"receiver": {
|
||||
"description": "Receiver receiver",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
@@ -6097,6 +6125,8 @@
|
||||
"x-go-name": "Name"
|
||||
}
|
||||
},
|
||||
"x-go-name": "Receiver",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
|
||||
"$ref": "#/definitions/receiver"
|
||||
},
|
||||
"silence": {
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"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/store"
|
||||
@@ -82,11 +81,9 @@ func (moa *MultiOrgAlertmanager) GetAlertmanagerConfiguration(ctx context.Contex
|
||||
result.AlertmanagerConfig.Receivers = append(result.AlertmanagerConfig.Receivers, &gettableApiReceiver)
|
||||
}
|
||||
|
||||
if moa.settings.IsFeatureToggleEnabled(featuremgmt.FlagAlertProvisioning) {
|
||||
result, err = moa.mergeProvenance(ctx, result, org)
|
||||
if err != nil {
|
||||
return definitions.GettableUserConfig{}, err
|
||||
}
|
||||
result, err = moa.mergeProvenance(ctx, result, org)
|
||||
if err != nil {
|
||||
return definitions.GettableUserConfig{}, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
|
||||
@@ -40,11 +40,6 @@ func SetupTestEnv(t *testing.T, baseInterval time.Duration) (*ngalert.AlertNG, *
|
||||
cfg.UnifiedAlerting.Enabled = new(bool)
|
||||
*cfg.UnifiedAlerting.Enabled = true
|
||||
|
||||
cfg.IsFeatureToggleEnabled = func(key string) bool {
|
||||
// Enable alert provisioning FF when running tests.
|
||||
return key == featuremgmt.FlagAlertProvisioning
|
||||
}
|
||||
|
||||
m := metrics.NewNGAlert(prometheus.NewRegistry())
|
||||
sqlStore := sqlstore.InitTestDB(t)
|
||||
secretsService := secretsManager.SetupTestService(t, database.ProvideSecretsStore(sqlStore))
|
||||
|
||||
Reference in New Issue
Block a user