mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Rename Recipient path parameter to DatasourceID (#47949)
This commit is contained in:
parent
6eb41f9cb3
commit
54962c2f0c
@ -70,13 +70,13 @@ func (srv TestingApiSrv) RouteTestGrafanaRuleConfig(c *models.ReqContext, body a
|
||||
}
|
||||
|
||||
func (srv TestingApiSrv) RouteTestRuleConfig(c *models.ReqContext, body apimodels.TestRulePayload) response.Response {
|
||||
recipient := web.Params(c.Req)[":Recipient"]
|
||||
datasourceID := web.Params(c.Req)[":DatasourceID"]
|
||||
if body.Type() != apimodels.LoTexRulerBackend {
|
||||
return ErrResp(http.StatusBadRequest, errors.New("unexpected payload"), "")
|
||||
}
|
||||
|
||||
var path string
|
||||
if datasourceID, err := strconv.ParseInt(recipient, 10, 64); err == nil {
|
||||
if datasourceID, err := strconv.ParseInt(datasourceID, 10, 64); err == nil {
|
||||
ds, err := srv.DatasourceCache.GetDatasource(context.Background(), datasourceID, c.SignedInUser, c.SkipCache)
|
||||
if err != nil {
|
||||
return ErrResp(http.StatusInternalServerError, err, "failed to get datasource")
|
||||
@ -88,7 +88,7 @@ func (srv TestingApiSrv) RouteTestRuleConfig(c *models.ReqContext, body apimodel
|
||||
case "prometheus":
|
||||
path = "api/v1/query"
|
||||
default:
|
||||
return ErrResp(http.StatusBadRequest, fmt.Errorf("unexpected recipient type %s", ds.Type), "")
|
||||
return ErrResp(http.StatusBadRequest, fmt.Errorf("unexpected datasource type %s", ds.Type), "")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,27 +75,27 @@ func (api *API) authorize(method, path string) web.Handler {
|
||||
eval = ac.EvalPermission(ac.ActionAlertingRuleRead)
|
||||
|
||||
// Lotex Paths
|
||||
case http.MethodDelete + "/api/ruler/{Recipient}/api/v1/rules/{Namespace}":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingRuleExternalWrite, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
case http.MethodDelete + "/api/ruler/{Recipient}/api/v1/rules/{Namespace}/{Groupname}":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingRuleExternalWrite, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
case http.MethodGet + "/api/ruler/{Recipient}/api/v1/rules/{Namespace}":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingRuleExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
case http.MethodGet + "/api/ruler/{Recipient}/api/v1/rules/{Namespace}/{Groupname}":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingRuleExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
case http.MethodGet + "/api/ruler/{Recipient}/api/v1/rules":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingRuleExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
case http.MethodPost + "/api/ruler/{Recipient}/api/v1/rules/{Namespace}":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingInstancesExternalWrite, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
case http.MethodDelete + "/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingRuleExternalWrite, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
case http.MethodDelete + "/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}/{Groupname}":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingRuleExternalWrite, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
case http.MethodGet + "/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingRuleExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
case http.MethodGet + "/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}/{Groupname}":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingRuleExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
case http.MethodGet + "/api/ruler/{DatasourceID}/api/v1/rules":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingRuleExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
case http.MethodPost + "/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingInstancesExternalWrite, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
|
||||
// Lotex Prometheus-compatible Paths
|
||||
case http.MethodGet + "/api/prometheus/{Recipient}/api/v1/rules":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingRuleExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
case http.MethodGet + "/api/prometheus/{DatasourceID}/api/v1/rules":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingRuleExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
|
||||
// Lotex Rules testing
|
||||
case http.MethodPost + "/api/v1/rule/test/{Recipient}":
|
||||
case http.MethodPost + "/api/v1/rule/test/{DatasourceID}":
|
||||
fallback = middleware.ReqSignedIn
|
||||
eval = ac.EvalPermission(ac.ActionAlertingRuleExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
eval = ac.EvalPermission(ac.ActionAlertingRuleExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
|
||||
// Alert Instances and Silences
|
||||
|
||||
@ -123,26 +123,26 @@ func (api *API) authorize(method, path string) web.Handler {
|
||||
eval = ac.EvalPermission(ac.ActionAlertingInstanceRead)
|
||||
|
||||
// Silences. External AM.
|
||||
case http.MethodDelete + "/api/alertmanager/{Recipient}/api/v2/silence/{SilenceId}":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingInstancesExternalWrite, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
case http.MethodPost + "/api/alertmanager/{Recipient}/api/v2/silences":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingInstancesExternalWrite, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
case http.MethodGet + "/api/alertmanager/{Recipient}/api/v2/silence/{SilenceId}":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingInstancesExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
case http.MethodGet + "/api/alertmanager/{Recipient}/api/v2/silences":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingInstancesExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
case http.MethodDelete + "/api/alertmanager/{DatasourceID}/api/v2/silence/{SilenceId}":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingInstancesExternalWrite, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
case http.MethodPost + "/api/alertmanager/{DatasourceID}/api/v2/silences":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingInstancesExternalWrite, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
case http.MethodGet + "/api/alertmanager/{DatasourceID}/api/v2/silence/{SilenceId}":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingInstancesExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
case http.MethodGet + "/api/alertmanager/{DatasourceID}/api/v2/silences":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingInstancesExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
|
||||
// Alert instances. External AM.
|
||||
case http.MethodGet + "/api/alertmanager/{Recipient}/api/v2/alerts/groups":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingInstancesExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
case http.MethodGet + "/api/alertmanager/{Recipient}/api/v2/alerts":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingInstancesExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
case http.MethodPost + "/api/alertmanager/{Recipient}/api/v2/alerts":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingInstancesExternalWrite, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
case http.MethodGet + "/api/alertmanager/{DatasourceID}/api/v2/alerts/groups":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingInstancesExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
case http.MethodGet + "/api/alertmanager/{DatasourceID}/api/v2/alerts":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingInstancesExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
case http.MethodPost + "/api/alertmanager/{DatasourceID}/api/v2/alerts":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingInstancesExternalWrite, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
|
||||
// Prometheus-compatible Paths
|
||||
case http.MethodGet + "/api/prometheus/{Recipient}/api/v1/alerts":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingInstancesExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
case http.MethodGet + "/api/prometheus/{DatasourceID}/api/v1/alerts":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingInstancesExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
|
||||
// Notification Policies, Contact Points and Templates
|
||||
|
||||
@ -162,16 +162,16 @@ func (api *API) authorize(method, path string) web.Handler {
|
||||
eval = ac.EvalPermission(ac.ActionAlertingNotificationsRead)
|
||||
|
||||
// External Alertmanager Paths
|
||||
case http.MethodDelete + "/api/alertmanager/{Recipient}/config/api/v1/alerts":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingNotificationsDelete, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
case http.MethodGet + "/api/alertmanager/{Recipient}/api/v2/status":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingNotificationsExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
case http.MethodGet + "/api/alertmanager/{Recipient}/config/api/v1/alerts":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingNotificationsExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
case http.MethodPost + "/api/alertmanager/{Recipient}/config/api/v1/alerts":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingNotificationsExternalWrite, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
case http.MethodPost + "/api/alertmanager/{Recipient}/config/api/v1/receivers/test":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingNotificationsExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":Recipient")))
|
||||
case http.MethodDelete + "/api/alertmanager/{DatasourceID}/config/api/v1/alerts":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingNotificationsDelete, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
case http.MethodGet + "/api/alertmanager/{DatasourceID}/api/v2/status":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingNotificationsExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
case http.MethodGet + "/api/alertmanager/{DatasourceID}/config/api/v1/alerts":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingNotificationsExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
case http.MethodPost + "/api/alertmanager/{DatasourceID}/config/api/v1/alerts":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingNotificationsExternalWrite, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
case http.MethodPost + "/api/alertmanager/{DatasourceID}/config/api/v1/receivers/test":
|
||||
eval = ac.EvalPermission(ac.ActionAlertingNotificationsExternalRead, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID")))
|
||||
|
||||
// Raw Alertmanager Config Paths
|
||||
case http.MethodDelete + "/api/v1/ngalert/admin_config",
|
||||
|
@ -187,21 +187,21 @@ func (api *API) RegisterAlertmanagerApiEndpoints(srv AlertmanagerApiForkingServi
|
||||
),
|
||||
)
|
||||
group.Post(
|
||||
toMacaronPath("/api/alertmanager/{Recipient}/api/v2/silences"),
|
||||
api.authorize(http.MethodPost, "/api/alertmanager/{Recipient}/api/v2/silences"),
|
||||
toMacaronPath("/api/alertmanager/{DatasourceID}/api/v2/silences"),
|
||||
api.authorize(http.MethodPost, "/api/alertmanager/{DatasourceID}/api/v2/silences"),
|
||||
metrics.Instrument(
|
||||
http.MethodPost,
|
||||
"/api/alertmanager/{Recipient}/api/v2/silences",
|
||||
"/api/alertmanager/{DatasourceID}/api/v2/silences",
|
||||
srv.RouteCreateSilence,
|
||||
m,
|
||||
),
|
||||
)
|
||||
group.Delete(
|
||||
toMacaronPath("/api/alertmanager/{Recipient}/config/api/v1/alerts"),
|
||||
api.authorize(http.MethodDelete, "/api/alertmanager/{Recipient}/config/api/v1/alerts"),
|
||||
toMacaronPath("/api/alertmanager/{DatasourceID}/config/api/v1/alerts"),
|
||||
api.authorize(http.MethodDelete, "/api/alertmanager/{DatasourceID}/config/api/v1/alerts"),
|
||||
metrics.Instrument(
|
||||
http.MethodDelete,
|
||||
"/api/alertmanager/{Recipient}/config/api/v1/alerts",
|
||||
"/api/alertmanager/{DatasourceID}/config/api/v1/alerts",
|
||||
srv.RouteDeleteAlertingConfig,
|
||||
m,
|
||||
),
|
||||
@ -227,51 +227,51 @@ func (api *API) RegisterAlertmanagerApiEndpoints(srv AlertmanagerApiForkingServi
|
||||
),
|
||||
)
|
||||
group.Delete(
|
||||
toMacaronPath("/api/alertmanager/{Recipient}/api/v2/silence/{SilenceId}"),
|
||||
api.authorize(http.MethodDelete, "/api/alertmanager/{Recipient}/api/v2/silence/{SilenceId}"),
|
||||
toMacaronPath("/api/alertmanager/{DatasourceID}/api/v2/silence/{SilenceId}"),
|
||||
api.authorize(http.MethodDelete, "/api/alertmanager/{DatasourceID}/api/v2/silence/{SilenceId}"),
|
||||
metrics.Instrument(
|
||||
http.MethodDelete,
|
||||
"/api/alertmanager/{Recipient}/api/v2/silence/{SilenceId}",
|
||||
"/api/alertmanager/{DatasourceID}/api/v2/silence/{SilenceId}",
|
||||
srv.RouteDeleteSilence,
|
||||
m,
|
||||
),
|
||||
)
|
||||
group.Get(
|
||||
toMacaronPath("/api/alertmanager/{Recipient}/api/v2/alerts/groups"),
|
||||
api.authorize(http.MethodGet, "/api/alertmanager/{Recipient}/api/v2/alerts/groups"),
|
||||
toMacaronPath("/api/alertmanager/{DatasourceID}/api/v2/alerts/groups"),
|
||||
api.authorize(http.MethodGet, "/api/alertmanager/{DatasourceID}/api/v2/alerts/groups"),
|
||||
metrics.Instrument(
|
||||
http.MethodGet,
|
||||
"/api/alertmanager/{Recipient}/api/v2/alerts/groups",
|
||||
"/api/alertmanager/{DatasourceID}/api/v2/alerts/groups",
|
||||
srv.RouteGetAMAlertGroups,
|
||||
m,
|
||||
),
|
||||
)
|
||||
group.Get(
|
||||
toMacaronPath("/api/alertmanager/{Recipient}/api/v2/alerts"),
|
||||
api.authorize(http.MethodGet, "/api/alertmanager/{Recipient}/api/v2/alerts"),
|
||||
toMacaronPath("/api/alertmanager/{DatasourceID}/api/v2/alerts"),
|
||||
api.authorize(http.MethodGet, "/api/alertmanager/{DatasourceID}/api/v2/alerts"),
|
||||
metrics.Instrument(
|
||||
http.MethodGet,
|
||||
"/api/alertmanager/{Recipient}/api/v2/alerts",
|
||||
"/api/alertmanager/{DatasourceID}/api/v2/alerts",
|
||||
srv.RouteGetAMAlerts,
|
||||
m,
|
||||
),
|
||||
)
|
||||
group.Get(
|
||||
toMacaronPath("/api/alertmanager/{Recipient}/api/v2/status"),
|
||||
api.authorize(http.MethodGet, "/api/alertmanager/{Recipient}/api/v2/status"),
|
||||
toMacaronPath("/api/alertmanager/{DatasourceID}/api/v2/status"),
|
||||
api.authorize(http.MethodGet, "/api/alertmanager/{DatasourceID}/api/v2/status"),
|
||||
metrics.Instrument(
|
||||
http.MethodGet,
|
||||
"/api/alertmanager/{Recipient}/api/v2/status",
|
||||
"/api/alertmanager/{DatasourceID}/api/v2/status",
|
||||
srv.RouteGetAMStatus,
|
||||
m,
|
||||
),
|
||||
)
|
||||
group.Get(
|
||||
toMacaronPath("/api/alertmanager/{Recipient}/config/api/v1/alerts"),
|
||||
api.authorize(http.MethodGet, "/api/alertmanager/{Recipient}/config/api/v1/alerts"),
|
||||
toMacaronPath("/api/alertmanager/{DatasourceID}/config/api/v1/alerts"),
|
||||
api.authorize(http.MethodGet, "/api/alertmanager/{DatasourceID}/config/api/v1/alerts"),
|
||||
metrics.Instrument(
|
||||
http.MethodGet,
|
||||
"/api/alertmanager/{Recipient}/config/api/v1/alerts",
|
||||
"/api/alertmanager/{DatasourceID}/config/api/v1/alerts",
|
||||
srv.RouteGetAlertingConfig,
|
||||
m,
|
||||
),
|
||||
@ -337,41 +337,41 @@ func (api *API) RegisterAlertmanagerApiEndpoints(srv AlertmanagerApiForkingServi
|
||||
),
|
||||
)
|
||||
group.Get(
|
||||
toMacaronPath("/api/alertmanager/{Recipient}/api/v2/silence/{SilenceId}"),
|
||||
api.authorize(http.MethodGet, "/api/alertmanager/{Recipient}/api/v2/silence/{SilenceId}"),
|
||||
toMacaronPath("/api/alertmanager/{DatasourceID}/api/v2/silence/{SilenceId}"),
|
||||
api.authorize(http.MethodGet, "/api/alertmanager/{DatasourceID}/api/v2/silence/{SilenceId}"),
|
||||
metrics.Instrument(
|
||||
http.MethodGet,
|
||||
"/api/alertmanager/{Recipient}/api/v2/silence/{SilenceId}",
|
||||
"/api/alertmanager/{DatasourceID}/api/v2/silence/{SilenceId}",
|
||||
srv.RouteGetSilence,
|
||||
m,
|
||||
),
|
||||
)
|
||||
group.Get(
|
||||
toMacaronPath("/api/alertmanager/{Recipient}/api/v2/silences"),
|
||||
api.authorize(http.MethodGet, "/api/alertmanager/{Recipient}/api/v2/silences"),
|
||||
toMacaronPath("/api/alertmanager/{DatasourceID}/api/v2/silences"),
|
||||
api.authorize(http.MethodGet, "/api/alertmanager/{DatasourceID}/api/v2/silences"),
|
||||
metrics.Instrument(
|
||||
http.MethodGet,
|
||||
"/api/alertmanager/{Recipient}/api/v2/silences",
|
||||
"/api/alertmanager/{DatasourceID}/api/v2/silences",
|
||||
srv.RouteGetSilences,
|
||||
m,
|
||||
),
|
||||
)
|
||||
group.Post(
|
||||
toMacaronPath("/api/alertmanager/{Recipient}/api/v2/alerts"),
|
||||
api.authorize(http.MethodPost, "/api/alertmanager/{Recipient}/api/v2/alerts"),
|
||||
toMacaronPath("/api/alertmanager/{DatasourceID}/api/v2/alerts"),
|
||||
api.authorize(http.MethodPost, "/api/alertmanager/{DatasourceID}/api/v2/alerts"),
|
||||
metrics.Instrument(
|
||||
http.MethodPost,
|
||||
"/api/alertmanager/{Recipient}/api/v2/alerts",
|
||||
"/api/alertmanager/{DatasourceID}/api/v2/alerts",
|
||||
srv.RoutePostAMAlerts,
|
||||
m,
|
||||
),
|
||||
)
|
||||
group.Post(
|
||||
toMacaronPath("/api/alertmanager/{Recipient}/config/api/v1/alerts"),
|
||||
api.authorize(http.MethodPost, "/api/alertmanager/{Recipient}/config/api/v1/alerts"),
|
||||
toMacaronPath("/api/alertmanager/{DatasourceID}/config/api/v1/alerts"),
|
||||
api.authorize(http.MethodPost, "/api/alertmanager/{DatasourceID}/config/api/v1/alerts"),
|
||||
metrics.Instrument(
|
||||
http.MethodPost,
|
||||
"/api/alertmanager/{Recipient}/config/api/v1/alerts",
|
||||
"/api/alertmanager/{DatasourceID}/config/api/v1/alerts",
|
||||
srv.RoutePostAlertingConfig,
|
||||
m,
|
||||
),
|
||||
@ -407,11 +407,11 @@ func (api *API) RegisterAlertmanagerApiEndpoints(srv AlertmanagerApiForkingServi
|
||||
),
|
||||
)
|
||||
group.Post(
|
||||
toMacaronPath("/api/alertmanager/{Recipient}/config/api/v1/receivers/test"),
|
||||
api.authorize(http.MethodPost, "/api/alertmanager/{Recipient}/config/api/v1/receivers/test"),
|
||||
toMacaronPath("/api/alertmanager/{DatasourceID}/config/api/v1/receivers/test"),
|
||||
api.authorize(http.MethodPost, "/api/alertmanager/{DatasourceID}/config/api/v1/receivers/test"),
|
||||
metrics.Instrument(
|
||||
http.MethodPost,
|
||||
"/api/alertmanager/{Recipient}/config/api/v1/receivers/test",
|
||||
"/api/alertmanager/{DatasourceID}/config/api/v1/receivers/test",
|
||||
srv.RoutePostTestReceivers,
|
||||
m,
|
||||
),
|
||||
|
@ -43,11 +43,11 @@ func (f *ForkedPrometheusApi) RouteGetRuleStatuses(ctx *models.ReqContext) respo
|
||||
func (api *API) RegisterPrometheusApiEndpoints(srv PrometheusApiForkingService, m *metrics.API) {
|
||||
api.RouteRegister.Group("", func(group routing.RouteRegister) {
|
||||
group.Get(
|
||||
toMacaronPath("/api/prometheus/{Recipient}/api/v1/alerts"),
|
||||
api.authorize(http.MethodGet, "/api/prometheus/{Recipient}/api/v1/alerts"),
|
||||
toMacaronPath("/api/prometheus/{DatasourceID}/api/v1/alerts"),
|
||||
api.authorize(http.MethodGet, "/api/prometheus/{DatasourceID}/api/v1/alerts"),
|
||||
metrics.Instrument(
|
||||
http.MethodGet,
|
||||
"/api/prometheus/{Recipient}/api/v1/alerts",
|
||||
"/api/prometheus/{DatasourceID}/api/v1/alerts",
|
||||
srv.RouteGetAlertStatuses,
|
||||
m,
|
||||
),
|
||||
@ -73,11 +73,11 @@ func (api *API) RegisterPrometheusApiEndpoints(srv PrometheusApiForkingService,
|
||||
),
|
||||
)
|
||||
group.Get(
|
||||
toMacaronPath("/api/prometheus/{Recipient}/api/v1/rules"),
|
||||
api.authorize(http.MethodGet, "/api/prometheus/{Recipient}/api/v1/rules"),
|
||||
toMacaronPath("/api/prometheus/{DatasourceID}/api/v1/rules"),
|
||||
api.authorize(http.MethodGet, "/api/prometheus/{DatasourceID}/api/v1/rules"),
|
||||
metrics.Instrument(
|
||||
http.MethodGet,
|
||||
"/api/prometheus/{Recipient}/api/v1/rules",
|
||||
"/api/prometheus/{DatasourceID}/api/v1/rules",
|
||||
srv.RouteGetRuleStatuses,
|
||||
m,
|
||||
),
|
||||
|
@ -113,21 +113,21 @@ func (api *API) RegisterRulerApiEndpoints(srv RulerApiForkingService, m *metrics
|
||||
),
|
||||
)
|
||||
group.Delete(
|
||||
toMacaronPath("/api/ruler/{Recipient}/api/v1/rules/{Namespace}"),
|
||||
api.authorize(http.MethodDelete, "/api/ruler/{Recipient}/api/v1/rules/{Namespace}"),
|
||||
toMacaronPath("/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}"),
|
||||
api.authorize(http.MethodDelete, "/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}"),
|
||||
metrics.Instrument(
|
||||
http.MethodDelete,
|
||||
"/api/ruler/{Recipient}/api/v1/rules/{Namespace}",
|
||||
"/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}",
|
||||
srv.RouteDeleteNamespaceRulesConfig,
|
||||
m,
|
||||
),
|
||||
)
|
||||
group.Delete(
|
||||
toMacaronPath("/api/ruler/{Recipient}/api/v1/rules/{Namespace}/{Groupname}"),
|
||||
api.authorize(http.MethodDelete, "/api/ruler/{Recipient}/api/v1/rules/{Namespace}/{Groupname}"),
|
||||
toMacaronPath("/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}/{Groupname}"),
|
||||
api.authorize(http.MethodDelete, "/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}/{Groupname}"),
|
||||
metrics.Instrument(
|
||||
http.MethodDelete,
|
||||
"/api/ruler/{Recipient}/api/v1/rules/{Namespace}/{Groupname}",
|
||||
"/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}/{Groupname}",
|
||||
srv.RouteDeleteRuleGroupConfig,
|
||||
m,
|
||||
),
|
||||
@ -163,31 +163,31 @@ func (api *API) RegisterRulerApiEndpoints(srv RulerApiForkingService, m *metrics
|
||||
),
|
||||
)
|
||||
group.Get(
|
||||
toMacaronPath("/api/ruler/{Recipient}/api/v1/rules/{Namespace}"),
|
||||
api.authorize(http.MethodGet, "/api/ruler/{Recipient}/api/v1/rules/{Namespace}"),
|
||||
toMacaronPath("/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}"),
|
||||
api.authorize(http.MethodGet, "/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}"),
|
||||
metrics.Instrument(
|
||||
http.MethodGet,
|
||||
"/api/ruler/{Recipient}/api/v1/rules/{Namespace}",
|
||||
"/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}",
|
||||
srv.RouteGetNamespaceRulesConfig,
|
||||
m,
|
||||
),
|
||||
)
|
||||
group.Get(
|
||||
toMacaronPath("/api/ruler/{Recipient}/api/v1/rules/{Namespace}/{Groupname}"),
|
||||
api.authorize(http.MethodGet, "/api/ruler/{Recipient}/api/v1/rules/{Namespace}/{Groupname}"),
|
||||
toMacaronPath("/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}/{Groupname}"),
|
||||
api.authorize(http.MethodGet, "/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}/{Groupname}"),
|
||||
metrics.Instrument(
|
||||
http.MethodGet,
|
||||
"/api/ruler/{Recipient}/api/v1/rules/{Namespace}/{Groupname}",
|
||||
"/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}/{Groupname}",
|
||||
srv.RouteGetRulegGroupConfig,
|
||||
m,
|
||||
),
|
||||
)
|
||||
group.Get(
|
||||
toMacaronPath("/api/ruler/{Recipient}/api/v1/rules"),
|
||||
api.authorize(http.MethodGet, "/api/ruler/{Recipient}/api/v1/rules"),
|
||||
toMacaronPath("/api/ruler/{DatasourceID}/api/v1/rules"),
|
||||
api.authorize(http.MethodGet, "/api/ruler/{DatasourceID}/api/v1/rules"),
|
||||
metrics.Instrument(
|
||||
http.MethodGet,
|
||||
"/api/ruler/{Recipient}/api/v1/rules",
|
||||
"/api/ruler/{DatasourceID}/api/v1/rules",
|
||||
srv.RouteGetRulesConfig,
|
||||
m,
|
||||
),
|
||||
@ -203,11 +203,11 @@ func (api *API) RegisterRulerApiEndpoints(srv RulerApiForkingService, m *metrics
|
||||
),
|
||||
)
|
||||
group.Post(
|
||||
toMacaronPath("/api/ruler/{Recipient}/api/v1/rules/{Namespace}"),
|
||||
api.authorize(http.MethodPost, "/api/ruler/{Recipient}/api/v1/rules/{Namespace}"),
|
||||
toMacaronPath("/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}"),
|
||||
api.authorize(http.MethodPost, "/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}"),
|
||||
metrics.Instrument(
|
||||
http.MethodPost,
|
||||
"/api/ruler/{Recipient}/api/v1/rules/{Namespace}",
|
||||
"/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}",
|
||||
srv.RoutePostNameRulesConfig,
|
||||
m,
|
||||
),
|
||||
|
@ -62,11 +62,11 @@ func (api *API) RegisterTestingApiEndpoints(srv TestingApiForkingService, m *met
|
||||
),
|
||||
)
|
||||
group.Post(
|
||||
toMacaronPath("/api/v1/rule/test/{Recipient}"),
|
||||
api.authorize(http.MethodPost, "/api/v1/rule/test/{Recipient}"),
|
||||
toMacaronPath("/api/v1/rule/test/{DatasourceID}"),
|
||||
api.authorize(http.MethodPost, "/api/v1/rule/test/{DatasourceID}"),
|
||||
metrics.Instrument(
|
||||
http.MethodPost,
|
||||
"/api/v1/rule/test/{Recipient}",
|
||||
"/api/v1/rule/test/{DatasourceID}",
|
||||
srv.RouteTestRuleConfig,
|
||||
m,
|
||||
),
|
||||
|
@ -60,12 +60,12 @@ func (am *LotexAM) withAMReq(
|
||||
extractor func(*response.NormalResponse) (interface{}, error),
|
||||
headers map[string]string,
|
||||
) response.Response {
|
||||
recipient, err := strconv.ParseInt(web.Params(ctx.Req)[":Recipient"], 10, 64)
|
||||
datasourceID, err := strconv.ParseInt(web.Params(ctx.Req)[":DatasourceID"], 10, 64)
|
||||
if err != nil {
|
||||
return response.Error(http.StatusBadRequest, "Recipient is invalid", err)
|
||||
return response.Error(http.StatusBadRequest, "DatasourceID is invalid", err)
|
||||
}
|
||||
|
||||
ds, err := am.DataProxy.DataSourceCache.GetDatasource(ctx.Req.Context(), recipient, ctx.SignedInUser, ctx.SkipCache)
|
||||
ds, err := am.DataProxy.DataSourceCache.GetDatasource(ctx.Req.Context(), datasourceID, ctx.SignedInUser, ctx.SkipCache)
|
||||
if err != nil {
|
||||
if errors.Is(err, models.ErrDataSourceAccessDenied) {
|
||||
return ErrResp(http.StatusForbidden, err, "Access denied to datasource")
|
||||
|
@ -78,12 +78,12 @@ func (p *LotexProm) RouteGetRuleStatuses(ctx *models.ReqContext) response.Respon
|
||||
}
|
||||
|
||||
func (p *LotexProm) getEndpoints(ctx *models.ReqContext) (*promEndpoints, error) {
|
||||
recipient, err := strconv.ParseInt(web.Params(ctx.Req)[":Recipient"], 10, 64)
|
||||
datasourceID, err := strconv.ParseInt(web.Params(ctx.Req)[":DatasourceID"], 10, 64)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("recipient is invalid")
|
||||
return nil, fmt.Errorf("datasource ID is invalid")
|
||||
}
|
||||
|
||||
ds, err := p.DataProxy.DataSourceCache.GetDatasource(ctx.Req.Context(), recipient, ctx.SignedInUser, ctx.SkipCache)
|
||||
ds, err := p.DataProxy.DataSourceCache.GetDatasource(ctx.Req.Context(), datasourceID, ctx.SignedInUser, ctx.SkipCache)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -176,12 +176,12 @@ func (r *LotexRuler) RoutePostNameRulesConfig(ctx *models.ReqContext, conf apimo
|
||||
}
|
||||
|
||||
func (r *LotexRuler) validateAndGetPrefix(ctx *models.ReqContext) (string, error) {
|
||||
recipient, err := strconv.ParseInt(web.Params(ctx.Req)[":Recipient"], 10, 64)
|
||||
datasourceID, err := strconv.ParseInt(web.Params(ctx.Req)[":DatasourceID"], 10, 64)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("recipient is invalid")
|
||||
return "", fmt.Errorf("datasource ID is invalid")
|
||||
}
|
||||
|
||||
ds, err := r.DataProxy.DataSourceCache.GetDatasource(ctx.Req.Context(), recipient, ctx.SignedInUser, ctx.SkipCache)
|
||||
ds, err := r.DataProxy.DataSourceCache.GetDatasource(ctx.Req.Context(), datasourceID, ctx.SignedInUser, ctx.SkipCache)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
@ -25,64 +25,64 @@ func TestLotexRuler_ValidateAndGetPrefix(t *testing.T) {
|
||||
err error
|
||||
}{
|
||||
{
|
||||
name: "with an invalid recipient",
|
||||
namedParams: map[string]string{":Recipient": "AAABBB"},
|
||||
err: errors.New("recipient is invalid"),
|
||||
name: "with an invalid datasource ID",
|
||||
namedParams: map[string]string{":DatasourceID": "AAABBB"},
|
||||
err: errors.New("datasource ID is invalid"),
|
||||
},
|
||||
{
|
||||
name: "with an error while trying to fetch the datasource",
|
||||
namedParams: map[string]string{":Recipient": "164"},
|
||||
namedParams: map[string]string{":DatasourceID": "164"},
|
||||
datasourceCache: fakeCacheService{err: models.ErrDataSourceNotFound},
|
||||
err: errors.New("data source not found"),
|
||||
},
|
||||
{
|
||||
name: "with an empty datasource URL",
|
||||
namedParams: map[string]string{":Recipient": "164"},
|
||||
namedParams: map[string]string{":DatasourceID": "164"},
|
||||
datasourceCache: fakeCacheService{datasource: &models.DataSource{}},
|
||||
err: errors.New("URL for this data source is empty"),
|
||||
},
|
||||
{
|
||||
name: "with an unsupported datasource type",
|
||||
namedParams: map[string]string{":Recipient": "164"},
|
||||
namedParams: map[string]string{":DatasourceID": "164"},
|
||||
datasourceCache: fakeCacheService{datasource: &models.DataSource{Url: "http://loki.com"}},
|
||||
err: errors.New("unexpected datasource type. expecting loki or prometheus"),
|
||||
},
|
||||
{
|
||||
name: "with a Loki datasource",
|
||||
namedParams: map[string]string{":Recipient": "164"},
|
||||
namedParams: map[string]string{":DatasourceID": "164"},
|
||||
datasourceCache: fakeCacheService{datasource: &models.DataSource{Url: "http://loki.com", Type: LokiDatasourceType}},
|
||||
expected: "/api/prom/rules",
|
||||
},
|
||||
{
|
||||
name: "with a Prometheus datasource",
|
||||
namedParams: map[string]string{":Recipient": "164"},
|
||||
namedParams: map[string]string{":DatasourceID": "164"},
|
||||
datasourceCache: fakeCacheService{datasource: &models.DataSource{Url: "http://loki.com", Type: PrometheusDatasourceType}},
|
||||
expected: "/rules",
|
||||
},
|
||||
{
|
||||
name: "with a Prometheus datasource and subtype of Cortex",
|
||||
namedParams: map[string]string{":Recipient": "164"},
|
||||
namedParams: map[string]string{":DatasourceID": "164"},
|
||||
urlParams: "?subtype=cortex",
|
||||
datasourceCache: fakeCacheService{datasource: &models.DataSource{Url: "http://loki.com", Type: PrometheusDatasourceType}},
|
||||
expected: "/rules",
|
||||
},
|
||||
{
|
||||
name: "with a Prometheus datasource and subtype of Mimir",
|
||||
namedParams: map[string]string{":Recipient": "164"},
|
||||
namedParams: map[string]string{":DatasourceID": "164"},
|
||||
urlParams: "?subtype=mimir",
|
||||
datasourceCache: fakeCacheService{datasource: &models.DataSource{Url: "http://loki.com", Type: PrometheusDatasourceType}},
|
||||
expected: "/config/v1/rules",
|
||||
},
|
||||
{
|
||||
name: "with a Prometheus datasource and subtype of Prometheus",
|
||||
namedParams: map[string]string{":Recipient": "164"},
|
||||
namedParams: map[string]string{":DatasourceID": "164"},
|
||||
urlParams: "?subtype=prometheus",
|
||||
datasourceCache: fakeCacheService{datasource: &models.DataSource{Url: "http://loki.com", Type: PrometheusDatasourceType}},
|
||||
expected: "/rules",
|
||||
},
|
||||
{
|
||||
name: "with a Prometheus datasource and no subtype",
|
||||
namedParams: map[string]string{":Recipient": "164"},
|
||||
namedParams: map[string]string{":DatasourceID": "164"},
|
||||
datasourceCache: fakeCacheService{datasource: &models.DataSource{Url: "http://loki.com", Type: PrometheusDatasourceType}},
|
||||
expected: "/rules",
|
||||
},
|
||||
|
@ -31,7 +31,7 @@ import (
|
||||
// 201: Ack
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route POST /api/alertmanager/{Recipient}/config/api/v1/alerts alertmanager RoutePostAlertingConfig
|
||||
// swagger:route POST /api/alertmanager/{DatasourceID}/config/api/v1/alerts alertmanager RoutePostAlertingConfig
|
||||
//
|
||||
// sets an Alerting config
|
||||
//
|
||||
@ -47,7 +47,7 @@ import (
|
||||
// 200: GettableUserConfig
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/alertmanager/{Recipient}/config/api/v1/alerts alertmanager RouteGetAlertingConfig
|
||||
// swagger:route GET /api/alertmanager/{DatasourceID}/config/api/v1/alerts alertmanager RouteGetAlertingConfig
|
||||
//
|
||||
// gets an Alerting config
|
||||
//
|
||||
@ -63,7 +63,7 @@ import (
|
||||
// 200: Ack
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route DELETE /api/alertmanager/{Recipient}/config/api/v1/alerts alertmanager RouteDeleteAlertingConfig
|
||||
// swagger:route DELETE /api/alertmanager/{DatasourceID}/config/api/v1/alerts alertmanager RouteDeleteAlertingConfig
|
||||
//
|
||||
// deletes the Alerting config for a tenant
|
||||
//
|
||||
@ -79,7 +79,7 @@ import (
|
||||
// 200: GettableStatus
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/alertmanager/{Recipient}/api/v2/status alertmanager RouteGetAMStatus
|
||||
// swagger:route GET /api/alertmanager/{DatasourceID}/api/v2/status alertmanager RouteGetAMStatus
|
||||
//
|
||||
// get alertmanager status and configuration
|
||||
//
|
||||
@ -95,7 +95,7 @@ import (
|
||||
// 200: gettableAlerts
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/alertmanager/{Recipient}/api/v2/alerts alertmanager RouteGetAMAlerts
|
||||
// swagger:route GET /api/alertmanager/{DatasourceID}/api/v2/alerts alertmanager RouteGetAMAlerts
|
||||
//
|
||||
// get alertmanager alerts
|
||||
//
|
||||
@ -111,7 +111,7 @@ import (
|
||||
// 200: Ack
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route POST /api/alertmanager/{Recipient}/api/v2/alerts alertmanager RoutePostAMAlerts
|
||||
// swagger:route POST /api/alertmanager/{DatasourceID}/api/v2/alerts alertmanager RoutePostAMAlerts
|
||||
//
|
||||
// create alertmanager alerts
|
||||
//
|
||||
@ -127,7 +127,7 @@ import (
|
||||
// 200: alertGroups
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/alertmanager/{Recipient}/api/v2/alerts/groups alertmanager RouteGetAMAlertGroups
|
||||
// swagger:route GET /api/alertmanager/{DatasourceID}/api/v2/alerts/groups alertmanager RouteGetAMAlertGroups
|
||||
//
|
||||
// get alertmanager alerts
|
||||
//
|
||||
@ -149,7 +149,7 @@ import (
|
||||
// 408: Failure
|
||||
// 409: AlertManagerNotReady
|
||||
|
||||
// swagger:route POST /api/alertmanager/{Recipient}/config/api/v1/receivers/test alertmanager RoutePostTestReceivers
|
||||
// swagger:route POST /api/alertmanager/{DatasourceID}/config/api/v1/receivers/test alertmanager RoutePostTestReceivers
|
||||
//
|
||||
// Test Grafana managed receivers without saving them.
|
||||
//
|
||||
@ -171,7 +171,7 @@ import (
|
||||
// 200: gettableSilences
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/alertmanager/{Recipient}/api/v2/silences alertmanager RouteGetSilences
|
||||
// swagger:route GET /api/alertmanager/{DatasourceID}/api/v2/silences alertmanager RouteGetSilences
|
||||
//
|
||||
// get silences
|
||||
//
|
||||
@ -187,7 +187,7 @@ import (
|
||||
// 201: gettableSilence
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route POST /api/alertmanager/{Recipient}/api/v2/silences alertmanager RouteCreateSilence
|
||||
// swagger:route POST /api/alertmanager/{DatasourceID}/api/v2/silences alertmanager RouteCreateSilence
|
||||
//
|
||||
// create silence
|
||||
//
|
||||
@ -203,7 +203,7 @@ import (
|
||||
// 200: gettableSilence
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/alertmanager/{Recipient}/api/v2/silence/{SilenceId} alertmanager RouteGetSilence
|
||||
// swagger:route GET /api/alertmanager/{DatasourceID}/api/v2/silence/{SilenceId} alertmanager RouteGetSilence
|
||||
//
|
||||
// get silence
|
||||
//
|
||||
@ -219,7 +219,7 @@ import (
|
||||
// 200: Ack
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route DELETE /api/alertmanager/{Recipient}/api/v2/silence/{SilenceId} alertmanager RouteDeleteSilence
|
||||
// swagger:route DELETE /api/alertmanager/{DatasourceID}/api/v2/silence/{SilenceId} alertmanager RouteDeleteSilence
|
||||
//
|
||||
// delete silence
|
||||
//
|
||||
@ -448,9 +448,9 @@ type BodyAlertingConfig struct {
|
||||
// testing routes
|
||||
// swagger:parameters RouteTestReceiverConfig RouteTestRuleConfig
|
||||
type DatasourceReference struct {
|
||||
// Recipient should be the numeric datasource id
|
||||
// DatasourceID should be the numeric datasource id
|
||||
// in:path
|
||||
Recipient int
|
||||
DatasourceID int
|
||||
}
|
||||
|
||||
// swagger:model
|
||||
|
@ -21,7 +21,7 @@ import (
|
||||
// 202: NamespaceConfigResponse
|
||||
//
|
||||
|
||||
// swagger:route Get /api/ruler/{Recipient}/api/v1/rules ruler RouteGetRulesConfig
|
||||
// swagger:route Get /api/ruler/{DatasourceID}/api/v1/rules ruler RouteGetRulesConfig
|
||||
//
|
||||
// List rule groups
|
||||
//
|
||||
@ -43,7 +43,7 @@ import (
|
||||
// 202: Ack
|
||||
//
|
||||
|
||||
// swagger:route POST /api/ruler/{Recipient}/api/v1/rules/{Namespace} ruler RoutePostNameRulesConfig
|
||||
// swagger:route POST /api/ruler/{DatasourceID}/api/v1/rules/{Namespace} ruler RoutePostNameRulesConfig
|
||||
//
|
||||
// Creates or updates a rule group
|
||||
//
|
||||
@ -64,7 +64,7 @@ import (
|
||||
// Responses:
|
||||
// 202: NamespaceConfigResponse
|
||||
|
||||
// swagger:route Get /api/ruler/{Recipient}/api/v1/rules/{Namespace} ruler RouteGetNamespaceRulesConfig
|
||||
// swagger:route Get /api/ruler/{DatasourceID}/api/v1/rules/{Namespace} ruler RouteGetNamespaceRulesConfig
|
||||
//
|
||||
// Get rule groups by namespace
|
||||
//
|
||||
@ -81,7 +81,7 @@ import (
|
||||
// Responses:
|
||||
// 202: Ack
|
||||
|
||||
// swagger:route Delete /api/ruler/{Recipient}/api/v1/rules/{Namespace} ruler RouteDeleteNamespaceRulesConfig
|
||||
// swagger:route Delete /api/ruler/{DatasourceID}/api/v1/rules/{Namespace} ruler RouteDeleteNamespaceRulesConfig
|
||||
//
|
||||
// Delete namespace
|
||||
//
|
||||
@ -98,7 +98,7 @@ import (
|
||||
// Responses:
|
||||
// 202: RuleGroupConfigResponse
|
||||
|
||||
// swagger:route Get /api/ruler/{Recipient}/api/v1/rules/{Namespace}/{Groupname} ruler RouteGetRulegGroupConfig
|
||||
// swagger:route Get /api/ruler/{DatasourceID}/api/v1/rules/{Namespace}/{Groupname} ruler RouteGetRulegGroupConfig
|
||||
//
|
||||
// Get rule group
|
||||
//
|
||||
@ -115,7 +115,7 @@ import (
|
||||
// Responses:
|
||||
// 202: Ack
|
||||
|
||||
// swagger:route Delete /api/ruler/{Recipient}/api/v1/rules/{Namespace}/{Groupname} ruler RouteDeleteRuleGroupConfig
|
||||
// swagger:route Delete /api/ruler/{DatasourceID}/api/v1/rules/{Namespace}/{Groupname} ruler RouteDeleteRuleGroupConfig
|
||||
//
|
||||
// Delete rule group
|
||||
//
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
// Responses:
|
||||
// 200: RuleResponse
|
||||
|
||||
// swagger:route GET /api/prometheus/{Recipient}/api/v1/rules prometheus RouteGetRuleStatuses
|
||||
// swagger:route GET /api/prometheus/{DatasourceID}/api/v1/rules prometheus RouteGetRuleStatuses
|
||||
//
|
||||
// gets the evaluation statuses of all rules
|
||||
//
|
||||
@ -27,7 +27,7 @@ import (
|
||||
// Responses:
|
||||
// 200: AlertResponse
|
||||
|
||||
// swagger:route GET /api/prometheus/{Recipient}/api/v1/alerts prometheus RouteGetAlertStatuses
|
||||
// swagger:route GET /api/prometheus/{DatasourceID}/api/v1/alerts prometheus RouteGetAlertStatuses
|
||||
//
|
||||
// gets the current alerts
|
||||
//
|
||||
|
@ -26,7 +26,7 @@ import (
|
||||
// Responses:
|
||||
// 200: TestRuleResponse
|
||||
|
||||
// swagger:route Post /api/v1/rule/test/{Recipient} testing RouteTestRuleConfig
|
||||
// swagger:route Post /api/v1/rule/test/{DatasourceID} testing RouteTestRuleConfig
|
||||
//
|
||||
// Test a rule against external data source ruler
|
||||
//
|
||||
|
@ -8,6 +8,32 @@
|
||||
"type": "object",
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
},
|
||||
"AddApiKeyCommand": {
|
||||
"description": "COMMANDS",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"x-go-name": "Name"
|
||||
},
|
||||
"role": {
|
||||
"enum": [
|
||||
"Viewer",
|
||||
"Editor",
|
||||
"Admin"
|
||||
],
|
||||
"type": "string",
|
||||
"x-go-enum-desc": "Viewer ROLE_VIEWER\nEditor ROLE_EDITOR\nAdmin ROLE_ADMIN",
|
||||
"x-go-name": "Role"
|
||||
},
|
||||
"secondsToLive": {
|
||||
"format": "int64",
|
||||
"type": "integer",
|
||||
"x-go-name": "SecondsToLive"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/models"
|
||||
},
|
||||
"Alert": {
|
||||
"properties": {
|
||||
"activeAt": {
|
||||
@ -566,6 +592,7 @@
|
||||
"x-go-name": "DisableResolveMessage"
|
||||
},
|
||||
"name": {
|
||||
"description": "Name is used as grouping key in the UI. Contact points with the\nsame name will be grouped in the UI.",
|
||||
"type": "string",
|
||||
"x-go-name": "Name"
|
||||
},
|
||||
@ -581,6 +608,7 @@
|
||||
"x-go-name": "Type"
|
||||
},
|
||||
"uid": {
|
||||
"description": "UID is the unique identifier of the contact point. This will be\nautomatically set be the Grafana.",
|
||||
"type": "string",
|
||||
"x-go-name": "UID"
|
||||
}
|
||||
@ -1963,6 +1991,10 @@
|
||||
"type": "object",
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
},
|
||||
"Provenance": {
|
||||
"type": "string",
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||
},
|
||||
"PushoverConfig": {
|
||||
"properties": {
|
||||
"expire": {
|
||||
@ -2164,6 +2196,9 @@
|
||||
"object_matchers": {
|
||||
"$ref": "#/definitions/ObjectMatchers"
|
||||
},
|
||||
"provenance": {
|
||||
"$ref": "#/definitions/Provenance"
|
||||
},
|
||||
"receiver": {
|
||||
"type": "string",
|
||||
"x-go-name": "Receiver"
|
||||
@ -3064,7 +3099,6 @@
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"alertGroup": {
|
||||
"description": "AlertGroup alert group",
|
||||
"properties": {
|
||||
"alerts": {
|
||||
"description": "alerts",
|
||||
@ -3086,14 +3120,17 @@
|
||||
"labels",
|
||||
"receiver"
|
||||
],
|
||||
"type": "object"
|
||||
"type": "object",
|
||||
"x-go-name": "AlertGroup",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"alertGroups": {
|
||||
"description": "AlertGroups alert groups",
|
||||
"items": {
|
||||
"$ref": "#/definitions/alertGroup"
|
||||
},
|
||||
"type": "array"
|
||||
"type": "array",
|
||||
"x-go-name": "AlertGroups",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"alertStatus": {
|
||||
"description": "AlertStatus alert status",
|
||||
@ -3213,6 +3250,7 @@
|
||||
"$ref": "#/definitions/Duration"
|
||||
},
|
||||
"gettableAlert": {
|
||||
"description": "GettableAlert gettable alert",
|
||||
"properties": {
|
||||
"annotations": {
|
||||
"$ref": "#/definitions/labelSet"
|
||||
@ -3271,9 +3309,7 @@
|
||||
"status",
|
||||
"updatedAt"
|
||||
],
|
||||
"type": "object",
|
||||
"x-go-name": "GettableAlert",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
"type": "object"
|
||||
},
|
||||
"gettableAlerts": {
|
||||
"description": "GettableAlerts gettable alerts",
|
||||
@ -3283,7 +3319,6 @@
|
||||
"type": "array"
|
||||
},
|
||||
"gettableSilence": {
|
||||
"description": "GettableSilence gettable silence",
|
||||
"properties": {
|
||||
"comment": {
|
||||
"description": "comment",
|
||||
@ -3335,14 +3370,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": {
|
||||
@ -3515,6 +3553,7 @@
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"receiver": {
|
||||
"description": "Receiver receiver",
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "name",
|
||||
@ -3525,9 +3564,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",
|
||||
@ -4089,7 +4126,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/{Recipient}/api/v2/alerts": {
|
||||
"/api/alertmanager/{DatasourceID}/api/v2/alerts": {
|
||||
"get": {
|
||||
"description": "get alertmanager alerts",
|
||||
"operationId": "RouteGetAMAlerts",
|
||||
@ -4136,10 +4173,10 @@
|
||||
"x-go-name": "Receivers"
|
||||
},
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
}
|
||||
@ -4177,10 +4214,10 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
}
|
||||
@ -4204,7 +4241,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/{Recipient}/api/v2/alerts/groups": {
|
||||
"/api/alertmanager/{DatasourceID}/api/v2/alerts/groups": {
|
||||
"get": {
|
||||
"description": "get alertmanager alerts",
|
||||
"operationId": "RouteGetAMAlertGroups",
|
||||
@ -4251,10 +4288,10 @@
|
||||
"x-go-name": "Receivers"
|
||||
},
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
}
|
||||
@ -4278,7 +4315,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/{Recipient}/api/v2/silence/{SilenceId}": {
|
||||
"/api/alertmanager/{DatasourceID}/api/v2/silence/{SilenceId}": {
|
||||
"delete": {
|
||||
"description": "delete silence",
|
||||
"operationId": "RouteDeleteSilence",
|
||||
@ -4290,10 +4327,10 @@
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
}
|
||||
@ -4327,10 +4364,10 @@
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
}
|
||||
@ -4354,7 +4391,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/{Recipient}/api/v2/silences": {
|
||||
"/api/alertmanager/{DatasourceID}/api/v2/silences": {
|
||||
"get": {
|
||||
"description": "get silences",
|
||||
"operationId": "RouteGetSilences",
|
||||
@ -4369,10 +4406,10 @@
|
||||
"x-go-name": "Filter"
|
||||
},
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
}
|
||||
@ -4407,10 +4444,10 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
}
|
||||
@ -4434,16 +4471,16 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/{Recipient}/api/v2/status": {
|
||||
"/api/alertmanager/{DatasourceID}/api/v2/status": {
|
||||
"get": {
|
||||
"description": "get alertmanager status and configuration",
|
||||
"operationId": "RouteGetAMStatus",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
}
|
||||
@ -4467,16 +4504,16 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/{Recipient}/config/api/v1/alerts": {
|
||||
"/api/alertmanager/{DatasourceID}/config/api/v1/alerts": {
|
||||
"delete": {
|
||||
"description": "deletes the Alerting config for a tenant",
|
||||
"operationId": "RouteDeleteAlertingConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
}
|
||||
@ -4504,10 +4541,10 @@
|
||||
"operationId": "RouteGetAlertingConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
}
|
||||
@ -4542,10 +4579,10 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
}
|
||||
@ -4569,7 +4606,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/{Recipient}/config/api/v1/receivers/test": {
|
||||
"/api/alertmanager/{DatasourceID}/config/api/v1/receivers/test": {
|
||||
"post": {
|
||||
"operationId": "RoutePostTestReceivers",
|
||||
"parameters": [
|
||||
@ -4581,10 +4618,10 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
}
|
||||
@ -4706,16 +4743,16 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/prometheus/{Recipient}/api/v1/alerts": {
|
||||
"/api/prometheus/{DatasourceID}/api/v1/alerts": {
|
||||
"get": {
|
||||
"description": "gets the current alerts",
|
||||
"operationId": "RouteGetAlertStatuses",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
}
|
||||
@ -4733,16 +4770,16 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/prometheus/{Recipient}/api/v1/rules": {
|
||||
"/api/prometheus/{DatasourceID}/api/v1/rules": {
|
||||
"get": {
|
||||
"description": "gets the evaluation statuses of all rules",
|
||||
"operationId": "RouteGetRuleStatuses",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
}
|
||||
@ -5100,16 +5137,16 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/ruler/{Recipient}/api/v1/rules": {
|
||||
"/api/ruler/{DatasourceID}/api/v1/rules": {
|
||||
"get": {
|
||||
"description": "List rule groups",
|
||||
"operationId": "RouteGetRulesConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
},
|
||||
@ -5141,16 +5178,16 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/ruler/{Recipient}/api/v1/rules/{Namespace}": {
|
||||
"/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}": {
|
||||
"delete": {
|
||||
"description": "Delete namespace",
|
||||
"operationId": "RouteDeleteNamespaceRulesConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
},
|
||||
@ -5178,10 +5215,10 @@
|
||||
"operationId": "RouteGetNamespaceRulesConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
},
|
||||
@ -5216,10 +5253,10 @@
|
||||
"operationId": "RoutePostNameRulesConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
},
|
||||
@ -5250,16 +5287,16 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/ruler/{Recipient}/api/v1/rules/{Namespace}/{Groupname}": {
|
||||
"/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}/{Groupname}": {
|
||||
"delete": {
|
||||
"description": "Delete rule group",
|
||||
"operationId": "RouteDeleteRuleGroupConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
},
|
||||
@ -5293,10 +5330,10 @@
|
||||
"operationId": "RouteGetRulegGroupConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
},
|
||||
@ -5502,7 +5539,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v1/rule/test/{Recipient}": {
|
||||
"/api/v1/rule/test/{DatasourceID}": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
@ -5511,10 +5548,10 @@
|
||||
"operationId": "RouteTestRuleConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"format": "int64",
|
||||
"in": "path",
|
||||
"name": "Recipient",
|
||||
"name": "DatasourceID",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
},
|
||||
|
@ -465,7 +465,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/{Recipient}/api/v2/alerts": {
|
||||
"/api/alertmanager/{DatasourceID}/api/v2/alerts": {
|
||||
"get": {
|
||||
"description": "get alertmanager alerts",
|
||||
"tags": [
|
||||
@ -517,8 +517,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -558,8 +558,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -580,7 +580,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/{Recipient}/api/v2/alerts/groups": {
|
||||
"/api/alertmanager/{DatasourceID}/api/v2/alerts/groups": {
|
||||
"get": {
|
||||
"description": "get alertmanager alerts",
|
||||
"tags": [
|
||||
@ -632,8 +632,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -654,7 +654,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/{Recipient}/api/v2/silence/{SilenceId}": {
|
||||
"/api/alertmanager/{DatasourceID}/api/v2/silence/{SilenceId}": {
|
||||
"get": {
|
||||
"description": "get silence",
|
||||
"tags": [
|
||||
@ -671,8 +671,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -708,8 +708,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -730,7 +730,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/{Recipient}/api/v2/silences": {
|
||||
"/api/alertmanager/{DatasourceID}/api/v2/silences": {
|
||||
"get": {
|
||||
"description": "get silences",
|
||||
"tags": [
|
||||
@ -750,8 +750,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -788,8 +788,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -810,7 +810,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/{Recipient}/api/v2/status": {
|
||||
"/api/alertmanager/{DatasourceID}/api/v2/status": {
|
||||
"get": {
|
||||
"description": "get alertmanager status and configuration",
|
||||
"tags": [
|
||||
@ -821,8 +821,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -843,7 +843,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/{Recipient}/config/api/v1/alerts": {
|
||||
"/api/alertmanager/{DatasourceID}/config/api/v1/alerts": {
|
||||
"get": {
|
||||
"description": "gets an Alerting config",
|
||||
"tags": [
|
||||
@ -854,8 +854,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -892,8 +892,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -923,8 +923,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -945,7 +945,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/{Recipient}/config/api/v1/receivers/test": {
|
||||
"/api/alertmanager/{DatasourceID}/config/api/v1/receivers/test": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"alertmanager"
|
||||
@ -963,8 +963,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -1082,7 +1082,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/prometheus/{Recipient}/api/v1/alerts": {
|
||||
"/api/prometheus/{DatasourceID}/api/v1/alerts": {
|
||||
"get": {
|
||||
"description": "gets the current alerts",
|
||||
"tags": [
|
||||
@ -1093,8 +1093,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -1109,7 +1109,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/prometheus/{Recipient}/api/v1/rules": {
|
||||
"/api/prometheus/{DatasourceID}/api/v1/rules": {
|
||||
"get": {
|
||||
"description": "gets the evaluation statuses of all rules",
|
||||
"tags": [
|
||||
@ -1120,8 +1120,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -1476,7 +1476,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/ruler/{Recipient}/api/v1/rules": {
|
||||
"/api/ruler/{DatasourceID}/api/v1/rules": {
|
||||
"get": {
|
||||
"description": "List rule groups",
|
||||
"produces": [
|
||||
@ -1490,8 +1490,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
@ -1517,7 +1517,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/ruler/{Recipient}/api/v1/rules/{Namespace}": {
|
||||
"/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}": {
|
||||
"get": {
|
||||
"description": "Get rule groups by namespace",
|
||||
"produces": [
|
||||
@ -1531,8 +1531,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
@ -1566,8 +1566,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
@ -1604,8 +1604,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
@ -1626,7 +1626,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/ruler/{Recipient}/api/v1/rules/{Namespace}/{Groupname}": {
|
||||
"/api/ruler/{DatasourceID}/api/v1/rules/{Namespace}/{Groupname}": {
|
||||
"get": {
|
||||
"description": "Get rule group",
|
||||
"produces": [
|
||||
@ -1640,8 +1640,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
@ -1677,8 +1677,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
@ -1878,7 +1878,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/rule/test/{Recipient}": {
|
||||
"/api/v1/rule/test/{DatasourceID}": {
|
||||
"post": {
|
||||
"description": "Test a rule against external data source ruler",
|
||||
"consumes": [
|
||||
@ -1895,8 +1895,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
@ -1924,6 +1924,32 @@
|
||||
"type": "object",
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
},
|
||||
"AddApiKeyCommand": {
|
||||
"description": "COMMANDS",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"x-go-name": "Name"
|
||||
},
|
||||
"role": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Viewer",
|
||||
"Editor",
|
||||
"Admin"
|
||||
],
|
||||
"x-go-enum-desc": "Viewer ROLE_VIEWER\nEditor ROLE_EDITOR\nAdmin ROLE_ADMIN",
|
||||
"x-go-name": "Role"
|
||||
},
|
||||
"secondsToLive": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "SecondsToLive"
|
||||
}
|
||||
},
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/models"
|
||||
},
|
||||
"Alert": {
|
||||
"type": "object",
|
||||
"title": "Alert has info for an alert.",
|
||||
@ -2484,6 +2510,7 @@
|
||||
"x-go-name": "DisableResolveMessage"
|
||||
},
|
||||
"name": {
|
||||
"description": "Name is used as grouping key in the UI. Contact points with the\nsame name will be grouped in the UI.",
|
||||
"type": "string",
|
||||
"x-go-name": "Name"
|
||||
},
|
||||
@ -2499,6 +2526,7 @@
|
||||
"x-go-name": "Type"
|
||||
},
|
||||
"uid": {
|
||||
"description": "UID is the unique identifier of the contact point. This will be\nautomatically set be the Grafana.",
|
||||
"type": "string",
|
||||
"x-go-name": "UID"
|
||||
}
|
||||
@ -3883,6 +3911,10 @@
|
||||
},
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
},
|
||||
"Provenance": {
|
||||
"type": "string",
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||
},
|
||||
"PushoverConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -4085,6 +4117,9 @@
|
||||
"object_matchers": {
|
||||
"$ref": "#/definitions/ObjectMatchers"
|
||||
},
|
||||
"provenance": {
|
||||
"$ref": "#/definitions/Provenance"
|
||||
},
|
||||
"receiver": {
|
||||
"type": "string",
|
||||
"x-go-name": "Receiver"
|
||||
@ -4984,7 +5019,6 @@
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"alertGroup": {
|
||||
"description": "AlertGroup alert group",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"alerts",
|
||||
@ -5007,14 +5041,17 @@
|
||||
"$ref": "#/definitions/receiver"
|
||||
}
|
||||
},
|
||||
"x-go-name": "AlertGroup",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
|
||||
"$ref": "#/definitions/alertGroup"
|
||||
},
|
||||
"alertGroups": {
|
||||
"description": "AlertGroups alert groups",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/alertGroup"
|
||||
},
|
||||
"x-go-name": "AlertGroups",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
|
||||
"$ref": "#/definitions/alertGroups"
|
||||
},
|
||||
"alertStatus": {
|
||||
@ -5135,6 +5172,7 @@
|
||||
"$ref": "#/definitions/Duration"
|
||||
},
|
||||
"gettableAlert": {
|
||||
"description": "GettableAlert gettable alert",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"labels",
|
||||
@ -5194,8 +5232,6 @@
|
||||
"x-go-name": "UpdatedAt"
|
||||
}
|
||||
},
|
||||
"x-go-name": "GettableAlert",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
|
||||
"$ref": "#/definitions/gettableAlert"
|
||||
},
|
||||
"gettableAlerts": {
|
||||
@ -5207,7 +5243,6 @@
|
||||
"$ref": "#/definitions/gettableAlerts"
|
||||
},
|
||||
"gettableSilence": {
|
||||
"description": "GettableSilence gettable silence",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"comment",
|
||||
@ -5260,14 +5295,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": {
|
||||
@ -5442,6 +5480,7 @@
|
||||
"$ref": "#/definitions/postableSilence"
|
||||
},
|
||||
"receiver": {
|
||||
"description": "Receiver receiver",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
@ -5453,8 +5492,6 @@
|
||||
"x-go-name": "Name"
|
||||
}
|
||||
},
|
||||
"x-go-name": "Receiver",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
|
||||
"$ref": "#/definitions/receiver"
|
||||
},
|
||||
"silence": {
|
||||
|
@ -36,8 +36,8 @@ func toMacaronPath(path string) string {
|
||||
}
|
||||
|
||||
func backendType(ctx *models.ReqContext, cache datasources.CacheService) (apimodels.Backend, error) {
|
||||
recipient := web.Params(ctx.Req)[":Recipient"]
|
||||
if datasourceID, err := strconv.ParseInt(recipient, 10, 64); err == nil {
|
||||
datasourceID := web.Params(ctx.Req)[":DatasourceID"]
|
||||
if datasourceID, err := strconv.ParseInt(datasourceID, 10, 64); err == nil {
|
||||
if ds, err := cache.GetDatasource(ctx.Req.Context(), datasourceID, ctx.SignedInUser, ctx.SkipCache); err == nil {
|
||||
switch ds.Type {
|
||||
case "loki", "prometheus":
|
||||
@ -49,7 +49,7 @@ func backendType(ctx *models.ReqContext, cache datasources.CacheService) (apimod
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0, fmt.Errorf("unexpected backend type (%v)", recipient)
|
||||
return 0, fmt.Errorf("unexpected backend type (%v)", datasourceID)
|
||||
}
|
||||
|
||||
// macaron unsafely asserts the http.ResponseWriter is an http.CloseNotifier, which will panic.
|
||||
@ -98,12 +98,12 @@ func (p *AlertingProxy) withReq(
|
||||
newCtx, resp := replacedResponseWriter(ctx)
|
||||
newCtx.Req = req
|
||||
|
||||
recipient, err := strconv.ParseInt(web.Params(ctx.Req)[":Recipient"], 10, 64)
|
||||
datasourceID, err := strconv.ParseInt(web.Params(ctx.Req)[":DatasourceID"], 10, 64)
|
||||
if err != nil {
|
||||
return ErrResp(http.StatusBadRequest, err, "Recipient is invalid")
|
||||
return ErrResp(http.StatusBadRequest, err, "DatasourceID is invalid")
|
||||
}
|
||||
|
||||
p.DataProxy.ProxyDatasourceRequestWithID(newCtx, recipient)
|
||||
p.DataProxy.ProxyDatasourceRequestWithID(newCtx, datasourceID)
|
||||
|
||||
status := resp.Status()
|
||||
if status >= 400 {
|
||||
|
@ -16,8 +16,8 @@ func TestToMacaronPath(t *testing.T) {
|
||||
expectedOutputPath: "",
|
||||
},
|
||||
{
|
||||
inputPath: "/ruler/{Recipient}/api/v1/rules/{Namespace}/{Groupname}",
|
||||
expectedOutputPath: "/ruler/:Recipient/api/v1/rules/:Namespace/:Groupname",
|
||||
inputPath: "/ruler/{DatasourceID}/api/v1/rules/{Namespace}/{Groupname}",
|
||||
expectedOutputPath: "/ruler/:DatasourceID/api/v1/rules/:Namespace/:Groupname",
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
|
@ -292,8 +292,8 @@ func Instrument(
|
||||
|
||||
// TODO: We could look up the datasource type via our datasource service
|
||||
var backend string
|
||||
recipient := web.Params(c.Req)[":Recipient"]
|
||||
if recipient == apimodels.GrafanaBackend.String() || recipient == "" {
|
||||
datasourceID := web.Params(c.Req)[":DatasourceID"]
|
||||
if datasourceID == apimodels.GrafanaBackend.String() || datasourceID == "" {
|
||||
backend = GrafanaBackend
|
||||
} else {
|
||||
backend = ProxyBackend
|
||||
|
@ -2217,7 +2217,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/alertmanager/{Recipient}/api/v2/alerts": {
|
||||
"/alertmanager/{DatasourceID}/api/v2/alerts": {
|
||||
"get": {
|
||||
"description": "get alertmanager alerts",
|
||||
"tags": ["alertmanager"],
|
||||
@ -2267,8 +2267,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -2306,8 +2306,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -2328,7 +2328,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/alertmanager/{Recipient}/api/v2/alerts/groups": {
|
||||
"/alertmanager/{DatasourceID}/api/v2/alerts/groups": {
|
||||
"get": {
|
||||
"description": "get alertmanager alerts",
|
||||
"tags": ["alertmanager"],
|
||||
@ -2378,8 +2378,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -2400,7 +2400,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/alertmanager/{Recipient}/api/v2/silence/{SilenceId}": {
|
||||
"/alertmanager/{DatasourceID}/api/v2/silence/{SilenceId}": {
|
||||
"get": {
|
||||
"description": "get silence",
|
||||
"tags": ["alertmanager"],
|
||||
@ -2415,8 +2415,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -2450,8 +2450,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -2472,7 +2472,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/alertmanager/{Recipient}/api/v2/silences": {
|
||||
"/alertmanager/{DatasourceID}/api/v2/silences": {
|
||||
"get": {
|
||||
"description": "get silences",
|
||||
"tags": ["alertmanager"],
|
||||
@ -2490,8 +2490,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -2526,8 +2526,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -2548,7 +2548,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/alertmanager/{Recipient}/api/v2/status": {
|
||||
"/alertmanager/{DatasourceID}/api/v2/status": {
|
||||
"get": {
|
||||
"description": "get alertmanager status and configuration",
|
||||
"tags": ["alertmanager"],
|
||||
@ -2557,8 +2557,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -2579,7 +2579,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/alertmanager/{Recipient}/config/api/v1/alerts": {
|
||||
"/alertmanager/{DatasourceID}/config/api/v1/alerts": {
|
||||
"get": {
|
||||
"description": "gets an Alerting config",
|
||||
"tags": ["alertmanager"],
|
||||
@ -2588,8 +2588,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -2624,8 +2624,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -2653,8 +2653,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -2675,7 +2675,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/alertmanager/{Recipient}/config/api/v1/receivers/test": {
|
||||
"/alertmanager/{DatasourceID}/config/api/v1/receivers/test": {
|
||||
"post": {
|
||||
"tags": ["alertmanager"],
|
||||
"summary": "Test Grafana managed receivers without saving them.",
|
||||
@ -2691,8 +2691,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -6550,7 +6550,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/prometheus/{Recipient}/api/v1/alerts": {
|
||||
"/prometheus/{DatasourceID}/api/v1/alerts": {
|
||||
"get": {
|
||||
"description": "gets the current alerts",
|
||||
"tags": ["prometheus"],
|
||||
@ -6559,8 +6559,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -6575,7 +6575,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/prometheus/{Recipient}/api/v1/rules": {
|
||||
"/prometheus/{DatasourceID}/api/v1/rules": {
|
||||
"get": {
|
||||
"description": "gets the evaluation statuses of all rules",
|
||||
"tags": ["prometheus"],
|
||||
@ -6584,8 +6584,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -7487,7 +7487,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/ruler/{Recipient}/api/v1/rules": {
|
||||
"/ruler/{DatasourceID}/api/v1/rules": {
|
||||
"get": {
|
||||
"description": "List rule groups",
|
||||
"produces": ["application/json"],
|
||||
@ -7497,8 +7497,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
@ -7524,7 +7524,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/ruler/{Recipient}/api/v1/rules/{Namespace}": {
|
||||
"/ruler/{DatasourceID}/api/v1/rules/{Namespace}": {
|
||||
"get": {
|
||||
"description": "Get rule groups by namespace",
|
||||
"produces": ["application/json"],
|
||||
@ -7534,8 +7534,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
@ -7564,8 +7564,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
@ -7600,8 +7600,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
@ -7622,7 +7622,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/ruler/{Recipient}/api/v1/rules/{Namespace}/{Groupname}": {
|
||||
"/ruler/{DatasourceID}/api/v1/rules/{Namespace}/{Groupname}": {
|
||||
"get": {
|
||||
"description": "Get rule group",
|
||||
"produces": ["application/json"],
|
||||
@ -7632,8 +7632,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
@ -7667,8 +7667,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
@ -8158,6 +8158,14 @@
|
||||
"summary": "Add External Group.",
|
||||
"operationId": "addTeamGroupApi",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "TeamID",
|
||||
"name": "teamId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"x-go-name": "Body",
|
||||
"name": "body",
|
||||
@ -8166,14 +8174,6 @@
|
||||
"schema": {
|
||||
"$ref": "#/definitions/TeamGroupMapping"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "TeamID",
|
||||
"name": "teamId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@ -8207,16 +8207,16 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "GroupID",
|
||||
"name": "groupId",
|
||||
"x-go-name": "TeamID",
|
||||
"name": "teamId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "TeamID",
|
||||
"name": "teamId",
|
||||
"x-go-name": "GroupID",
|
||||
"name": "groupId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -9457,7 +9457,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/rule/test/{Recipient}": {
|
||||
"/v1/rule/test/{DatasourceID}": {
|
||||
"post": {
|
||||
"description": "Test a rule against external data source ruler",
|
||||
"consumes": ["application/json"],
|
||||
@ -9468,8 +9468,8 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"description": "DatasourceID should be the numeric datasource id",
|
||||
"name": "DatasourceID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
@ -11935,6 +11935,7 @@
|
||||
"x-go-name": "DisableResolveMessage"
|
||||
},
|
||||
"name": {
|
||||
"description": "Name is used as grouping key in the UI. Contact points with the\nsame name will be grouped in the UI.",
|
||||
"type": "string",
|
||||
"x-go-name": "Name"
|
||||
},
|
||||
@ -11950,6 +11951,7 @@
|
||||
"x-go-name": "Type"
|
||||
},
|
||||
"uid": {
|
||||
"description": "UID is the unique identifier of the contact point. This will be\nautomatically set be the Grafana.",
|
||||
"type": "string",
|
||||
"x-go-name": "UID"
|
||||
}
|
||||
@ -14538,6 +14540,10 @@
|
||||
},
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/extensions/recordedqueries/api"
|
||||
},
|
||||
"Provenance": {
|
||||
"type": "string",
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||
},
|
||||
"PushoverConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -14939,6 +14945,9 @@
|
||||
"object_matchers": {
|
||||
"$ref": "#/definitions/ObjectMatchers"
|
||||
},
|
||||
"provenance": {
|
||||
"$ref": "#/definitions/Provenance"
|
||||
},
|
||||
"receiver": {
|
||||
"type": "string",
|
||||
"x-go-name": "Receiver"
|
||||
@ -17149,7 +17158,6 @@
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"alertGroup": {
|
||||
"description": "AlertGroup alert group",
|
||||
"type": "object",
|
||||
"required": ["alerts", "labels", "receiver"],
|
||||
"properties": {
|
||||
@ -17167,14 +17175,17 @@
|
||||
"receiver": {
|
||||
"$ref": "#/definitions/receiver"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-go-name": "AlertGroup",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"alertGroups": {
|
||||
"description": "AlertGroups alert groups",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/alertGroup"
|
||||
}
|
||||
},
|
||||
"x-go-name": "AlertGroups",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"alertStatus": {
|
||||
"description": "AlertStatus alert status",
|
||||
@ -17277,6 +17288,7 @@
|
||||
"$ref": "#/definitions/Duration"
|
||||
},
|
||||
"gettableAlert": {
|
||||
"description": "GettableAlert gettable alert",
|
||||
"type": "object",
|
||||
"required": ["labels", "annotations", "endsAt", "fingerprint", "receivers", "startsAt", "status", "updatedAt"],
|
||||
"properties": {
|
||||
@ -17326,9 +17338,7 @@
|
||||
"format": "date-time",
|
||||
"x-go-name": "UpdatedAt"
|
||||
}
|
||||
},
|
||||
"x-go-name": "GettableAlert",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
}
|
||||
},
|
||||
"gettableAlerts": {
|
||||
"description": "GettableAlerts gettable alerts",
|
||||
@ -17338,7 +17348,6 @@
|
||||
}
|
||||
},
|
||||
"gettableSilence": {
|
||||
"description": "GettableSilence gettable silence",
|
||||
"type": "object",
|
||||
"required": ["comment", "createdBy", "endsAt", "matchers", "startsAt", "id", "status", "updatedAt"],
|
||||
"properties": {
|
||||
@ -17381,14 +17390,17 @@
|
||||
"format": "date-time",
|
||||
"x-go-name": "UpdatedAt"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-go-name": "GettableSilence",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"labelSet": {
|
||||
"description": "LabelSet label set",
|
||||
@ -17546,6 +17558,7 @@
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
},
|
||||
"receiver": {
|
||||
"description": "Receiver receiver",
|
||||
"type": "object",
|
||||
"required": ["name"],
|
||||
"properties": {
|
||||
@ -17554,9 +17567,7 @@
|
||||
"type": "string",
|
||||
"x-go-name": "Name"
|
||||
}
|
||||
},
|
||||
"x-go-name": "Receiver",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
|
||||
}
|
||||
},
|
||||
"silence": {
|
||||
"description": "Silence silence",
|
||||
|
@ -6588,6 +6588,14 @@
|
||||
"summary": "Add External Group.",
|
||||
"operationId": "addTeamGroupApi",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "TeamID",
|
||||
"name": "teamId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"x-go-name": "Body",
|
||||
"name": "body",
|
||||
@ -6596,14 +6604,6 @@
|
||||
"schema": {
|
||||
"$ref": "#/definitions/TeamGroupMapping"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "TeamID",
|
||||
"name": "teamId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@ -6637,16 +6637,16 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "GroupID",
|
||||
"name": "groupId",
|
||||
"x-go-name": "TeamID",
|
||||
"name": "teamId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "TeamID",
|
||||
"name": "teamId",
|
||||
"x-go-name": "GroupID",
|
||||
"name": "groupId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user