diff --git a/pkg/services/ngalert/api/api_prometheus.go b/pkg/services/ngalert/api/api_prometheus.go index 0c3f4320c40..f00b1ec0124 100644 --- a/pkg/services/ngalert/api/api_prometheus.go +++ b/pkg/services/ngalert/api/api_prometheus.go @@ -9,17 +9,16 @@ import ( "strings" "time" - apiv1 "github.com/prometheus/client_golang/api/prometheus/v1" - - "github.com/grafana/grafana/pkg/services/ngalert/eval" - ngmodels "github.com/grafana/grafana/pkg/services/ngalert/models" - "github.com/grafana/grafana/pkg/services/ngalert/store" - "github.com/grafana/grafana/pkg/api/response" "github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/models" apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions" + "github.com/grafana/grafana/pkg/services/ngalert/eval" + ngmodels "github.com/grafana/grafana/pkg/services/ngalert/models" "github.com/grafana/grafana/pkg/services/ngalert/state" + "github.com/grafana/grafana/pkg/services/ngalert/store" + + apiv1 "github.com/prometheus/client_golang/api/prometheus/v1" ) type PrometheusSrv struct { @@ -28,6 +27,8 @@ type PrometheusSrv struct { store store.RuleStore } +const queryIncludeInternalLabels = "includeInternalLabels" + func (srv PrometheusSrv) RouteGetAlertStatuses(c *models.ReqContext) response.Response { alertResponse := apimodels.AlertResponse{ DiscoveryBase: apimodels.DiscoveryBase{ @@ -37,6 +38,12 @@ func (srv PrometheusSrv) RouteGetAlertStatuses(c *models.ReqContext) response.Re Alerts: []*apimodels.Alert{}, }, } + + var labelOptions []ngmodels.LabelOption + if !c.QueryBoolWithDefault(queryIncludeInternalLabels, false) { + labelOptions = append(labelOptions, ngmodels.WithoutInternalLabels()) + } + for _, alertState := range srv.manager.GetAll(c.OrgId) { startsAt := alertState.StartsAt valString := "" @@ -45,7 +52,7 @@ func (srv PrometheusSrv) RouteGetAlertStatuses(c *models.ReqContext) response.Re } alertResponse.Data.Alerts = append(alertResponse.Data.Alerts, &apimodels.Alert{ - Labels: map[string]string(alertState.Labels), + Labels: alertState.GetLabels(labelOptions...), Annotations: alertState.Annotations, State: alertState.State.String(), ActiveAt: &startsAt, @@ -73,6 +80,11 @@ func (srv PrometheusSrv) RouteGetRuleStatuses(c *models.ReqContext) response.Res }, } + var labelOptions []ngmodels.LabelOption + if !c.QueryBoolWithDefault(queryIncludeInternalLabels, false) { + labelOptions = append(labelOptions, ngmodels.WithoutInternalLabels()) + } + namespaceMap, err := srv.store.GetNamespaces(c.Req.Context(), c.OrgId, c.SignedInUser) if err != nil { return ErrResp(http.StatusInternalServerError, err, "failed to get namespaces visible to the user") @@ -157,7 +169,7 @@ func (srv PrometheusSrv) RouteGetRuleStatuses(c *models.ReqContext) response.Res newRule := apimodels.Rule{ Name: rule.Title, - Labels: rule.Labels, + Labels: rule.GetLabels(labelOptions...), Health: "ok", Type: apiv1.RuleTypeAlerting, LastEvaluation: time.Time{}, @@ -169,8 +181,9 @@ func (srv PrometheusSrv) RouteGetRuleStatuses(c *models.ReqContext) response.Res if alertState.State == eval.Alerting { valString = alertState.LastEvaluationString } + alert := &apimodels.Alert{ - Labels: map[string]string(alertState.Labels), + Labels: alertState.GetLabels(labelOptions...), Annotations: alertState.Annotations, State: alertState.State.String(), ActiveAt: &activeAt, diff --git a/pkg/services/ngalert/api/api_prometheus_test.go b/pkg/services/ngalert/api/api_prometheus_test.go index 2c86b540595..f9e7a548c87 100644 --- a/pkg/services/ngalert/api/api_prometheus_test.go +++ b/pkg/services/ngalert/api/api_prometheus_test.go @@ -21,19 +21,14 @@ import ( ) func TestRouteGetAlertStatuses(t *testing.T) { - fakeStore := store.NewFakeRuleStore(t) - fakeAlertInstanceManager := NewFakeAlertInstanceManager(t) orgID := int64(1) - api := PrometheusSrv{ - log: log.NewNopLogger(), - manager: fakeAlertInstanceManager, - store: fakeStore, - } - - c := &models.ReqContext{SignedInUser: &models.SignedInUser{OrgId: orgID}} - t.Run("with no alerts", func(t *testing.T) { + _, _, api := setupAPI(t) + req, err := http.NewRequest("GET", "/api/v1/alerts", nil) + require.NoError(t, err) + c := &models.ReqContext{Context: &web.Context{Req: req}, SignedInUser: &models.SignedInUser{OrgId: orgID}} + r := api.RouteGetAlertStatuses(c) require.Equal(t, http.StatusOK, r.Status()) require.JSONEq(t, ` @@ -47,7 +42,54 @@ func TestRouteGetAlertStatuses(t *testing.T) { }) t.Run("with two alerts", func(t *testing.T) { - fakeAlertInstanceManager.GenerateAlertInstances(1, util.GenerateShortUID(), 2) + _, fakeAIM, api := setupAPI(t) + fakeAIM.GenerateAlertInstances(1, util.GenerateShortUID(), 2) + req, err := http.NewRequest("GET", "/api/v1/alerts", nil) + require.NoError(t, err) + c := &models.ReqContext{Context: &web.Context{Req: req}, SignedInUser: &models.SignedInUser{OrgId: orgID}} + + r := api.RouteGetAlertStatuses(c) + require.Equal(t, http.StatusOK, r.Status()) + require.JSONEq(t, ` +{ + "status": "success", + "data": { + "alerts": [{ + "labels": { + "alertname": "test_title_0", + "instance_label": "test", + "label": "test" + }, + "annotations": { + "annotation": "test" + }, + "state": "Normal", + "activeAt": "0001-01-01T00:00:00Z", + "value": "" + }, { + "labels": { + "alertname": "test_title_1", + "instance_label": "test", + "label": "test" + }, + "annotations": { + "annotation": "test" + }, + "state": "Normal", + "activeAt": "0001-01-01T00:00:00Z", + "value": "" + }] + } +}`, string(r.Body())) + }) + + t.Run("with the inclusion of internal labels", func(t *testing.T) { + _, fakeAIM, api := setupAPI(t) + fakeAIM.GenerateAlertInstances(orgID, util.GenerateShortUID(), 2) + req, err := http.NewRequest("GET", "/api/v1/alerts?includeInternalLabels=true", nil) + require.NoError(t, err) + c := &models.ReqContext{Context: &web.Context{Req: req}, SignedInUser: &models.SignedInUser{OrgId: orgID}} + r := api.RouteGetAlertStatuses(c) require.Equal(t, http.StatusOK, r.Status()) require.JSONEq(t, ` @@ -138,9 +180,63 @@ func TestRouteGetRuleStatuses(t *testing.T) { "activeAt": "0001-01-01T00:00:00Z", "value": "" }], - "labels": null, + "labels": { + "__a_private_label_on_the_rule__": "a_value" + }, + "health": "ok", + "type": "alerting", + "lastEvaluation": "2022-03-10T14:01:00Z", + "duration": 180, + "evaluationTime": 60 + }], + "interval": 60, + "lastEvaluation": "2022-03-10T14:01:00Z", + "evaluationTime": 0 + }] + } +} +`, string(r.Body())) + }) + + t.Run("with the inclusion of internal Labels", func(t *testing.T) { + fakeStore, fakeAIM, api := setupAPI(t) + generateRuleAndInstanceWithQuery(t, orgID, fakeAIM, fakeStore, withClassicConditionSingleQuery()) + + req, err := http.NewRequest("GET", "/api/v1/rules?includeInternalLabels=true", nil) + require.NoError(t, err) + c := &models.ReqContext{Context: &web.Context{Req: req}, SignedInUser: &models.SignedInUser{OrgId: orgID}} + + r := api.RouteGetRuleStatuses(c) + require.Equal(t, http.StatusOK, r.Status()) + require.JSONEq(t, ` +{ + "status": "success", + "data": { + "groups": [{ + "name": "rule-group", + "file": "namespaceUID", + "rules": [{ + "state": "inactive", + "name": "AlwaysFiring", + "query": "vector(1)", + "alerts": [{ + "labels": { + "job": "prometheus", + "__alert_rule_namespace_uid__": "test_namespace_uid", + "__alert_rule_uid__": "test_alert_rule_uid_0" + }, + "annotations": { + "severity": "critical" + }, + "state": "Normal", + "activeAt": "0001-01-01T00:00:00Z", + "value": "" + }], + "labels": { + "__a_private_label_on_the_rule__": "a_value", + "__alert_rule_uid__": "RuleUID" + }, "health": "ok", - "lastError": "", "type": "alerting", "lastEvaluation": "2022-03-10T14:01:00Z", "duration": 180, @@ -183,9 +279,10 @@ func TestRouteGetRuleStatuses(t *testing.T) { "activeAt": "0001-01-01T00:00:00Z", "value": "" }], - "labels": null, + "labels": { + "__a_private_label_on_the_rule__": "a_value" + }, "health": "ok", - "lastError": "", "type": "alerting", "lastEvaluation": "2022-03-10T14:01:00Z", "duration": 180, @@ -219,7 +316,11 @@ func generateRuleAndInstanceWithQuery(t *testing.T, orgID int64, fakeAIM *fakeAl rules := ngmodels.GenerateAlertRules(1, ngmodels.AlertRuleGen(withOrgID(orgID), asFixture(), query)) fakeAIM.GenerateAlertInstances(orgID, rules[0].UID, 1, func(s *state.State) *state.State { - s.Labels = data.Labels{"job": "prometheus"} + s.Labels = data.Labels{ + "job": "prometheus", + ngmodels.NamespaceUIDLabel: "test_namespace_uid", + ngmodels.RuleUIDLabel: "test_alert_rule_uid_0", + } s.Annotations = data.Labels{"severity": "critical"} return s }) @@ -237,7 +338,10 @@ func asFixture() func(r *ngmodels.AlertRule) { r.NamespaceUID = "namespaceUID" r.RuleGroup = "rule-group" r.UID = "RuleUID" - r.Labels = nil + r.Labels = map[string]string{ + "__a_private_label_on_the_rule__": "a_value", + ngmodels.RuleUIDLabel: "RuleUID", + } r.Annotations = nil r.IntervalSeconds = 60 r.For = 180 * time.Second diff --git a/pkg/services/ngalert/api/tooling/definitions/alertmanager.go b/pkg/services/ngalert/api/tooling/definitions/alertmanager.go index 40567675b02..df301280ec2 100644 --- a/pkg/services/ngalert/api/tooling/definitions/alertmanager.go +++ b/pkg/services/ngalert/api/tooling/definitions/alertmanager.go @@ -297,14 +297,6 @@ type GetSilencesParams struct { Filter []string `json:"filter"` } -// swagger:parameters RouteGetRuleStatuses RouteGetGrafanaRuleStatuses -type GetRuleStatusesParams struct { - // in: query - DashboardUID string - // in: query - PanelID int64 -} - // swagger:model type GettableStatus struct { // cluster diff --git a/pkg/services/ngalert/api/tooling/definitions/prom.go b/pkg/services/ngalert/api/tooling/definitions/prom.go index cf65ff3e46b..48fdeec8e7a 100644 --- a/pkg/services/ngalert/api/tooling/definitions/prom.go +++ b/pkg/services/ngalert/api/tooling/definitions/prom.go @@ -115,10 +115,10 @@ type Rule struct { Name string `json:"name"` // required: true Query string `json:"query"` - Labels overrideLabels `json:"labels"` + Labels overrideLabels `json:"labels,omitempty"` // required: true Health string `json:"health"` - LastError string `json:"lastError"` + LastError string `json:"lastError,omitempty"` // required: true Type v1.RuleType `json:"type"` LastEvaluation time.Time `json:"lastEvaluation"` @@ -142,3 +142,31 @@ type Alert struct { // override the labels type with a map for generation. // The custom marshaling for labels.Labels ends up doing this anyways. type overrideLabels map[string]string + +// swagger:parameters RouteGetGrafanaAlertStatuses +type GetGrafanaAlertStatusesParams struct { + // Include Grafana specific labels as part of the response. + // in: query + // required: false + // default: false + IncludeInternalLabels bool `json:"includeInternalLabels"` +} + +// swagger:parameters RouteGetGrafanaRuleStatuses +type GetGrafanaRuleStatusesParams struct { + // Include Grafana specific labels as part of the response. + // in: query + // required: false + // default: false + IncludeInternalLabels bool `json:"includeInternalLabels"` + + // Filter the list of rules to those that belong to the specified dashboard UID. + // in: query + // required: false + DashboardUID string + + // Filter the list of rules to those that belong to the specified panel ID. Dashboard UID must be specified. + // in: query + // required: false + PanelID int64 +} diff --git a/pkg/services/ngalert/api/tooling/post.json b/pkg/services/ngalert/api/tooling/post.json index e4a43aad5c3..2c852fd2faa 100644 --- a/pkg/services/ngalert/api/tooling/post.json +++ b/pkg/services/ngalert/api/tooling/post.json @@ -2803,6 +2803,7 @@ "x-go-package": "github.com/prometheus/alertmanager/timeinterval" }, "URL": { + "description": "The general form represented is:\n\n[scheme:][//[userinfo@]host][/]path[?query][#fragment]\n\nURLs that do not start with a slash after the scheme are interpreted as:\n\nscheme:opaque[?query][#fragment]\n\nNote that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.\nA consequence is that it is impossible to tell which slashes in the Path were\nslashes in the raw URL and which were %2f. This distinction is rarely important,\nbut when it is, the code should use RawPath, an optional field which only gets\nset if the default encoding is different from Path.\n\nURL's String method uses the EscapedPath method to obtain the path. See the\nEscapedPath method for more details.", "properties": { "ForceQuery": { "type": "boolean" @@ -2835,9 +2836,9 @@ "$ref": "#/definitions/Userinfo" } }, - "title": "URL is a custom URL type that allows validation at configuration load time.", + "title": "A URL represents a parsed URL (technically, a URI reference).", "type": "object", - "x-go-package": "github.com/prometheus/common/config" + "x-go-package": "net/url" }, "Userinfo": { "description": "The Userinfo type is an immutable encapsulation of username and\npassword details for a URL. An existing Userinfo value is guaranteed\nto have a username set (potentially empty, as allowed by RFC 2396),\nand optionally a password.", @@ -3034,6 +3035,7 @@ "x-go-package": "github.com/prometheus/alertmanager/api/v2/models" }, "alertGroup": { + "description": "AlertGroup alert group", "properties": { "alerts": { "description": "alerts", @@ -3055,9 +3057,7 @@ "labels", "receiver" ], - "type": "object", - "x-go-name": "AlertGroup", - "x-go-package": "github.com/prometheus/alertmanager/api/v2/models" + "type": "object" }, "alertGroups": { "items": { @@ -4615,6 +4615,16 @@ "get": { "description": "gets the current alerts", "operationId": "RouteGetGrafanaAlertStatuses", + "parameters": [ + { + "default": false, + "description": "Include Grafana specific labels as part of the response.", + "in": "query", + "name": "includeInternalLabels", + "type": "boolean", + "x-go-name": "IncludeInternalLabels" + } + ], "responses": { "200": { "description": "AlertResponse", @@ -4634,11 +4644,21 @@ "operationId": "RouteGetGrafanaRuleStatuses", "parameters": [ { + "default": false, + "description": "Include Grafana specific labels as part of the response.", + "in": "query", + "name": "includeInternalLabels", + "type": "boolean", + "x-go-name": "IncludeInternalLabels" + }, + { + "description": "Filter the list of rules to those that belong to the specified dashboard UID.", "in": "query", "name": "DashboardUID", "type": "string" }, { + "description": "Filter the list of rules to those that belong to the specified panel ID. Dashboard UID must be specified.", "format": "int64", "in": "query", "name": "PanelID", @@ -4690,17 +4710,6 @@ "description": "gets the evaluation statuses of all rules", "operationId": "RouteGetRuleStatuses", "parameters": [ - { - "in": "query", - "name": "DashboardUID", - "type": "string" - }, - { - "format": "int64", - "in": "query", - "name": "PanelID", - "type": "integer" - }, { "description": "Recipient should be the numeric datasource id", "format": "int64", diff --git a/pkg/services/ngalert/api/tooling/spec.json b/pkg/services/ngalert/api/tooling/spec.json index 1f5bd9ca9b4..481564747b6 100644 --- a/pkg/services/ngalert/api/tooling/spec.json +++ b/pkg/services/ngalert/api/tooling/spec.json @@ -1022,6 +1022,16 @@ "prometheus" ], "operationId": "RouteGetGrafanaAlertStatuses", + "parameters": [ + { + "type": "boolean", + "default": false, + "x-go-name": "IncludeInternalLabels", + "description": "Include Grafana specific labels as part of the response.", + "name": "includeInternalLabels", + "in": "query" + } + ], "responses": { "200": { "description": "AlertResponse", @@ -1040,14 +1050,24 @@ ], "operationId": "RouteGetGrafanaRuleStatuses", "parameters": [ + { + "type": "boolean", + "default": false, + "x-go-name": "IncludeInternalLabels", + "description": "Include Grafana specific labels as part of the response.", + "name": "includeInternalLabels", + "in": "query" + }, { "type": "string", + "description": "Filter the list of rules to those that belong to the specified dashboard UID.", "name": "DashboardUID", "in": "query" }, { "type": "integer", "format": "int64", + "description": "Filter the list of rules to those that belong to the specified panel ID. Dashboard UID must be specified.", "name": "PanelID", "in": "query" } @@ -1097,17 +1117,6 @@ ], "operationId": "RouteGetRuleStatuses", "parameters": [ - { - "type": "string", - "name": "DashboardUID", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "name": "PanelID", - "in": "query" - }, { "type": "integer", "format": "int64", @@ -4555,8 +4564,9 @@ "x-go-package": "github.com/prometheus/alertmanager/timeinterval" }, "URL": { + "description": "The general form represented is:\n\n[scheme:][//[userinfo@]host][/]path[?query][#fragment]\n\nURLs that do not start with a slash after the scheme are interpreted as:\n\nscheme:opaque[?query][#fragment]\n\nNote that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.\nA consequence is that it is impossible to tell which slashes in the Path were\nslashes in the raw URL and which were %2f. This distinction is rarely important,\nbut when it is, the code should use RawPath, an optional field which only gets\nset if the default encoding is different from Path.\n\nURL's String method uses the EscapedPath method to obtain the path. See the\nEscapedPath method for more details.", "type": "object", - "title": "URL is a custom URL type that allows validation at configuration load time.", + "title": "A URL represents a parsed URL (technically, a URI reference).", "properties": { "ForceQuery": { "type": "boolean" @@ -4589,7 +4599,7 @@ "$ref": "#/definitions/Userinfo" } }, - "x-go-package": "github.com/prometheus/common/config" + "x-go-package": "net/url" }, "Userinfo": { "description": "The Userinfo type is an immutable encapsulation of username and\npassword details for a URL. An existing Userinfo value is guaranteed\nto have a username set (potentially empty, as allowed by RFC 2396),\nand optionally a password.", @@ -4786,6 +4796,7 @@ "x-go-package": "github.com/prometheus/alertmanager/api/v2/models" }, "alertGroup": { + "description": "AlertGroup alert group", "type": "object", "required": [ "alerts", @@ -4808,8 +4819,6 @@ "$ref": "#/definitions/receiver" } }, - "x-go-name": "AlertGroup", - "x-go-package": "github.com/prometheus/alertmanager/api/v2/models", "$ref": "#/definitions/alertGroup" }, "alertGroups": { diff --git a/pkg/services/ngalert/models/alert_rule.go b/pkg/services/ngalert/models/alert_rule.go index 3216961469c..dbf5476f13c 100644 --- a/pkg/services/ngalert/models/alert_rule.go +++ b/pkg/services/ngalert/models/alert_rule.go @@ -18,12 +18,9 @@ var ( // ErrAlertRuleFailedGenerateUniqueUID is an error for failure to generate alert rule UID ErrAlertRuleFailedGenerateUniqueUID = errors.New("failed to generate alert rule UID") // ErrCannotEditNamespace is an error returned if the user does not have permissions to edit the namespace - ErrCannotEditNamespace = errors.New("user does not have permissions to edit the namespace") - // ErrRuleGroupNamespaceNotFound - ErrRuleGroupNamespaceNotFound = errors.New("rule group not found under this namespace") - // ErrAlertRuleFailedValidation - ErrAlertRuleFailedValidation = errors.New("invalid alert rule") - // ErrAlertRuleUniqueConstraintViolation + ErrCannotEditNamespace = errors.New("user does not have permissions to edit the namespace") + ErrRuleGroupNamespaceNotFound = errors.New("rule group not found under this namespace") + ErrAlertRuleFailedValidation = errors.New("invalid alert rule") ErrAlertRuleUniqueConstraintViolation = errors.New("a conflicting alert rule is found: rule title under the same organisation and folder should be unique") ) @@ -77,6 +74,12 @@ const ( OkErrState ExecutionErrorState = "OK" ) +// InternalLabelNameSet are labels that grafana automatically include as part of the labelset. +var InternalLabelNameSet = map[string]struct{}{ + RuleUIDLabel: {}, + NamespaceUIDLabel: {}, +} + const ( RuleUIDLabel = "__alert_rule_uid__" NamespaceUIDLabel = "__alert_rule_namespace_uid__" @@ -110,6 +113,29 @@ type AlertRule struct { Labels map[string]string } +type LabelOption func(map[string]string) + +func WithoutInternalLabels() LabelOption { + return func(labels map[string]string) { + for k := range labels { + if _, ok := InternalLabelNameSet[k]; ok { + delete(labels, k) + } + } + } +} + +// GetLabels returns the labels specified as part of the alert rule. +func (alertRule *AlertRule) GetLabels(opts ...LabelOption) map[string]string { + labels := alertRule.Labels + + for _, opt := range opts { + opt(labels) + } + + return labels +} + // Diff calculates diff between two alert rules. Returns nil if two rules are equal. Otherwise, returns cmputil.DiffReport func (alertRule *AlertRule) Diff(rule *AlertRule, ignore ...string) cmputil.DiffReport { var reporter cmputil.DiffReporter diff --git a/pkg/services/ngalert/state/state.go b/pkg/services/ngalert/state/state.go index 6b06eb1a453..270a029bafa 100644 --- a/pkg/services/ngalert/state/state.go +++ b/pkg/services/ngalert/state/state.go @@ -47,7 +47,7 @@ func NewEvaluationValues(m map[string]eval.NumberValueCapture) map[string]*float return result } -func (a *State) resultNormal(alertRule *ngModels.AlertRule, result eval.Result) { +func (a *State) resultNormal(_ *ngModels.AlertRule, result eval.Result) { a.Error = result.Error // should be nil since state is not error if a.State != eval.Normal { @@ -177,3 +177,13 @@ func (a *State) setEndsAt(alertRule *ngModels.AlertRule, result eval.Result) { a.EndsAt = result.EvaluatedAt.Add(ends * 3) } + +func (a *State) GetLabels(opts ...ngModels.LabelOption) map[string]string { + labels := a.Labels.Copy() + + for _, opt := range opts { + opt(labels) + } + + return labels +} diff --git a/pkg/tests/api/alerting/api_prometheus_test.go b/pkg/tests/api/alerting/api_prometheus_test.go index bce301c230c..8a834a19292 100644 --- a/pkg/tests/api/alerting/api_prometheus_test.go +++ b/pkg/tests/api/alerting/api_prometheus_test.go @@ -245,7 +245,6 @@ func TestPrometheusRules(t *testing.T) { "label1": "val1" }, "health": "ok", - "lastError": "", "type": "alerting", "lastEvaluation": "0001-01-01T00:00:00Z", "evaluationTime": 0 @@ -253,9 +252,7 @@ func TestPrometheusRules(t *testing.T) { "state": "inactive", "name": "AlwaysFiringButSilenced", "query": "[{\"refId\":\"A\",\"queryType\":\"\",\"relativeTimeRange\":{\"from\":18000,\"to\":10800},\"datasourceUid\":\"-100\",\"model\":{\"expression\":\"2 + 3 \\u003e 1\",\"intervalMs\":1000,\"maxDataPoints\":43200,\"type\":\"math\"}}]", - "labels": null, "health": "ok", - "lastError": "", "type": "alerting", "lastEvaluation": "0001-01-01T00:00:00Z", "evaluationTime": 0 @@ -300,7 +297,6 @@ func TestPrometheusRules(t *testing.T) { "label1": "val1" }, "health": "ok", - "lastError": "", "type": "alerting", "lastEvaluation": "0001-01-01T00:00:00Z", "evaluationTime": 0 @@ -308,9 +304,7 @@ func TestPrometheusRules(t *testing.T) { "state": "inactive", "name": "AlwaysFiringButSilenced", "query": "[{\"refId\":\"A\",\"queryType\":\"\",\"relativeTimeRange\":{\"from\":18000,\"to\":10800},\"datasourceUid\":\"-100\",\"model\":{\"expression\":\"2 + 3 \\u003e 1\",\"intervalMs\":1000,\"maxDataPoints\":43200,\"type\":\"math\"}}]", - "labels": null, "health": "ok", - "lastError": "", "type": "alerting", "lastEvaluation": "0001-01-01T00:00:00Z", "evaluationTime": 0 @@ -446,9 +440,7 @@ func TestPrometheusRulesFilterByDashboard(t *testing.T) { "__dashboardUid__": "%s", "__panelId__": "1" }, - "labels": null, "health": "ok", - "lastError": "", "type": "alerting", "lastEvaluation": "0001-01-01T00:00:00Z", "evaluationTime": 0 @@ -456,9 +448,7 @@ func TestPrometheusRulesFilterByDashboard(t *testing.T) { "state": "inactive", "name": "AlwaysFiringButSilenced", "query": "[{\"refId\":\"A\",\"queryType\":\"\",\"relativeTimeRange\":{\"from\":18000,\"to\":10800},\"datasourceUid\":\"-100\",\"model\":{\"expression\":\"2 + 3 \\u003e 1\",\"intervalMs\":1000,\"maxDataPoints\":43200,\"type\":\"math\"}}]", - "labels": null, "health": "ok", - "lastError": "", "type": "alerting", "lastEvaluation": "0001-01-01T00:00:00Z", "evaluationTime": 0 @@ -485,9 +475,7 @@ func TestPrometheusRulesFilterByDashboard(t *testing.T) { "__dashboardUid__": "%s", "__panelId__": "1" }, - "labels": null, "health": "ok", - "lastError": "", "type": "alerting", "lastEvaluation": "0001-01-01T00:00:00Z", "evaluationTime": 0 @@ -694,7 +682,6 @@ func TestPrometheusRulesPermissions(t *testing.T) { "label1": "val1" }, "health": "ok", - "lastError": "", "type": "alerting", "lastEvaluation": "0001-01-01T00:00:00Z", "evaluationTime": 0 @@ -718,7 +705,6 @@ func TestPrometheusRulesPermissions(t *testing.T) { "label1": "val1" }, "health": "ok", - "lastError": "", "type": "alerting", "lastEvaluation": "0001-01-01T00:00:00Z", "evaluationTime": 0 @@ -767,7 +753,6 @@ func TestPrometheusRulesPermissions(t *testing.T) { "label1": "val1" }, "health": "ok", - "lastError": "", "type": "alerting", "lastEvaluation": "0001-01-01T00:00:00Z", "evaluationTime": 0 diff --git a/public/api-merged.json b/public/api-merged.json index 9a6603027a1..3873ab8603e 100644 --- a/public/api-merged.json +++ b/public/api-merged.json @@ -19,46 +19,23 @@ }, "basePath": "/api", "paths": { - "/access-control/builtin-roles": { - "get": { - "description": "You need to have a permission with action `roles.builtin:list` with scope `roles:*`.", - "tags": ["access_control", "enterprise"], - "summary": "Get all built-in role assignments.", - "operationId": "listBuiltinRoles", - "responses": { - "200": { - "$ref": "#/responses/listBuiltinRolesResponse" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, + "/admin/ldap/reload": { "post": { - "description": "You need to have a permission with action `roles.builtin:add` and scope `permissions:delegate`. `permission:delegate` scope ensures that users can only create built-in role assignments with the roles which have same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to create a built-in role assignment which will allow to do that. This is done to prevent escalation of privileges.", - "tags": ["access_control", "enterprise"], - "summary": "Create a built-in role assignment.", - "operationId": "addBuiltinRole", - "parameters": [ + "security": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AddBuiltInRoleCommand" - } + "basic": [] } ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.config:reload`.", + "tags": ["admin_ldap"], + "summary": "Reloads the LDAP configuration.", + "operationId": "reloadLDAP", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -69,94 +46,60 @@ } } }, - "/access-control/builtin-roles/{builtinRole}/roles/{roleUID}": { - "delete": { - "description": "Deletes a built-in role assignment (for one of Viewer, Editor, Admin, or Grafana Admin) to the role with the provided UID.\n\nYou need to have a permission with action `roles.builtin:remove` and scope `permissions:delegate`. `permission:delegate` scope ensures that users can only remove built-in role assignments with the roles which have same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to remove a built-in role assignment which allows to do that.", - "tags": ["access_control", "enterprise"], - "summary": "Remove a built-in role assignment.", - "operationId": "removeBuiltinRole", - "parameters": [ - { - "type": "string", - "x-go-name": "RoleUID", - "name": "roleUID", - "in": "path", - "required": true - }, - { - "type": "string", - "x-go-name": "RoleUID", - "name": "builtinRole", - "in": "path", - "required": true - }, + "/admin/ldap/status": { + "get": { + "security": [ { - "type": "boolean", - "x-go-name": "Global", - "description": "A flag indicating if the assignment is global or not. If set to false, the default org ID of the authenticated user will be used from the request to remove assignment.", - "name": "global", - "in": "query" + "basic": [] } ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.status:read`.", + "tags": ["admin_ldap"], + "summary": "Attempts to connect to all the configured LDAP servers and returns information on whenever they're available or not.", + "operationId": "getLDAPStatus", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/access-control/roles": { - "get": { - "description": "Gets all existing roles. The response contains all global and organization local roles, for the organization which user is signed in.\n\nYou need to have a permission with action `roles:list` and scope `roles:*`.", - "tags": ["access_control", "enterprise"], - "summary": "Get all roles.", - "operationId": "getAllRoles", - "responses": { - "200": { - "$ref": "#/responses/getAllRolesResponse" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, + "/admin/ldap/sync/{user_id}": { "post": { - "description": "Creates a new custom role and maps given permissions to that role. Note that roles with the same prefix as Fixed Roles can’t be created.\n\nYou need to have a permission with action `roles:write` and scope `permissions:delegate`. `permission:delegate`` scope ensures that users can only create custom roles with the same, or a subset of permissions which the user has.\nFor example, if a user does not have required permissions for creating users, they won’t be able to create a custom role which allows to do that. This is done to prevent escalation of privileges.", - "tags": ["access_control", "enterprise"], - "summary": "Create a new custom role.", - "operationId": "createRoleWithPermissions", + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.user:sync`.", + "tags": ["admin_ldap"], + "summary": "Enables a single Grafana user to be synchronized against LDAP.", + "operationId": "syncLDAPUser", "parameters": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/SetUserRolesCommand" - } + "type": "integer", + "format": "int64", + "x-go-name": "UserID", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getRoleResponse" + "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -167,24 +110,32 @@ } } }, - "/access-control/roles/{roleUID}": { + "/admin/ldap/{user_name}": { "get": { - "description": "Get a role for the given UID.\n\nYou need to have a permission with action `roles:read` and scope `roles:*`.", - "tags": ["access_control", "enterprise"], - "summary": "Get a role.", - "operationId": "getRole", + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.user:read`.", + "tags": ["admin_ldap"], + "summary": "Finds an user based on a username in LDAP. This helps illustrate how would the particular user be mapped in Grafana when synced.", + "operationId": "getLDAPUser", "parameters": [ { "type": "string", - "x-go-name": "RoleUID", - "name": "roleUID", + "x-go-name": "UserID", + "name": "user_name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getRoleResponse" + "$ref": "#/responses/okResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -193,68 +144,62 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "You need to have a permission with action `roles:write` and scope `permissions:delegate`. `permission:delegate`` scope ensures that users can only create custom roles with the same, or a subset of permissions which the user has.", - "tags": ["access_control", "enterprise"], - "summary": "Update a custom role.", - "operationId": "updateRoleWithPermissions", - "parameters": [ + } + }, + "/admin/pause-all-alerts": { + "post": { + "security": [ { - "type": "string", - "x-go-name": "RoleUID", - "name": "roleUID", - "in": "path", - "required": true - }, + "basic": [] + } + ], + "tags": ["admin"], + "summary": "Pause/unpause all (legacy) alerts.", + "operationId": "pauseAllAlerts", + "parameters": [ { "x-go-name": "Body", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateRoleCommand" + "$ref": "#/definitions/PauseAllAlertsCommand" } } ], "responses": { "200": { - "$ref": "#/responses/getRoleResponse" + "$ref": "#/responses/pauseAlertsResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Delete a role with the given UID, and it’s permissions. If the role is assigned to a built-in role, the deletion operation will fail, unless force query param is set to true, and in that case all assignments will also be deleted.\n\nYou need to have a permission with action `roles:delete` and scope `permissions:delegate`. `permission:delegate` scope ensures that users can only delete a custom role with the same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to delete a custom role which allows to do that.", - "tags": ["access_control", "enterprise"], - "summary": "Delete a custom role.", - "operationId": "deleteCustomRole", - "parameters": [ + } + }, + "/admin/provisioning/accesscontrol/reload": { + "post": { + "security": [ { - "type": "string", - "x-go-name": "RoleUID", - "name": "roleUID", - "in": "path", - "required": true + "basic": [] } ], + "description": "Reloads the provisioning config files for access control again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:accesscontrol`.", + "tags": ["admin_provisioning"], + "summary": "Reload access control provisioning configurations.", + "operationId": "reloadProvisionedAccessControl", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -265,50 +210,50 @@ } } }, - "/access-control/status": { - "get": { - "description": "Returns an indicator to check if fine-grained access control is enabled or not.\n\nYou need to have a permission with action `status:accesscontrol` and scope `services:accesscontrol`.", - "tags": ["access_control", "enterprise"], - "summary": "Get status.", - "operationId": "getAccessControlStatus", + "/admin/provisioning/dashboards/reload": { + "post": { + "security": [ + { + "basic": [] + } + ], + "description": "Reloads the provisioning config files for dashboards again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:dashboards`.", + "tags": ["admin_provisioning"], + "summary": "Reload dashboard provisioning configurations.", + "operationId": "reloadProvisionedDashboards", "responses": { "200": { - "$ref": "#/responses/getAccessControlStatusResponse" + "$ref": "#/responses/okResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/access-control/teams/{teamId}/roles": { - "get": { - "description": "You need to have a permission with action `teams.roles:list` and scope `teams:id:\u003cteam ID\u003e`.", - "tags": ["access_control", "enterprise"], - "summary": "Get team roles.", - "operationId": "listTeamRoles", - "parameters": [ + "/admin/provisioning/datasources/reload": { + "post": { + "security": [ { - "type": "integer", - "format": "int64", - "x-go-name": "TeamID", - "name": "teamId", - "in": "path", - "required": true + "basic": [] } ], + "description": "Reloads the provisioning config files for datasources again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:datasources`.", + "tags": ["admin_provisioning"], + "summary": "Reload datasource provisioning configurations.", + "operationId": "reloadProvisionedDatasources", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -317,147 +262,98 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "You need to have a permission with action `teams.roles:add` and `teams.roles:remove` and scope `permissions:delegate` for each.", - "tags": ["access_control", "enterprise"], - "summary": "Update team role.", - "operationId": "setTeamRoles", - "parameters": [ + } + }, + "/admin/provisioning/notifications/reload": { + "post": { + "security": [ { - "type": "integer", - "format": "int64", - "x-go-name": "TeamID", - "name": "teamId", - "in": "path", - "required": true + "basic": [] } ], + "description": "Reloads the provisioning config files for legacy alert notifiers again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:notifications`.", + "tags": ["admin_provisioning"], + "summary": "Reload legacy alert notifier provisioning configurations.", + "operationId": "reloadProvisionedAlertNotifiers", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/admin/provisioning/plugins/reload": { "post": { - "description": "You need to have a permission with action `teams.roles:add` and scope `permissions:delegate`.", - "tags": ["access_control", "enterprise"], - "summary": "Add team role.", - "operationId": "addTeamRole", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "TeamID", - "name": "teamId", - "in": "path", - "required": true - }, + "security": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AddTeamRoleCommand" - } + "basic": [] } ], + "description": "Reloads the provisioning config files for plugins again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:plugin`.", + "tags": ["admin_provisioning"], + "summary": "Reload plugin provisioning configurations.", + "operationId": "reloadProvisionedPlugins", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/access-control/teams/{teamId}/roles/{roleUID}": { - "delete": { - "description": "You need to have a permission with action `teams.roles:remove` and scope `permissions:delegate`.", - "tags": ["access_control", "enterprise"], - "summary": "Remove team role.", - "operationId": "removeTeamRole", - "parameters": [ - { - "type": "string", - "x-go-name": "RoleUID", - "name": "roleUID", - "in": "path", - "required": true - }, + "/admin/settings": { + "get": { + "security": [ { - "type": "integer", - "format": "int64", - "x-go-name": "TeamID", - "name": "teamId", - "in": "path", - "required": true + "basic": [] } ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `settings:read` and scopes: `settings:*`, `settings:auth.saml:` and `settings:auth.saml:enabled` (property level).", + "tags": ["admin"], + "summary": "Fetch settings.", + "operationId": "getSettings", "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getSettingsResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" } } } }, - "/access-control/users/{user_id}/roles": { + "/admin/stats": { "get": { - "description": "Lists the roles that have been directly assigned to a given user. The list does not include built-in roles (Viewer, Editor, Admin or Grafana Admin), and it does not include roles that have been inherited from a team.\n\nYou need to have a permission with action `users.roles:list` and scope `users:id:\u003cuser ID\u003e`.", - "tags": ["access_control", "enterprise"], - "summary": "List roles assigned to a user.", - "operationId": "listUserRoles", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", - "required": true - } - ], + "description": "Only works with Basic Authentication (username and password). See introduction for an explanation.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `server:stats:read`.", + "tags": ["admin"], + "summary": "Fetch Grafana Stats.", + "operationId": "getStats", "responses": { "200": { - "$ref": "#/responses/getAllRolesResponse" + "$ref": "#/responses/getStatsResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -466,45 +362,19 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "Update the user’s role assignments to match the provided set of UIDs. This will remove any assigned roles that aren’t in the request and add roles that are in the set but are not already assigned to the user.\nIf you want to add or remove a single role, consider using Add a user role assignment or Remove a user role assignment instead.\n\nYou need to have a permission with action `users.roles:add` and `users.roles:remove` and scope `permissions:delegate` for each. `permission:delegate` scope ensures that users can only assign or unassign roles which have same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to assign or unassign a role which will allow to do that. This is done to prevent escalation of privileges.", - "tags": ["access_control", "enterprise"], - "summary": "Set user role assignments.", - "operationId": "setUserRoles", - "parameters": [ + } + }, + "/admin/users": { + "post": { + "security": [ { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", - "required": true + "basic": [] } ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "post": { - "description": "Assign a role to a specific user. For bulk updates consider Set user role assignments.\n\nYou need to have a permission with action `users.roles:add` and scope `permissions:delegate`. `permission:delegate` scope ensures that users can only assign roles which have same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to assign a role which will allow to do that. This is done to prevent escalation of privileges.", - "tags": ["access_control", "enterprise"], - "summary": "Add a user role assignment.", - "operationId": "addUserRole", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:create`.\nNote that OrgId is an optional parameter that can be used to assign a new user to a different organization when `auto_assign_org` is set to `true`.", + "tags": ["admin_users"], + "summary": "Create new user.", + "operationId": "createUser", "parameters": [ { "x-go-name": "Body", @@ -512,27 +382,25 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddUserRoleCommand" + "$ref": "#/definitions/AdminCreateUserForm" } - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/createUserResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "412": { + "$ref": "#/responses/preconditionFailedError" }, "500": { "$ref": "#/responses/internalServerError" @@ -540,27 +408,18 @@ } } }, - "/access-control/users/{user_id}/roles/{roleUID}": { + "/admin/users/{user_id}": { "delete": { - "description": "Revoke a role from a user. For bulk updates consider Set user role assignments.\n\nYou need to have a permission with action `users.roles:remove` and scope `permissions:delegate`. `permission:delegate` scope ensures that users can only unassign roles which have same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to unassign a role which will allow to do that. This is done to prevent escalation of privileges.", - "tags": ["access_control", "enterprise"], - "summary": "Remove a user role assignment.", - "operationId": "removeUserRole", - "parameters": [ - { - "type": "string", - "x-go-name": "RoleUID", - "name": "roleUID", - "in": "path", - "required": true - }, + "security": [ { - "type": "boolean", - "x-go-name": "Global", - "description": "A flag indicating if the assignment is global or not. If set to false, the default org ID of the authenticated user will be used from the request to remove assignment.", - "name": "global", - "in": "query" - }, + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:delete` and scope `global:users:*`.", + "tags": ["admin_users"], + "summary": "Delete global User.", + "operationId": "deleteUser", + "parameters": [ { "type": "integer", "format": "int64", @@ -574,8 +433,8 @@ "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -589,42 +448,30 @@ } } }, - "/admin/ldap-sync-status": { + "/admin/users/{user_id}/auth-tokens": { "get": { - "description": "You need to have a permission with action `ldap.status:read`.", - "tags": ["ldap_debug"], - "summary": "Available to grafana admins.", - "operationId": "getLDAPSyncStatus", - "responses": { - "200": { - "$ref": "#/responses/getLDAPSyncStatusResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/admin/ldap/reload": { - "post": { "security": [ { "basic": [] } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.config:reload`.", - "tags": ["admin_ldap"], - "summary": "Reloads the LDAP configuration.", - "operationId": "reloadLDAP", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.authtoken:list` and scope `global:users:*`.", + "tags": ["admin_users"], + "summary": "Return a list of all auth tokens (devices) that the user currently have logged in from.", + "operationId": "getAuthTokens", + "parameters": [ + { + "type": "integer", + "format": "int64", + "x-go-name": "UserID", + "name": "user_id", + "in": "path", + "required": true + } + ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getAuthTokensResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -638,17 +485,27 @@ } } }, - "/admin/ldap/status": { - "get": { + "/admin/users/{user_id}/disable": { + "post": { "security": [ { "basic": [] } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.status:read`.", - "tags": ["admin_ldap"], - "summary": "Attempts to connect to all the configured LDAP servers and returns information on whenever they're available or not.", - "operationId": "getLDAPStatus", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:disable` and scope `global:users:1` (userIDScope).", + "tags": ["admin_users"], + "summary": "Disable user.", + "operationId": "disableUser", + "parameters": [ + { + "type": "integer", + "format": "int64", + "x-go-name": "UserID", + "name": "user_id", + "in": "path", + "required": true + } + ], "responses": { "200": { "$ref": "#/responses/okResponse" @@ -659,23 +516,26 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/ldap/sync/{user_id}": { + "/admin/users/{user_id}/enable": { "post": { "security": [ { "basic": [] } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.user:sync`.", - "tags": ["admin_ldap"], - "summary": "Enables a single Grafana user to be synchronized against LDAP.", - "operationId": "syncLDAPUser", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:enable` and scope `global:users:1` (userIDScope).", + "tags": ["admin_users"], + "summary": "Enable user.", + "operationId": "enableUser", "parameters": [ { "type": "integer", @@ -696,28 +556,32 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/ldap/{user_name}": { - "get": { + "/admin/users/{user_id}/logout": { + "post": { "security": [ { "basic": [] } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.user:read`.", - "tags": ["admin_ldap"], - "summary": "Finds an user based on a username in LDAP. This helps illustrate how would the particular user be mapped in Grafana when synced.", - "operationId": "getLDAPUser", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.logout` and scope `global:users:*`.", + "tags": ["admin_users"], + "summary": "Logout user revokes all auth tokens (devices) for the user. User of issued auth tokens (devices) will no longer be logged in and will be required to authenticate again upon next activity.", + "operationId": "logoutUser", "parameters": [ { - "type": "string", + "type": "integer", + "format": "int64", "x-go-name": "UserID", - "name": "user_name", + "name": "user_id", "in": "path", "required": true } @@ -726,28 +590,35 @@ "200": { "$ref": "#/responses/okResponse" }, + "400": { + "$ref": "#/responses/badRequestError" + }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/pause-all-alerts": { - "post": { + "/admin/users/{user_id}/password": { + "put": { "security": [ { "basic": [] } ], - "tags": ["admin"], - "summary": "Pause/unpause all (legacy) alerts.", - "operationId": "pauseAllAlerts", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.password:update` and scope `global:users:*`.", + "tags": ["admin_users"], + "summary": "Set password for user.", + "operationId": "setPassword", "parameters": [ { "x-go-name": "Body", @@ -755,13 +626,24 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PauseAllAlertsCommand" + "$ref": "#/definitions/AdminUpdateUserPasswordForm" } + }, + { + "type": "integer", + "format": "int64", + "x-go-name": "UserID", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/pauseAlertsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -775,39 +657,38 @@ } } }, - "/admin/provisioning/access-control/reload": { - "post": { - "tags": ["access_control_provisioning", "enterprise"], - "summary": "You need to have a permission with action `provisioning:reload` with scope `provisioners:accesscontrol`.", - "operationId": "adminProvisioningReloadAccessControl", - "responses": { - "202": { - "$ref": "#/responses/acceptedResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "/admin/users/{user_id}/permissions": { + "put": { + "description": "Only works with Basic Authentication (username and password). See introduction for an explanation.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.permissions:update` and scope `global:users:*`.", + "tags": ["admin_users"], + "summary": "Set permissions for user.", + "operationId": "setPermissions", + "parameters": [ + { + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AdminUpdateUserPermissionsForm" + } }, - "403": { - "$ref": "#/responses/forbiddenError" - } - } - } - }, - "/admin/provisioning/accesscontrol/reload": { - "post": { - "security": [ { - "basic": [] + "type": "integer", + "format": "int64", + "x-go-name": "UserID", + "name": "user_id", + "in": "path", + "required": true } ], - "description": "Reloads the provisioning config files for access control again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:accesscontrol`.", - "tags": ["admin_provisioning"], - "summary": "Reload access control provisioning configurations.", - "operationId": "reloadProvisionedAccessControl", "responses": { "200": { "$ref": "#/responses/okResponse" }, + "400": { + "$ref": "#/responses/badRequestError" + }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -820,20 +701,30 @@ } } }, - "/admin/provisioning/dashboards/reload": { - "post": { + "/admin/users/{user_id}/quotas": { + "get": { "security": [ { "basic": [] } ], - "description": "Reloads the provisioning config files for dashboards again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:dashboards`.", - "tags": ["admin_provisioning"], - "summary": "Reload dashboard provisioning configurations.", - "operationId": "reloadProvisionedDashboards", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.quotas:list` and scope `global:users:1` (userIDScope).", + "tags": ["admin_users"], + "summary": "Fetch user quota.", + "operationId": "getUserQuota", + "parameters": [ + { + "type": "integer", + "format": "int64", + "x-go-name": "UserID", + "name": "user_id", + "in": "path", + "required": true + } + ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQuotaResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -841,23 +732,52 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/provisioning/datasources/reload": { - "post": { + "/admin/users/{user_id}/quotas/{quota_target}": { + "put": { "security": [ { "basic": [] } ], - "description": "Reloads the provisioning config files for datasources again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:datasources`.", - "tags": ["admin_provisioning"], - "summary": "Reload datasource provisioning configurations.", - "operationId": "reloadProvisionedDatasources", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.quotas:update` and scope `global:users:1` (userIDScope).", + "tags": ["admin_users"], + "summary": "Update user quota.", + "operationId": "updateUserQuota", + "parameters": [ + { + "type": "string", + "x-go-name": "QuotaTarget", + "name": "quota_target", + "in": "path", + "required": true + }, + { + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateUserQuotaCmd" + } + }, + { + "type": "integer", + "format": "int64", + "x-go-name": "UserID", + "name": "user_id", + "in": "path", + "required": true + } + ], "responses": { "200": { "$ref": "#/responses/okResponse" @@ -868,53 +788,76 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/provisioning/notifications/reload": { + "/admin/users/{user_id}/revoke-auth-token": { "post": { "security": [ { "basic": [] } ], - "description": "Reloads the provisioning config files for legacy alert notifiers again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:notifications`.", - "tags": ["admin_provisioning"], - "summary": "Reload legacy alert notifier provisioning configurations.", - "operationId": "reloadProvisionedAlertNotifiers", + "description": "Revokes the given auth token (device) for the user. User of issued auth token (device) will no longer be logged in and will be required to authenticate again upon next activity.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.authtoken:update` and scope `global:users:*`.", + "tags": ["admin_users"], + "summary": "Revoke auth token for user.", + "operationId": "revokeAuthToken", + "parameters": [ + { + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RevokeAuthTokenCmd" + } + }, + { + "type": "integer", + "format": "int64", + "x-go-name": "UserID", + "name": "user_id", + "in": "path", + "required": true + } + ], "responses": { "200": { "$ref": "#/responses/okResponse" }, + "400": { + "$ref": "#/responses/badRequestError" + }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/provisioning/plugins/reload": { - "post": { - "security": [ - { - "basic": [] - } - ], - "description": "Reloads the provisioning config files for plugins again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:plugin`.", - "tags": ["admin_provisioning"], - "summary": "Reload plugin provisioning configurations.", - "operationId": "reloadProvisionedPlugins", + "/alert-notifications": { + "get": { + "description": "Returns all notification channels that the authenticated user has permission to view.", + "tags": ["legacy_alerts_notification_channels"], + "summary": "Get all notification channels.", + "operationId": "getAlertNotificationChannels", "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getAlertNotificationChannelsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -926,41 +869,51 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/settings": { - "get": { - "security": [ + }, + "post": { + "description": "You can find the full list of [supported notifiers](https://grafana.com/docs/grafana/latest/alerting/old-alerting/notifications/#list-of-supported-notifiers) on the alert notifiers page.", + "tags": ["legacy_alerts_notification_channels"], + "summary": "Create notification channel.", + "operationId": "createAlertNotificationChannel", + "parameters": [ { - "basic": [] + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateAlertNotificationCommand" + } } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `settings:read` and scopes: `settings:*`, `settings:auth.saml:` and `settings:auth.saml:enabled` (property level).", - "tags": ["admin"], - "summary": "Fetch settings.", - "operationId": "getSettings", "responses": { "200": { - "$ref": "#/responses/getSettingsResponse" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" + }, + "409": { + "$ref": "#/responses/conflictError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/admin/stats": { + "/alert-notifications/lookup": { "get": { - "description": "Only works with Basic Authentication (username and password). See introduction for an explanation.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `server:stats:read`.", - "tags": ["admin"], - "summary": "Fetch Grafana Stats.", - "operationId": "getStats", + "description": "Returns all notification channels, but with less detailed information. Accessible by any authenticated user and is mainly used by providing alert notification channels in Grafana UI when configuring alert rule.", + "tags": ["legacy_alerts_notification_channels"], + "summary": "Get all notification channels (lookup)", + "operationId": "lookupAlertNotificationChannels", "responses": { "200": { - "$ref": "#/responses/getStatsResponse" + "$ref": "#/responses/lookupAlertNotificationChannelsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -974,17 +927,12 @@ } } }, - "/admin/users": { + "/alert-notifications/test": { "post": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:create`.\nNote that OrgId is an optional parameter that can be used to assign a new user to a different organization when `auto_assign_org` is set to `true`.", - "tags": ["admin_users"], - "summary": "Create new user.", - "operationId": "createUser", + "description": "Sends a test notification to the channel.", + "tags": ["legacy_alerts_notification_channels"], + "summary": "Test notification channel.", + "operationId": "notificationChannelTest", "parameters": [ { "x-go-name": "Body", @@ -992,13 +940,13 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AdminCreateUserForm" + "$ref": "#/definitions/NotificationTestCommand" } } ], "responses": { "200": { - "$ref": "#/responses/createUserResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -1010,7 +958,7 @@ "$ref": "#/responses/forbiddenError" }, "412": { - "$ref": "#/responses/preconditionFailedError" + "$ref": "#/responses/SMTPNotEnabledError" }, "500": { "$ref": "#/responses/internalServerError" @@ -1018,30 +966,24 @@ } } }, - "/admin/users/{user_id}": { - "delete": { - "security": [ + "/alert-notifications/uid/{notification_channel_uid}": { + "get": { + "description": "Returns the notification channel given the notification channel UID.", + "tags": ["legacy_alerts_notification_channels"], + "summary": "Get notification channel by UID", + "operationId": "getAlertNotificationChannelByUID", + "parameters": [ { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:delete` and scope `global:users:*`.", - "tags": ["admin_users"], - "summary": "Delete global User.", - "operationId": "deleteUser", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", - "required": true + "type": "string", + "x-go-name": "NotificationUID", + "name": "notification_channel_uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1056,69 +998,33 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/users/{user_id}/auth-tokens": { - "get": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.authtoken:list` and scope `global:users:*`.", - "tags": ["admin_users"], - "summary": "Return a list of all auth tokens (devices) that the user currently have logged in from.", - "operationId": "getAuthTokens", + }, + "put": { + "description": "Updates an existing notification channel identified by uid.", + "tags": ["legacy_alerts_notification_channels"], + "summary": "Update notification channel by UID.", + "operationId": "updateAlertNotificationChannelBYUID", "parameters": [ { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", + "type": "string", + "x-go-name": "NotificationUID", + "name": "notification_channel_uid", "in": "path", "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAuthTokensResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/admin/users/{user_id}/disable": { - "post": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:disable` and scope `global:users:1` (userIDScope).", - "tags": ["admin_users"], - "summary": "Disable user.", - "operationId": "disableUser", - "parameters": [ { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", - "required": true + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateAlertNotificationWithUidCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1133,32 +1039,24 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/users/{user_id}/enable": { - "post": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:enable` and scope `global:users:1` (userIDScope).", - "tags": ["admin_users"], - "summary": "Enable user.", - "operationId": "enableUser", + }, + "delete": { + "description": "Deletes an existing notification channel identified by UID.", + "tags": ["legacy_alerts_notification_channels"], + "summary": "Delete alert notification by UID.", + "operationId": "deleteAlertNotificationChannelByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", + "type": "string", + "x-go-name": "NotificationUID", + "name": "notification_channel_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/deleteAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1175,33 +1073,25 @@ } } }, - "/admin/users/{user_id}/logout": { - "post": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.logout` and scope `global:users:*`.", - "tags": ["admin_users"], - "summary": "Logout user revokes all auth tokens (devices) for the user. User of issued auth tokens (devices) will no longer be logged in and will be required to authenticate again upon next activity.", - "operationId": "logoutUser", + "/alert-notifications/{notification_channel_id}": { + "get": { + "description": "Returns the notification channel given the notification channel ID.", + "tags": ["legacy_alerts_notification_channels"], + "summary": "Get notification channel by ID.", + "operationId": "getAlertNotificationChannelByID", "parameters": [ { "type": "integer", "format": "int64", - "x-go-name": "UserID", - "name": "user_id", + "x-go-name": "NotificationID", + "name": "notification_channel_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1216,88 +1106,34 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/users/{user_id}/password": { + }, "put": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.password:update` and scope `global:users:*`.", - "tags": ["admin_users"], - "summary": "Set password for user.", - "operationId": "setPassword", + "description": "Updates an existing notification channel identified by ID.", + "tags": ["legacy_alerts_notification_channels"], + "summary": "Update notification channel by ID.", + "operationId": "updateAlertNotificationChannel", "parameters": [ - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AdminUpdateUserPasswordForm" - } - }, { "type": "integer", "format": "int64", - "x-go-name": "UserID", - "name": "user_id", + "x-go-name": "NotificationID", + "name": "notification_channel_id", "in": "path", "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/admin/users/{user_id}/permissions": { - "put": { - "description": "Only works with Basic Authentication (username and password). See introduction for an explanation.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.permissions:update` and scope `global:users:*`.", - "tags": ["admin_users"], - "summary": "Set permissions for user.", - "operationId": "setPermissions", - "parameters": [ { "x-go-name": "Body", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AdminUpdateUserPermissionsForm" + "$ref": "#/definitions/UpdateAlertNotificationCommand" } - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1305,36 +1141,32 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/users/{user_id}/quotas": { - "get": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.quotas:list` and scope `global:users:1` (userIDScope).", - "tags": ["admin_users"], - "summary": "Fetch user quota.", - "operationId": "getUserQuota", + }, + "delete": { + "description": "Deletes an existing notification channel identified by ID.", + "tags": ["legacy_alerts_notification_channels"], + "summary": "Delete alert notification by ID.", + "operationId": "deleteAlertNotificationChannel", "parameters": [ { "type": "integer", "format": "int64", - "x-go-name": "UserID", - "name": "user_id", + "x-go-name": "NotificationID", + "name": "notification_channel_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQuotaResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1351,988 +1183,11 @@ } } }, - "/admin/users/{user_id}/quotas/{quota_target}": { - "put": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.quotas:update` and scope `global:users:1` (userIDScope).", - "tags": ["admin_users"], - "summary": "Update user quota.", - "operationId": "updateUserQuota", - "parameters": [ - { - "type": "string", - "x-go-name": "QuotaTarget", - "name": "quota_target", - "in": "path", - "required": true - }, - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateUserQuotaCmd" - } - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/admin/users/{user_id}/revoke-auth-token": { - "post": { - "security": [ - { - "basic": [] - } - ], - "description": "Revokes the given auth token (device) for the user. User of issued auth token (device) will no longer be logged in and will be required to authenticate again upon next activity.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.authtoken:update` and scope `global:users:*`.", - "tags": ["admin_users"], - "summary": "Revoke auth token for user.", - "operationId": "revokeAuthToken", - "parameters": [ - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RevokeAuthTokenCmd" - } - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/alert-notifications": { - "get": { - "description": "Returns all notification channels that the authenticated user has permission to view.", - "tags": ["legacy_alerts_notification_channels"], - "summary": "Get all notification channels.", - "operationId": "getAlertNotificationChannels", - "responses": { - "200": { - "$ref": "#/responses/getAlertNotificationChannelsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "post": { - "description": "You can find the full list of [supported notifiers](https://grafana.com/docs/grafana/latest/alerting/old-alerting/notifications/#list-of-supported-notifiers) on the alert notifiers page.", - "tags": ["legacy_alerts_notification_channels"], - "summary": "Create notification channel.", - "operationId": "createAlertNotificationChannel", - "parameters": [ - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateAlertNotificationCommand" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "409": { - "$ref": "#/responses/conflictError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/alert-notifications/lookup": { - "get": { - "description": "Returns all notification channels, but with less detailed information. Accessible by any authenticated user and is mainly used by providing alert notification channels in Grafana UI when configuring alert rule.", - "tags": ["legacy_alerts_notification_channels"], - "summary": "Get all notification channels (lookup)", - "operationId": "lookupAlertNotificationChannels", - "responses": { - "200": { - "$ref": "#/responses/lookupAlertNotificationChannelsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/alert-notifications/test": { - "post": { - "description": "Sends a test notification to the channel.", - "tags": ["legacy_alerts_notification_channels"], - "summary": "Test notification channel.", - "operationId": "notificationChannelTest", - "parameters": [ - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/NotificationTestCommand" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "412": { - "$ref": "#/responses/SMTPNotEnabledError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/alert-notifications/uid/{notification_channel_uid}": { - "get": { - "description": "Returns the notification channel given the notification channel UID.", - "tags": ["legacy_alerts_notification_channels"], - "summary": "Get notification channel by UID", - "operationId": "getAlertNotificationChannelByUID", - "parameters": [ - { - "type": "string", - "x-go-name": "NotificationUID", - "name": "notification_channel_uid", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "put": { - "description": "Updates an existing notification channel identified by uid.", - "tags": ["legacy_alerts_notification_channels"], - "summary": "Update notification channel by UID.", - "operationId": "updateAlertNotificationChannelBYUID", - "parameters": [ - { - "type": "string", - "x-go-name": "NotificationUID", - "name": "notification_channel_uid", - "in": "path", - "required": true - }, - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateAlertNotificationWithUidCommand" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "delete": { - "description": "Deletes an existing notification channel identified by UID.", - "tags": ["legacy_alerts_notification_channels"], - "summary": "Delete alert notification by UID.", - "operationId": "deleteAlertNotificationChannelByUID", - "parameters": [ - { - "type": "string", - "x-go-name": "NotificationUID", - "name": "notification_channel_uid", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/deleteAlertNotificationChannelResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/alert-notifications/{notification_channel_id}": { - "get": { - "description": "Returns the notification channel given the notification channel ID.", - "tags": ["legacy_alerts_notification_channels"], - "summary": "Get notification channel by ID.", - "operationId": "getAlertNotificationChannelByID", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "NotificationID", - "name": "notification_channel_id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "put": { - "description": "Updates an existing notification channel identified by ID.", - "tags": ["legacy_alerts_notification_channels"], - "summary": "Update notification channel by ID.", - "operationId": "updateAlertNotificationChannel", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "NotificationID", - "name": "notification_channel_id", - "in": "path", - "required": true - }, - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateAlertNotificationCommand" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "delete": { - "description": "Deletes an existing notification channel identified by ID.", - "tags": ["legacy_alerts_notification_channels"], - "summary": "Delete alert notification by ID.", - "operationId": "deleteAlertNotificationChannel", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "NotificationID", - "name": "notification_channel_id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/alertmanager/grafana/api/v2/alerts": { - "get": { - "description": "get alertmanager alerts", - "tags": ["alertmanager"], - "operationId": "RouteGetGrafanaAMAlerts", - "parameters": [ - { - "type": "boolean", - "default": true, - "x-go-name": "Active", - "description": "Show active alerts", - "name": "active", - "in": "query" - }, - { - "type": "boolean", - "default": true, - "x-go-name": "Silenced", - "description": "Show silenced alerts", - "name": "silenced", - "in": "query" - }, - { - "type": "boolean", - "default": true, - "x-go-name": "Inhibited", - "description": "Show inhibited alerts", - "name": "inhibited", - "in": "query" - }, - { - "type": "array", - "items": { - "type": "string" - }, - "x-go-name": "Matchers", - "description": "A list of matchers to filter alerts by", - "name": "filter", - "in": "query" - }, - { - "type": "string", - "x-go-name": "Receivers", - "description": "A regex matching receivers to filter alerts by", - "name": "receiver", - "in": "query" - } - ], - "responses": { - "200": { - "description": "gettableAlerts", - "schema": { - "$ref": "#/definitions/gettableAlerts" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - }, - "post": { - "description": "create alertmanager alerts", - "tags": ["alertmanager"], - "operationId": "RoutePostGrafanaAMAlerts", - "parameters": [ - { - "name": "PostableAlerts", - "in": "body", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/postableAlert" - } - } - } - ], - "responses": { - "200": { - "description": "Ack", - "schema": { - "$ref": "#/definitions/Ack" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - } - }, - "/alertmanager/grafana/api/v2/alerts/groups": { - "get": { - "description": "get alertmanager alerts", - "tags": ["alertmanager"], - "operationId": "RouteGetGrafanaAMAlertGroups", - "parameters": [ - { - "type": "boolean", - "default": true, - "x-go-name": "Active", - "description": "Show active alerts", - "name": "active", - "in": "query" - }, - { - "type": "boolean", - "default": true, - "x-go-name": "Silenced", - "description": "Show silenced alerts", - "name": "silenced", - "in": "query" - }, - { - "type": "boolean", - "default": true, - "x-go-name": "Inhibited", - "description": "Show inhibited alerts", - "name": "inhibited", - "in": "query" - }, - { - "type": "array", - "items": { - "type": "string" - }, - "x-go-name": "Matchers", - "description": "A list of matchers to filter alerts by", - "name": "filter", - "in": "query" - }, - { - "type": "string", - "x-go-name": "Receivers", - "description": "A regex matching receivers to filter alerts by", - "name": "receiver", - "in": "query" - } - ], - "responses": { - "200": { - "description": "alertGroups", - "schema": { - "$ref": "#/definitions/alertGroups" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - } - }, - "/alertmanager/grafana/api/v2/silence/{SilenceId}": { - "get": { - "description": "get silence", - "tags": ["alertmanager"], - "operationId": "RouteGetGrafanaSilence", - "parameters": [ - { - "type": "string", - "name": "SilenceId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "gettableSilence", - "schema": { - "$ref": "#/definitions/gettableSilence" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - }, - "delete": { - "description": "delete silence", - "tags": ["alertmanager"], - "operationId": "RouteDeleteGrafanaSilence", - "parameters": [ - { - "type": "string", - "name": "SilenceId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "Ack", - "schema": { - "$ref": "#/definitions/Ack" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - } - }, - "/alertmanager/grafana/api/v2/silences": { - "get": { - "description": "get silences", - "tags": ["alertmanager"], - "operationId": "RouteGetGrafanaSilences", - "parameters": [ - { - "type": "array", - "items": { - "type": "string" - }, - "x-go-name": "Filter", - "name": "filter", - "in": "query" - } - ], - "responses": { - "200": { - "description": "gettableSilences", - "schema": { - "$ref": "#/definitions/gettableSilences" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - }, - "post": { - "description": "create silence", - "tags": ["alertmanager"], - "operationId": "RouteCreateGrafanaSilence", - "parameters": [ - { - "name": "Silence", - "in": "body", - "schema": { - "$ref": "#/definitions/postableSilence" - } - } - ], - "responses": { - "201": { - "description": "gettableSilence", - "schema": { - "$ref": "#/definitions/gettableSilence" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - } - }, - "/alertmanager/grafana/api/v2/status": { - "get": { - "description": "get alertmanager status and configuration", - "tags": ["alertmanager"], - "operationId": "RouteGetGrafanaAMStatus", - "responses": { - "200": { - "description": "GettableStatus", - "schema": { - "$ref": "#/definitions/GettableStatus" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - } - }, - "/alertmanager/grafana/config/api/v1/alerts": { - "get": { - "description": "gets an Alerting config", - "tags": ["alertmanager"], - "operationId": "RouteGetGrafanaAlertingConfig", - "responses": { - "200": { - "description": "GettableUserConfig", - "schema": { - "$ref": "#/definitions/GettableUserConfig" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - }, - "post": { - "description": "sets an Alerting config", - "tags": ["alertmanager"], - "operationId": "RoutePostGrafanaAlertingConfig", - "parameters": [ - { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/PostableUserConfig" - } - } - ], - "responses": { - "201": { - "description": "Ack", - "schema": { - "$ref": "#/definitions/Ack" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - }, - "delete": { - "description": "deletes the Alerting config for a tenant", - "tags": ["alertmanager"], - "operationId": "RouteDeleteGrafanaAlertingConfig", - "responses": { - "200": { - "description": "Ack", - "schema": { - "$ref": "#/definitions/Ack" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - } - }, - "/alertmanager/grafana/config/api/v1/receivers/test": { - "post": { - "tags": ["alertmanager"], - "summary": "Test Grafana managed receivers without saving them.", - "operationId": "RoutePostTestGrafanaReceivers", - "parameters": [ - { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/TestReceiversConfigBodyParams" - } - } - ], - "responses": { - "200": { - "description": "Ack", - "schema": { - "$ref": "#/definitions/Ack" - } - }, - "207": { - "description": "MultiStatus", - "schema": { - "$ref": "#/definitions/MultiStatus" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - }, - "403": { - "description": "PermissionDenied", - "schema": { - "$ref": "#/definitions/PermissionDenied" - } - }, - "404": { - "description": "AlertManagerNotFound", - "schema": { - "$ref": "#/definitions/AlertManagerNotFound" - } - }, - "408": { - "description": "Failure", - "schema": { - "$ref": "#/definitions/Failure" - } - }, - "409": { - "description": "AlertManagerNotReady", - "schema": { - "$ref": "#/definitions/AlertManagerNotReady" - } - } - } - } - }, - "/alertmanager/{Recipient}/api/v2/alerts": { - "get": { - "description": "get alertmanager alerts", - "tags": ["alertmanager"], - "operationId": "RouteGetAMAlerts", - "parameters": [ - { - "type": "boolean", - "default": true, - "x-go-name": "Active", - "description": "Show active alerts", - "name": "active", - "in": "query" - }, - { - "type": "boolean", - "default": true, - "x-go-name": "Silenced", - "description": "Show silenced alerts", - "name": "silenced", - "in": "query" - }, - { - "type": "boolean", - "default": true, - "x-go-name": "Inhibited", - "description": "Show inhibited alerts", - "name": "inhibited", - "in": "query" - }, - { - "type": "array", - "items": { - "type": "string" - }, - "x-go-name": "Matchers", - "description": "A list of matchers to filter alerts by", - "name": "filter", - "in": "query" - }, - { - "type": "string", - "x-go-name": "Receivers", - "description": "A regex matching receivers to filter alerts by", - "name": "receiver", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Recipient should be the numeric datasource id", - "name": "Recipient", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "gettableAlerts", - "schema": { - "$ref": "#/definitions/gettableAlerts" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - }, - "post": { - "description": "create alertmanager alerts", - "tags": ["alertmanager"], - "operationId": "RoutePostAMAlerts", - "parameters": [ - { - "name": "PostableAlerts", - "in": "body", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/postableAlert" - } - } - }, - { - "type": "integer", - "format": "int64", - "description": "Recipient should be the numeric datasource id", - "name": "Recipient", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "Ack", - "schema": { - "$ref": "#/definitions/Ack" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - } - }, - "/alertmanager/{Recipient}/api/v2/alerts/groups": { - "get": { - "description": "get alertmanager alerts", - "tags": ["alertmanager"], - "operationId": "RouteGetAMAlertGroups", + "/alertmanager/grafana/api/v2/alerts": { + "get": { + "description": "get alertmanager alerts", + "tags": ["alertmanager"], + "operationId": "RouteGetGrafanaAMAlerts", "parameters": [ { "type": "boolean", @@ -2374,133 +1229,13 @@ "description": "A regex matching receivers to filter alerts by", "name": "receiver", "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Recipient should be the numeric datasource id", - "name": "Recipient", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "alertGroups", - "schema": { - "$ref": "#/definitions/alertGroups" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - } - }, - "/alertmanager/{Recipient}/api/v2/silence/{SilenceId}": { - "get": { - "description": "get silence", - "tags": ["alertmanager"], - "operationId": "RouteGetSilence", - "parameters": [ - { - "type": "string", - "name": "SilenceId", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "description": "Recipient should be the numeric datasource id", - "name": "Recipient", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "gettableSilence", - "schema": { - "$ref": "#/definitions/gettableSilence" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - }, - "delete": { - "description": "delete silence", - "tags": ["alertmanager"], - "operationId": "RouteDeleteSilence", - "parameters": [ - { - "type": "string", - "name": "SilenceId", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "description": "Recipient should be the numeric datasource id", - "name": "Recipient", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "Ack", - "schema": { - "$ref": "#/definitions/Ack" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - } - }, - "/alertmanager/{Recipient}/api/v2/silences": { - "get": { - "description": "get silences", - "tags": ["alertmanager"], - "operationId": "RouteGetSilences", - "parameters": [ - { - "type": "array", - "items": { - "type": "string" - }, - "x-go-name": "Filter", - "name": "filter", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Recipient should be the numeric datasource id", - "name": "Recipient", - "in": "path", - "required": true } ], "responses": { "200": { - "description": "gettableSilences", + "description": "gettableAlerts", "schema": { - "$ref": "#/definitions/gettableSilences" + "$ref": "#/definitions/gettableAlerts" } }, "400": { @@ -2512,62 +1247,26 @@ } }, "post": { - "description": "create silence", - "tags": ["alertmanager"], - "operationId": "RouteCreateSilence", - "parameters": [ - { - "name": "Silence", - "in": "body", - "schema": { - "$ref": "#/definitions/postableSilence" - } - }, - { - "type": "integer", - "format": "int64", - "description": "Recipient should be the numeric datasource id", - "name": "Recipient", - "in": "path", - "required": true - } - ], - "responses": { - "201": { - "description": "gettableSilence", - "schema": { - "$ref": "#/definitions/gettableSilence" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - } - }, - "/alertmanager/{Recipient}/api/v2/status": { - "get": { - "description": "get alertmanager status and configuration", + "description": "create alertmanager alerts", "tags": ["alertmanager"], - "operationId": "RouteGetAMStatus", + "operationId": "RoutePostGrafanaAMAlerts", "parameters": [ { - "type": "integer", - "format": "int64", - "description": "Recipient should be the numeric datasource id", - "name": "Recipient", - "in": "path", - "required": true + "name": "PostableAlerts", + "in": "body", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/postableAlert" + } + } } ], "responses": { "200": { - "description": "GettableStatus", + "description": "Ack", "schema": { - "$ref": "#/definitions/GettableStatus" + "$ref": "#/definitions/Ack" } }, "400": { @@ -2579,26 +1278,59 @@ } } }, - "/alertmanager/{Recipient}/config/api/v1/alerts": { + "/alertmanager/grafana/api/v2/alerts/groups": { "get": { - "description": "gets an Alerting config", + "description": "get alertmanager alerts", "tags": ["alertmanager"], - "operationId": "RouteGetAlertingConfig", + "operationId": "RouteGetGrafanaAMAlertGroups", "parameters": [ { - "type": "integer", - "format": "int64", - "description": "Recipient should be the numeric datasource id", - "name": "Recipient", - "in": "path", - "required": true + "type": "boolean", + "default": true, + "x-go-name": "Active", + "description": "Show active alerts", + "name": "active", + "in": "query" + }, + { + "type": "boolean", + "default": true, + "x-go-name": "Silenced", + "description": "Show silenced alerts", + "name": "silenced", + "in": "query" + }, + { + "type": "boolean", + "default": true, + "x-go-name": "Inhibited", + "description": "Show inhibited alerts", + "name": "inhibited", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Matchers", + "description": "A list of matchers to filter alerts by", + "name": "filter", + "in": "query" + }, + { + "type": "string", + "x-go-name": "Receivers", + "description": "A regex matching receivers to filter alerts by", + "name": "receiver", + "in": "query" } ], "responses": { "200": { - "description": "GettableUserConfig", + "description": "alertGroups", "schema": { - "$ref": "#/definitions/GettableUserConfig" + "$ref": "#/definitions/alertGroups" } }, "400": { @@ -2608,33 +1340,26 @@ } } } - }, - "post": { - "description": "sets an Alerting config", + } + }, + "/alertmanager/grafana/api/v2/silence/{SilenceId}": { + "get": { + "description": "get silence", "tags": ["alertmanager"], - "operationId": "RoutePostAlertingConfig", + "operationId": "RouteGetGrafanaSilence", "parameters": [ { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/PostableUserConfig" - } - }, - { - "type": "integer", - "format": "int64", - "description": "Recipient should be the numeric datasource id", - "name": "Recipient", + "type": "string", + "name": "SilenceId", "in": "path", "required": true } ], "responses": { - "201": { - "description": "Ack", + "200": { + "description": "gettableSilence", "schema": { - "$ref": "#/definitions/Ack" + "$ref": "#/definitions/gettableSilence" } }, "400": { @@ -2646,15 +1371,13 @@ } }, "delete": { - "description": "deletes the Alerting config for a tenant", + "description": "delete silence", "tags": ["alertmanager"], - "operationId": "RouteDeleteAlertingConfig", + "operationId": "RouteDeleteGrafanaSilence", "parameters": [ { - "type": "integer", - "format": "int64", - "description": "Recipient should be the numeric datasource id", - "name": "Recipient", + "type": "string", + "name": "SilenceId", "in": "path", "required": true } @@ -2675,39 +1398,27 @@ } } }, - "/alertmanager/{Recipient}/config/api/v1/receivers/test": { - "post": { + "/alertmanager/grafana/api/v2/silences": { + "get": { + "description": "get silences", "tags": ["alertmanager"], - "summary": "Test Grafana managed receivers without saving them.", - "operationId": "RoutePostTestReceivers", + "operationId": "RouteGetGrafanaSilences", "parameters": [ { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/TestReceiversConfigBodyParams" - } - }, - { - "type": "integer", - "format": "int64", - "description": "Recipient should be the numeric datasource id", - "name": "Recipient", - "in": "path", - "required": true + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Filter", + "name": "filter", + "in": "query" } ], "responses": { "200": { - "description": "Ack", - "schema": { - "$ref": "#/definitions/Ack" - } - }, - "207": { - "description": "MultiStatus", + "description": "gettableSilences", "schema": { - "$ref": "#/definitions/MultiStatus" + "$ref": "#/definitions/gettableSilences" } }, "400": { @@ -2715,317 +1426,215 @@ "schema": { "$ref": "#/definitions/ValidationError" } - }, - "403": { - "description": "PermissionDenied", - "schema": { - "$ref": "#/definitions/PermissionDenied" - } - }, - "404": { - "description": "AlertManagerNotFound", - "schema": { - "$ref": "#/definitions/AlertManagerNotFound" - } - }, - "408": { - "description": "Failure", - "schema": { - "$ref": "#/definitions/Failure" - } - }, - "409": { - "description": "AlertManagerNotReady", - "schema": { - "$ref": "#/definitions/AlertManagerNotReady" - } } } - } - }, - "/alerts": { - "get": { - "tags": ["legacy_alerts"], - "summary": "Get legacy alerts.", - "operationId": "getAlerts", - "parameters": [ - { - "type": "array", - "items": { - "type": "string" - }, - "x-go-name": "DashboardID", - "description": "Limit response to alerts in specified dashboard(s). You can specify multiple dashboards.", - "name": "dashboardId", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "PanelID", - "description": "Limit response to alert for a specified panel on a dashboard.", - "name": "panelId", - "in": "query" - }, - { - "type": "string", - "x-go-name": "Query", - "description": "Limit response to alerts having a name like this value.", - "name": "query", - "in": "query" - }, - { - "enum": ["all", "no_data", "paused", "alerting", "ok", "pending", "unknown"], - "type": "string", - "x-go-name": "State", - "description": "Return alerts with one or more of the following alert states", - "name": "state", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "Limit", - "description": "Limit response to X number of alerts.", - "name": "limit", - "in": "query" - }, - { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "x-go-name": "FolderID", - "description": "Limit response to alerts of dashboards in specified folder(s). You can specify multiple folders", - "name": "folderId", - "in": "query" - }, - { - "type": "string", - "x-go-name": "DashboardQuery", - "description": "Limit response to alerts having a dashboard name like this value./ Limit response to alerts having a dashboard name like this value.", - "name": "dashboardQuery", - "in": "query" - }, - { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "x-go-name": "DashboardTag", - "description": "Limit response to alerts of dashboards with specified tags. To do an “AND” filtering with multiple tags, specify the tags parameter multiple times", - "name": "dashboardTag", - "in": "query" + }, + "post": { + "description": "create silence", + "tags": ["alertmanager"], + "operationId": "RouteCreateGrafanaSilence", + "parameters": [ + { + "name": "Silence", + "in": "body", + "schema": { + "$ref": "#/definitions/postableSilence" + } } ], "responses": { - "200": { - "$ref": "#/responses/getAlertsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "201": { + "description": "gettableSilence", + "schema": { + "$ref": "#/definitions/gettableSilence" + } }, - "500": { - "$ref": "#/responses/internalServerError" + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } } }, - "/alerts/states-for-dashboard": { + "/alertmanager/grafana/api/v2/status": { "get": { - "tags": ["legacy_alerts"], - "summary": "Get alert states for a dashboard.", - "operationId": "getDashboardStates", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "DashboardID", - "name": "dashboardId", - "in": "query", - "required": true - } - ], + "description": "get alertmanager status and configuration", + "tags": ["alertmanager"], + "operationId": "RouteGetGrafanaAMStatus", "responses": { "200": { - "$ref": "#/responses/getDashboardStatesResponse" + "description": "GettableStatus", + "schema": { + "$ref": "#/definitions/GettableStatus" + } }, "400": { - "$ref": "#/responses/badRequestError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } } }, - "/alerts/test": { + "/alertmanager/grafana/config/api/v1/alerts": { + "get": { + "description": "gets an Alerting config", + "tags": ["alertmanager"], + "operationId": "RouteGetGrafanaAlertingConfig", + "responses": { + "200": { + "description": "GettableUserConfig", + "schema": { + "$ref": "#/definitions/GettableUserConfig" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + }, "post": { - "tags": ["legacy_alerts"], - "summary": "Test alert.", - "operationId": "testAlert", + "description": "sets an Alerting config", + "tags": ["alertmanager"], + "operationId": "RoutePostGrafanaAlertingConfig", "parameters": [ { - "x-go-name": "Body", - "name": "body", + "name": "Body", "in": "body", "schema": { - "$ref": "#/definitions/AlertTestCommand" + "$ref": "#/definitions/PostableUserConfig" } } ], "responses": { - "200": { - "$ref": "#/responses/testAlertResponse" + "201": { + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } }, "400": { - "$ref": "#/responses/badRequestError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "422": { - "$ref": "#/responses/unprocessableEntityError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } - } - }, - "/alerts/{alert_id}": { - "get": { - "description": "“evalMatches” data in the response is cached in the db when and only when the state of the alert changes (e.g. transitioning from “ok” to “alerting” state).\nIf data from one server triggers the alert first and, before that server is seen leaving alerting state, a second server also enters a state that would trigger the alert, the second server will not be visible in “evalMatches” data.", - "tags": ["legacy_alerts"], - "summary": "Get alert by ID.", - "operationId": "getAlertByID", - "parameters": [ - { - "type": "string", - "x-go-name": "AlertID", - "name": "alert_id", - "in": "path", - "required": true - } - ], + }, + "delete": { + "description": "deletes the Alerting config for a tenant", + "tags": ["alertmanager"], + "operationId": "RouteDeleteGrafanaAlertingConfig", "responses": { "200": { - "$ref": "#/responses/getAlertResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } }, - "500": { - "$ref": "#/responses/internalServerError" + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } } }, - "/alerts/{alert_id}/pause": { + "/alertmanager/grafana/config/api/v1/receivers/test": { "post": { - "tags": ["legacy_alerts"], - "summary": "Pause/unpause alert by id.", - "operationId": "pauseAlert", + "tags": ["alertmanager"], + "summary": "Test Grafana managed receivers without saving them.", + "operationId": "RoutePostTestGrafanaReceivers", "parameters": [ { - "type": "string", - "x-go-name": "AlertID", - "name": "alert_id", - "in": "path", - "required": true - }, - { - "x-go-name": "Body", - "name": "body", + "name": "Body", "in": "body", - "required": true, "schema": { - "$ref": "#/definitions/PauseAlertCommand" + "$ref": "#/definitions/TestReceiversConfigBodyParams" } } ], "responses": { "200": { - "$ref": "#/responses/pauseAlertResponse" + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } }, - "401": { - "$ref": "#/responses/unauthorisedError" + "207": { + "description": "MultiStatus", + "schema": { + "$ref": "#/definitions/MultiStatus" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } }, "403": { - "$ref": "#/responses/forbiddenError" + "description": "PermissionDenied", + "schema": { + "$ref": "#/definitions/PermissionDenied" + } }, "404": { - "$ref": "#/responses/notFoundError" + "description": "AlertManagerNotFound", + "schema": { + "$ref": "#/definitions/AlertManagerNotFound" + } }, - "500": { - "$ref": "#/responses/internalServerError" + "408": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/Failure" + } + }, + "409": { + "description": "AlertManagerNotReady", + "schema": { + "$ref": "#/definitions/AlertManagerNotReady" + } } } } }, - "/annotations": { + "/alertmanager/{Recipient}/api/v2/alerts": { "get": { - "description": "Starting in Grafana v6.4 regions annotations are now returned in one entity that now includes the timeEnd property.", - "tags": ["annotations"], - "summary": "Find Annotations.", - "operationId": "getAnnotations", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "From", - "description": "Find annotations created after specific epoch datetime in milliseconds.", - "name": "from", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "To", - "description": "Find annotations created before specific epoch datetime in milliseconds.", - "name": "to", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "description": "Limit response to annotations created by specific user.", - "name": "userId", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "AlertID", - "description": "Find annotations for a specified alert.", - "name": "alertId", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "DashboardID", - "description": "Find annotations that are scoped to a specific dashboard", - "name": "dashboardId", + "description": "get alertmanager alerts", + "tags": ["alertmanager"], + "operationId": "RouteGetAMAlerts", + "parameters": [ + { + "type": "boolean", + "default": true, + "x-go-name": "Active", + "description": "Show active alerts", + "name": "active", "in": "query" }, { - "type": "integer", - "format": "int64", - "x-go-name": "PanelID", - "description": "Find annotations that are scoped to a specific panel", - "name": "panelId", + "type": "boolean", + "default": true, + "x-go-name": "Silenced", + "description": "Show silenced alerts", + "name": "silenced", "in": "query" }, { - "type": "integer", - "format": "int64", - "x-go-name": "Limit", - "description": "Max limit for results returned.", - "name": "limit", + "type": "boolean", + "default": true, + "x-go-name": "Inhibited", + "description": "Show inhibited alerts", + "name": "inhibited", "in": "query" }, { @@ -3033,525 +1642,577 @@ "items": { "type": "string" }, - "collectionFormat": "multi", - "x-go-name": "Tags", - "description": "Use this to filter global annotations. Global annotations are annotations from an annotation data source that are not connected specifically to a dashboard or panel. You can filter by multiple tags.", - "name": "tags", + "x-go-name": "Matchers", + "description": "A list of matchers to filter alerts by", + "name": "filter", "in": "query" }, { - "enum": ["alert", "annotation"], "type": "string", - "x-go-name": "Type", - "description": "Return alerts or user created annotations", - "name": "type", + "x-go-name": "Receivers", + "description": "A regex matching receivers to filter alerts by", + "name": "receiver", "in": "query" }, { - "type": "boolean", - "x-go-name": "MatchAny", - "description": "Match any or all tags", - "name": "matchAny", - "in": "query" + "type": "integer", + "format": "int64", + "description": "Recipient should be the numeric datasource id", + "name": "Recipient", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAnnotationsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "description": "gettableAlerts", + "schema": { + "$ref": "#/definitions/gettableAlerts" + } }, - "500": { - "$ref": "#/responses/internalServerError" + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } }, "post": { - "description": "Creates an annotation in the Grafana database. The dashboardId and panelId fields are optional. If they are not specified then a global annotation is created and can be queried in any dashboard that adds the Grafana annotations data source. When creating a region annotation include the timeEnd property.\nThe format for `time` and `timeEnd` should be epoch numbers in millisecond resolution.\nThe response for this HTTP request is slightly different in versions prior to v6.4. In prior versions you would also get an endId if you where creating a region. But in 6.4 regions are represented using a single event with time and timeEnd properties.", - "tags": ["annotations"], - "summary": "Create Annotation.", - "operationId": "createAnnotation", + "description": "create alertmanager alerts", + "tags": ["alertmanager"], + "operationId": "RoutePostAMAlerts", "parameters": [ { - "x-go-name": "Body", - "name": "body", + "name": "PostableAlerts", "in": "body", - "required": true, "schema": { - "$ref": "#/definitions/PostAnnotationsCmd" + "type": "array", + "items": { + "$ref": "#/definitions/postableAlert" + } } + }, + { + "type": "integer", + "format": "int64", + "description": "Recipient should be the numeric datasource id", + "name": "Recipient", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/createAnnotationResponse" + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } }, "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } } }, - "/annotations/graphite": { - "post": { - "description": "Creates an annotation by using Graphite-compatible event format. The `when` and `data` fields are optional. If `when` is not specified then the current time will be used as annotation’s timestamp. The `tags` field can also be in prior to Graphite `0.10.0` format (string with multiple tags being separated by a space).", - "tags": ["annotations"], - "summary": "Create Annotation in Graphite format.", - "operationId": "createGraphiteAnnotation", + "/alertmanager/{Recipient}/api/v2/alerts/groups": { + "get": { + "description": "get alertmanager alerts", + "tags": ["alertmanager"], + "operationId": "RouteGetAMAlertGroups", "parameters": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PostGraphiteAnnotationsCmd" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/createAnnotationResponse" + "type": "boolean", + "default": true, + "x-go-name": "Active", + "description": "Show active alerts", + "name": "active", + "in": "query" }, - "400": { - "$ref": "#/responses/badRequestError" + { + "type": "boolean", + "default": true, + "x-go-name": "Silenced", + "description": "Show silenced alerts", + "name": "silenced", + "in": "query" }, - "401": { - "$ref": "#/responses/unauthorisedError" + { + "type": "boolean", + "default": true, + "x-go-name": "Inhibited", + "description": "Show inhibited alerts", + "name": "inhibited", + "in": "query" }, - "403": { - "$ref": "#/responses/forbiddenError" + { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Matchers", + "description": "A list of matchers to filter alerts by", + "name": "filter", + "in": "query" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/annotations/mass-delete": { - "post": { - "tags": ["annotations"], - "summary": "Delete multiple annotations.", - "operationId": "massDeleteAnnotations", - "parameters": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/DeleteAnnotationsCmd" - } + "type": "string", + "x-go-name": "Receivers", + "description": "A regex matching receivers to filter alerts by", + "name": "receiver", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Recipient should be the numeric datasource id", + "name": "Recipient", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "description": "alertGroups", + "schema": { + "$ref": "#/definitions/alertGroups" + } }, - "500": { - "$ref": "#/responses/internalServerError" + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } } }, - "/annotations/tags": { + "/alertmanager/{Recipient}/api/v2/silence/{SilenceId}": { "get": { - "description": "Find all the event tags created in the annotations.", - "tags": ["annotations"], - "summary": "Find Annotations Tags.", - "operationId": "getAnnotationTags", + "description": "get silence", + "tags": ["alertmanager"], + "operationId": "RouteGetSilence", "parameters": [ { "type": "string", - "x-go-name": "Tag", - "description": "Tag is a string that you can use to filter tags.", - "name": "tag", - "in": "query" + "name": "SilenceId", + "in": "path", + "required": true }, { - "type": "string", - "default": "100", - "x-go-name": "Limit", - "description": "Max limit for results returned.", - "name": "limit", - "in": "query" + "type": "integer", + "format": "int64", + "description": "Recipient should be the numeric datasource id", + "name": "Recipient", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAnnotationTagsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "description": "gettableSilence", + "schema": { + "$ref": "#/definitions/gettableSilence" + } }, - "500": { - "$ref": "#/responses/internalServerError" + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } - } - }, - "/annotations/{annotation_id}": { - "put": { - "description": "Updates all properties of an annotation that matches the specified id. To only update certain property, consider using the Patch Annotation operation.", - "tags": ["annotations"], - "summary": "Update Annotation.", - "operationId": "updateAnnotation", + }, + "delete": { + "description": "delete silence", + "tags": ["alertmanager"], + "operationId": "RouteDeleteSilence", "parameters": [ { "type": "string", - "x-go-name": "AnnotationID", - "name": "annotation_id", + "name": "SilenceId", "in": "path", "required": true }, { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateAnnotationsCmd" - } + "type": "integer", + "format": "int64", + "description": "Recipient should be the numeric datasource id", + "name": "Recipient", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } }, "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } - }, - "delete": { - "description": "Deletes the annotation that matches the specified ID.", - "tags": ["annotations"], - "summary": "Delete Annotation By ID.", - "operationId": "deleteAnnotation", + } + }, + "/alertmanager/{Recipient}/api/v2/silences": { + "get": { + "description": "get silences", + "tags": ["alertmanager"], + "operationId": "RouteGetSilences", "parameters": [ { - "type": "string", - "x-go-name": "AnnotationID", - "name": "annotation_id", + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Filter", + "name": "filter", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Recipient should be the numeric datasource id", + "name": "Recipient", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "description": "gettableSilences", + "schema": { + "$ref": "#/definitions/gettableSilences" + } }, - "500": { - "$ref": "#/responses/internalServerError" + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } }, - "patch": { - "description": "Updates one or more properties of an annotation that matches the specified ID.\nThis operation currently supports updating of the `text`, `tags`, `time` and `timeEnd` properties.\nThis is available in Grafana 6.0.0-beta2 and above.", - "tags": ["annotations"], - "summary": "Patch Annotation", - "operationId": "patchAnnotation", + "post": { + "description": "create silence", + "tags": ["alertmanager"], + "operationId": "RouteCreateSilence", "parameters": [ { - "type": "string", - "x-go-name": "AnnotationID", - "name": "annotation_id", - "in": "path", - "required": true - }, - { - "x-go-name": "Body", - "name": "body", + "name": "Silence", "in": "body", - "required": true, "schema": { - "$ref": "#/definitions/PatchAnnotationsCmd" + "$ref": "#/definitions/postableSilence" } + }, + { + "type": "integer", + "format": "int64", + "description": "Recipient should be the numeric datasource id", + "name": "Recipient", + "in": "path", + "required": true } ], "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "201": { + "description": "gettableSilence", + "schema": { + "$ref": "#/definitions/gettableSilence" + } }, - "500": { - "$ref": "#/responses/internalServerError" + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } } }, - "/auth/keys": { + "/alertmanager/{Recipient}/api/v2/status": { "get": { - "description": "Will return auth keys.", - "tags": ["api_keys"], - "summary": "Get auth keys.", - "operationId": "getAPIkeys", + "description": "get alertmanager status and configuration", + "tags": ["alertmanager"], + "operationId": "RouteGetAMStatus", "parameters": [ { - "type": "boolean", - "default": false, - "x-go-name": "IncludeExpired", - "description": "Show expired keys", - "name": "includeExpired", - "in": "query" + "type": "integer", + "format": "int64", + "description": "Recipient should be the numeric datasource id", + "name": "Recipient", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAPIkeyResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "description": "GettableStatus", + "schema": { + "$ref": "#/definitions/GettableStatus" + } }, - "500": { - "$ref": "#/responses/internalServerError" + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } - }, - "post": { - "description": "Will return details of the created API key", - "tags": ["api_keys"], - "summary": "Creates an API key.", - "operationId": "addAPIkey", + } + }, + "/alertmanager/{Recipient}/config/api/v1/alerts": { + "get": { + "description": "gets an Alerting config", + "tags": ["alertmanager"], + "operationId": "RouteGetAlertingConfig", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AddApiKeyCommand" - } + "type": "integer", + "format": "int64", + "description": "Recipient should be the numeric datasource id", + "name": "Recipient", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/postAPIkeyResponse" + "description": "GettableUserConfig", + "schema": { + "$ref": "#/definitions/GettableUserConfig" + } }, "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "409": { - "$ref": "#/responses/conflictError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } - } - }, - "/auth/keys/{id}": { - "delete": { - "tags": ["api_keys"], - "summary": "Delete API key.", - "operationId": "deleteAPIkey", + }, + "post": { + "description": "sets an Alerting config", + "tags": ["alertmanager"], + "operationId": "RoutePostAlertingConfig", "parameters": [ + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/PostableUserConfig" + } + }, { "type": "integer", "format": "int64", - "x-go-name": "ID", - "name": "id", + "description": "Recipient should be the numeric datasource id", + "name": "Recipient", "in": "path", "required": true } ], "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "201": { + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } }, - "500": { - "$ref": "#/responses/internalServerError" + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } - } - }, - "/dashboard/snapshots": { - "get": { - "tags": ["snapshots"], - "summary": "List snapshots.", - "operationId": "getSnapshots", + }, + "delete": { + "description": "deletes the Alerting config for a tenant", + "tags": ["alertmanager"], + "operationId": "RouteDeleteAlertingConfig", "parameters": [ - { - "type": "string", - "x-go-name": "Query", - "description": "Search Query", - "name": "query", - "in": "query" - }, { "type": "integer", "format": "int64", - "default": 1000, - "x-go-name": "Limit", - "description": "Limit the number of returned results", - "name": "limit", - "in": "query" + "description": "Recipient should be the numeric datasource id", + "name": "Recipient", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getSnapshotsResponse" + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } }, - "500": { - "$ref": "#/responses/internalServerError" + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } } }, - "/dashboards/calculate-diff": { + "/alertmanager/{Recipient}/config/api/v1/receivers/test": { "post": { - "produces": ["application/json", "text/html"], - "tags": ["dashboards"], - "summary": "Perform diff on two dashboards.", - "operationId": "calcDashboardDiff", + "tags": ["alertmanager"], + "summary": "Test Grafana managed receivers without saving them.", + "operationId": "RoutePostTestReceivers", "parameters": [ { "name": "Body", "in": "body", - "required": true, "schema": { - "type": "object", - "properties": { - "base": { - "$ref": "#/definitions/CalculateDiffTarget" - }, - "diffType": { - "description": "The type of diff to return\nDescription:\n`basic`\n`json`", - "type": "string", - "enum": ["basic", "json"], - "x-go-name": "DiffType" - }, - "new": { - "$ref": "#/definitions/CalculateDiffTarget" - } - } + "$ref": "#/definitions/TestReceiversConfigBodyParams" } + }, + { + "type": "integer", + "format": "int64", + "description": "Recipient should be the numeric datasource id", + "name": "Recipient", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/dashboardDiffResponse" + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } }, - "401": { - "$ref": "#/responses/unauthorisedError" + "207": { + "description": "MultiStatus", + "schema": { + "$ref": "#/definitions/MultiStatus" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } }, "403": { - "$ref": "#/responses/forbiddenError" + "description": "PermissionDenied", + "schema": { + "$ref": "#/definitions/PermissionDenied" + } }, - "500": { - "$ref": "#/responses/internalServerError" + "404": { + "description": "AlertManagerNotFound", + "schema": { + "$ref": "#/definitions/AlertManagerNotFound" + } + }, + "408": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/Failure" + } + }, + "409": { + "description": "AlertManagerNotReady", + "schema": { + "$ref": "#/definitions/AlertManagerNotReady" + } } } } }, - "/dashboards/db": { - "post": { - "description": "Creates a new dashboard or updates an existing dashboard.", - "tags": ["dashboards"], - "summary": "Create / Update dashboard", - "operationId": "postDashboard", + "/alerts": { + "get": { + "tags": ["legacy_alerts"], + "summary": "Get legacy alerts.", + "operationId": "getAlerts", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/SaveDashboardCommand" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/postDashboardResponse" + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "DashboardID", + "description": "Limit response to alerts in specified dashboard(s). You can specify multiple dashboards.", + "name": "dashboardId", + "in": "query" }, - "400": { - "$ref": "#/responses/badRequestError" + { + "type": "integer", + "format": "int64", + "x-go-name": "PanelID", + "description": "Limit response to alert for a specified panel on a dashboard.", + "name": "panelId", + "in": "query" }, - "401": { - "$ref": "#/responses/unauthorisedError" + { + "type": "string", + "x-go-name": "Query", + "description": "Limit response to alerts having a name like this value.", + "name": "query", + "in": "query" }, - "403": { - "$ref": "#/responses/forbiddenError" + { + "enum": ["all", "no_data", "paused", "alerting", "ok", "pending", "unknown"], + "type": "string", + "x-go-name": "State", + "description": "Return alerts with one or more of the following alert states", + "name": "state", + "in": "query" }, - "404": { - "$ref": "#/responses/notFoundError" + { + "type": "integer", + "format": "int64", + "x-go-name": "Limit", + "description": "Limit response to X number of alerts.", + "name": "limit", + "in": "query" }, - "412": { - "$ref": "#/responses/preconditionFailedError" + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "x-go-name": "FolderID", + "description": "Limit response to alerts of dashboards in specified folder(s). You can specify multiple folders", + "name": "folderId", + "in": "query" }, - "422": { - "$ref": "#/responses/unprocessableEntityError" + { + "type": "string", + "x-go-name": "DashboardQuery", + "description": "Limit response to alerts having a dashboard name like this value./ Limit response to alerts having a dashboard name like this value.", + "name": "dashboardQuery", + "in": "query" }, - "500": { - "$ref": "#/responses/internalServerError" + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "x-go-name": "DashboardTag", + "description": "Limit response to alerts of dashboards with specified tags. To do an “AND” filtering with multiple tags, specify the tags parameter multiple times", + "name": "dashboardTag", + "in": "query" } - } - } - }, - "/dashboards/home": { - "get": { - "tags": ["dashboards"], - "summary": "Get home dashboard.", - "operationId": "getHomeDashboard", + ], "responses": { "200": { - "$ref": "#/responses/getHomeDashboardResponse" + "$ref": "#/responses/getAlertsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3562,75 +2223,61 @@ } } }, - "/dashboards/id/{DashboardID}/permissions": { + "/alerts/states-for-dashboard": { "get": { - "tags": ["dashboard_permissions"], - "summary": "Gets all existing permissions for the given dashboard.", - "operationId": "getDashboardPermissions", + "tags": ["legacy_alerts"], + "summary": "Get alert states for a dashboard.", + "operationId": "getDashboardStates", "parameters": [ { "type": "integer", "format": "int64", - "name": "DashboardID", - "in": "path", + "x-go-name": "DashboardID", + "name": "dashboardId", + "in": "query", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDashboardPermissionsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "$ref": "#/responses/getDashboardStatesResponse" }, - "404": { - "$ref": "#/responses/notFoundError" + "400": { + "$ref": "#/responses/badRequestError" }, "500": { "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/alerts/test": { "post": { - "description": "This operation will remove existing permissions if they’re not included in the request.", - "tags": ["dashboard_permissions"], - "summary": "Updates permissions for a dashboard.", - "operationId": "postDashboardPermissions", + "tags": ["legacy_alerts"], + "summary": "Test alert.", + "operationId": "testAlert", "parameters": [ { - "name": "Body", + "x-go-name": "Body", + "name": "body", "in": "body", - "required": true, "schema": { - "$ref": "#/definitions/UpdateDashboardAclCommand" + "$ref": "#/definitions/AlertTestCommand" } - }, - { - "type": "integer", - "format": "int64", - "name": "DashboardID", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/testAlertResponse" }, "400": { "$ref": "#/responses/badRequestError" }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "422": { + "$ref": "#/responses/unprocessableEntityError" }, "500": { "$ref": "#/responses/internalServerError" @@ -3638,74 +2285,60 @@ } } }, - "/dashboards/id/{DashboardID}/restore": { - "post": { - "tags": ["dashboard_versions"], - "summary": "Restore a dashboard to a given dashboard version.", - "operationId": "restoreDashboardVersion", + "/alerts/{alert_id}": { + "get": { + "description": "“evalMatches” data in the response is cached in the db when and only when the state of the alert changes (e.g. transitioning from “ok” to “alerting” state).\nIf data from one server triggers the alert first and, before that server is seen leaving alerting state, a second server also enters a state that would trigger the alert, the second server will not be visible in “evalMatches” data.", + "tags": ["legacy_alerts"], + "summary": "Get alert by ID.", + "operationId": "getAlertByID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "x-go-name": "AlertID", + "name": "alert_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/postDashboardResponse" + "$ref": "#/responses/getAlertResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/id/{DashboardID}/versions": { - "get": { - "tags": ["dashboard_versions"], - "summary": "Gets all existing versions for the dashboard.", - "operationId": "getDashboardVersions", + "/alerts/{alert_id}/pause": { + "post": { + "tags": ["legacy_alerts"], + "summary": "Pause/unpause alert by id.", + "operationId": "pauseAlert", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "x-go-name": "AlertID", + "name": "alert_id", "in": "path", "required": true }, { - "type": "integer", - "format": "int64", - "default": 0, - "x-go-name": "Limit", - "description": "Maximum number of results to return", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 0, - "x-go-name": "Start", - "description": "Version to start from when returning queries", - "name": "start", - "in": "query" + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PauseAlertCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionsResponse" + "$ref": "#/responses/pauseAlertResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3722,91 +2355,99 @@ } } }, - "/dashboards/id/{DashboardID}/versions/{DashboardVersionID}": { + "/annotations": { "get": { - "tags": ["dashboard_versions"], - "summary": "Get a specific dashboard version.", - "operationId": "getDashboardVersion", + "description": "Starting in Grafana v6.4 regions annotations are now returned in one entity that now includes the timeEnd property.", + "tags": ["annotations"], + "summary": "Find Annotations.", + "operationId": "getAnnotations", "parameters": [ { "type": "integer", "format": "int64", - "name": "DashboardID", - "in": "path", - "required": true + "x-go-name": "From", + "description": "Find annotations created after specific epoch datetime in milliseconds.", + "name": "from", + "in": "query" }, { "type": "integer", "format": "int64", - "name": "DashboardVersionID", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/dashboardVersionResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "x-go-name": "To", + "description": "Find annotations created before specific epoch datetime in milliseconds.", + "name": "to", + "in": "query" }, - "403": { - "$ref": "#/responses/forbiddenError" + { + "type": "integer", + "format": "int64", + "x-go-name": "UserID", + "description": "Limit response to annotations created by specific user.", + "name": "userId", + "in": "query" }, - "404": { - "$ref": "#/responses/notFoundError" + { + "type": "integer", + "format": "int64", + "x-go-name": "AlertID", + "description": "Find annotations for a specified alert.", + "name": "alertId", + "in": "query" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboards/import": { - "post": { - "tags": ["dashboards"], - "summary": "Import dashboard.", - "operationId": "importDashboard", - "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/ImportDashboardRequest" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/importDashboardResponse" + "type": "integer", + "format": "int64", + "x-go-name": "DashboardID", + "description": "Find annotations that are scoped to a specific dashboard", + "name": "dashboardId", + "in": "query" }, - "400": { - "$ref": "#/responses/badRequestError" + { + "type": "integer", + "format": "int64", + "x-go-name": "PanelID", + "description": "Find annotations that are scoped to a specific panel", + "name": "panelId", + "in": "query" }, - "401": { - "$ref": "#/responses/unauthorisedError" + { + "type": "integer", + "format": "int64", + "x-go-name": "Limit", + "description": "Max limit for results returned.", + "name": "limit", + "in": "query" }, - "412": { - "$ref": "#/responses/preconditionFailedError" + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "x-go-name": "Tags", + "description": "Use this to filter global annotations. Global annotations are annotations from an annotation data source that are not connected specifically to a dashboard or panel. You can filter by multiple tags.", + "name": "tags", + "in": "query" }, - "422": { - "$ref": "#/responses/unprocessableEntityError" + { + "enum": ["alert", "annotation"], + "type": "string", + "x-go-name": "Type", + "description": "Return alerts or user created annotations", + "name": "type", + "in": "query" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboards/tags": { - "get": { - "tags": ["dashboards"], - "summary": "Get all dashboards tags of an organisation.", - "operationId": "getDashboardTags", + { + "type": "boolean", + "x-go-name": "MatchAny", + "description": "Match any or all tags", + "name": "matchAny", + "in": "query" + } + ], "responses": { "200": { - "$ref": "#/responses/dashboardsTagsResponse" + "$ref": "#/responses/getAnnotationsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3815,54 +2456,65 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/dashboards/trim": { + }, "post": { - "tags": ["dashboards"], - "summary": "Trim defaults from dashboard.", - "operationId": "trimDashboard", + "description": "Creates an annotation in the Grafana database. The dashboardId and panelId fields are optional. If they are not specified then a global annotation is created and can be queried in any dashboard that adds the Grafana annotations data source. When creating a region annotation include the timeEnd property.\nThe format for `time` and `timeEnd` should be epoch numbers in millisecond resolution.\nThe response for this HTTP request is slightly different in versions prior to v6.4. In prior versions you would also get an endId if you where creating a region. But in 6.4 regions are represented using a single event with time and timeEnd properties.", + "tags": ["annotations"], + "summary": "Create Annotation.", + "operationId": "createAnnotation", "parameters": [ { - "name": "Body", + "x-go-name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/TrimDashboardCommand" + "$ref": "#/definitions/PostAnnotationsCmd" } } ], "responses": { "200": { - "$ref": "#/responses/trimDashboardResponse" + "$ref": "#/responses/createAnnotationResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/uid/{uid}": { - "get": { - "description": "Will return the dashboard given the dashboard unique identifier (uid).", - "tags": ["dashboards"], - "summary": "Get dashboard by uid.", - "operationId": "getDashboardByUID", + "/annotations/graphite": { + "post": { + "description": "Creates an annotation by using Graphite-compatible event format. The `when` and `data` fields are optional. If `when` is not specified then the current time will be used as annotation’s timestamp. The `tags` field can also be in prior to Graphite `0.10.0` format (string with multiple tags being separated by a space).", + "tags": ["annotations"], + "summary": "Create Annotation in Graphite format.", + "operationId": "createGraphiteAnnotation", "parameters": [ { - "type": "string", - "x-go-name": "UID", - "name": "uid", - "in": "path", - "required": true + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PostGraphiteAnnotationsCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/dashboardResponse" + "$ref": "#/responses/createAnnotationResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3870,120 +2522,107 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Will delete the dashboard given the specified unique identifier (uid).", - "tags": ["dashboards"], - "summary": "Delete dashboard by uid.", - "operationId": "deleteDashboardByUID", + } + }, + "/annotations/mass-delete": { + "post": { + "tags": ["annotations"], + "summary": "Delete multiple annotations.", + "operationId": "massDeleteAnnotations", "parameters": [ { - "type": "string", - "x-go-name": "UID", - "name": "uid", - "in": "path", - "required": true + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/DeleteAnnotationsCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/deleteDashboardResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources": { + "/annotations/tags": { "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scope: `datasources:*`.", - "tags": ["datasources"], - "summary": "Get all data sources.", - "operationId": "getDatasources", - "responses": { - "200": { - "$ref": "#/responses/getDatasourcesResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "post": { - "description": "By defining `password` and `basicAuthPassword` under secureJsonData property\nGrafana encrypts them securely as an encrypted blob in the database.\nThe response then lists the encrypted fields under secureJsonFields.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:create`", - "tags": ["datasources"], - "summary": "Create a data source.", - "operationId": "addDatasource", + "description": "Find all the event tags created in the annotations.", + "tags": ["annotations"], + "summary": "Find Annotations Tags.", + "operationId": "getAnnotationTags", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AddDataSourceCommand" - } + "type": "string", + "x-go-name": "Tag", + "description": "Tag is a string that you can use to filter tags.", + "name": "tag", + "in": "query" + }, + { + "type": "string", + "default": "100", + "x-go-name": "Limit", + "description": "Max limit for results returned.", + "name": "limit", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" + "$ref": "#/responses/getAnnotationTagsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "409": { - "$ref": "#/responses/conflictError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources/id/{datasource_name}": { - "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", - "tags": ["datasources"], - "summary": "Get data source Id by Name.", - "operationId": "getDatasourceIdByName", + "/annotations/{annotation_id}": { + "put": { + "description": "Updates all properties of an annotation that matches the specified id. To only update certain property, consider using the Patch Annotation operation.", + "tags": ["annotations"], + "summary": "Update Annotation.", + "operationId": "updateAnnotation", "parameters": [ { "type": "string", - "x-go-name": "DatasourceName", - "name": "datasource_name", + "x-go-name": "AnnotationID", + "name": "annotation_id", "in": "path", "required": true + }, + { + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateAnnotationsCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/getDatasourceIDresponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3991,33 +2630,28 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/name/{datasource_name}": { - "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", - "tags": ["datasources"], - "summary": "Get a single data source by Name.", - "operationId": "getDatasourceByName", + }, + "delete": { + "description": "Deletes the annotation that matches the specified ID.", + "tags": ["annotations"], + "summary": "Delete Annotation By ID.", + "operationId": "deleteAnnotation", "parameters": [ { "type": "string", - "x-go-name": "DatasourceName", - "name": "datasource_name", + "x-go-name": "AnnotationID", + "name": "annotation_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDatasourceResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4030,23 +2664,32 @@ } } }, - "delete": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", - "tags": ["datasources"], - "summary": "Delete an existing data source by name.", - "operationId": "deleteDatasourceByName", + "patch": { + "description": "Updates one or more properties of an annotation that matches the specified ID.\nThis operation currently supports updating of the `text`, `tags`, `time` and `timeEnd` properties.\nThis is available in Grafana 6.0.0-beta2 and above.", + "tags": ["annotations"], + "summary": "Patch Annotation", + "operationId": "patchAnnotation", "parameters": [ { "type": "string", - "x-go-name": "DatasourceName", - "name": "datasource_name", + "x-go-name": "AnnotationID", + "name": "annotation_id", "in": "path", "required": true + }, + { + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PatchAnnotationsCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/deleteDatasourceByNameResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4063,34 +2706,25 @@ } } }, - "/datasources/proxy/{datasource_id}/{datasource_proxy_route}": { + "/auth/keys": { "get": { - "description": "Proxies all calls to the actual data source.", - "tags": ["datasources"], - "summary": "Data source proxy GET calls.", - "operationId": "datasourceProxyGETcalls", + "description": "Will return auth keys.", + "tags": ["api_keys"], + "summary": "Get auth keys.", + "operationId": "getAPIkeys", "parameters": [ { - "type": "string", - "x-go-name": "DatasourceID", - "name": "datasource_id", - "in": "path", - "required": true - }, - { - "type": "string", - "x-go-name": "DatasourceProxyRoute", - "name": "datasource_proxy_route", - "in": "path", - "required": true + "type": "boolean", + "default": false, + "x-go-name": "IncludeExpired", + "description": "Show expired keys", + "name": "includeExpired", + "in": "query" } ], "responses": { "200": { - "description": "" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getAPIkeyResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4107,40 +2741,23 @@ } }, "post": { - "description": "Proxies all calls to the actual data source. The data source should support POST methods for the specific path and role as defined", - "tags": ["datasources"], - "summary": "Data source proxy POST calls.", - "operationId": "datasourceProxyPOSTcalls", + "description": "Will return details of the created API key", + "tags": ["api_keys"], + "summary": "Creates an API key.", + "operationId": "addAPIkey", "parameters": [ { - "type": "string", - "x-go-name": "DatasourceID", - "name": "datasource_id", - "in": "path", - "required": true - }, - { - "type": "string", - "x-go-name": "DatasourceProxyRoute", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "name": "DatasourceProxyParam", + "name": "Body", "in": "body", "required": true, "schema": { - "type": "object" + "$ref": "#/definitions/AddApiKeyCommand" } } ], "responses": { - "201": { - "description": "" - }, - "202": { - "description": "" + "200": { + "$ref": "#/responses/postAPIkeyResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4151,41 +2768,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/auth/keys/{id}": { "delete": { - "description": "Proxies all calls to the actual data source.", - "tags": ["datasources"], - "summary": "Data source proxy DELETE calls.", - "operationId": "datasourceProxyDELETEcalls", + "tags": ["api_keys"], + "summary": "Delete API key.", + "operationId": "deleteAPIkey", "parameters": [ { - "type": "string", - "x-go-name": "DatasourceID", - "name": "datasource_id", - "in": "path", - "required": true - }, - { - "type": "string", - "x-go-name": "DatasourceProxyRoute", - "name": "datasource_proxy_route", + "type": "integer", + "format": "int64", + "x-go-name": "ID", + "name": "id", "in": "path", "required": true } ], "responses": { - "202": { - "description": "" - }, - "400": { - "$ref": "#/responses/badRequestError" + "200": { + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4202,59 +2811,72 @@ } } }, - "/datasources/uid/{datasource_uid}": { + "/dashboard/snapshots": { "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", - "tags": ["datasources"], - "summary": "Get a single data source by UID.", - "operationId": "getDatasourceByUID", + "tags": ["snapshots"], + "summary": "List snapshots.", + "operationId": "getSnapshots", "parameters": [ { "type": "string", - "x-go-name": "DatasourceUID", - "name": "datasource_uid", - "in": "path", - "required": true + "x-go-name": "Query", + "description": "Search Query", + "name": "query", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1000, + "x-go-name": "Limit", + "description": "Limit the number of returned results", + "name": "limit", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/getDatasourceResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "$ref": "#/responses/getSnapshotsResponse" }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", - "tags": ["datasources"], - "summary": "Delete an existing data source by UID.", - "operationId": "deleteDatasourceByUID", + } + }, + "/dashboards/calculate-diff": { + "post": { + "produces": ["application/json", "text/html"], + "tags": ["dashboards"], + "summary": "Perform diff on two dashboards.", + "operationId": "calcDashboardDiff", "parameters": [ { - "type": "string", - "x-go-name": "DatasourceUID", - "name": "datasource_uid", - "in": "path", - "required": true + "name": "Body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "base": { + "$ref": "#/definitions/CalculateDiffTarget" + }, + "diffType": { + "description": "The type of diff to return\nDescription:\n`basic`\n`json`", + "type": "string", + "enum": ["basic", "json"], + "x-go-name": "DiffType" + }, + "new": { + "$ref": "#/definitions/CalculateDiffTarget" + } + } + } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/dashboardDiffResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4262,33 +2884,31 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources/{datasource_id}": { - "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).", - "tags": ["datasources"], - "summary": "Get a single data source by Id.", - "operationId": "getDatasourceByID", + "/dashboards/db": { + "post": { + "description": "Creates a new dashboard or updates an existing dashboard.", + "tags": ["dashboards"], + "summary": "Create / Update dashboard", + "operationId": "postDashboard", "parameters": [ { - "type": "string", - "x-go-name": "DatasourceID", - "name": "datasource_id", - "in": "path", - "required": true + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/SaveDashboardCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/getDatasourceResponse" + "$ref": "#/responses/postDashboardResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4302,65 +2922,53 @@ "404": { "$ref": "#/responses/notFoundError" }, + "412": { + "$ref": "#/responses/preconditionFailedError" + }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "Similar to creating a data source, `password` and `basicAuthPassword` should be defined under\nsecureJsonData in order to be stored securely as an encrypted blob in the database. Then, the\nencrypted fields are listed under secureJsonFields section in the response.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:write` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).", - "tags": ["datasources"], - "summary": "Update an existing data source.", - "operationId": "updateDatasource", - "parameters": [ - { - "type": "string", - "x-go-name": "DatasourceID", - "name": "datasource_id", - "in": "path", - "required": true - }, - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateDataSourceCommand" - } - } - ], + } + }, + "/dashboards/home": { + "get": { + "tags": ["dashboards"], + "summary": "Get home dashboard.", + "operationId": "getHomeDashboard", "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" + "$ref": "#/responses/getHomeDashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).", - "tags": ["datasources"], - "summary": "Delete an existing data source by id.", - "operationId": "deleteDatasourceByID", + } + }, + "/dashboards/id/{DashboardID}/permissions": { + "get": { + "tags": ["dashboard_permissions"], + "summary": "Gets all existing permissions for the given dashboard.", + "operationId": "getDashboardPermissions", "parameters": [ { - "type": "string", - "x-go-name": "DatasourceID", - "name": "datasource_id", + "type": "integer", + "format": "int64", + "name": "DashboardID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getDashboardPermissionsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4375,26 +2983,32 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/{datasource_id}/disable-permissions": { + }, "post": { - "description": "Disables permissions for the data source with the given id. All existing permissions will be removed and anyone will be able to query the data source.\n\nYou need to have a permission with action `datasources.permissions:toggle` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", - "tags": ["datasource_permissions", "enterprise"], - "summary": "Disable permissions for a data source.", - "operationId": "disablePermissions", + "description": "This operation will remove existing permissions if they’re not included in the request.", + "tags": ["dashboard_permissions"], + "summary": "Updates permissions for a dashboard.", + "operationId": "postDashboardPermissions", "parameters": [ { - "type": "string", - "x-go-name": "DatasourceID", - "name": "datasource_id", + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateDashboardAclCommand" + } + }, + { + "type": "integer", + "format": "int64", + "name": "DashboardID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4414,27 +3028,23 @@ } } }, - "/datasources/{datasource_id}/enable-permissions": { + "/dashboards/id/{DashboardID}/restore": { "post": { - "description": "Enables permissions for the data source with the given id.\nNo one except Org Admins will be able to query the data source until permissions have been added\nwhich permit certain users or teams to query the data source.\n\nYou need to have a permission with action `datasources.permissions:toggle` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", - "tags": ["datasource_permissions", "enterprise"], - "summary": "Enable permissions for a data source.", - "operationId": "enablePermissions", + "tags": ["dashboard_versions"], + "summary": "Restore a dashboard to a given dashboard version.", + "operationId": "restoreDashboardVersion", "parameters": [ { - "type": "string", - "x-go-name": "DatasourceID", - "name": "datasource_id", + "type": "integer", + "format": "int64", + "name": "DashboardID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/postDashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4451,24 +3061,41 @@ } } }, - "/datasources/{datasource_id}/permissions": { + "/dashboards/id/{DashboardID}/versions": { "get": { - "description": "Gets all existing permissions for the data source with the given id.\n\nYou need to have a permission with action `datasources.permissions:read` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", - "tags": ["datasource_permissions", "enterprise"], - "summary": "Get permissions for a data source.", - "operationId": "getPermissions", + "tags": ["dashboard_versions"], + "summary": "Gets all existing versions for the dashboard.", + "operationId": "getDashboardVersions", "parameters": [ { - "type": "string", - "x-go-name": "DatasourceID", - "name": "datasource_id", + "type": "integer", + "format": "int64", + "name": "DashboardID", "in": "path", "required": true + }, + { + "type": "integer", + "format": "int64", + "default": 0, + "x-go-name": "Limit", + "description": "Maximum number of results to return", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 0, + "x-go-name": "Start", + "description": "Version to start from when returning queries", + "name": "start", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/getPermissionseResponse" + "$ref": "#/responses/dashboardVersionsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4485,31 +3112,30 @@ } } }, - "/datasources/{datasource_id}/permissions/{permissionId}": { - "delete": { - "description": "Removes the permission with the given permissionId for the data source with the given id.\n\nYou need to have a permission with action `datasources.permissions:delete` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", - "tags": ["datasource_permissions", "enterprise"], - "summary": "Remove permission for a data source.", - "operationId": "deletePermissions", + "/dashboards/id/{DashboardID}/versions/{DashboardVersionID}": { + "get": { + "tags": ["dashboard_versions"], + "summary": "Get a specific dashboard version.", + "operationId": "getDashboardVersion", "parameters": [ { - "type": "string", - "x-go-name": "PermissionID", - "name": "permissionId", + "type": "integer", + "format": "int64", + "name": "DashboardID", "in": "path", "required": true }, { - "type": "string", - "x-go-name": "DatasourceID", - "name": "datasource_id", + "type": "integer", + "format": "int64", + "name": "DashboardVersionID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/dashboardVersionResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4526,26 +3152,24 @@ } } }, - "/ds/query": { + "/dashboards/import": { "post": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:query`.", - "tags": ["ds"], - "summary": "Query metrics with expressions", - "operationId": "queryMetricsWithExpressions", + "tags": ["dashboards"], + "summary": "Import dashboard.", + "operationId": "importDashboard", "parameters": [ { - "x-go-name": "Body", - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/MetricRequest" + "$ref": "#/definitions/ImportDashboardRequest" } } ], "responses": { "200": { - "$ref": "#/responses/queryDataResponse" + "$ref": "#/responses/importDashboardResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4553,8 +3177,11 @@ "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" + "412": { + "$ref": "#/responses/preconditionFailedError" + }, + "422": { + "$ref": "#/responses/unprocessableEntityError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4562,103 +3189,70 @@ } } }, - "/folders": { + "/dashboards/tags": { "get": { - "description": "Returns all folders that the authenticated user has permission to view.", - "tags": ["folders"], - "summary": "Get all folders.", - "operationId": "getFolders", - "parameters": [ - { - "type": "integer", - "format": "int64", - "default": 1000, - "x-go-name": "Limit", - "description": "Limit the maximum number of folders to return", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 1, - "x-go-name": "Page", - "description": "Page index for starting fetching folders", - "name": "page", - "in": "query" - } - ], + "tags": ["dashboards"], + "summary": "Get all dashboards tags of an organisation.", + "operationId": "getDashboardTags", "responses": { "200": { - "$ref": "#/responses/getFoldersResponse" + "$ref": "#/responses/dashboardsTagsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/dashboards/trim": { "post": { - "tags": ["folders"], - "summary": "Create folder.", - "operationId": "createFolder", + "tags": ["dashboards"], + "summary": "Trim defaults from dashboard.", + "operationId": "trimDashboard", "parameters": [ { - "x-go-name": "Body", - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateFolderCommand" + "$ref": "#/definitions/TrimDashboardCommand" } } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/trimDashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "409": { - "$ref": "#/responses/conflictError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/folders/id/{folder_id}": { + "/dashboards/uid/{uid}": { "get": { - "description": "Returns the folder identified by id.", - "tags": ["folders"], - "summary": "Get folder by id.", - "operationId": "getFolderByID", + "description": "Will return the dashboard given the dashboard unique identifier (uid).", + "tags": ["dashboards"], + "summary": "Get dashboard by uid.", + "operationId": "getDashboardByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "x-go-name": "FolderID", - "name": "folder_id", + "type": "string", + "x-go-name": "UID", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/dashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4673,25 +3267,24 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/folders/{folder_uid}": { - "get": { - "tags": ["folders"], - "summary": "Get folder by uid.", - "operationId": "getFolderByUID", + }, + "delete": { + "description": "Will delete the dashboard given the specified unique identifier (uid).", + "tags": ["dashboards"], + "summary": "Delete dashboard by uid.", + "operationId": "deleteDashboardByUID", "parameters": [ { "type": "string", - "x-go-name": "FolderUID", - "name": "folder_uid", + "x-go-name": "UID", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "description": "" + "$ref": "#/responses/deleteDashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4706,36 +3299,47 @@ "$ref": "#/responses/internalServerError" } } + } + }, + "/datasources": { + "get": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scope: `datasources:*`.", + "tags": ["datasources"], + "summary": "Get all data sources.", + "operationId": "getDatasources", + "responses": { + "200": { + "$ref": "#/responses/getDatasourcesResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } }, - "put": { - "tags": ["folders"], - "summary": "Update folder.", - "operationId": "updateFolder", + "post": { + "description": "By defining `password` and `basicAuthPassword` under secureJsonData property\nGrafana encrypts them securely as an encrypted blob in the database.\nThe response then lists the encrypted fields under secureJsonFields.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:create`", + "tags": ["datasources"], + "summary": "Create a data source.", + "operationId": "addDatasource", "parameters": [ { - "type": "string", - "x-go-name": "FolderUID", - "name": "folder_uid", - "in": "path", - "required": true - }, - { - "x-go-name": "Body", - "description": "To change the unique identifier (uid), provide another one.\nTo overwrite an existing folder with newer version, set `overwrite` to `true`.\nProvide the current version to safelly update the folder: if the provided version differs from the stored one the request will fail, unless `overwrite` is `true`.", - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateFolderCommand" + "$ref": "#/definitions/AddDataSourceCommand" } } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4743,9 +3347,6 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "409": { "$ref": "#/responses/conflictError" }, @@ -4753,35 +3354,26 @@ "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Deletes an existing folder identified by UID along with all dashboards (and their alerts) stored in the folder. This operation cannot be reverted.", - "tags": ["folders"], - "summary": "Delete folder.", - "operationId": "deleteFolder", + } + }, + "/datasources/id/{datasource_name}": { + "get": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", + "tags": ["datasources"], + "summary": "Get data source Id by Name.", + "operationId": "getDatasourceIdByName", "parameters": [ { "type": "string", - "x-go-name": "FolderUID", - "name": "folder_uid", + "x-go-name": "DatasourceName", + "name": "datasource_name", "in": "path", "required": true - }, - { - "type": "boolean", - "default": false, - "x-go-name": "ForceDeleteRules", - "description": "If `true` any Grafana 8 Alerts under this folder will be deleted.\nSet to `false` so that the request will fail if the folder contains any Grafana 8 Alerts.", - "name": "forceDeleteRules", - "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/deleteFolderResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getDatasourceIDresponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4798,23 +3390,24 @@ } } }, - "/folders/{folder_uid}/permissions": { + "/datasources/name/{datasource_name}": { "get": { - "tags": ["folder_permissions"], - "summary": "Gets all existing permissions for the folder with the given `uid`.", - "operationId": "getFolderPermissions", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", + "tags": ["datasources"], + "summary": "Get a single data source by Name.", + "operationId": "getDatasourceByName", "parameters": [ { "type": "string", - "x-go-name": "FolderUID", - "name": "folder_uid", + "x-go-name": "DatasourceName", + "name": "datasource_name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDashboardPermissionsResponse" + "$ref": "#/responses/getDatasourceResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4822,38 +3415,28 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { - "tags": ["folder_permissions"], - "summary": "Updates permissions for a folder. This operation will remove existing permissions if they’re not included in the request.", - "operationId": "updateFolderPermissions", + "delete": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", + "tags": ["datasources"], + "summary": "Delete an existing data source by name.", + "operationId": "deleteDatasourceByName", "parameters": [ - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateDashboardAclCommand" - } - }, { "type": "string", - "x-go-name": "FolderUID", - "name": "folder_uid", + "x-go-name": "DatasourceName", + "name": "datasource_name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/deleteDatasourceByNameResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4870,108 +3453,84 @@ } } }, - "/library-elements": { + "/datasources/proxy/{datasource_id}/{datasource_proxy_route}": { "get": { - "description": "Returns a list of all library elements the authenticated user has permission to view.\nUse the `perPage` query parameter to control the maximum number of library elements returned; the default limit is `100`.\nYou can also use the `page` query parameter to fetch library elements from any page other than the first one.", - "tags": ["library_elements"], - "summary": "Get all library elements.", - "operationId": "getLibraryElements", + "description": "Proxies all calls to the actual data source.", + "tags": ["datasources"], + "summary": "Data source proxy GET calls.", + "operationId": "datasourceProxyGETcalls", "parameters": [ { "type": "string", - "x-go-name": "SearchString", - "description": "Part of the name or description searched for.", - "name": "searchString", - "in": "query" - }, - { - "enum": [1, 2], - "type": "integer", - "format": "int64", - "x-go-name": "Kind", - "description": "Kind of element to search for.", - "name": "kind", - "in": "query" - }, - { - "enum": ["alpha-asc", "alpha-desc"], - "type": "string", - "x-go-name": "SortDirection", - "description": "Sort order of elements.", - "name": "sortDirection", - "in": "query" - }, - { - "type": "string", - "x-go-name": "TypeFilter", - "description": "A comma separated list of types to filter the elements by", - "name": "typeFilter", - "in": "query" - }, - { - "type": "string", - "x-go-name": "ExcludeUID", - "description": "Element UID to exclude from search results.", - "name": "excludeUid", - "in": "query" + "x-go-name": "DatasourceID", + "name": "datasource_id", + "in": "path", + "required": true }, { "type": "string", - "x-go-name": "FolderFilter", - "description": "A comma separated list of folder ID(s) to filter the elements by.", - "name": "folderFilter", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 100, - "x-go-name": "PerPage", - "description": "The number of results per page.", - "name": "perPage", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 1, - "x-go-name": "Page", - "description": "The page for a set of records, given that only perPage records are returned at a time. Numbering starts at 1.", - "name": "page", - "in": "query" + "x-go-name": "DatasourceProxyRoute", + "name": "datasource_proxy_route", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementsResponse" + "description": "" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "post": { - "description": "Creates a new library element.", - "tags": ["library_elements"], - "summary": "Create library element.", - "operationId": "createLibraryElement", + "description": "Proxies all calls to the actual data source. The data source should support POST methods for the specific path and role as defined", + "tags": ["datasources"], + "summary": "Data source proxy POST calls.", + "operationId": "datasourceProxyPOSTcalls", "parameters": [ { - "x-go-name": "Body", - "name": "body", + "type": "string", + "x-go-name": "DatasourceID", + "name": "datasource_id", + "in": "path", + "required": true + }, + { + "type": "string", + "x-go-name": "DatasourceProxyRoute", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, + { + "name": "DatasourceProxyParam", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateLibraryElementCommand" + "type": "object" } } ], "responses": { - "200": { - "$ref": "#/responses/getLibraryElementResponse" + "201": { + "description": "" + }, + "202": { + "description": "" }, "400": { "$ref": "#/responses/badRequestError" @@ -4989,61 +3548,41 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/library-elements/name/{library_element_name}": { - "get": { - "description": "Returns a library element with the given name.", - "tags": ["library_elements"], - "summary": "Get library element by name.", - "operationId": "getLibraryElementByName", + }, + "delete": { + "description": "Proxies all calls to the actual data source.", + "tags": ["datasources"], + "summary": "Data source proxy DELETE calls.", + "operationId": "datasourceProxyDELETEcalls", "parameters": [ { "type": "string", - "x-go-name": "Name", - "name": "library_element_name", + "x-go-name": "DatasourceID", + "name": "datasource_id", "in": "path", "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getLibraryElementResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "404": { - "$ref": "#/responses/notFoundError" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/library-elements/{library_element_uid}": { - "get": { - "description": "Returns a library element with the given UID.", - "tags": ["library_elements"], - "summary": "Get library element by UID.", - "operationId": "getLibraryElementByUID", - "parameters": [ { "type": "string", - "x-go-name": "UID", - "name": "library_element_uid", + "x-go-name": "DatasourceProxyRoute", + "name": "datasource_proxy_route", "in": "path", "required": true } ], "responses": { - "200": { - "$ref": "#/responses/getLibraryElementResponse" + "202": { + "description": "" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "404": { "$ref": "#/responses/notFoundError" }, @@ -5051,24 +3590,26 @@ "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Deletes an existing library element as specified by the UID. This operation cannot be reverted.\nYou cannot delete a library element that is connected. This operation cannot be reverted.", - "tags": ["library_elements"], - "summary": "Delete library element.", - "operationId": "deleteLibraryElementByUID", + } + }, + "/datasources/uid/{datasource_uid}": { + "get": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", + "tags": ["datasources"], + "summary": "Get a single data source by UID.", + "operationId": "getDatasourceByUID", "parameters": [ { - "type": "string", - "x-go-name": "UID", - "name": "library_element_uid", + "type": "string", + "x-go-name": "DatasourceUID", + "name": "datasource_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getDatasourceResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5087,35 +3628,23 @@ } } }, - "patch": { - "description": "Updates an existing library element identified by uid.", - "tags": ["library_elements"], - "summary": "Update library element.", - "operationId": "updateLibraryElement", + "delete": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", + "tags": ["datasources"], + "summary": "Delete an existing data source by UID.", + "operationId": "deleteDatasourceByUID", "parameters": [ { "type": "string", - "x-go-name": "UID", - "name": "library_element_uid", + "x-go-name": "DatasourceUID", + "name": "datasource_uid", "in": "path", "required": true - }, - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PatchLibraryElementCommand" - } } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5126,37 +3655,40 @@ "404": { "$ref": "#/responses/notFoundError" }, - "412": { - "$ref": "#/responses/preconditionFailedError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/library-elements/{library_element_uid}/connections/": { + "/datasources/{datasource_id}": { "get": { - "description": "Returns a list of connections for a library element based on the UID specified.", - "tags": ["library_elements"], - "summary": "Get library element connections.", - "operationId": "getLibraryElementConnections", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).", + "tags": ["datasources"], + "summary": "Get a single data source by Id.", + "operationId": "getDatasourceByID", "parameters": [ { "type": "string", - "x-go-name": "UID", - "name": "library_element_uid", + "x-go-name": "DatasourceID", + "name": "datasource_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementConnectionsResponse" + "$ref": "#/responses/getDatasourceResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "404": { "$ref": "#/responses/notFoundError" }, @@ -5164,128 +3696,61 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/licensing/check": { - "get": { - "tags": ["licensing", "enterprise"], - "summary": "Check license availability.", - "operationId": "getLicenseStatus", - "responses": { - "200": { - "$ref": "#/responses/getLicenseStatusResponse" - } - } - } - }, - "/licensing/custom-permissions": { - "get": { - "description": "You need to have a permission with action `licensing.reports:read`.", - "tags": ["licensing", "enterprise"], - "summary": "Get custom permissions report.", - "operationId": "getCustomPermissionsReport", - "responses": { - "200": { - "$ref": "#/responses/getCustomPermissionsReportResponse" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/licensing/custom-permissions-csv": { - "get": { - "description": "You need to have a permission with action `licensing.reports:read`.", - "produces": ["text/csv"], - "tags": ["licensing", "enterprise"], - "summary": "Get custom permissions report in CSV format.", - "operationId": "getCustomPermissionsCSV", - "responses": { - "200": { - "$ref": "#/responses/getCustomPermissionsReportResponse" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/licensing/refresh-stats": { - "get": { - "description": "You need to have a permission with action `licensing:read`.", - "tags": ["licensing", "enterprise"], - "summary": "Refresh license stats.", - "operationId": "refreshLicenseStats", - "responses": { - "200": { - "$ref": "#/responses/refreshLicenseStatsResponse" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/licensing/token": { - "get": { - "description": "You need to have a permission with action `licensing:read`.", - "tags": ["licensing", "enterprise"], - "summary": "Get license token.", - "operationId": "getLicenseToken", - "responses": { - "200": { - "$ref": "#/responses/getLicenseTokenResponse" - } - } }, - "post": { - "description": "You need to have a permission with action `licensing:update`.", - "tags": ["licensing", "enterprise"], - "summary": "Create license token.", - "operationId": "postLicenseToken", + "put": { + "description": "Similar to creating a data source, `password` and `basicAuthPassword` should be defined under\nsecureJsonData in order to be stored securely as an encrypted blob in the database. Then, the\nencrypted fields are listed under secureJsonFields section in the response.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:write` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).", + "tags": ["datasources"], + "summary": "Update an existing data source.", + "operationId": "updateDatasource", "parameters": [ { - "x-go-name": "Body", - "name": "body", + "type": "string", + "x-go-name": "DatasourceID", + "name": "datasource_id", + "in": "path", + "required": true + }, + { + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/DeleteTokenCommand" + "$ref": "#/definitions/UpdateDataSourceCommand" } } ], "responses": { "200": { - "$ref": "#/responses/getLicenseTokenResponse" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } }, "delete": { - "description": "Removes the license stored in the Grafana database. Available in Grafana Enterprise v7.4+.\n\nYou need to have a permission with action `licensing:delete`.", - "tags": ["licensing", "enterprise"], - "summary": "Remove license from database.", - "operationId": "deleteLicenseToken", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).", + "tags": ["datasources"], + "summary": "Delete an existing data source by id.", + "operationId": "deleteDatasourceByID", "parameters": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/DeleteTokenCommand" - } + "type": "string", + "x-go-name": "DatasourceID", + "name": "datasource_id", + "in": "path", + "required": true } ], "responses": { - "202": { - "$ref": "#/responses/acceptedResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "200": { + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5293,8 +3758,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "422": { - "$ref": "#/responses/unprocessableEntityError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -5302,12 +3767,12 @@ } } }, - "/licensing/token/renew": { + "/ds/query": { "post": { - "description": "Manually ask license issuer for a new token. Available in Grafana Enterprise v7.4+.\n\nYou need to have a permission with action `licensing:update`.", - "tags": ["licensing", "enterprise"], - "summary": "Manually force license refresh.", - "operationId": "postRenewLicenseToken", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:query`.", + "tags": ["ds"], + "summary": "Query metrics with expressions", + "operationId": "queryMetricsWithExpressions", "parameters": [ { "x-go-name": "Body", @@ -5315,34 +3780,22 @@ "in": "body", "required": true, "schema": { - "type": "object" + "$ref": "#/definitions/MetricRequest" } } ], "responses": { "200": { - "$ref": "#/responses/postRenewLicenseTokenResponse" + "$ref": "#/responses/queryDataResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" - } - } - } - }, - "/login/saml": { - "get": { - "tags": ["saml", "enterprise"], - "summary": "It initiates the login flow by redirecting the user to the IdP.", - "operationId": "getSAMLLogin", - "responses": { - "302": { - "description": "" - }, - "404": { - "$ref": "#/responses/notFoundError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -5350,32 +3803,35 @@ } } }, - "/logout/saml": { + "/folders": { "get": { - "tags": ["saml", "enterprise"], - "summary": "GetLogout initiates single logout process.", - "operationId": "getSAMLLogout", - "responses": { - "302": { - "description": "" - }, - "404": { - "$ref": "#/responses/notFoundError" + "description": "Returns all folders that the authenticated user has permission to view.", + "tags": ["folders"], + "summary": "Get all folders.", + "operationId": "getFolders", + "parameters": [ + { + "type": "integer", + "format": "int64", + "default": 1000, + "x-go-name": "Limit", + "description": "Limit the maximum number of folders to return", + "name": "limit", + "in": "query" }, - "500": { - "$ref": "#/responses/internalServerError" + { + "type": "integer", + "format": "int64", + "default": 1, + "x-go-name": "Page", + "description": "Page index for starting fetching folders", + "name": "page", + "in": "query" } - } - } - }, - "/org": { - "get": { - "description": "Get current Organization", - "tags": ["current_org_details"], - "operationId": "getOrg", + ], "responses": { "200": { - "$ref": "#/responses/getOrgResponse" + "$ref": "#/responses/getFoldersResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5388,10 +3844,10 @@ } } }, - "put": { - "tags": ["current_org_details"], - "summary": "Update current Organization.", - "operationId": "updateOrg", + "post": { + "tags": ["folders"], + "summary": "Create folder.", + "operationId": "createFolder", "parameters": [ { "x-go-name": "Body", @@ -5399,13 +3855,13 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgForm" + "$ref": "#/definitions/CreateFolderCommand" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/folderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5416,34 +3872,34 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "409": { + "$ref": "#/responses/conflictError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/address": { - "put": { - "tags": ["current_org_details"], - "summary": "Update current Organization's address.", - "operationId": "updateOrgAddress", + "/folders/id/{folder_id}": { + "get": { + "description": "Returns the folder identified by id.", + "tags": ["folders"], + "summary": "Get folder by id.", + "operationId": "getFolderByID", "parameters": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgAddressForm" - } + "type": "integer", + "format": "int64", + "x-go-name": "FolderID", + "name": "folder_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/folderResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5451,20 +3907,32 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/invites": { + "/folders/{folder_uid}": { "get": { - "tags": ["org_invites"], - "summary": "Get pending invites.", - "operationId": "getInvites", + "tags": ["folders"], + "summary": "Get folder by uid.", + "operationId": "getFolderByUID", + "parameters": [ + { + "type": "string", + "x-go-name": "FolderUID", + "name": "folder_uid", + "in": "path", + "required": true + } + ], "responses": { "200": { - "$ref": "#/responses/getInvitesResponse" + "description": "" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5472,29 +3940,40 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { - "tags": ["org_invites"], - "summary": "Add invite.", - "operationId": "addInvite", + "put": { + "tags": ["folders"], + "summary": "Update folder.", + "operationId": "updateFolder", "parameters": [ + { + "type": "string", + "x-go-name": "FolderUID", + "name": "folder_uid", + "in": "path", + "required": true + }, { "x-go-name": "Body", + "description": "To change the unique identifier (uid), provide another one.\nTo overwrite an existing folder with newer version, set `overwrite` to `true`.\nProvide the current version to safelly update the folder: if the provided version differs from the stored one the request will fail, unless `overwrite` is `true`.", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddInviteForm" + "$ref": "#/definitions/UpdateFolderCommand" } } ], "responses": { "200": { - "$ref": "#/responses/addOrgUser" + "$ref": "#/responses/folderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5505,53 +3984,42 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "412": { - "$ref": "#/responses/SMTPNotEnabledError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/org/preferences": { - "get": { - "tags": ["org_preferences"], - "summary": "Get Current Org Prefs.", - "operationId": "getOrgPreferences", - "responses": { - "200": { - "$ref": "#/responses/getPreferencesResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "404": { + "$ref": "#/responses/notFoundError" }, - "403": { - "$ref": "#/responses/forbiddenError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" } } }, - "put": { - "tags": ["org_preferences"], - "summary": "Update Current Org Prefs.", - "operationId": "updateOrgPreferences", + "delete": { + "description": "Deletes an existing folder identified by UID along with all dashboards (and their alerts) stored in the folder. This operation cannot be reverted.", + "tags": ["folders"], + "summary": "Delete folder.", + "operationId": "deleteFolder", "parameters": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdatePrefsCmd" - } + "type": "string", + "x-go-name": "FolderUID", + "name": "folder_uid", + "in": "path", + "required": true + }, + { + "type": "boolean", + "default": false, + "x-go-name": "ForceDeleteRules", + "description": "If `true` any Grafana 8 Alerts under this folder will be deleted.\nSet to `false` so that the request will fail if the folder contains any Grafana 8 Alerts.", + "name": "forceDeleteRules", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/addOrgUser" + "$ref": "#/responses/deleteFolderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5562,21 +4030,32 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/users": { + "/folders/{folder_uid}/permissions": { "get": { - "description": "Returns all org users within the current organization. Accessible to users with org admin role.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:read` with scope `users:*`.", - "tags": ["current_org_details"], - "summary": "Get all users within the current organization.", - "operationId": "getOrgUsers", + "tags": ["folder_permissions"], + "summary": "Gets all existing permissions for the folder with the given `uid`.", + "operationId": "getFolderPermissions", + "parameters": [ + { + "type": "string", + "x-go-name": "FolderUID", + "name": "folder_uid", + "in": "path", + "required": true + } + ], "responses": { "200": { - "$ref": "#/responses/getOrgUsersResponse" + "$ref": "#/responses/getDashboardPermissionsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5584,25 +4063,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "post": { - "description": "Adds a global user to the current organization.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:add` with scope `users:*`.", - "tags": ["current_org_details"], - "summary": "Add a new user to the current organization", - "operationId": "addOrgUser", + "tags": ["folder_permissions"], + "summary": "Updates permissions for a folder. This operation will remove existing permissions if they’re not included in the request.", + "operationId": "updateFolderPermissions", "parameters": [ { - "x-go-name": "Body", - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddOrgUserCommand" + "$ref": "#/definitions/UpdateDashboardAclCommand" } + }, + { + "type": "string", + "x-go-name": "FolderUID", + "name": "folder_uid", + "in": "path", + "required": true } ], "responses": { @@ -5615,88 +4102,103 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/users/lookup": { + "/library-elements": { "get": { - "description": "Returns all org users within the current organization, but with less detailed information.\nAccessible to users with org admin role, admin in any folder or admin of any team.\nMainly used by Grafana UI for providing list of users when adding team members and when editing folder/dashboard permissions.", - "tags": ["current_org_details"], - "summary": "Get all users within the current organization (lookup)", - "operationId": "lookupOrgUsers", + "description": "Returns a list of all library elements the authenticated user has permission to view.\nUse the `perPage` query parameter to control the maximum number of library elements returned; the default limit is `100`.\nYou can also use the `page` query parameter to fetch library elements from any page other than the first one.", + "tags": ["library_elements"], + "summary": "Get all library elements.", + "operationId": "getLibraryElements", "parameters": [ { "type": "string", - "x-go-name": "Query", - "name": "query", + "x-go-name": "SearchString", + "description": "Part of the name or description searched for.", + "name": "searchString", "in": "query" }, { + "enum": [1, 2], "type": "integer", "format": "int64", - "x-go-name": "Limit", - "name": "limit", + "x-go-name": "Kind", + "description": "Kind of element to search for.", + "name": "kind", "in": "query" - } - ], - "responses": { - "200": { - "$ref": "#/responses/lookupOrgUsersResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + { + "enum": ["alpha-asc", "alpha-desc"], + "type": "string", + "x-go-name": "SortDirection", + "description": "Sort order of elements.", + "name": "sortDirection", + "in": "query" }, - "403": { - "$ref": "#/responses/forbiddenError" + { + "type": "string", + "x-go-name": "TypeFilter", + "description": "A comma separated list of types to filter the elements by", + "name": "typeFilter", + "in": "query" + }, + { + "type": "string", + "x-go-name": "ExcludeUID", + "description": "Element UID to exclude from search results.", + "name": "excludeUid", + "in": "query" + }, + { + "type": "string", + "x-go-name": "FolderFilter", + "description": "A comma separated list of folder ID(s) to filter the elements by.", + "name": "folderFilter", + "in": "query" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/org/users/{user_id}": { - "delete": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:remove` with scope `users:*`.", - "tags": ["current_org_details"], - "summary": "Delete user in current organization", - "operationId": "deleteOrgUser", - "parameters": [ { "type": "integer", "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", - "required": true + "default": 100, + "x-go-name": "PerPage", + "description": "The number of results per page.", + "name": "perPage", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1, + "x-go-name": "Page", + "description": "The page for a set of records, given that only perPage records are returned at a time. Numbering starts at 1.", + "name": "page", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "$ref": "#/responses/getLibraryElementsResponse" }, - "403": { - "$ref": "#/responses/forbiddenError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "500": { "$ref": "#/responses/internalServerError" } } }, - "patch": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users.role:update` with scope `users:*`.", - "tags": ["current_org_details"], - "summary": "Updates the given user", - "operationId": "updateOrgUser", + "post": { + "description": "Creates a new library element.", + "tags": ["library_elements"], + "summary": "Create library element.", + "operationId": "createLibraryElement", "parameters": [ { "x-go-name": "Body", @@ -5704,21 +4206,13 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgUserCommand" + "$ref": "#/definitions/CreateLibraryElementCommand" } - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getLibraryElementResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5729,36 +4223,37 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/{invitation_code}/invites": { - "delete": { - "tags": ["org_invites"], - "summary": "Revoke invite.", - "operationId": "revokeInvite", + "/library-elements/name/{library_element_name}": { + "get": { + "description": "Returns a library element with the given name.", + "tags": ["library_elements"], + "summary": "Get library element by name.", + "operationId": "getLibraryElementByName", "parameters": [ { "type": "string", - "x-go-name": "Code", - "name": "invitation_code", + "x-go-name": "Name", + "name": "library_element_name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getLibraryElementResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "404": { "$ref": "#/responses/notFoundError" }, @@ -5768,51 +4263,56 @@ } } }, - "/orgs": { + "/library-elements/{library_element_uid}": { "get": { - "security": [ + "description": "Returns a library element with the given UID.", + "tags": ["library_elements"], + "summary": "Get library element by UID.", + "operationId": "getLibraryElementByUID", + "parameters": [ { - "basic": [] + "type": "string", + "x-go-name": "UID", + "name": "library_element_uid", + "in": "path", + "required": true } ], - "description": "Search all Organizations", - "tags": ["orgs"], - "operationId": "searchOrg", - "parameters": [ - { - "type": "integer", - "format": "int64", - "default": 1, - "x-go-name": "Page", - "name": "page", - "in": "query" + "responses": { + "200": { + "$ref": "#/responses/getLibraryElementResponse" }, - { - "type": "integer", - "format": "int64", - "default": 1000, - "x-go-name": "PerPage", - "description": "Number of items per page\nThe totalCount field in the response can be used for pagination list E.g. if totalCount is equal to 100 teams and the perpage parameter is set to 10 then there are 10 pages of teams.", - "name": "perpage", - "in": "query" + "401": { + "$ref": "#/responses/unauthorisedError" }, - { - "type": "string", - "x-go-name": "Name", - "name": "name", - "in": "query" + "404": { + "$ref": "#/responses/notFoundError" }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "delete": { + "description": "Deletes an existing library element as specified by the UID. This operation cannot be reverted.\nYou cannot delete a library element that is connected. This operation cannot be reverted.", + "tags": ["library_elements"], + "summary": "Delete library element.", + "operationId": "deleteLibraryElementByUID", + "parameters": [ { "type": "string", - "x-go-name": "Query", - "description": "If set it will return results where the query value is contained in the name field. Query values with spaces need to be URL encoded.", - "name": "query", - "in": "query" + "x-go-name": "UID", + "name": "library_element_uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/searchOrgResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5820,33 +4320,43 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { - "description": "Only works if [users.allow_org_create](https://grafana.com/docs/grafana/latest/administration/configuration/#allow_org_create) is set.", - "tags": ["orgs"], - "summary": "Create Organization.", - "operationId": "createOrg", + "patch": { + "description": "Updates an existing library element identified by uid.", + "tags": ["library_elements"], + "summary": "Update library element.", + "operationId": "updateLibraryElement", "parameters": [ + { + "type": "string", + "x-go-name": "UID", + "name": "library_element_uid", + "in": "path", + "required": true + }, { "x-go-name": "Body", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateOrgCommand" + "$ref": "#/definitions/PatchLibraryElementCommand" } } ], "responses": { "200": { - "$ref": "#/responses/createOrgResponse" + "$ref": "#/responses/getLibraryElementResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5854,8 +4364,11 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" + "404": { + "$ref": "#/responses/notFoundError" + }, + "412": { + "$ref": "#/responses/preconditionFailedError" }, "500": { "$ref": "#/responses/internalServerError" @@ -5863,34 +4376,30 @@ } } }, - "/orgs/name/{org_name}": { + "/library-elements/{library_element_uid}/connections/": { "get": { - "security": [ - { - "basic": [] - } - ], - "tags": ["orgs"], - "summary": "Get Organization by ID.", - "operationId": "getOrgByName", + "description": "Returns a list of connections for a library element based on the UID specified.", + "tags": ["library_elements"], + "summary": "Get library element connections.", + "operationId": "getLibraryElementConnections", "parameters": [ { "type": "string", - "x-go-name": "OrgName", - "name": "org_name", + "x-go-name": "UID", + "name": "library_element_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getOrgResponse" + "$ref": "#/responses/getLibraryElementConnectionsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -5898,26 +4407,11 @@ } } }, - "/orgs/{org_id}": { + "/org": { "get": { - "security": [ - { - "basic": [] - } - ], - "tags": ["orgs"], - "summary": "Get Organization by ID.", - "operationId": "getOrgByID", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID", - "name": "org_id", - "in": "path", - "required": true - } - ], + "description": "Get current Organization", + "tags": ["current_org_details"], + "operationId": "getOrg", "responses": { "200": { "$ref": "#/responses/getOrgResponse" @@ -5934,14 +4428,9 @@ } }, "put": { - "security": [ - { - "basic": [] - } - ], - "tags": ["orgs"], - "summary": "Update Organization.", - "operationId": "adminUpdateOrg", + "tags": ["current_org_details"], + "summary": "Update current Organization.", + "operationId": "updateOrg", "parameters": [ { "x-go-name": "Body", @@ -5949,53 +4438,8 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgForm" - } - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID", - "name": "org_id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "delete": { - "security": [ - { - "basic": [] - } - ], - "tags": ["orgs"], - "summary": "Delete Organization.", - "operationId": "adminDeleteOrg", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID", - "name": "org_id", - "in": "path", - "required": true + "$ref": "#/definitions/UpdateOrgForm" + } } ], "responses": { @@ -6011,20 +4455,17 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs/{org_id}/address": { + "/org/address": { "put": { - "tags": ["orgs"], - "summary": "Update Organization's address.", - "operationId": "adminUpdateOrgAddress", + "tags": ["current_org_details"], + "summary": "Update current Organization's address.", + "operationId": "updateOrgAddress", "parameters": [ { "x-go-name": "Body", @@ -6034,14 +4475,6 @@ "schema": { "$ref": "#/definitions/UpdateOrgAddressForm" } - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { @@ -6063,25 +4496,14 @@ } } }, - "/orgs/{org_id}/quotas": { + "/org/invites": { "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `orgs.quotas:read` and scope `org:id:1` (orgIDScope).\nlist", - "tags": ["orgs"], - "summary": "Fetch Organization quota.", - "operationId": "getOrgQuota", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID", - "name": "org_id", - "in": "path", - "required": true - } - ], + "tags": ["org_invites"], + "summary": "Get pending invites.", + "operationId": "getInvites", "responses": { "200": { - "$ref": "#/responses/getQuotaResponse" + "$ref": "#/responses/getInvitesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6089,55 +4511,32 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/orgs/{org_id}/quotas/{quota_target}": { - "put": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `orgs.quotas:write` and scope `org:id:1` (orgIDScope).", - "tags": ["orgs"], - "summary": "Update user quota.", - "operationId": "updateOrgQuota", + }, + "post": { + "tags": ["org_invites"], + "summary": "Add invite.", + "operationId": "addInvite", "parameters": [ - { - "type": "string", - "x-go-name": "QuotaTarget", - "name": "quota_target", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID", - "name": "org_id", - "in": "path", - "required": true - }, { "x-go-name": "Body", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgQuotaCmd" + "$ref": "#/definitions/AddInviteForm" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/addOrgUser" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6145,8 +4544,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "412": { + "$ref": "#/responses/SMTPNotEnabledError" }, "500": { "$ref": "#/responses/internalServerError" @@ -6154,30 +4553,14 @@ } } }, - "/orgs/{org_id}/users": { + "/org/preferences": { "get": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:read` with scope `users:*`.", - "tags": ["orgs"], - "summary": "Get Users in Organization.", - "operationId": "adminGetOrgUsers", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID", - "name": "org_id", - "in": "path", - "required": true - } - ], + "tags": ["org_preferences"], + "summary": "Get Current Org Prefs.", + "operationId": "getOrgPreferences", "responses": { "200": { - "$ref": "#/responses/getOrgUsersResponse" + "$ref": "#/responses/getPreferencesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6190,11 +4573,10 @@ } } }, - "post": { - "description": "Adds a global user to the current organization.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:add` with scope `users:*`.", - "tags": ["orgs"], - "summary": "Add a new user to the current organization", - "operationId": "adminAddOrgUser", + "put": { + "tags": ["org_preferences"], + "summary": "Update Current Org Prefs.", + "operationId": "updateOrgPreferences", "parameters": [ { "x-go-name": "Body", @@ -6202,21 +4584,16 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddOrgUserCommand" + "$ref": "#/definitions/UpdatePrefsCmd" } - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/addOrgUser" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6230,36 +4607,15 @@ } } }, - "/orgs/{org_id}/users/{user_id}": { - "delete": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:remove` with scope `users:*`.", - "tags": ["orgs"], - "summary": "Delete user in current organization", - "operationId": "adminDeleteOrgUser", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID", - "name": "org_id", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", - "required": true - } - ], + "/org/users": { + "get": { + "description": "Returns all org users within the current organization. Accessible to users with org admin role.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:read` with scope `users:*`.", + "tags": ["current_org_details"], + "summary": "Get all users within the current organization.", + "operationId": "getOrgUsers", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getOrgUsersResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6272,11 +4628,11 @@ } } }, - "patch": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users.role:update` with scope `users:*`.", - "tags": ["orgs"], - "summary": "Update Users in Organization.", - "operationId": "adminUpdateOrgUser", + "post": { + "description": "Adds a global user to the current organization.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:add` with scope `users:*`.", + "tags": ["current_org_details"], + "summary": "Add a new user to the current organization", + "operationId": "addOrgUser", "parameters": [ { "x-go-name": "Body", @@ -6284,33 +4640,14 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgUserCommand" + "$ref": "#/definitions/AddOrgUserCommand" } - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID", - "name": "org_id", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", - "required": true } ], "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -6323,118 +4660,137 @@ } } }, - "/prometheus/grafana/api/v1/alerts": { - "get": { - "description": "gets the current alerts", - "tags": ["prometheus"], - "operationId": "RouteGetGrafanaAlertStatuses", - "responses": { - "200": { - "description": "AlertResponse", - "schema": { - "$ref": "#/definitions/AlertResponse" - } - } - } - } - }, - "/prometheus/grafana/api/v1/rules": { + "/org/users/lookup": { "get": { - "description": "gets the evaluation statuses of all rules", - "tags": ["prometheus"], - "operationId": "RouteGetGrafanaRuleStatuses", + "description": "Returns all org users within the current organization, but with less detailed information.\nAccessible to users with org admin role, admin in any folder or admin of any team.\nMainly used by Grafana UI for providing list of users when adding team members and when editing folder/dashboard permissions.", + "tags": ["current_org_details"], + "summary": "Get all users within the current organization (lookup)", + "operationId": "lookupOrgUsers", "parameters": [ { "type": "string", - "name": "DashboardUID", + "x-go-name": "Query", + "name": "query", "in": "query" }, { "type": "integer", "format": "int64", - "name": "PanelID", + "x-go-name": "Limit", + "name": "limit", "in": "query" } ], "responses": { "200": { - "description": "RuleResponse", - "schema": { - "$ref": "#/definitions/RuleResponse" - } + "$ref": "#/responses/lookupOrgUsersResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } - } - }, - "/prometheus/{Recipient}/api/v1/alerts": { - "get": { - "description": "gets the current alerts", - "tags": ["prometheus"], - "operationId": "RouteGetAlertStatuses", + } + }, + "/org/users/{user_id}": { + "delete": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:remove` with scope `users:*`.", + "tags": ["current_org_details"], + "summary": "Delete user in current organization", + "operationId": "deleteOrgUser", "parameters": [ { "type": "integer", "format": "int64", - "description": "Recipient should be the numeric datasource id", - "name": "Recipient", + "x-go-name": "UserID", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "description": "AlertResponse", - "schema": { - "$ref": "#/definitions/AlertResponse" - } + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } - } - }, - "/prometheus/{Recipient}/api/v1/rules": { - "get": { - "description": "gets the evaluation statuses of all rules", - "tags": ["prometheus"], - "operationId": "RouteGetRuleStatuses", + }, + "patch": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users.role:update` with scope `users:*`.", + "tags": ["current_org_details"], + "summary": "Updates the given user", + "operationId": "updateOrgUser", "parameters": [ { - "type": "string", - "name": "DashboardUID", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "name": "PanelID", - "in": "query" + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgUserCommand" + } }, { "type": "integer", "format": "int64", - "description": "Recipient should be the numeric datasource id", - "name": "Recipient", + "x-go-name": "UserID", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "description": "RuleResponse", - "schema": { - "$ref": "#/definitions/RuleResponse" - } + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/recording-rules": { - "get": { - "tags": ["recording_rules", "enterprise"], - "summary": "Get all recording rules.", - "operationId": "listRecordingRules", + "/org/{invitation_code}/invites": { + "delete": { + "tags": ["org_invites"], + "summary": "Revoke invite.", + "operationId": "revokeInvite", + "parameters": [ + { + "type": "string", + "x-go-name": "Code", + "name": "invitation_code", + "in": "path", + "required": true + } + ], "responses": { "200": { - "$ref": "#/responses/listRecordingRulesResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6449,25 +4805,53 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { - "tags": ["recording_rules", "enterprise"], - "summary": "Update a recording rule.", - "operationId": "updateRecordingRule", + } + }, + "/orgs": { + "get": { + "security": [ + { + "basic": [] + } + ], + "description": "Search all Organizations", + "tags": ["orgs"], + "operationId": "searchOrg", "parameters": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RecordingRuleJSON" - } + "type": "integer", + "format": "int64", + "default": 1, + "x-go-name": "Page", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1000, + "x-go-name": "PerPage", + "description": "Number of items per page\nThe totalCount field in the response can be used for pagination list E.g. if totalCount is equal to 100 teams and the perpage parameter is set to 10 then there are 10 pages of teams.", + "name": "perpage", + "in": "query" + }, + { + "type": "string", + "x-go-name": "Name", + "name": "name", + "in": "query" + }, + { + "type": "string", + "x-go-name": "Query", + "description": "If set it will return results where the query value is contained in the name field. Query values with spaces need to be URL encoded.", + "name": "query", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/recordingRuleResponse" + "$ref": "#/responses/searchOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6475,8 +4859,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -6484,9 +4868,10 @@ } }, "post": { - "tags": ["recording_rules", "enterprise"], - "summary": "Create a new recording rule.", - "operationId": "createRecordingRule", + "description": "Only works if [users.allow_org_create](https://grafana.com/docs/grafana/latest/administration/configuration/#allow_org_create) is set.", + "tags": ["orgs"], + "summary": "Create Organization.", + "operationId": "createOrg", "parameters": [ { "x-go-name": "Body", @@ -6494,13 +4879,13 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/RecordingRuleJSON" + "$ref": "#/definitions/CreateOrgCommand" } } ], "responses": { "200": { - "$ref": "#/responses/recordingRuleResponse" + "$ref": "#/responses/createOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6508,8 +4893,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -6517,25 +4902,28 @@ } } }, - "/recording-rules/test": { - "post": { - "tags": ["recording_rules", "enterprise"], - "summary": "Test a recording rule.", - "operationId": "testCreateRecordingRule", + "/orgs/name/{org_name}": { + "get": { + "security": [ + { + "basic": [] + } + ], + "tags": ["orgs"], + "summary": "Get Organization by ID.", + "operationId": "getOrgByName", "parameters": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RecordingRuleJSON" - } + "type": "string", + "x-go-name": "OrgName", + "name": "org_name", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6543,26 +4931,35 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "422": { - "$ref": "#/responses/unprocessableEntityError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/recording-rules/writer": { + "/orgs/{org_id}": { "get": { - "tags": ["recording_rules", "enterprise"], - "summary": "Get the write target.", - "operationId": "getRecordingRuleWriteTarget", + "security": [ + { + "basic": [] + } + ], + "tags": ["orgs"], + "summary": "Get Organization by ID.", + "operationId": "getOrgByID", + "parameters": [ + { + "type": "integer", + "format": "int64", + "x-go-name": "OrgID", + "name": "org_id", + "in": "path", + "required": true + } + ], "responses": { "200": { - "$ref": "#/responses/recordingRuleWriteTargetResponse" + "$ref": "#/responses/getOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6570,18 +4967,20 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { - "tags": ["recording_rules", "enterprise"], - "summary": "Create a new write target.", - "operationId": "createRecordingRuleWriteTarget", + "put": { + "security": [ + { + "basic": [] + } + ], + "tags": ["orgs"], + "summary": "Update Organization.", + "operationId": "adminUpdateOrg", "parameters": [ { "x-go-name": "Body", @@ -6589,13 +4988,24 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PrometheusRemoteWriteTargetJSON" + "$ref": "#/definitions/UpdateOrgForm" } + }, + { + "type": "integer", + "format": "int64", + "x-go-name": "OrgID", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/recordingRuleWriteTargetResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6603,25 +5013,37 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "422": { - "$ref": "#/responses/unprocessableEntityError" - }, "500": { "$ref": "#/responses/internalServerError" } - } - }, - "delete": { - "tags": ["recording_rules", "enterprise"], - "summary": "Delete the write target.", - "operationId": "deleteRecordingRuleWriteTarget", + } + }, + "delete": { + "security": [ + { + "basic": [] + } + ], + "tags": ["orgs"], + "summary": "Delete Organization.", + "operationId": "adminDeleteOrg", + "parameters": [ + { + "type": "integer", + "format": "int64", + "x-go-name": "OrgID", + "name": "org_id", + "in": "path", + "required": true + } + ], "responses": { "200": { "$ref": "#/responses/okResponse" }, + "400": { + "$ref": "#/responses/badRequestError" + }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -6637,17 +5059,26 @@ } } }, - "/recording-rules/{recordingRuleID}": { - "delete": { - "tags": ["recording_rules", "enterprise"], - "summary": "Delete a recording rule.", - "operationId": "deleteRecordingRule", + "/orgs/{org_id}/address": { + "put": { + "tags": ["orgs"], + "summary": "Update Organization's address.", + "operationId": "adminUpdateOrgAddress", "parameters": [ + { + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgAddressForm" + } + }, { "type": "integer", "format": "int64", - "x-go-name": "RecordingRuleID", - "name": "recordingRuleID", + "x-go-name": "OrgID", + "name": "org_id", "in": "path", "required": true } @@ -6656,64 +5087,40 @@ "200": { "$ref": "#/responses/okResponse" }, + "400": { + "$ref": "#/responses/badRequestError" + }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/reports": { + "/orgs/{org_id}/quotas": { "get": { - "description": "Available to org admins only and with a valid or expired license\n\nYou need to have a permission with action `reports:read` with scope `reports:*`.", - "tags": ["reports", "enterprise"], - "summary": "List reports.", - "operationId": "getReports", - "responses": { - "200": { - "$ref": "#/responses/getReportsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "post": { - "description": "Available to org admins only and with a valid license.\n\nYou need to have a permission with action `reports.admin:create`.", - "tags": ["reports", "enterprise"], - "summary": "Create a report.", - "operationId": "createReport", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `orgs.quotas:read` and scope `org:id:1` (orgIDScope).\nlist", + "tags": ["orgs"], + "summary": "Fetch Organization quota.", + "operationId": "getOrgQuota", "parameters": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateOrUpdateConfigCmd" - } + "type": "integer", + "format": "int64", + "x-go-name": "OrgID", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/createReportResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getQuotaResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6730,20 +5137,40 @@ } } }, - "/reports/email": { - "post": { - "description": "Generate and send a report. This API waits for the report to be generated before returning. We recommend that you set the client’s timeout to at least 60 seconds. Available to org admins only and with a valid license.\n\nOnly available in Grafana Enterprise v7.0+.\nThis API endpoint is experimental and may be deprecated in a future release. On deprecation, a migration strategy will be provided and the endpoint will remain functional until the next major release of Grafana.\n\nYou need to have a permission with action `reports:send`.", - "tags": ["reports", "enterprise"], - "summary": "Send a report.", - "operationId": "sendReport", + "/orgs/{org_id}/quotas/{quota_target}": { + "put": { + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `orgs.quotas:write` and scope `org:id:1` (orgIDScope).", + "tags": ["orgs"], + "summary": "Update user quota.", + "operationId": "updateOrgQuota", "parameters": [ + { + "type": "string", + "x-go-name": "QuotaTarget", + "name": "quota_target", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "x-go-name": "OrgID", + "name": "org_id", + "in": "path", + "required": true + }, { "x-go-name": "Body", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/ReportEmailDTO" + "$ref": "#/definitions/UpdateOrgQuotaCmd" } } ], @@ -6751,9 +5178,6 @@ "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -6769,47 +5193,30 @@ } } }, - "/reports/render/pdf/{DashboardID}": { + "/orgs/{org_id}/users": { "get": { - "description": "Available to all users and with a valid license.", - "produces": ["application/pdf"], - "tags": ["reports", "enterprise"], - "summary": "Render report for dashboard.", - "operationId": "renderReportPDF", + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:read` with scope `users:*`.", + "tags": ["orgs"], + "summary": "Get Users in Organization.", + "operationId": "adminGetOrgUsers", "parameters": [ { "type": "integer", "format": "int64", - "name": "DashboardID", + "x-go-name": "OrgID", + "name": "org_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/contentResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/reports/settings": { - "get": { - "description": "Available to org admins only and with a valid or expired license\n\nYou need to have a permission with action `reports.settings:read`x.", - "tags": ["reports", "enterprise"], - "summary": "Get settings.", - "operationId": "getReportSettings", - "responses": { - "200": { - "$ref": "#/responses/getReportSettingsResponse" + "$ref": "#/responses/getOrgUsersResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6823,10 +5230,10 @@ } }, "post": { - "description": "Available to org admins only and with a valid or expired license\n\nYou need to have a permission with action `reports.settings:write`xx.", - "tags": ["reports", "enterprise"], - "summary": "Save settings.", - "operationId": "saveReportSettings", + "description": "Adds a global user to the current organization.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:add` with scope `users:*`.", + "tags": ["orgs"], + "summary": "Add a new user to the current organization", + "operationId": "adminAddOrgUser", "parameters": [ { "x-go-name": "Body", @@ -6834,17 +5241,22 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/SettingsDTO" + "$ref": "#/definitions/AddOrgUserCommand" } + }, + { + "type": "integer", + "format": "int64", + "x-go-name": "OrgID", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -6857,21 +5269,28 @@ } } }, - "/reports/test-email": { - "post": { - "description": "Available to org admins only and with a valid license.\n\nYou need to have a permission with action `reports:send`.", - "tags": ["reports", "enterprise"], - "summary": "Send test report via email.", - "operationId": "sendTestEmail", + "/orgs/{org_id}/users/{user_id}": { + "delete": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:remove` with scope `users:*`.", + "tags": ["orgs"], + "summary": "Delete user in current organization", + "operationId": "adminDeleteOrgUser", "parameters": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateOrUpdateConfigCmd" - } + "type": "integer", + "format": "int64", + "x-go-name": "OrgID", + "name": "org_id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "x-go-name": "UserID", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { @@ -6887,34 +5306,46 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/reports/{reportID}": { - "get": { - "description": "Available to org admins only and with a valid or expired license\n\nYou need to have a permission with action `reports:read` with scope `reports:id:\u003creport ID\u003e`.", - "tags": ["reports", "enterprise"], - "summary": "Get a report.", - "operationId": "getReport", + }, + "patch": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users.role:update` with scope `users:*`.", + "tags": ["orgs"], + "summary": "Update Users in Organization.", + "operationId": "adminUpdateOrgUser", "parameters": [ + { + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgUserCommand" + } + }, + { + "type": "integer", + "format": "int64", + "x-go-name": "OrgID", + "name": "org_id", + "in": "path", + "required": true + }, { "type": "integer", "format": "int64", - "x-go-name": "ReportID", - "name": "reportID", + "x-go-name": "UserID", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getReportResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -6925,92 +5356,121 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "Available to org admins only and with a valid or expired license\n\nYou need to have a permission with action `reports.admin:write` with scope `reports:id:\u003creport ID\u003e`.", - "tags": ["reports", "enterprise"], - "summary": "Update a report.", - "operationId": "updateReport", + } + }, + "/prometheus/grafana/api/v1/alerts": { + "get": { + "description": "gets the current alerts", + "tags": ["prometheus"], + "operationId": "RouteGetGrafanaAlertStatuses", + "parameters": [ + { + "type": "boolean", + "default": false, + "x-go-name": "IncludeInternalLabels", + "description": "Include Grafana specific labels as part of the response.", + "name": "includeInternalLabels", + "in": "query" + } + ], + "responses": { + "200": { + "description": "AlertResponse", + "schema": { + "$ref": "#/definitions/AlertResponse" + } + } + } + } + }, + "/prometheus/grafana/api/v1/rules": { + "get": { + "description": "gets the evaluation statuses of all rules", + "tags": ["prometheus"], + "operationId": "RouteGetGrafanaRuleStatuses", + "parameters": [ + { + "type": "boolean", + "default": false, + "x-go-name": "IncludeInternalLabels", + "description": "Include Grafana specific labels as part of the response.", + "name": "includeInternalLabels", + "in": "query" + }, + { + "type": "string", + "description": "Filter the list of rules to those that belong to the specified dashboard UID.", + "name": "DashboardUID", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Filter the list of rules to those that belong to the specified panel ID. Dashboard UID must be specified.", + "name": "PanelID", + "in": "query" + } + ], + "responses": { + "200": { + "description": "RuleResponse", + "schema": { + "$ref": "#/definitions/RuleResponse" + } + } + } + } + }, + "/prometheus/{Recipient}/api/v1/alerts": { + "get": { + "description": "gets the current alerts", + "tags": ["prometheus"], + "operationId": "RouteGetAlertStatuses", "parameters": [ { "type": "integer", "format": "int64", - "x-go-name": "ReportID", - "name": "reportID", + "description": "Recipient should be the numeric datasource id", + "name": "Recipient", "in": "path", "required": true - }, - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateOrUpdateConfigCmd" - } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "description": "AlertResponse", + "schema": { + "$ref": "#/definitions/AlertResponse" + } } } - }, - "delete": { - "description": "Available to org admins only and with a valid or expired license\n\nYou need to have a permission with action `reports.delete` with scope `reports:id:\u003creport ID\u003e`.", - "tags": ["reports", "enterprise"], - "summary": "Delete a report.", - "operationId": "deleteReport", + } + }, + "/prometheus/{Recipient}/api/v1/rules": { + "get": { + "description": "gets the evaluation statuses of all rules", + "tags": ["prometheus"], + "operationId": "RouteGetRuleStatuses", "parameters": [ { "type": "integer", "format": "int64", - "x-go-name": "ReportID", - "name": "reportID", + "description": "Recipient should be the numeric datasource id", + "name": "Recipient", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "description": "RuleResponse", + "schema": { + "$ref": "#/definitions/RuleResponse" + } } } } @@ -7383,77 +5843,6 @@ } } }, - "/saml/acs": { - "post": { - "tags": ["saml", "enterprise"], - "summary": "It performs assertion Consumer Service (ACS).", - "operationId": "postACS", - "parameters": [ - { - "type": "string", - "name": "RelayState", - "in": "query" - } - ], - "responses": { - "302": { - "description": "" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/saml/metadata": { - "get": { - "produces": ["application/xml;application/samlmetadata+xml"], - "tags": ["saml", "enterprise"], - "summary": "It exposes the SP (Grafana's) metadata for the IdP's consumption.", - "operationId": "getSAMLMetadata", - "responses": { - "200": { - "$ref": "#/responses/contentResponse" - } - } - } - }, - "/saml/slo": { - "post": { - "tags": ["saml", "enterprise"], - "summary": "It performs Single Logout (SLO) callback.", - "operationId": "postSLO", - "parameters": [ - { - "type": "string", - "name": "SAMLRequest", - "in": "query" - }, - { - "type": "string", - "name": "SAMLResponse", - "in": "query" - } - ], - "responses": { - "302": { - "description": "" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, "/search": { "get": { "tags": ["search"], @@ -7805,132 +6194,6 @@ } } }, - "/teams/{teamId}/groups": { - "get": { - "tags": ["sync_team_groups", "enterprise"], - "summary": "Get External Groups.", - "operationId": "getTeamGroupsApi", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "TeamID", - "name": "teamId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getTeamGroupsApiResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "post": { - "tags": ["sync_team_groups", "enterprise"], - "summary": "Add External Group.", - "operationId": "addTeamGroupApi", - "parameters": [ - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/TeamGroupMapping" - } - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "TeamID", - "name": "teamId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/teams/{teamId}/groups/{groupId}": { - "delete": { - "tags": ["sync_team_groups", "enterprise"], - "summary": "Remove External Group.", - "operationId": "removeTeamGroupApi", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "GroupID", - "name": "groupId", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "TeamID", - "name": "teamId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, "/teams/{team_id}": { "get": { "tags": ["teams"], @@ -9146,57 +7409,13 @@ } } } - } - } - }, - "definitions": { - "Ack": { - "type": "object", - "x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions" - }, - "ActiveSyncStatusDTO": { - "description": "ActiveSyncStatusDTO holds the information for LDAP background Sync", - "type": "object", - "properties": { - "enabled": { - "type": "boolean", - "x-go-name": "Enabled" - }, - "nextSync": { - "type": "string", - "format": "date-time", - "x-go-name": "NextSync" - }, - "prevSync": { - "$ref": "#/definitions/SyncResult" - }, - "schedule": { - "type": "string", - "x-go-name": "Schedule" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/ldapdebug" - }, - "ActiveUserStats": { + } + } + }, + "definitions": { + "Ack": { "type": "object", - "properties": { - "active_admins_and_editors": { - "type": "integer", - "format": "int64", - "x-go-name": "ActiveAdminsAndEditors" - }, - "active_users": { - "type": "integer", - "format": "int64", - "x-go-name": "ActiveUsers" - }, - "active_viewers": { - "type": "integer", - "format": "int64", - "x-go-name": "ActiveViewers" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/licensing" + "x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions" }, "AddApiKeyCommand": { "description": "COMMANDS", @@ -9217,26 +7436,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/models" }, - "AddBuiltInRoleCommand": { - "type": "object", - "properties": { - "builtInRole": { - "type": "string", - "enum": ["Viewer", " Editor", " Admin", " Grafana Admin"], - "x-go-name": "BuiltinRole" - }, - "global": { - "description": "A flag indicating if the assignment is global or not. If set to false, the default org ID of the authenticated user will be used from the request to create organization local assignment. Refer to the Built-in role assignments for more information.", - "type": "boolean", - "x-go-name": "Global" - }, - "roleUid": { - "type": "string", - "x-go-name": "RoleUID" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/accesscontrol" - }, "AddDataSourceCommand": { "description": "Also acts as api DTO", "type": "object", @@ -9339,29 +7538,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/models" }, - "AddPermissionDTO": { - "type": "object", - "properties": { - "builtinRole": { - "type": "string", - "x-go-name": "BuiltinRole" - }, - "permission": { - "$ref": "#/definitions/DsPermissionType" - }, - "teamId": { - "type": "integer", - "format": "int64", - "x-go-name": "TeamId" - }, - "userId": { - "type": "integer", - "format": "int64", - "x-go-name": "UserId" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/dspermissions" - }, "AddTeamMemberCommand": { "type": "object", "properties": { @@ -9373,30 +7549,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/models" }, - "AddTeamRoleCommand": { - "type": "object", - "properties": { - "roleUid": { - "type": "string", - "x-go-name": "RoleUID" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/accesscontrol" - }, - "AddUserRoleCommand": { - "type": "object", - "properties": { - "global": { - "type": "boolean", - "x-go-name": "Global" - }, - "roleUid": { - "type": "string", - "x-go-name": "RoleUID" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/accesscontrol" - }, "Address": { "type": "object", "properties": { @@ -10143,32 +8295,6 @@ }, "x-go-package": "github.com/prometheus/common/config" }, - "BrandingOptionsDTO": { - "type": "object", - "properties": { - "emailFooterLink": { - "type": "string", - "x-go-name": "EmailFooterLink" - }, - "emailFooterMode": { - "type": "string", - "x-go-name": "EmailFooterMode" - }, - "emailFooterText": { - "type": "string", - "x-go-name": "EmailFooterText" - }, - "emailLogoUrl": { - "type": "string", - "x-go-name": "EmailLogo" - }, - "reportLogoUrl": { - "type": "string", - "x-go-name": "ReportLogo" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/report" - }, "CalculateDiffTarget": { "type": "object", "properties": { @@ -10236,89 +8362,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions" }, - "ConfigDTO": { - "description": "ConfigDTO is model representation in transfer", - "type": "object", - "properties": { - "created": { - "type": "string", - "format": "date-time", - "x-go-name": "Created" - }, - "dashboardId": { - "type": "integer", - "format": "int64", - "x-go-name": "DashboardID" - }, - "dashboardName": { - "type": "string", - "x-go-name": "DashboardName" - }, - "dashboardUid": { - "type": "string", - "x-go-name": "DashboardUID" - }, - "enableCsv": { - "type": "boolean", - "x-go-name": "EnableCSV" - }, - "enableDashboardUrl": { - "type": "boolean", - "x-go-name": "EnableDashboardURL" - }, - "id": { - "type": "integer", - "format": "int64", - "x-go-name": "ID" - }, - "message": { - "type": "string", - "x-go-name": "Message" - }, - "name": { - "type": "string", - "x-go-name": "Name" - }, - "options": { - "$ref": "#/definitions/ReportOptionsDTO" - }, - "orgId": { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID" - }, - "recipients": { - "type": "string", - "x-go-name": "Recipients" - }, - "replyTo": { - "type": "string", - "x-go-name": "ReplyTo" - }, - "schedule": { - "$ref": "#/definitions/ScheduleDTO" - }, - "state": { - "type": "string", - "x-go-name": "State" - }, - "templateVars": { - "type": "object", - "x-go-name": "TemplateVars" - }, - "updated": { - "type": "string", - "format": "date-time", - "x-go-name": "Updated" - }, - "userId": { - "type": "integer", - "format": "int64", - "x-go-name": "UserID" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/report" - }, "CreateAlertNotificationCommand": { "type": "object", "properties": { @@ -10452,59 +8495,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/services/libraryelements" }, - "CreateOrUpdateConfigCmd": { - "type": "object", - "properties": { - "dashboardId": { - "type": "integer", - "format": "int64", - "x-go-name": "DashboardID" - }, - "dashboardUid": { - "type": "string", - "x-go-name": "DashboardUID" - }, - "enableCsv": { - "type": "boolean", - "x-go-name": "EnableCSV" - }, - "enableDashboardUrl": { - "type": "boolean", - "x-go-name": "EnableDashboardURL" - }, - "message": { - "type": "string", - "x-go-name": "Message" - }, - "name": { - "type": "string", - "x-go-name": "Name" - }, - "options": { - "$ref": "#/definitions/ReportOptionsDTO" - }, - "recipients": { - "type": "string", - "x-go-name": "Recipients" - }, - "replyTo": { - "type": "string", - "x-go-name": "ReplyTo" - }, - "schedule": { - "$ref": "#/definitions/ScheduleDTO" - }, - "state": { - "type": "string", - "x-go-name": "State" - }, - "templateVars": { - "type": "object", - "x-go-name": "TemplateVars" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/report" - }, "CreateOrgCommand": { "type": "object", "properties": { @@ -10515,44 +8505,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/models" }, - "CreateRoleWithPermissionsCommand": { - "type": "object", - "properties": { - "description": { - "type": "string", - "x-go-name": "Description" - }, - "displayName": { - "type": "string", - "x-go-name": "DisplayName" - }, - "group": { - "type": "string", - "x-go-name": "Group" - }, - "name": { - "type": "string", - "x-go-name": "Name" - }, - "permissions": { - "type": "array", - "items": { - "$ref": "#/definitions/Permission" - }, - "x-go-name": "Permissions" - }, - "uid": { - "type": "string", - "x-go-name": "UID" - }, - "version": { - "type": "integer", - "format": "int64", - "x-go-name": "Version" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/accesscontrol" - }, "CreateTeamCommand": { "type": "object", "properties": { @@ -10562,71 +8514,10 @@ }, "name": { "type": "string", - "x-go-name": "Name" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/models" - }, - "CustomPermissionsRecordDTO": { - "type": "object", - "properties": { - "customPermissions": { - "type": "string", - "x-go-name": "CustomPermissions" - }, - "granteeName": { - "type": "string", - "x-go-name": "GranteeName" - }, - "granteeType": { - "type": "string", - "x-go-name": "GranteeType" - }, - "granteeUrl": { - "type": "string", - "x-go-name": "GranteeURL" - }, - "id": { - "type": "integer", - "format": "int64", - "x-go-name": "ID" - }, - "isFolder": { - "type": "boolean", - "x-go-name": "IsFolder" - }, - "orgId": { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID" - }, - "orgRole": { - "type": "string", - "x-go-name": "OrgRole" - }, - "slug": { - "type": "string", - "x-go-name": "Slug" - }, - "title": { - "type": "string", - "x-go-name": "Title" - }, - "uid": { - "type": "string", - "x-go-name": "UID" - }, - "url": { - "type": "string", - "x-go-name": "URL" - }, - "usersCount": { - "type": "integer", - "format": "int64", - "x-go-name": "UsersCount" + "x-go-name": "Name" } }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/licensing" + "x-go-package": "github.com/grafana/grafana/pkg/models" }, "DashboardAclInfoDTO": { "type": "object", @@ -11448,16 +9339,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/api/dtos" }, - "DeleteTokenCommand": { - "type": "object", - "properties": { - "instance": { - "type": "string", - "x-go-name": "Instance" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/licensing" - }, "DiscoveryBase": { "type": "object", "required": ["status"], @@ -11676,19 +9557,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions" }, - "FailedUser": { - "description": "FailedUser holds the information of an user that failed", - "type": "object", - "properties": { - "Error": { - "type": "string" - }, - "Login": { - "type": "string" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/ldapsync" - }, "Failure": { "$ref": "#/definitions/ResponseDetails" }, @@ -13589,31 +11457,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/api/dtos" }, - "Permission": { - "type": "object", - "title": "Permission is the model for access control permissions.", - "properties": { - "action": { - "type": "string", - "x-go-name": "Action" - }, - "created": { - "type": "string", - "format": "date-time", - "x-go-name": "Created" - }, - "scope": { - "type": "string", - "x-go-name": "Scope" - }, - "updated": { - "type": "string", - "format": "date-time", - "x-go-name": "Updated" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/services/accesscontrol" - }, "PermissionDenied": { "type": "object", "x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions" @@ -14021,24 +11864,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/api/dtos" }, - "PrometheusRemoteWriteTargetJSON": { - "type": "object", - "properties": { - "data_source_uid": { - "type": "string", - "x-go-name": "DatasourceUID" - }, - "id": { - "type": "string", - "x-go-name": "ID" - }, - "remote_write_path": { - "type": "string", - "x-go-name": "WritePath" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/recordedqueries/api" - }, "PushoverConfig": { "type": "object", "properties": { @@ -14178,65 +12003,6 @@ }, "x-go-package": "github.com/prometheus/alertmanager/config" }, - "RecordingRuleJSON": { - "description": "RecordingRuleJSON is the external representation of a recording rule", - "type": "object", - "properties": { - "active": { - "type": "boolean", - "x-go-name": "Active" - }, - "count": { - "type": "boolean", - "x-go-name": "Count" - }, - "description": { - "type": "string", - "x-go-name": "Description" - }, - "dest_data_source_uid": { - "type": "string", - "x-go-name": "DestDataSourceUID" - }, - "id": { - "type": "string", - "x-go-name": "ID" - }, - "interval": { - "type": "integer", - "format": "int64", - "x-go-name": "Interval" - }, - "name": { - "type": "string", - "x-go-name": "Name" - }, - "prom_name": { - "type": "string", - "x-go-name": "PromName" - }, - "queries": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": { - "type": "object" - } - }, - "x-go-name": "Queries" - }, - "range": { - "type": "integer", - "format": "int64", - "x-go-name": "Range" - }, - "target_ref_id": { - "type": "string", - "x-go-name": "TargetRefID" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/recordedqueries/api" - }, "Regexp": { "description": "A Regexp is safe for concurrent use by multiple goroutines,\nexcept for configuration methods, such as Longest.", "type": "object", @@ -14256,49 +12022,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/models" }, - "ReportEmailDTO": { - "type": "object", - "properties": { - "email": { - "type": "string", - "x-go-name": "Email" - }, - "emails": { - "description": "Comma-separated list of emails to which to send the report to.", - "type": "string", - "x-go-name": "Emails" - }, - "id": { - "description": "Send the report to the emails specified in the report. Required if emails is not present.", - "type": "string", - "format": "int64", - "x-go-name": "Id" - }, - "useEmailsFromReport": { - "description": "Send the report to the emails specified in the report. Required if emails is not present.", - "type": "boolean", - "x-go-name": "UseEmailsFromReport" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/report" - }, - "ReportOptionsDTO": { - "type": "object", - "properties": { - "layout": { - "type": "string", - "x-go-name": "Layout" - }, - "orientation": { - "type": "string", - "x-go-name": "Orientation" - }, - "timeRange": { - "$ref": "#/definitions/TimeRangeDTO" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/report" - }, "ResponseDetails": { "type": "object", "properties": { @@ -14329,58 +12052,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/models" }, - "RoleDTO": { - "type": "object", - "properties": { - "created": { - "type": "string", - "format": "date-time", - "x-go-name": "Created" - }, - "delegatable": { - "type": "boolean", - "x-go-name": "Delegatable" - }, - "description": { - "type": "string", - "x-go-name": "Description" - }, - "displayName": { - "type": "string", - "x-go-name": "DisplayName" - }, - "group": { - "type": "string", - "x-go-name": "Group" - }, - "name": { - "type": "string", - "x-go-name": "Name" - }, - "permissions": { - "type": "array", - "items": { - "$ref": "#/definitions/Permission" - }, - "x-go-name": "Permissions" - }, - "uid": { - "type": "string", - "x-go-name": "UID" - }, - "updated": { - "type": "string", - "format": "date-time", - "x-go-name": "Updated" - }, - "version": { - "type": "integer", - "format": "int64", - "x-go-name": "Version" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/services/accesscontrol" - }, "RoleType": { "type": "string", "x-go-package": "github.com/grafana/grafana/pkg/models" @@ -14696,61 +12367,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/models" }, - "ScheduleDTO": { - "type": "object", - "properties": { - "day": { - "type": "string", - "x-go-name": "Day" - }, - "dayOfMonth": { - "type": "string", - "x-go-name": "DayOfMonth" - }, - "endDate": { - "type": "string", - "format": "date-time", - "x-go-name": "EndDate" - }, - "frequency": { - "type": "string", - "x-go-name": "Frequency" - }, - "hour": { - "type": "integer", - "format": "int64", - "x-go-name": "Hour" - }, - "intervalAmount": { - "type": "integer", - "format": "int64", - "x-go-name": "IntervalAmount" - }, - "intervalFrequency": { - "type": "string", - "x-go-name": "IntervalFrequency" - }, - "minute": { - "type": "integer", - "format": "int64", - "x-go-name": "Minute" - }, - "startDate": { - "type": "string", - "format": "date-time", - "x-go-name": "StartDate" - }, - "timeZone": { - "type": "string", - "x-go-name": "TimeZone" - }, - "workdaysOnly": { - "type": "boolean", - "x-go-name": "WorkdaysOnly" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/report" - }, "SearchTeamQueryResult": { "type": "object", "properties": { @@ -14816,23 +12432,6 @@ "title": "SecretURL is a URL that must not be revealed on marshaling.", "$ref": "#/definitions/URL" }, - "SetUserRolesCommand": { - "type": "object", - "properties": { - "global": { - "type": "boolean", - "x-go-name": "Global" - }, - "roleUids": { - "type": "array", - "items": { - "type": "string" - }, - "x-go-name": "RoleUIDs" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/accesscontrol" - }, "SettingsBag": { "type": "object", "additionalProperties": { @@ -14843,30 +12442,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/setting" }, - "SettingsDTO": { - "type": "object", - "properties": { - "branding": { - "$ref": "#/definitions/BrandingOptionsDTO" - }, - "id": { - "type": "integer", - "format": "int64", - "x-go-name": "ID" - }, - "orgId": { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID" - }, - "userId": { - "type": "integer", - "format": "int64", - "x-go-name": "UserID" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/report" - }, "SigV4Config": { "description": "SigV4Config is the configuration for signing remote write requests with\nAWS's SigV4 verification process. Empty values will be retrieved using the\nAWS default credentials chain.", "type": "object", @@ -15077,62 +12652,18 @@ "SmtpNotEnabled": { "$ref": "#/definitions/ResponseDetails" }, - "Status": { - "type": "object", - "properties": { - "enabled": { - "type": "boolean", - "x-go-name": "Enabled" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/accesscontrol" - }, "Success": { "$ref": "#/definitions/ResponseDetails" }, - "SuccessResponseBody": { - "type": "object", - "properties": { - "message": { - "type": "string", - "x-go-name": "Message" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/api/docs/definitions" - }, - "SyncResult": { - "type": "object", - "title": "SyncResult holds the result of a sync with LDAP. This gives us information on which users were updated and how.", - "properties": { - "Elapsed": { - "$ref": "#/definitions/Duration" - }, - "FailedUsers": { - "type": "array", - "items": { - "$ref": "#/definitions/FailedUser" - } - }, - "MissingUserIds": { - "type": "array", - "items": { - "type": "integer", - "format": "int64" - } - }, - "Started": { + "SuccessResponseBody": { + "type": "object", + "properties": { + "message": { "type": "string", - "format": "date-time" - }, - "UpdatedUserIds": { - "type": "array", - "items": { - "type": "integer", - "format": "int64" - } + "x-go-name": "Message" } }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/ldapsync" + "x-go-package": "github.com/grafana/grafana/pkg/api/docs/definitions" }, "TLSConfig": { "type": "object", @@ -15225,36 +12756,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/models" }, - "TeamGroupDTO": { - "type": "object", - "properties": { - "groupId": { - "type": "string", - "x-go-name": "GroupId" - }, - "orgId": { - "type": "integer", - "format": "int64", - "x-go-name": "OrgId" - }, - "teamId": { - "type": "integer", - "format": "int64", - "x-go-name": "TeamId" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/teamgroupsync/models" - }, - "TeamGroupMapping": { - "type": "object", - "properties": { - "groupId": { - "type": "string", - "x-go-name": "GroupId" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/teamgroupsync/models" - }, "TeamMemberDTO": { "type": "object", "properties": { @@ -15546,136 +13047,6 @@ }, "x-go-package": "github.com/prometheus/alertmanager/timeinterval" }, - "TimeRangeDTO": { - "type": "object", - "properties": { - "from": { - "type": "string", - "x-go-name": "From" - }, - "to": { - "type": "string", - "x-go-name": "To" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/report" - }, - "Token": { - "type": "object", - "properties": { - "account": { - "type": "string", - "x-go-name": "Account" - }, - "company": { - "type": "string", - "x-go-name": "Company" - }, - "details_url": { - "type": "string", - "x-go-name": "DetailsUrl" - }, - "exp": { - "type": "integer", - "format": "int64", - "x-go-name": "Expires" - }, - "iat": { - "type": "integer", - "format": "int64", - "x-go-name": "Issued" - }, - "included_admins": { - "type": "integer", - "format": "int64", - "x-go-name": "IncludedAdmins" - }, - "included_users": { - "type": "integer", - "format": "int64", - "x-go-name": "IncludedUsers" - }, - "included_viewers": { - "type": "integer", - "format": "int64", - "x-go-name": "IncludedViewers" - }, - "iss": { - "type": "string", - "x-go-name": "Issuer" - }, - "jti": { - "type": "string", - "x-go-name": "Id" - }, - "lexp": { - "type": "integer", - "format": "int64", - "x-go-name": "LicenseExpires" - }, - "lic_exp_warn_days": { - "type": "integer", - "format": "int64", - "x-go-name": "LicenseExpiresWarnDays" - }, - "lid": { - "type": "string", - "x-go-name": "LicenseId" - }, - "limit_by": { - "type": "string", - "x-go-name": "LimitBy" - }, - "max_concurrent_user_sessions": { - "type": "integer", - "format": "int64", - "x-go-name": "MaxConcurrentUserSessions" - }, - "nbf": { - "type": "integer", - "format": "int64", - "x-go-name": "LicenseIssued" - }, - "prod": { - "type": "array", - "items": { - "type": "string" - }, - "x-go-name": "Products" - }, - "slug": { - "type": "string", - "x-go-name": "Slug" - }, - "status": { - "$ref": "#/definitions/TokenStatus" - }, - "sub": { - "type": "string", - "x-go-name": "Subject" - }, - "tok_exp_warn_days": { - "type": "integer", - "format": "int64", - "x-go-name": "TokenExpiresWarnDays" - }, - "update_days": { - "type": "integer", - "format": "int64", - "x-go-name": "UpdateDays" - }, - "usage_billing": { - "type": "boolean", - "x-go-name": "UsageBilling" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/licensing" - }, - "TokenStatus": { - "type": "integer", - "format": "int64", - "x-go-package": "github.com/grafana/grafana/pkg/extensions/licensing" - }, "TrimDashboardCommand": { "type": "object", "properties": { @@ -15701,8 +13072,9 @@ "x-go-package": "github.com/grafana/grafana/pkg/api/dtos" }, "URL": { + "description": "The general form represented is:\n\n[scheme:][//[userinfo@]host][/]path[?query][#fragment]\n\nURLs that do not start with a slash after the scheme are interpreted as:\n\nscheme:opaque[?query][#fragment]\n\nNote that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.\nA consequence is that it is impossible to tell which slashes in the Path were\nslashes in the raw URL and which were %2f. This distinction is rarely important,\nbut when it is, the code should use RawPath, an optional field which only gets\nset if the default encoding is different from Path.\n\nURL's String method uses the EscapedPath method to obtain the path. See the\nEscapedPath method for more details.", "type": "object", - "title": "URL is a custom URL type that allows validation at configuration load time.", + "title": "A URL represents a parsed URL (technically, a URI reference).", "properties": { "ForceQuery": { "type": "boolean" @@ -15735,7 +13107,7 @@ "$ref": "#/definitions/Userinfo" } }, - "x-go-package": "github.com/prometheus/common/config" + "x-go-package": "net/url" }, "UpdateAlertNotificationCommand": { "type": "object", @@ -16062,44 +13434,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/api/dtos" }, - "UpdateRoleCommand": { - "type": "object", - "properties": { - "description": { - "type": "string", - "x-go-name": "Description" - }, - "displayName": { - "type": "string", - "x-go-name": "DisplayName" - }, - "global": { - "type": "boolean", - "x-go-name": "Global" - }, - "group": { - "type": "string", - "x-go-name": "Group" - }, - "name": { - "type": "string", - "x-go-name": "Name" - }, - "permissions": { - "type": "array", - "items": { - "$ref": "#/definitions/Permission" - }, - "x-go-name": "Permissions" - }, - "version": { - "type": "integer", - "format": "int64", - "x-go-name": "Version" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/accesscontrol" - }, "UpdateTeamCommand": { "type": "object", "properties": { @@ -16608,6 +13942,7 @@ "x-go-package": "github.com/prometheus/alertmanager/api/v2/models" }, "alertGroup": { + "description": "AlertGroup alert group", "type": "object", "required": ["alerts", "labels", "receiver"], "properties": { @@ -16625,9 +13960,7 @@ "receiver": { "$ref": "#/definitions/receiver" } - }, - "x-go-name": "AlertGroup", - "x-go-package": "github.com/prometheus/alertmanager/api/v2/models" + } }, "alertGroups": { "type": "array", @@ -17152,16 +14485,6 @@ "$ref": "#/definitions/ErrorResponseBody" } }, - "contentResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "type": "integer", - "format": "uint8" - } - } - }, "createAnnotationResponse": { "description": "", "schema": { @@ -17236,12 +14559,6 @@ } } }, - "createReportResponse": { - "description": "", - "schema": { - "type": "object" - } - }, "createSnapshotResponse": { "description": "", "schema": { @@ -17463,12 +14780,6 @@ } } }, - "getAccessControlStatusResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/Status" - } - }, "getAlertNotificationChannelResponse": { "description": "", "schema": { @@ -17502,15 +14813,6 @@ } } }, - "getAllRolesResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/RoleDTO" - } - } - }, "getAnnotationTagsResponse": { "description": "", "schema": { @@ -17535,15 +14837,6 @@ } } }, - "getCustomPermissionsReportResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/CustomPermissionsRecordDTO" - } - } - }, "getDashboardPermissionsResponse": { "description": "", "schema": { @@ -17614,12 +14907,6 @@ } } }, - "getLDAPSyncStatusResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/ActiveSyncStatusDTO" - } - }, "getLibraryElementConnectionsResponse": { "description": "", "schema": { @@ -17638,15 +14925,6 @@ "$ref": "#/definitions/LibraryElementSearchResponse" } }, - "getLicenseStatusResponse": { - "description": "" - }, - "getLicenseTokenResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/Token" - } - }, "getOrgResponse": { "description": "", "schema": { @@ -17662,12 +14940,6 @@ } } }, - "getPermissionseResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/AddPermissionDTO" - } - }, "getPreferencesResponse": { "description": "", "schema": { @@ -17683,33 +14955,6 @@ } } }, - "getReportResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/ConfigDTO" - } - }, - "getReportSettingsResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/SettingsDTO" - } - }, - "getReportsResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/ConfigDTO" - } - } - }, - "getRoleResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/RoleDTO" - } - }, "getSettingsResponse": { "description": "", "schema": { @@ -17751,15 +14996,6 @@ "$ref": "#/definitions/AdminStats" } }, - "getTeamGroupsApiResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/TeamGroupDTO" - } - } - }, "getTeamMembersResponse": { "description": "", "schema": { @@ -17822,27 +15058,6 @@ "$ref": "#/definitions/ErrorResponseBody" } }, - "listBuiltinRolesResponse": { - "description": "", - "schema": { - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "$ref": "#/definitions/RoleDTO" - } - } - } - }, - "listRecordingRulesResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/RecordingRuleJSON" - } - } - }, "lookupAlertNotificationChannelsResponse": { "description": "", "schema": { @@ -17972,9 +15187,6 @@ } } }, - "postRenewLicenseTokenResponse": { - "description": "" - }, "preconditionFailedError": { "description": "PreconditionFailedError", "schema": { @@ -17993,24 +15205,6 @@ "$ref": "#/definitions/DataResponse" } }, - "recordingRuleResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/RecordingRuleJSON" - } - }, - "recordingRuleWriteTargetResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/PrometheusRemoteWriteTargetJSON" - } - }, - "refreshLicenseStatsResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/ActiveUserStats" - } - }, "searchOrgResponse": { "description": "", "schema": { diff --git a/public/api-spec.json b/public/api-spec.json index 5b8469bfb29..7338c39b31c 100644 --- a/public/api-spec.json +++ b/public/api-spec.json @@ -19,46 +19,23 @@ }, "basePath": "/api", "paths": { - "/access-control/builtin-roles": { - "get": { - "description": "You need to have a permission with action `roles.builtin:list` with scope `roles:*`.", - "tags": ["access_control", "enterprise"], - "summary": "Get all built-in role assignments.", - "operationId": "listBuiltinRoles", - "responses": { - "200": { - "$ref": "#/responses/listBuiltinRolesResponse" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, + "/admin/ldap/reload": { "post": { - "description": "You need to have a permission with action `roles.builtin:add` and scope `permissions:delegate`. `permission:delegate` scope ensures that users can only create built-in role assignments with the roles which have same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to create a built-in role assignment which will allow to do that. This is done to prevent escalation of privileges.", - "tags": ["access_control", "enterprise"], - "summary": "Create a built-in role assignment.", - "operationId": "addBuiltinRole", - "parameters": [ + "security": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AddBuiltInRoleCommand" - } + "basic": [] } ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.config:reload`.", + "tags": ["admin_ldap"], + "summary": "Reloads the LDAP configuration.", + "operationId": "reloadLDAP", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -69,94 +46,60 @@ } } }, - "/access-control/builtin-roles/{builtinRole}/roles/{roleUID}": { - "delete": { - "description": "Deletes a built-in role assignment (for one of Viewer, Editor, Admin, or Grafana Admin) to the role with the provided UID.\n\nYou need to have a permission with action `roles.builtin:remove` and scope `permissions:delegate`. `permission:delegate` scope ensures that users can only remove built-in role assignments with the roles which have same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to remove a built-in role assignment which allows to do that.", - "tags": ["access_control", "enterprise"], - "summary": "Remove a built-in role assignment.", - "operationId": "removeBuiltinRole", - "parameters": [ - { - "type": "string", - "x-go-name": "RoleUID", - "name": "roleUID", - "in": "path", - "required": true - }, - { - "type": "string", - "x-go-name": "RoleUID", - "name": "builtinRole", - "in": "path", - "required": true - }, + "/admin/ldap/status": { + "get": { + "security": [ { - "type": "boolean", - "x-go-name": "Global", - "description": "A flag indicating if the assignment is global or not. If set to false, the default org ID of the authenticated user will be used from the request to remove assignment.", - "name": "global", - "in": "query" + "basic": [] } ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.status:read`.", + "tags": ["admin_ldap"], + "summary": "Attempts to connect to all the configured LDAP servers and returns information on whenever they're available or not.", + "operationId": "getLDAPStatus", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/access-control/roles": { - "get": { - "description": "Gets all existing roles. The response contains all global and organization local roles, for the organization which user is signed in.\n\nYou need to have a permission with action `roles:list` and scope `roles:*`.", - "tags": ["access_control", "enterprise"], - "summary": "Get all roles.", - "operationId": "getAllRoles", - "responses": { - "200": { - "$ref": "#/responses/getAllRolesResponse" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, + "/admin/ldap/sync/{user_id}": { "post": { - "description": "Creates a new custom role and maps given permissions to that role. Note that roles with the same prefix as Fixed Roles can’t be created.\n\nYou need to have a permission with action `roles:write` and scope `permissions:delegate`. `permission:delegate`` scope ensures that users can only create custom roles with the same, or a subset of permissions which the user has.\nFor example, if a user does not have required permissions for creating users, they won’t be able to create a custom role which allows to do that. This is done to prevent escalation of privileges.", - "tags": ["access_control", "enterprise"], - "summary": "Create a new custom role.", - "operationId": "createRoleWithPermissions", + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.user:sync`.", + "tags": ["admin_ldap"], + "summary": "Enables a single Grafana user to be synchronized against LDAP.", + "operationId": "syncLDAPUser", "parameters": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/SetUserRolesCommand" - } + "type": "integer", + "format": "int64", + "x-go-name": "UserID", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getRoleResponse" + "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -167,24 +110,32 @@ } } }, - "/access-control/roles/{roleUID}": { + "/admin/ldap/{user_name}": { "get": { - "description": "Get a role for the given UID.\n\nYou need to have a permission with action `roles:read` and scope `roles:*`.", - "tags": ["access_control", "enterprise"], - "summary": "Get a role.", - "operationId": "getRole", + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.user:read`.", + "tags": ["admin_ldap"], + "summary": "Finds an user based on a username in LDAP. This helps illustrate how would the particular user be mapped in Grafana when synced.", + "operationId": "getLDAPUser", "parameters": [ { "type": "string", - "x-go-name": "RoleUID", - "name": "roleUID", + "x-go-name": "UserID", + "name": "user_name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getRoleResponse" + "$ref": "#/responses/okResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -193,68 +144,62 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "You need to have a permission with action `roles:write` and scope `permissions:delegate`. `permission:delegate`` scope ensures that users can only create custom roles with the same, or a subset of permissions which the user has.", - "tags": ["access_control", "enterprise"], - "summary": "Update a custom role.", - "operationId": "updateRoleWithPermissions", - "parameters": [ + } + }, + "/admin/pause-all-alerts": { + "post": { + "security": [ { - "type": "string", - "x-go-name": "RoleUID", - "name": "roleUID", - "in": "path", - "required": true - }, + "basic": [] + } + ], + "tags": ["admin"], + "summary": "Pause/unpause all (legacy) alerts.", + "operationId": "pauseAllAlerts", + "parameters": [ { "x-go-name": "Body", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateRoleCommand" + "$ref": "#/definitions/PauseAllAlertsCommand" } } ], "responses": { "200": { - "$ref": "#/responses/getRoleResponse" + "$ref": "#/responses/pauseAlertsResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Delete a role with the given UID, and it’s permissions. If the role is assigned to a built-in role, the deletion operation will fail, unless force query param is set to true, and in that case all assignments will also be deleted.\n\nYou need to have a permission with action `roles:delete` and scope `permissions:delegate`. `permission:delegate` scope ensures that users can only delete a custom role with the same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to delete a custom role which allows to do that.", - "tags": ["access_control", "enterprise"], - "summary": "Delete a custom role.", - "operationId": "deleteCustomRole", - "parameters": [ + } + }, + "/admin/provisioning/accesscontrol/reload": { + "post": { + "security": [ { - "type": "string", - "x-go-name": "RoleUID", - "name": "roleUID", - "in": "path", - "required": true + "basic": [] } ], + "description": "Reloads the provisioning config files for access control again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:accesscontrol`.", + "tags": ["admin_provisioning"], + "summary": "Reload access control provisioning configurations.", + "operationId": "reloadProvisionedAccessControl", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -265,50 +210,50 @@ } } }, - "/access-control/status": { - "get": { - "description": "Returns an indicator to check if fine-grained access control is enabled or not.\n\nYou need to have a permission with action `status:accesscontrol` and scope `services:accesscontrol`.", - "tags": ["access_control", "enterprise"], - "summary": "Get status.", - "operationId": "getAccessControlStatus", + "/admin/provisioning/dashboards/reload": { + "post": { + "security": [ + { + "basic": [] + } + ], + "description": "Reloads the provisioning config files for dashboards again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:dashboards`.", + "tags": ["admin_provisioning"], + "summary": "Reload dashboard provisioning configurations.", + "operationId": "reloadProvisionedDashboards", "responses": { "200": { - "$ref": "#/responses/getAccessControlStatusResponse" + "$ref": "#/responses/okResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/access-control/teams/{teamId}/roles": { - "get": { - "description": "You need to have a permission with action `teams.roles:list` and scope `teams:id:\u003cteam ID\u003e`.", - "tags": ["access_control", "enterprise"], - "summary": "Get team roles.", - "operationId": "listTeamRoles", - "parameters": [ + "/admin/provisioning/datasources/reload": { + "post": { + "security": [ { - "type": "integer", - "format": "int64", - "x-go-name": "TeamID", - "name": "teamId", - "in": "path", - "required": true + "basic": [] } ], + "description": "Reloads the provisioning config files for datasources again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:datasources`.", + "tags": ["admin_provisioning"], + "summary": "Reload datasource provisioning configurations.", + "operationId": "reloadProvisionedDatasources", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -317,147 +262,98 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "You need to have a permission with action `teams.roles:add` and `teams.roles:remove` and scope `permissions:delegate` for each.", - "tags": ["access_control", "enterprise"], - "summary": "Update team role.", - "operationId": "setTeamRoles", - "parameters": [ + } + }, + "/admin/provisioning/notifications/reload": { + "post": { + "security": [ { - "type": "integer", - "format": "int64", - "x-go-name": "TeamID", - "name": "teamId", - "in": "path", - "required": true + "basic": [] } ], + "description": "Reloads the provisioning config files for legacy alert notifiers again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:notifications`.", + "tags": ["admin_provisioning"], + "summary": "Reload legacy alert notifier provisioning configurations.", + "operationId": "reloadProvisionedAlertNotifiers", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/admin/provisioning/plugins/reload": { "post": { - "description": "You need to have a permission with action `teams.roles:add` and scope `permissions:delegate`.", - "tags": ["access_control", "enterprise"], - "summary": "Add team role.", - "operationId": "addTeamRole", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "TeamID", - "name": "teamId", - "in": "path", - "required": true - }, + "security": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AddTeamRoleCommand" - } + "basic": [] } ], + "description": "Reloads the provisioning config files for plugins again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:plugin`.", + "tags": ["admin_provisioning"], + "summary": "Reload plugin provisioning configurations.", + "operationId": "reloadProvisionedPlugins", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/access-control/teams/{teamId}/roles/{roleUID}": { - "delete": { - "description": "You need to have a permission with action `teams.roles:remove` and scope `permissions:delegate`.", - "tags": ["access_control", "enterprise"], - "summary": "Remove team role.", - "operationId": "removeTeamRole", - "parameters": [ - { - "type": "string", - "x-go-name": "RoleUID", - "name": "roleUID", - "in": "path", - "required": true - }, + "/admin/settings": { + "get": { + "security": [ { - "type": "integer", - "format": "int64", - "x-go-name": "TeamID", - "name": "teamId", - "in": "path", - "required": true + "basic": [] } ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `settings:read` and scopes: `settings:*`, `settings:auth.saml:` and `settings:auth.saml:enabled` (property level).", + "tags": ["admin"], + "summary": "Fetch settings.", + "operationId": "getSettings", "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getSettingsResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" } } } }, - "/access-control/users/{user_id}/roles": { + "/admin/stats": { "get": { - "description": "Lists the roles that have been directly assigned to a given user. The list does not include built-in roles (Viewer, Editor, Admin or Grafana Admin), and it does not include roles that have been inherited from a team.\n\nYou need to have a permission with action `users.roles:list` and scope `users:id:\u003cuser ID\u003e`.", - "tags": ["access_control", "enterprise"], - "summary": "List roles assigned to a user.", - "operationId": "listUserRoles", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", - "required": true - } - ], + "description": "Only works with Basic Authentication (username and password). See introduction for an explanation.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `server:stats:read`.", + "tags": ["admin"], + "summary": "Fetch Grafana Stats.", + "operationId": "getStats", "responses": { "200": { - "$ref": "#/responses/getAllRolesResponse" + "$ref": "#/responses/getStatsResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -466,45 +362,19 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "Update the user’s role assignments to match the provided set of UIDs. This will remove any assigned roles that aren’t in the request and add roles that are in the set but are not already assigned to the user.\nIf you want to add or remove a single role, consider using Add a user role assignment or Remove a user role assignment instead.\n\nYou need to have a permission with action `users.roles:add` and `users.roles:remove` and scope `permissions:delegate` for each. `permission:delegate` scope ensures that users can only assign or unassign roles which have same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to assign or unassign a role which will allow to do that. This is done to prevent escalation of privileges.", - "tags": ["access_control", "enterprise"], - "summary": "Set user role assignments.", - "operationId": "setUserRoles", - "parameters": [ + } + }, + "/admin/users": { + "post": { + "security": [ { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", - "required": true + "basic": [] } ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "post": { - "description": "Assign a role to a specific user. For bulk updates consider Set user role assignments.\n\nYou need to have a permission with action `users.roles:add` and scope `permissions:delegate`. `permission:delegate` scope ensures that users can only assign roles which have same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to assign a role which will allow to do that. This is done to prevent escalation of privileges.", - "tags": ["access_control", "enterprise"], - "summary": "Add a user role assignment.", - "operationId": "addUserRole", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:create`.\nNote that OrgId is an optional parameter that can be used to assign a new user to a different organization when `auto_assign_org` is set to `true`.", + "tags": ["admin_users"], + "summary": "Create new user.", + "operationId": "createUser", "parameters": [ { "x-go-name": "Body", @@ -512,27 +382,25 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddUserRoleCommand" + "$ref": "#/definitions/AdminCreateUserForm" } - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/createUserResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "412": { + "$ref": "#/responses/preconditionFailedError" }, "500": { "$ref": "#/responses/internalServerError" @@ -540,27 +408,18 @@ } } }, - "/access-control/users/{user_id}/roles/{roleUID}": { + "/admin/users/{user_id}": { "delete": { - "description": "Revoke a role from a user. For bulk updates consider Set user role assignments.\n\nYou need to have a permission with action `users.roles:remove` and scope `permissions:delegate`. `permission:delegate` scope ensures that users can only unassign roles which have same, or a subset of permissions which the user has. For example, if a user does not have required permissions for creating users, they won’t be able to unassign a role which will allow to do that. This is done to prevent escalation of privileges.", - "tags": ["access_control", "enterprise"], - "summary": "Remove a user role assignment.", - "operationId": "removeUserRole", - "parameters": [ - { - "type": "string", - "x-go-name": "RoleUID", - "name": "roleUID", - "in": "path", - "required": true - }, + "security": [ { - "type": "boolean", - "x-go-name": "Global", - "description": "A flag indicating if the assignment is global or not. If set to false, the default org ID of the authenticated user will be used from the request to remove assignment.", - "name": "global", - "in": "query" - }, + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:delete` and scope `global:users:*`.", + "tags": ["admin_users"], + "summary": "Delete global User.", + "operationId": "deleteUser", + "parameters": [ { "type": "integer", "format": "int64", @@ -574,8 +433,8 @@ "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -589,42 +448,30 @@ } } }, - "/admin/ldap-sync-status": { + "/admin/users/{user_id}/auth-tokens": { "get": { - "description": "You need to have a permission with action `ldap.status:read`.", - "tags": ["ldap_debug"], - "summary": "Available to grafana admins.", - "operationId": "getLDAPSyncStatus", - "responses": { - "200": { - "$ref": "#/responses/getLDAPSyncStatusResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/admin/ldap/reload": { - "post": { "security": [ { "basic": [] } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.config:reload`.", - "tags": ["admin_ldap"], - "summary": "Reloads the LDAP configuration.", - "operationId": "reloadLDAP", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.authtoken:list` and scope `global:users:*`.", + "tags": ["admin_users"], + "summary": "Return a list of all auth tokens (devices) that the user currently have logged in from.", + "operationId": "getAuthTokens", + "parameters": [ + { + "type": "integer", + "format": "int64", + "x-go-name": "UserID", + "name": "user_id", + "in": "path", + "required": true + } + ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getAuthTokensResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -638,17 +485,27 @@ } } }, - "/admin/ldap/status": { - "get": { + "/admin/users/{user_id}/disable": { + "post": { "security": [ { "basic": [] } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.status:read`.", - "tags": ["admin_ldap"], - "summary": "Attempts to connect to all the configured LDAP servers and returns information on whenever they're available or not.", - "operationId": "getLDAPStatus", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:disable` and scope `global:users:1` (userIDScope).", + "tags": ["admin_users"], + "summary": "Disable user.", + "operationId": "disableUser", + "parameters": [ + { + "type": "integer", + "format": "int64", + "x-go-name": "UserID", + "name": "user_id", + "in": "path", + "required": true + } + ], "responses": { "200": { "$ref": "#/responses/okResponse" @@ -659,23 +516,26 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/ldap/sync/{user_id}": { + "/admin/users/{user_id}/enable": { "post": { "security": [ { "basic": [] } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.user:sync`.", - "tags": ["admin_ldap"], - "summary": "Enables a single Grafana user to be synchronized against LDAP.", - "operationId": "syncLDAPUser", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:enable` and scope `global:users:1` (userIDScope).", + "tags": ["admin_users"], + "summary": "Enable user.", + "operationId": "enableUser", "parameters": [ { "type": "integer", @@ -696,28 +556,32 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/ldap/{user_name}": { - "get": { + "/admin/users/{user_id}/logout": { + "post": { "security": [ { "basic": [] } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `ldap.user:read`.", - "tags": ["admin_ldap"], - "summary": "Finds an user based on a username in LDAP. This helps illustrate how would the particular user be mapped in Grafana when synced.", - "operationId": "getLDAPUser", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.logout` and scope `global:users:*`.", + "tags": ["admin_users"], + "summary": "Logout user revokes all auth tokens (devices) for the user. User of issued auth tokens (devices) will no longer be logged in and will be required to authenticate again upon next activity.", + "operationId": "logoutUser", "parameters": [ { - "type": "string", + "type": "integer", + "format": "int64", "x-go-name": "UserID", - "name": "user_name", + "name": "user_id", "in": "path", "required": true } @@ -726,28 +590,35 @@ "200": { "$ref": "#/responses/okResponse" }, + "400": { + "$ref": "#/responses/badRequestError" + }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/pause-all-alerts": { - "post": { + "/admin/users/{user_id}/password": { + "put": { "security": [ { "basic": [] } ], - "tags": ["admin"], - "summary": "Pause/unpause all (legacy) alerts.", - "operationId": "pauseAllAlerts", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.password:update` and scope `global:users:*`.", + "tags": ["admin_users"], + "summary": "Set password for user.", + "operationId": "setPassword", "parameters": [ { "x-go-name": "Body", @@ -755,13 +626,24 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PauseAllAlertsCommand" + "$ref": "#/definitions/AdminUpdateUserPasswordForm" } + }, + { + "type": "integer", + "format": "int64", + "x-go-name": "UserID", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/pauseAlertsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -775,39 +657,38 @@ } } }, - "/admin/provisioning/access-control/reload": { - "post": { - "tags": ["access_control_provisioning", "enterprise"], - "summary": "You need to have a permission with action `provisioning:reload` with scope `provisioners:accesscontrol`.", - "operationId": "adminProvisioningReloadAccessControl", - "responses": { - "202": { - "$ref": "#/responses/acceptedResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "/admin/users/{user_id}/permissions": { + "put": { + "description": "Only works with Basic Authentication (username and password). See introduction for an explanation.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.permissions:update` and scope `global:users:*`.", + "tags": ["admin_users"], + "summary": "Set permissions for user.", + "operationId": "setPermissions", + "parameters": [ + { + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AdminUpdateUserPermissionsForm" + } }, - "403": { - "$ref": "#/responses/forbiddenError" - } - } - } - }, - "/admin/provisioning/accesscontrol/reload": { - "post": { - "security": [ { - "basic": [] + "type": "integer", + "format": "int64", + "x-go-name": "UserID", + "name": "user_id", + "in": "path", + "required": true } ], - "description": "Reloads the provisioning config files for access control again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:accesscontrol`.", - "tags": ["admin_provisioning"], - "summary": "Reload access control provisioning configurations.", - "operationId": "reloadProvisionedAccessControl", "responses": { "200": { "$ref": "#/responses/okResponse" }, + "400": { + "$ref": "#/responses/badRequestError" + }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -820,20 +701,30 @@ } } }, - "/admin/provisioning/dashboards/reload": { - "post": { + "/admin/users/{user_id}/quotas": { + "get": { "security": [ { "basic": [] } ], - "description": "Reloads the provisioning config files for dashboards again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:dashboards`.", - "tags": ["admin_provisioning"], - "summary": "Reload dashboard provisioning configurations.", - "operationId": "reloadProvisionedDashboards", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.quotas:list` and scope `global:users:1` (userIDScope).", + "tags": ["admin_users"], + "summary": "Fetch user quota.", + "operationId": "getUserQuota", + "parameters": [ + { + "type": "integer", + "format": "int64", + "x-go-name": "UserID", + "name": "user_id", + "in": "path", + "required": true + } + ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQuotaResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -841,23 +732,52 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/provisioning/datasources/reload": { - "post": { + "/admin/users/{user_id}/quotas/{quota_target}": { + "put": { "security": [ { "basic": [] } ], - "description": "Reloads the provisioning config files for datasources again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:datasources`.", - "tags": ["admin_provisioning"], - "summary": "Reload datasource provisioning configurations.", - "operationId": "reloadProvisionedDatasources", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.quotas:update` and scope `global:users:1` (userIDScope).", + "tags": ["admin_users"], + "summary": "Update user quota.", + "operationId": "updateUserQuota", + "parameters": [ + { + "type": "string", + "x-go-name": "QuotaTarget", + "name": "quota_target", + "in": "path", + "required": true + }, + { + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateUserQuotaCmd" + } + }, + { + "type": "integer", + "format": "int64", + "x-go-name": "UserID", + "name": "user_id", + "in": "path", + "required": true + } + ], "responses": { "200": { "$ref": "#/responses/okResponse" @@ -868,53 +788,76 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/provisioning/notifications/reload": { + "/admin/users/{user_id}/revoke-auth-token": { "post": { "security": [ { "basic": [] } ], - "description": "Reloads the provisioning config files for legacy alert notifiers again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:notifications`.", - "tags": ["admin_provisioning"], - "summary": "Reload legacy alert notifier provisioning configurations.", - "operationId": "reloadProvisionedAlertNotifiers", + "description": "Revokes the given auth token (device) for the user. User of issued auth token (device) will no longer be logged in and will be required to authenticate again upon next activity.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.authtoken:update` and scope `global:users:*`.", + "tags": ["admin_users"], + "summary": "Revoke auth token for user.", + "operationId": "revokeAuthToken", + "parameters": [ + { + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RevokeAuthTokenCmd" + } + }, + { + "type": "integer", + "format": "int64", + "x-go-name": "UserID", + "name": "user_id", + "in": "path", + "required": true + } + ], "responses": { "200": { "$ref": "#/responses/okResponse" }, + "400": { + "$ref": "#/responses/badRequestError" + }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/provisioning/plugins/reload": { - "post": { - "security": [ - { - "basic": [] - } - ], - "description": "Reloads the provisioning config files for plugins again. It won’t return until the new provisioned entities are already stored in the database. In case of dashboards, it will stop polling for changes in dashboard files and then restart it with new configurations after returning.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `provisioning:reload` and scope `provisioners:plugin`.", - "tags": ["admin_provisioning"], - "summary": "Reload plugin provisioning configurations.", - "operationId": "reloadProvisionedPlugins", + "/alert-notifications": { + "get": { + "description": "Returns all notification channels that the authenticated user has permission to view.", + "tags": ["legacy_alerts_notification_channels"], + "summary": "Get all notification channels.", + "operationId": "getAlertNotificationChannels", "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getAlertNotificationChannelsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -926,41 +869,51 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/settings": { - "get": { - "security": [ + }, + "post": { + "description": "You can find the full list of [supported notifiers](https://grafana.com/docs/grafana/latest/alerting/old-alerting/notifications/#list-of-supported-notifiers) on the alert notifiers page.", + "tags": ["legacy_alerts_notification_channels"], + "summary": "Create notification channel.", + "operationId": "createAlertNotificationChannel", + "parameters": [ { - "basic": [] + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateAlertNotificationCommand" + } } ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `settings:read` and scopes: `settings:*`, `settings:auth.saml:` and `settings:auth.saml:enabled` (property level).", - "tags": ["admin"], - "summary": "Fetch settings.", - "operationId": "getSettings", "responses": { "200": { - "$ref": "#/responses/getSettingsResponse" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" + }, + "409": { + "$ref": "#/responses/conflictError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/admin/stats": { + "/alert-notifications/lookup": { "get": { - "description": "Only works with Basic Authentication (username and password). See introduction for an explanation.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `server:stats:read`.", - "tags": ["admin"], - "summary": "Fetch Grafana Stats.", - "operationId": "getStats", + "description": "Returns all notification channels, but with less detailed information. Accessible by any authenticated user and is mainly used by providing alert notification channels in Grafana UI when configuring alert rule.", + "tags": ["legacy_alerts_notification_channels"], + "summary": "Get all notification channels (lookup)", + "operationId": "lookupAlertNotificationChannels", "responses": { "200": { - "$ref": "#/responses/getStatsResponse" + "$ref": "#/responses/lookupAlertNotificationChannelsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -974,17 +927,12 @@ } } }, - "/admin/users": { + "/alert-notifications/test": { "post": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:create`.\nNote that OrgId is an optional parameter that can be used to assign a new user to a different organization when `auto_assign_org` is set to `true`.", - "tags": ["admin_users"], - "summary": "Create new user.", - "operationId": "createUser", + "description": "Sends a test notification to the channel.", + "tags": ["legacy_alerts_notification_channels"], + "summary": "Test notification channel.", + "operationId": "notificationChannelTest", "parameters": [ { "x-go-name": "Body", @@ -992,13 +940,13 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AdminCreateUserForm" + "$ref": "#/definitions/NotificationTestCommand" } } ], "responses": { "200": { - "$ref": "#/responses/createUserResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -1010,7 +958,7 @@ "$ref": "#/responses/forbiddenError" }, "412": { - "$ref": "#/responses/preconditionFailedError" + "$ref": "#/responses/SMTPNotEnabledError" }, "500": { "$ref": "#/responses/internalServerError" @@ -1018,30 +966,24 @@ } } }, - "/admin/users/{user_id}": { - "delete": { - "security": [ + "/alert-notifications/uid/{notification_channel_uid}": { + "get": { + "description": "Returns the notification channel given the notification channel UID.", + "tags": ["legacy_alerts_notification_channels"], + "summary": "Get notification channel by UID", + "operationId": "getAlertNotificationChannelByUID", + "parameters": [ { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:delete` and scope `global:users:*`.", - "tags": ["admin_users"], - "summary": "Delete global User.", - "operationId": "deleteUser", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", - "required": true + "type": "string", + "x-go-name": "NotificationUID", + "name": "notification_channel_uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1056,69 +998,33 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/users/{user_id}/auth-tokens": { - "get": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.authtoken:list` and scope `global:users:*`.", - "tags": ["admin_users"], - "summary": "Return a list of all auth tokens (devices) that the user currently have logged in from.", - "operationId": "getAuthTokens", + }, + "put": { + "description": "Updates an existing notification channel identified by uid.", + "tags": ["legacy_alerts_notification_channels"], + "summary": "Update notification channel by UID.", + "operationId": "updateAlertNotificationChannelBYUID", "parameters": [ { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", + "type": "string", + "x-go-name": "NotificationUID", + "name": "notification_channel_uid", "in": "path", "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAuthTokensResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/admin/users/{user_id}/disable": { - "post": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:disable` and scope `global:users:1` (userIDScope).", - "tags": ["admin_users"], - "summary": "Disable user.", - "operationId": "disableUser", - "parameters": [ { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", - "required": true + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateAlertNotificationWithUidCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1133,32 +1039,24 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/users/{user_id}/enable": { - "post": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users:enable` and scope `global:users:1` (userIDScope).", - "tags": ["admin_users"], - "summary": "Enable user.", - "operationId": "enableUser", + }, + "delete": { + "description": "Deletes an existing notification channel identified by UID.", + "tags": ["legacy_alerts_notification_channels"], + "summary": "Delete alert notification by UID.", + "operationId": "deleteAlertNotificationChannelByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", + "type": "string", + "x-go-name": "NotificationUID", + "name": "notification_channel_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/deleteAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1175,33 +1073,25 @@ } } }, - "/admin/users/{user_id}/logout": { - "post": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.logout` and scope `global:users:*`.", - "tags": ["admin_users"], - "summary": "Logout user revokes all auth tokens (devices) for the user. User of issued auth tokens (devices) will no longer be logged in and will be required to authenticate again upon next activity.", - "operationId": "logoutUser", + "/alert-notifications/{notification_channel_id}": { + "get": { + "description": "Returns the notification channel given the notification channel ID.", + "tags": ["legacy_alerts_notification_channels"], + "summary": "Get notification channel by ID.", + "operationId": "getAlertNotificationChannelByID", "parameters": [ { "type": "integer", "format": "int64", - "x-go-name": "UserID", - "name": "user_id", + "x-go-name": "NotificationID", + "name": "notification_channel_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1216,88 +1106,34 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/users/{user_id}/password": { + }, "put": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.password:update` and scope `global:users:*`.", - "tags": ["admin_users"], - "summary": "Set password for user.", - "operationId": "setPassword", + "description": "Updates an existing notification channel identified by ID.", + "tags": ["legacy_alerts_notification_channels"], + "summary": "Update notification channel by ID.", + "operationId": "updateAlertNotificationChannel", "parameters": [ - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AdminUpdateUserPasswordForm" - } - }, { "type": "integer", "format": "int64", - "x-go-name": "UserID", - "name": "user_id", + "x-go-name": "NotificationID", + "name": "notification_channel_id", "in": "path", "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/admin/users/{user_id}/permissions": { - "put": { - "description": "Only works with Basic Authentication (username and password). See introduction for an explanation.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.permissions:update` and scope `global:users:*`.", - "tags": ["admin_users"], - "summary": "Set permissions for user.", - "operationId": "setPermissions", - "parameters": [ { "x-go-name": "Body", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AdminUpdateUserPermissionsForm" + "$ref": "#/definitions/UpdateAlertNotificationCommand" } - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1305,36 +1141,32 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/users/{user_id}/quotas": { - "get": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.quotas:list` and scope `global:users:1` (userIDScope).", - "tags": ["admin_users"], - "summary": "Fetch user quota.", - "operationId": "getUserQuota", + }, + "delete": { + "description": "Deletes an existing notification channel identified by ID.", + "tags": ["legacy_alerts_notification_channels"], + "summary": "Delete alert notification by ID.", + "operationId": "deleteAlertNotificationChannel", "parameters": [ { "type": "integer", "format": "int64", - "x-go-name": "UserID", - "name": "user_id", + "x-go-name": "NotificationID", + "name": "notification_channel_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQuotaResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1351,163 +1183,151 @@ } } }, - "/admin/users/{user_id}/quotas/{quota_target}": { - "put": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.quotas:update` and scope `global:users:1` (userIDScope).", - "tags": ["admin_users"], - "summary": "Update user quota.", - "operationId": "updateUserQuota", + "/alerts": { + "get": { + "tags": ["legacy_alerts"], + "summary": "Get legacy alerts.", + "operationId": "getAlerts", "parameters": [ { - "type": "string", - "x-go-name": "QuotaTarget", - "name": "quota_target", - "in": "path", - "required": true - }, + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "DashboardID", + "description": "Limit response to alerts in specified dashboard(s). You can specify multiple dashboards.", + "name": "dashboardId", + "in": "query" + }, { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateUserQuotaCmd" - } + "type": "integer", + "format": "int64", + "x-go-name": "PanelID", + "description": "Limit response to alert for a specified panel on a dashboard.", + "name": "panelId", + "in": "query" + }, + { + "type": "string", + "x-go-name": "Query", + "description": "Limit response to alerts having a name like this value.", + "name": "query", + "in": "query" + }, + { + "enum": ["all", "no_data", "paused", "alerting", "ok", "pending", "unknown"], + "type": "string", + "x-go-name": "State", + "description": "Return alerts with one or more of the following alert states", + "name": "state", + "in": "query" }, { "type": "integer", "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", - "required": true + "x-go-name": "Limit", + "description": "Limit response to X number of alerts.", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "x-go-name": "FolderID", + "description": "Limit response to alerts of dashboards in specified folder(s). You can specify multiple folders", + "name": "folderId", + "in": "query" + }, + { + "type": "string", + "x-go-name": "DashboardQuery", + "description": "Limit response to alerts having a dashboard name like this value./ Limit response to alerts having a dashboard name like this value.", + "name": "dashboardQuery", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "x-go-name": "DashboardTag", + "description": "Limit response to alerts of dashboards with specified tags. To do an “AND” filtering with multiple tags, specify the tags parameter multiple times", + "name": "dashboardTag", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getAlertsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users/{user_id}/revoke-auth-token": { - "post": { - "security": [ - { - "basic": [] - } - ], - "description": "Revokes the given auth token (device) for the user. User of issued auth token (device) will no longer be logged in and will be required to authenticate again upon next activity.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `users.authtoken:update` and scope `global:users:*`.", - "tags": ["admin_users"], - "summary": "Revoke auth token for user.", - "operationId": "revokeAuthToken", + "/alerts/states-for-dashboard": { + "get": { + "tags": ["legacy_alerts"], + "summary": "Get alert states for a dashboard.", + "operationId": "getDashboardStates", "parameters": [ - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RevokeAuthTokenCmd" - } - }, { "type": "integer", "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", + "x-go-name": "DashboardID", + "name": "dashboardId", + "in": "query", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getDashboardStatesResponse" }, "400": { "$ref": "#/responses/badRequestError" }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alert-notifications": { - "get": { - "description": "Returns all notification channels that the authenticated user has permission to view.", - "tags": ["legacy_alerts_notification_channels"], - "summary": "Get all notification channels.", - "operationId": "getAlertNotificationChannels", - "responses": { - "200": { - "$ref": "#/responses/getAlertNotificationChannelsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, + "/alerts/test": { "post": { - "description": "You can find the full list of [supported notifiers](https://grafana.com/docs/grafana/latest/alerting/old-alerting/notifications/#list-of-supported-notifiers) on the alert notifiers page.", - "tags": ["legacy_alerts_notification_channels"], - "summary": "Create notification channel.", - "operationId": "createAlertNotificationChannel", + "tags": ["legacy_alerts"], + "summary": "Test alert.", + "operationId": "testAlert", "parameters": [ { "x-go-name": "Body", "name": "body", "in": "body", - "required": true, "schema": { - "$ref": "#/definitions/CreateAlertNotificationCommand" + "$ref": "#/definitions/AlertTestCommand" } } ], "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/testAlertResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" + "422": { + "$ref": "#/responses/unprocessableEntityError" }, "500": { "$ref": "#/responses/internalServerError" @@ -1515,51 +1335,60 @@ } } }, - "/alert-notifications/lookup": { + "/alerts/{alert_id}": { "get": { - "description": "Returns all notification channels, but with less detailed information. Accessible by any authenticated user and is mainly used by providing alert notification channels in Grafana UI when configuring alert rule.", - "tags": ["legacy_alerts_notification_channels"], - "summary": "Get all notification channels (lookup)", - "operationId": "lookupAlertNotificationChannels", + "description": "“evalMatches” data in the response is cached in the db when and only when the state of the alert changes (e.g. transitioning from “ok” to “alerting” state).\nIf data from one server triggers the alert first and, before that server is seen leaving alerting state, a second server also enters a state that would trigger the alert, the second server will not be visible in “evalMatches” data.", + "tags": ["legacy_alerts"], + "summary": "Get alert by ID.", + "operationId": "getAlertByID", + "parameters": [ + { + "type": "string", + "x-go-name": "AlertID", + "name": "alert_id", + "in": "path", + "required": true + } + ], "responses": { "200": { - "$ref": "#/responses/lookupAlertNotificationChannelsResponse" + "$ref": "#/responses/getAlertResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alert-notifications/test": { + "/alerts/{alert_id}/pause": { "post": { - "description": "Sends a test notification to the channel.", - "tags": ["legacy_alerts_notification_channels"], - "summary": "Test notification channel.", - "operationId": "notificationChannelTest", + "tags": ["legacy_alerts"], + "summary": "Pause/unpause alert by id.", + "operationId": "pauseAlert", "parameters": [ + { + "type": "string", + "x-go-name": "AlertID", + "name": "alert_id", + "in": "path", + "required": true + }, { "x-go-name": "Body", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/NotificationTestCommand" + "$ref": "#/definitions/PauseAlertCommand" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/pauseAlertResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1567,8 +1396,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "412": { - "$ref": "#/responses/SMTPNotEnabledError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -1576,236 +1405,50 @@ } } }, - "/alert-notifications/uid/{notification_channel_uid}": { + "/annotations": { "get": { - "description": "Returns the notification channel given the notification channel UID.", - "tags": ["legacy_alerts_notification_channels"], - "summary": "Get notification channel by UID", - "operationId": "getAlertNotificationChannelByUID", + "description": "Starting in Grafana v6.4 regions annotations are now returned in one entity that now includes the timeEnd property.", + "tags": ["annotations"], + "summary": "Find Annotations.", + "operationId": "getAnnotations", "parameters": [ { - "type": "string", - "x-go-name": "NotificationUID", - "name": "notification_channel_uid", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "type": "integer", + "format": "int64", + "x-go-name": "From", + "description": "Find annotations created after specific epoch datetime in milliseconds.", + "name": "from", + "in": "query" }, - "403": { - "$ref": "#/responses/forbiddenError" + { + "type": "integer", + "format": "int64", + "x-go-name": "To", + "description": "Find annotations created before specific epoch datetime in milliseconds.", + "name": "to", + "in": "query" }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "put": { - "description": "Updates an existing notification channel identified by uid.", - "tags": ["legacy_alerts_notification_channels"], - "summary": "Update notification channel by UID.", - "operationId": "updateAlertNotificationChannelBYUID", - "parameters": [ - { - "type": "string", - "x-go-name": "NotificationUID", - "name": "notification_channel_uid", - "in": "path", - "required": true - }, - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateAlertNotificationWithUidCommand" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "delete": { - "description": "Deletes an existing notification channel identified by UID.", - "tags": ["legacy_alerts_notification_channels"], - "summary": "Delete alert notification by UID.", - "operationId": "deleteAlertNotificationChannelByUID", - "parameters": [ - { - "type": "string", - "x-go-name": "NotificationUID", - "name": "notification_channel_uid", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/deleteAlertNotificationChannelResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/alert-notifications/{notification_channel_id}": { - "get": { - "description": "Returns the notification channel given the notification channel ID.", - "tags": ["legacy_alerts_notification_channels"], - "summary": "Get notification channel by ID.", - "operationId": "getAlertNotificationChannelByID", - "parameters": [ { "type": "integer", "format": "int64", - "x-go-name": "NotificationID", - "name": "notification_channel_id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "x-go-name": "UserID", + "description": "Limit response to annotations created by specific user.", + "name": "userId", + "in": "query" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "put": { - "description": "Updates an existing notification channel identified by ID.", - "tags": ["legacy_alerts_notification_channels"], - "summary": "Update notification channel by ID.", - "operationId": "updateAlertNotificationChannel", - "parameters": [ { "type": "integer", "format": "int64", - "x-go-name": "NotificationID", - "name": "notification_channel_id", - "in": "path", - "required": true - }, - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateAlertNotificationCommand" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "x-go-name": "AlertID", + "description": "Find annotations for a specified alert.", + "name": "alertId", + "in": "query" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "delete": { - "description": "Deletes an existing notification channel identified by ID.", - "tags": ["legacy_alerts_notification_channels"], - "summary": "Delete alert notification by ID.", - "operationId": "deleteAlertNotificationChannel", - "parameters": [ { "type": "integer", "format": "int64", - "x-go-name": "NotificationID", - "name": "notification_channel_id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/alerts": { - "get": { - "tags": ["legacy_alerts"], - "summary": "Get legacy alerts.", - "operationId": "getAlerts", - "parameters": [ - { - "type": "array", - "items": { - "type": "string" - }, "x-go-name": "DashboardID", - "description": "Limit response to alerts in specified dashboard(s). You can specify multiple dashboards.", + "description": "Find annotations that are scoped to a specific dashboard", "name": "dashboardId", "in": "query" }, @@ -1813,30 +1456,15 @@ "type": "integer", "format": "int64", "x-go-name": "PanelID", - "description": "Limit response to alert for a specified panel on a dashboard.", + "description": "Find annotations that are scoped to a specific panel", "name": "panelId", "in": "query" }, - { - "type": "string", - "x-go-name": "Query", - "description": "Limit response to alerts having a name like this value.", - "name": "query", - "in": "query" - }, - { - "enum": ["all", "no_data", "paused", "alerting", "ok", "pending", "unknown"], - "type": "string", - "x-go-name": "State", - "description": "Return alerts with one or more of the following alert states", - "name": "state", - "in": "query" - }, { "type": "integer", "format": "int64", "x-go-name": "Limit", - "description": "Limit response to X number of alerts.", + "description": "Max limit for results returned.", "name": "limit", "in": "query" }, @@ -1846,1351 +1474,58 @@ "type": "string" }, "collectionFormat": "multi", - "x-go-name": "FolderID", - "description": "Limit response to alerts of dashboards in specified folder(s). You can specify multiple folders", - "name": "folderId", + "x-go-name": "Tags", + "description": "Use this to filter global annotations. Global annotations are annotations from an annotation data source that are not connected specifically to a dashboard or panel. You can filter by multiple tags.", + "name": "tags", "in": "query" }, { + "enum": ["alert", "annotation"], "type": "string", - "x-go-name": "DashboardQuery", - "description": "Limit response to alerts having a dashboard name like this value./ Limit response to alerts having a dashboard name like this value.", - "name": "dashboardQuery", + "x-go-name": "Type", + "description": "Return alerts or user created annotations", + "name": "type", "in": "query" }, { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "x-go-name": "DashboardTag", - "description": "Limit response to alerts of dashboards with specified tags. To do an “AND” filtering with multiple tags, specify the tags parameter multiple times", - "name": "dashboardTag", + "type": "boolean", + "x-go-name": "MatchAny", + "description": "Match any or all tags", + "name": "matchAny", "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/getAlertsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/alerts/states-for-dashboard": { - "get": { - "tags": ["legacy_alerts"], - "summary": "Get alert states for a dashboard.", - "operationId": "getDashboardStates", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "DashboardID", - "name": "dashboardId", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getDashboardStatesResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/alerts/test": { - "post": { - "tags": ["legacy_alerts"], - "summary": "Test alert.", - "operationId": "testAlert", - "parameters": [ - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "schema": { - "$ref": "#/definitions/AlertTestCommand" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/testAlertResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "422": { - "$ref": "#/responses/unprocessableEntityError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/alerts/{alert_id}": { - "get": { - "description": "“evalMatches” data in the response is cached in the db when and only when the state of the alert changes (e.g. transitioning from “ok” to “alerting” state).\nIf data from one server triggers the alert first and, before that server is seen leaving alerting state, a second server also enters a state that would trigger the alert, the second server will not be visible in “evalMatches” data.", - "tags": ["legacy_alerts"], - "summary": "Get alert by ID.", - "operationId": "getAlertByID", - "parameters": [ - { - "type": "string", - "x-go-name": "AlertID", - "name": "alert_id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAlertResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/alerts/{alert_id}/pause": { - "post": { - "tags": ["legacy_alerts"], - "summary": "Pause/unpause alert by id.", - "operationId": "pauseAlert", - "parameters": [ - { - "type": "string", - "x-go-name": "AlertID", - "name": "alert_id", - "in": "path", - "required": true - }, - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PauseAlertCommand" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/pauseAlertResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/annotations": { - "get": { - "description": "Starting in Grafana v6.4 regions annotations are now returned in one entity that now includes the timeEnd property.", - "tags": ["annotations"], - "summary": "Find Annotations.", - "operationId": "getAnnotations", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "From", - "description": "Find annotations created after specific epoch datetime in milliseconds.", - "name": "from", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "To", - "description": "Find annotations created before specific epoch datetime in milliseconds.", - "name": "to", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "description": "Limit response to annotations created by specific user.", - "name": "userId", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "AlertID", - "description": "Find annotations for a specified alert.", - "name": "alertId", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "DashboardID", - "description": "Find annotations that are scoped to a specific dashboard", - "name": "dashboardId", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "PanelID", - "description": "Find annotations that are scoped to a specific panel", - "name": "panelId", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "Limit", - "description": "Max limit for results returned.", - "name": "limit", - "in": "query" - }, - { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "x-go-name": "Tags", - "description": "Use this to filter global annotations. Global annotations are annotations from an annotation data source that are not connected specifically to a dashboard or panel. You can filter by multiple tags.", - "name": "tags", - "in": "query" - }, - { - "enum": ["alert", "annotation"], - "type": "string", - "x-go-name": "Type", - "description": "Return alerts or user created annotations", - "name": "type", - "in": "query" - }, - { - "type": "boolean", - "x-go-name": "MatchAny", - "description": "Match any or all tags", - "name": "matchAny", - "in": "query" - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAnnotationsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "post": { - "description": "Creates an annotation in the Grafana database. The dashboardId and panelId fields are optional. If they are not specified then a global annotation is created and can be queried in any dashboard that adds the Grafana annotations data source. When creating a region annotation include the timeEnd property.\nThe format for `time` and `timeEnd` should be epoch numbers in millisecond resolution.\nThe response for this HTTP request is slightly different in versions prior to v6.4. In prior versions you would also get an endId if you where creating a region. But in 6.4 regions are represented using a single event with time and timeEnd properties.", - "tags": ["annotations"], - "summary": "Create Annotation.", - "operationId": "createAnnotation", - "parameters": [ - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PostAnnotationsCmd" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/createAnnotationResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/annotations/graphite": { - "post": { - "description": "Creates an annotation by using Graphite-compatible event format. The `when` and `data` fields are optional. If `when` is not specified then the current time will be used as annotation’s timestamp. The `tags` field can also be in prior to Graphite `0.10.0` format (string with multiple tags being separated by a space).", - "tags": ["annotations"], - "summary": "Create Annotation in Graphite format.", - "operationId": "createGraphiteAnnotation", - "parameters": [ - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PostGraphiteAnnotationsCmd" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/createAnnotationResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/annotations/mass-delete": { - "post": { - "tags": ["annotations"], - "summary": "Delete multiple annotations.", - "operationId": "massDeleteAnnotations", - "parameters": [ - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/DeleteAnnotationsCmd" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/annotations/tags": { - "get": { - "description": "Find all the event tags created in the annotations.", - "tags": ["annotations"], - "summary": "Find Annotations Tags.", - "operationId": "getAnnotationTags", - "parameters": [ - { - "type": "string", - "x-go-name": "Tag", - "description": "Tag is a string that you can use to filter tags.", - "name": "tag", - "in": "query" - }, - { - "type": "string", - "default": "100", - "x-go-name": "Limit", - "description": "Max limit for results returned.", - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAnnotationTagsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/annotations/{annotation_id}": { - "put": { - "description": "Updates all properties of an annotation that matches the specified id. To only update certain property, consider using the Patch Annotation operation.", - "tags": ["annotations"], - "summary": "Update Annotation.", - "operationId": "updateAnnotation", - "parameters": [ - { - "type": "string", - "x-go-name": "AnnotationID", - "name": "annotation_id", - "in": "path", - "required": true - }, - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateAnnotationsCmd" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "delete": { - "description": "Deletes the annotation that matches the specified ID.", - "tags": ["annotations"], - "summary": "Delete Annotation By ID.", - "operationId": "deleteAnnotation", - "parameters": [ - { - "type": "string", - "x-go-name": "AnnotationID", - "name": "annotation_id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "patch": { - "description": "Updates one or more properties of an annotation that matches the specified ID.\nThis operation currently supports updating of the `text`, `tags`, `time` and `timeEnd` properties.\nThis is available in Grafana 6.0.0-beta2 and above.", - "tags": ["annotations"], - "summary": "Patch Annotation", - "operationId": "patchAnnotation", - "parameters": [ - { - "type": "string", - "x-go-name": "AnnotationID", - "name": "annotation_id", - "in": "path", - "required": true - }, - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PatchAnnotationsCmd" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/auth/keys": { - "get": { - "description": "Will return auth keys.", - "tags": ["api_keys"], - "summary": "Get auth keys.", - "operationId": "getAPIkeys", - "parameters": [ - { - "type": "boolean", - "default": false, - "x-go-name": "IncludeExpired", - "description": "Show expired keys", - "name": "includeExpired", - "in": "query" - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAPIkeyResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "post": { - "description": "Will return details of the created API key", - "tags": ["api_keys"], - "summary": "Creates an API key.", - "operationId": "addAPIkey", - "parameters": [ - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AddApiKeyCommand" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/postAPIkeyResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "409": { - "$ref": "#/responses/conflictError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/auth/keys/{id}": { - "delete": { - "tags": ["api_keys"], - "summary": "Delete API key.", - "operationId": "deleteAPIkey", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboard/snapshots": { - "get": { - "tags": ["snapshots"], - "summary": "List snapshots.", - "operationId": "getSnapshots", - "parameters": [ - { - "type": "string", - "x-go-name": "Query", - "description": "Search Query", - "name": "query", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 1000, - "x-go-name": "Limit", - "description": "Limit the number of returned results", - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "$ref": "#/responses/getSnapshotsResponse" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboards/calculate-diff": { - "post": { - "produces": ["application/json", "text/html"], - "tags": ["dashboards"], - "summary": "Perform diff on two dashboards.", - "operationId": "calcDashboardDiff", - "parameters": [ - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "base": { - "$ref": "#/definitions/CalculateDiffTarget" - }, - "diffType": { - "description": "The type of diff to return\nDescription:\n`basic`\n`json`", - "type": "string", - "enum": ["basic", "json"], - "x-go-name": "DiffType" - }, - "new": { - "$ref": "#/definitions/CalculateDiffTarget" - } - } - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/dashboardDiffResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboards/db": { - "post": { - "description": "Creates a new dashboard or updates an existing dashboard.", - "tags": ["dashboards"], - "summary": "Create / Update dashboard", - "operationId": "postDashboard", - "parameters": [ - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/SaveDashboardCommand" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/postDashboardResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "412": { - "$ref": "#/responses/preconditionFailedError" - }, - "422": { - "$ref": "#/responses/unprocessableEntityError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboards/home": { - "get": { - "tags": ["dashboards"], - "summary": "Get home dashboard.", - "operationId": "getHomeDashboard", - "responses": { - "200": { - "$ref": "#/responses/getHomeDashboardResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboards/id/{DashboardID}/permissions": { - "get": { - "tags": ["dashboard_permissions"], - "summary": "Gets all existing permissions for the given dashboard.", - "operationId": "getDashboardPermissions", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "DashboardID", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getDashboardPermissionsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "post": { - "description": "This operation will remove existing permissions if they’re not included in the request.", - "tags": ["dashboard_permissions"], - "summary": "Updates permissions for a dashboard.", - "operationId": "postDashboardPermissions", - "parameters": [ - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateDashboardAclCommand" - } - }, - { - "type": "integer", - "format": "int64", - "name": "DashboardID", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboards/id/{DashboardID}/restore": { - "post": { - "tags": ["dashboard_versions"], - "summary": "Restore a dashboard to a given dashboard version.", - "operationId": "restoreDashboardVersion", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "DashboardID", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/postDashboardResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboards/id/{DashboardID}/versions": { - "get": { - "tags": ["dashboard_versions"], - "summary": "Gets all existing versions for the dashboard.", - "operationId": "getDashboardVersions", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "DashboardID", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "default": 0, - "x-go-name": "Limit", - "description": "Maximum number of results to return", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 0, - "x-go-name": "Start", - "description": "Version to start from when returning queries", - "name": "start", - "in": "query" - } - ], - "responses": { - "200": { - "$ref": "#/responses/dashboardVersionsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboards/id/{DashboardID}/versions/{DashboardVersionID}": { - "get": { - "tags": ["dashboard_versions"], - "summary": "Get a specific dashboard version.", - "operationId": "getDashboardVersion", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "DashboardID", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "DashboardVersionID", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/dashboardVersionResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboards/import": { - "post": { - "tags": ["dashboards"], - "summary": "Import dashboard.", - "operationId": "importDashboard", - "parameters": [ - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/ImportDashboardRequest" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/importDashboardResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "412": { - "$ref": "#/responses/preconditionFailedError" - }, - "422": { - "$ref": "#/responses/unprocessableEntityError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboards/tags": { - "get": { - "tags": ["dashboards"], - "summary": "Get all dashboards tags of an organisation.", - "operationId": "getDashboardTags", - "responses": { - "200": { - "$ref": "#/responses/dashboardsTagsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboards/trim": { - "post": { - "tags": ["dashboards"], - "summary": "Trim defaults from dashboard.", - "operationId": "trimDashboard", - "parameters": [ - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/TrimDashboardCommand" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/trimDashboardResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboards/uid/{uid}": { - "get": { - "description": "Will return the dashboard given the dashboard unique identifier (uid).", - "tags": ["dashboards"], - "summary": "Get dashboard by uid.", - "operationId": "getDashboardByUID", - "parameters": [ - { - "type": "string", - "x-go-name": "UID", - "name": "uid", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/dashboardResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "delete": { - "description": "Will delete the dashboard given the specified unique identifier (uid).", - "tags": ["dashboards"], - "summary": "Delete dashboard by uid.", - "operationId": "deleteDashboardByUID", - "parameters": [ - { - "type": "string", - "x-go-name": "UID", - "name": "uid", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/deleteDashboardResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/datasources": { - "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scope: `datasources:*`.", - "tags": ["datasources"], - "summary": "Get all data sources.", - "operationId": "getDatasources", - "responses": { - "200": { - "$ref": "#/responses/getDatasourcesResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "post": { - "description": "By defining `password` and `basicAuthPassword` under secureJsonData property\nGrafana encrypts them securely as an encrypted blob in the database.\nThe response then lists the encrypted fields under secureJsonFields.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:create`", - "tags": ["datasources"], - "summary": "Create a data source.", - "operationId": "addDatasource", - "parameters": [ - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AddDataSourceCommand" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "409": { - "$ref": "#/responses/conflictError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/datasources/id/{datasource_name}": { - "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", - "tags": ["datasources"], - "summary": "Get data source Id by Name.", - "operationId": "getDatasourceIdByName", - "parameters": [ - { - "type": "string", - "x-go-name": "DatasourceName", - "name": "datasource_name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getDatasourceIDresponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/datasources/name/{datasource_name}": { - "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", - "tags": ["datasources"], - "summary": "Get a single data source by Name.", - "operationId": "getDatasourceByName", - "parameters": [ - { - "type": "string", - "x-go-name": "DatasourceName", - "name": "datasource_name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getDatasourceResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "delete": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", - "tags": ["datasources"], - "summary": "Delete an existing data source by name.", - "operationId": "deleteDatasourceByName", - "parameters": [ - { - "type": "string", - "x-go-name": "DatasourceName", - "name": "datasource_name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/deleteDatasourceByNameResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/datasources/proxy/{datasource_id}/{datasource_proxy_route}": { - "get": { - "description": "Proxies all calls to the actual data source.", - "tags": ["datasources"], - "summary": "Data source proxy GET calls.", - "operationId": "datasourceProxyGETcalls", - "parameters": [ - { - "type": "string", - "x-go-name": "DatasourceID", - "name": "datasource_id", - "in": "path", - "required": true - }, - { - "type": "string", - "x-go-name": "DatasourceProxyRoute", - "name": "datasource_proxy_route", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getAnnotationsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, "post": { - "description": "Proxies all calls to the actual data source. The data source should support POST methods for the specific path and role as defined", - "tags": ["datasources"], - "summary": "Data source proxy POST calls.", - "operationId": "datasourceProxyPOSTcalls", + "description": "Creates an annotation in the Grafana database. The dashboardId and panelId fields are optional. If they are not specified then a global annotation is created and can be queried in any dashboard that adds the Grafana annotations data source. When creating a region annotation include the timeEnd property.\nThe format for `time` and `timeEnd` should be epoch numbers in millisecond resolution.\nThe response for this HTTP request is slightly different in versions prior to v6.4. In prior versions you would also get an endId if you where creating a region. But in 6.4 regions are represented using a single event with time and timeEnd properties.", + "tags": ["annotations"], + "summary": "Create Annotation.", + "operationId": "createAnnotation", "parameters": [ { - "type": "string", - "x-go-name": "DatasourceID", - "name": "datasource_id", - "in": "path", - "required": true - }, - { - "type": "string", - "x-go-name": "DatasourceProxyRoute", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "name": "DatasourceProxyParam", + "x-go-name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "type": "object" + "$ref": "#/definitions/PostAnnotationsCmd" } } ], "responses": { - "201": { - "description": "" - }, - "202": { - "description": "" + "200": { + "$ref": "#/responses/createAnnotationResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3201,38 +1536,32 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Proxies all calls to the actual data source.", - "tags": ["datasources"], - "summary": "Data source proxy DELETE calls.", - "operationId": "datasourceProxyDELETEcalls", + } + }, + "/annotations/graphite": { + "post": { + "description": "Creates an annotation by using Graphite-compatible event format. The `when` and `data` fields are optional. If `when` is not specified then the current time will be used as annotation’s timestamp. The `tags` field can also be in prior to Graphite `0.10.0` format (string with multiple tags being separated by a space).", + "tags": ["annotations"], + "summary": "Create Annotation in Graphite format.", + "operationId": "createGraphiteAnnotation", "parameters": [ { - "type": "string", - "x-go-name": "DatasourceID", - "name": "datasource_id", - "in": "path", - "required": true - }, - { - "type": "string", - "x-go-name": "DatasourceProxyRoute", - "name": "datasource_proxy_route", - "in": "path", - "required": true + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PostGraphiteAnnotationsCmd" + } } ], "responses": { - "202": { - "description": "" + "200": { + "$ref": "#/responses/createAnnotationResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3243,102 +1572,104 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources/uid/{datasource_uid}": { - "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", - "tags": ["datasources"], - "summary": "Get a single data source by UID.", - "operationId": "getDatasourceByUID", + "/annotations/mass-delete": { + "post": { + "tags": ["annotations"], + "summary": "Delete multiple annotations.", + "operationId": "massDeleteAnnotations", "parameters": [ { - "type": "string", - "x-go-name": "DatasourceUID", - "name": "datasource_uid", - "in": "path", - "required": true + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/DeleteAnnotationsCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/getDatasourceResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", - "tags": ["datasources"], - "summary": "Delete an existing data source by UID.", - "operationId": "deleteDatasourceByUID", + } + }, + "/annotations/tags": { + "get": { + "description": "Find all the event tags created in the annotations.", + "tags": ["annotations"], + "summary": "Find Annotations Tags.", + "operationId": "getAnnotationTags", "parameters": [ { "type": "string", - "x-go-name": "DatasourceUID", - "name": "datasource_uid", - "in": "path", - "required": true + "x-go-name": "Tag", + "description": "Tag is a string that you can use to filter tags.", + "name": "tag", + "in": "query" + }, + { + "type": "string", + "default": "100", + "x-go-name": "Limit", + "description": "Max limit for results returned.", + "name": "limit", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getAnnotationTagsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources/{datasource_id}": { - "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).", - "tags": ["datasources"], - "summary": "Get a single data source by Id.", - "operationId": "getDatasourceByID", + "/annotations/{annotation_id}": { + "put": { + "description": "Updates all properties of an annotation that matches the specified id. To only update certain property, consider using the Patch Annotation operation.", + "tags": ["annotations"], + "summary": "Update Annotation.", + "operationId": "updateAnnotation", "parameters": [ { "type": "string", - "x-go-name": "DatasourceID", - "name": "datasource_id", + "x-go-name": "AnnotationID", + "name": "annotation_id", "in": "path", "required": true + }, + { + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateAnnotationsCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/getDatasourceResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3349,39 +1680,28 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, - "put": { - "description": "Similar to creating a data source, `password` and `basicAuthPassword` should be defined under\nsecureJsonData in order to be stored securely as an encrypted blob in the database. Then, the\nencrypted fields are listed under secureJsonFields section in the response.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:write` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).", - "tags": ["datasources"], - "summary": "Update an existing data source.", - "operationId": "updateDatasource", + "delete": { + "description": "Deletes the annotation that matches the specified ID.", + "tags": ["annotations"], + "summary": "Delete Annotation By ID.", + "operationId": "deleteAnnotation", "parameters": [ { "type": "string", - "x-go-name": "DatasourceID", - "name": "datasource_id", + "x-go-name": "AnnotationID", + "name": "annotation_id", "in": "path", "required": true - }, - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateDataSourceCommand" - } } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3394,18 +1714,27 @@ } } }, - "delete": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).", - "tags": ["datasources"], - "summary": "Delete an existing data source by id.", - "operationId": "deleteDatasourceByID", + "patch": { + "description": "Updates one or more properties of an annotation that matches the specified ID.\nThis operation currently supports updating of the `text`, `tags`, `time` and `timeEnd` properties.\nThis is available in Grafana 6.0.0-beta2 and above.", + "tags": ["annotations"], + "summary": "Patch Annotation", + "operationId": "patchAnnotation", "parameters": [ { "type": "string", - "x-go-name": "DatasourceID", - "name": "datasource_id", + "x-go-name": "AnnotationID", + "name": "annotation_id", "in": "path", "required": true + }, + { + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PatchAnnotationsCmd" + } } ], "responses": { @@ -3427,27 +1756,25 @@ } } }, - "/datasources/{datasource_id}/disable-permissions": { - "post": { - "description": "Disables permissions for the data source with the given id. All existing permissions will be removed and anyone will be able to query the data source.\n\nYou need to have a permission with action `datasources.permissions:toggle` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", - "tags": ["datasource_permissions", "enterprise"], - "summary": "Disable permissions for a data source.", - "operationId": "disablePermissions", + "/auth/keys": { + "get": { + "description": "Will return auth keys.", + "tags": ["api_keys"], + "summary": "Get auth keys.", + "operationId": "getAPIkeys", "parameters": [ { - "type": "string", - "x-go-name": "DatasourceID", - "name": "datasource_id", - "in": "path", - "required": true + "type": "boolean", + "default": false, + "x-go-name": "IncludeExpired", + "description": "Show expired keys", + "name": "includeExpired", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getAPIkeyResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3462,26 +1789,25 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/{datasource_id}/enable-permissions": { + }, "post": { - "description": "Enables permissions for the data source with the given id.\nNo one except Org Admins will be able to query the data source until permissions have been added\nwhich permit certain users or teams to query the data source.\n\nYou need to have a permission with action `datasources.permissions:toggle` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", - "tags": ["datasource_permissions", "enterprise"], - "summary": "Enable permissions for a data source.", - "operationId": "enablePermissions", + "description": "Will return details of the created API key", + "tags": ["api_keys"], + "summary": "Creates an API key.", + "operationId": "addAPIkey", "parameters": [ { - "type": "string", - "x-go-name": "DatasourceID", - "name": "datasource_id", - "in": "path", - "required": true + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddApiKeyCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" + "$ref": "#/responses/postAPIkeyResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3492,8 +1818,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -3501,24 +1827,24 @@ } } }, - "/datasources/{datasource_id}/permissions": { - "get": { - "description": "Gets all existing permissions for the data source with the given id.\n\nYou need to have a permission with action `datasources.permissions:read` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", - "tags": ["datasource_permissions", "enterprise"], - "summary": "Get permissions for a data source.", - "operationId": "getPermissions", + "/auth/keys/{id}": { + "delete": { + "tags": ["api_keys"], + "summary": "Delete API key.", + "operationId": "deleteAPIkey", "parameters": [ { - "type": "string", - "x-go-name": "DatasourceID", - "name": "datasource_id", + "type": "integer", + "format": "int64", + "x-go-name": "ID", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getPermissionseResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3535,31 +1861,72 @@ } } }, - "/datasources/{datasource_id}/permissions/{permissionId}": { - "delete": { - "description": "Removes the permission with the given permissionId for the data source with the given id.\n\nYou need to have a permission with action `datasources.permissions:delete` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", - "tags": ["datasource_permissions", "enterprise"], - "summary": "Remove permission for a data source.", - "operationId": "deletePermissions", + "/dashboard/snapshots": { + "get": { + "tags": ["snapshots"], + "summary": "List snapshots.", + "operationId": "getSnapshots", "parameters": [ { "type": "string", - "x-go-name": "PermissionID", - "name": "permissionId", - "in": "path", - "required": true + "x-go-name": "Query", + "description": "Search Query", + "name": "query", + "in": "query" }, { - "type": "string", - "x-go-name": "DatasourceID", - "name": "datasource_id", - "in": "path", - "required": true + "type": "integer", + "format": "int64", + "default": 1000, + "x-go-name": "Limit", + "description": "Limit the number of returned results", + "name": "limit", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getSnapshotsResponse" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/calculate-diff": { + "post": { + "produces": ["application/json", "text/html"], + "tags": ["dashboards"], + "summary": "Perform diff on two dashboards.", + "operationId": "calcDashboardDiff", + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "base": { + "$ref": "#/definitions/CalculateDiffTarget" + }, + "diffType": { + "description": "The type of diff to return\nDescription:\n`basic`\n`json`", + "type": "string", + "enum": ["basic", "json"], + "x-go-name": "DiffType" + }, + "new": { + "$ref": "#/definitions/CalculateDiffTarget" + } + } + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/dashboardDiffResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3567,35 +1934,31 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/ds/query": { + "/dashboards/db": { "post": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:query`.", - "tags": ["ds"], - "summary": "Query metrics with expressions", - "operationId": "queryMetricsWithExpressions", + "description": "Creates a new dashboard or updates an existing dashboard.", + "tags": ["dashboards"], + "summary": "Create / Update dashboard", + "operationId": "postDashboard", "parameters": [ { - "x-go-name": "Body", - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/MetricRequest" + "$ref": "#/definitions/SaveDashboardCommand" } } ], "responses": { "200": { - "$ref": "#/responses/queryDataResponse" + "$ref": "#/responses/postDashboardResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3606,41 +1969,56 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "412": { + "$ref": "#/responses/preconditionFailedError" + }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/folders": { + "/dashboards/home": { "get": { - "description": "Returns all folders that the authenticated user has permission to view.", - "tags": ["folders"], - "summary": "Get all folders.", - "operationId": "getFolders", - "parameters": [ - { - "type": "integer", - "format": "int64", - "default": 1000, - "x-go-name": "Limit", - "description": "Limit the maximum number of folders to return", - "name": "limit", - "in": "query" + "tags": ["dashboards"], + "summary": "Get home dashboard.", + "operationId": "getHomeDashboard", + "responses": { + "200": { + "$ref": "#/responses/getHomeDashboardResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/id/{DashboardID}/permissions": { + "get": { + "tags": ["dashboard_permissions"], + "summary": "Gets all existing permissions for the given dashboard.", + "operationId": "getDashboardPermissions", + "parameters": [ { "type": "integer", "format": "int64", - "default": 1, - "x-go-name": "Page", - "description": "Page index for starting fetching folders", - "name": "page", - "in": "query" + "name": "DashboardID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getFoldersResponse" + "$ref": "#/responses/getDashboardPermissionsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3648,29 +2026,39 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "post": { - "tags": ["folders"], - "summary": "Create folder.", - "operationId": "createFolder", + "description": "This operation will remove existing permissions if they’re not included in the request.", + "tags": ["dashboard_permissions"], + "summary": "Updates permissions for a dashboard.", + "operationId": "postDashboardPermissions", "parameters": [ { - "x-go-name": "Body", - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateFolderCommand" + "$ref": "#/definitions/UpdateDashboardAclCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3681,8 +2069,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -3690,25 +2078,74 @@ } } }, - "/folders/id/{folder_id}": { + "/dashboards/id/{DashboardID}/restore": { + "post": { + "tags": ["dashboard_versions"], + "summary": "Restore a dashboard to a given dashboard version.", + "operationId": "restoreDashboardVersion", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/postDashboardResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/id/{DashboardID}/versions": { "get": { - "description": "Returns the folder identified by id.", - "tags": ["folders"], - "summary": "Get folder by id.", - "operationId": "getFolderByID", + "tags": ["dashboard_versions"], + "summary": "Gets all existing versions for the dashboard.", + "operationId": "getDashboardVersions", "parameters": [ { "type": "integer", "format": "int64", - "x-go-name": "FolderID", - "name": "folder_id", - "in": "path", - "required": true + "name": "DashboardID", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "default": 0, + "x-go-name": "Limit", + "description": "Maximum number of results to return", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 0, + "x-go-name": "Start", + "description": "Version to start from when returning queries", + "name": "start", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/dashboardVersionsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3725,23 +2162,30 @@ } } }, - "/folders/{folder_uid}": { + "/dashboards/id/{DashboardID}/versions/{DashboardVersionID}": { "get": { - "tags": ["folders"], - "summary": "Get folder by uid.", - "operationId": "getFolderByUID", + "tags": ["dashboard_versions"], + "summary": "Get a specific dashboard version.", + "operationId": "getDashboardVersion", "parameters": [ { - "type": "string", - "x-go-name": "FolderUID", - "name": "folder_uid", + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "DashboardVersionID", "in": "path", "required": true } ], "responses": { "200": { - "description": "" + "$ref": "#/responses/dashboardVersionResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3756,33 +2200,26 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { - "tags": ["folders"], - "summary": "Update folder.", - "operationId": "updateFolder", + } + }, + "/dashboards/import": { + "post": { + "tags": ["dashboards"], + "summary": "Import dashboard.", + "operationId": "importDashboard", "parameters": [ { - "type": "string", - "x-go-name": "FolderUID", - "name": "folder_uid", - "in": "path", - "required": true - }, - { - "x-go-name": "Body", - "description": "To change the unique identifier (uid), provide another one.\nTo overwrite an existing folder with newer version, set `overwrite` to `true`.\nProvide the current version to safelly update the folder: if the provided version differs from the stored one the request will fail, unless `overwrite` is `true`.", - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateFolderCommand" + "$ref": "#/definitions/ImportDashboardRequest" } } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/importDashboardResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3790,81 +2227,82 @@ "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" + "412": { + "$ref": "#/responses/preconditionFailedError" }, - "404": { - "$ref": "#/responses/notFoundError" + "422": { + "$ref": "#/responses/unprocessableEntityError" }, - "409": { - "$ref": "#/responses/conflictError" + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/tags": { + "get": { + "tags": ["dashboards"], + "summary": "Get all dashboards tags of an organisation.", + "operationId": "getDashboardTags", + "responses": { + "200": { + "$ref": "#/responses/dashboardsTagsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Deletes an existing folder identified by UID along with all dashboards (and their alerts) stored in the folder. This operation cannot be reverted.", - "tags": ["folders"], - "summary": "Delete folder.", - "operationId": "deleteFolder", + } + }, + "/dashboards/trim": { + "post": { + "tags": ["dashboards"], + "summary": "Trim defaults from dashboard.", + "operationId": "trimDashboard", "parameters": [ { - "type": "string", - "x-go-name": "FolderUID", - "name": "folder_uid", - "in": "path", - "required": true - }, - { - "type": "boolean", - "default": false, - "x-go-name": "ForceDeleteRules", - "description": "If `true` any Grafana 8 Alerts under this folder will be deleted.\nSet to `false` so that the request will fail if the folder contains any Grafana 8 Alerts.", - "name": "forceDeleteRules", - "in": "query" + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/TrimDashboardCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/deleteFolderResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/trimDashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/folders/{folder_uid}/permissions": { + "/dashboards/uid/{uid}": { "get": { - "tags": ["folder_permissions"], - "summary": "Gets all existing permissions for the folder with the given `uid`.", - "operationId": "getFolderPermissions", + "description": "Will return the dashboard given the dashboard unique identifier (uid).", + "tags": ["dashboards"], + "summary": "Get dashboard by uid.", + "operationId": "getDashboardByUID", "parameters": [ { "type": "string", - "x-go-name": "FolderUID", - "name": "folder_uid", + "x-go-name": "UID", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDashboardPermissionsResponse" + "$ref": "#/responses/dashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3880,30 +2318,23 @@ } } }, - "post": { - "tags": ["folder_permissions"], - "summary": "Updates permissions for a folder. This operation will remove existing permissions if they’re not included in the request.", - "operationId": "updateFolderPermissions", + "delete": { + "description": "Will delete the dashboard given the specified unique identifier (uid).", + "tags": ["dashboards"], + "summary": "Delete dashboard by uid.", + "operationId": "deleteDashboardByUID", "parameters": [ - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateDashboardAclCommand" - } - }, { "type": "string", - "x-go-name": "FolderUID", - "name": "folder_uid", + "x-go-name": "UID", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/deleteDashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3920,111 +2351,45 @@ } } }, - "/library-elements": { + "/datasources": { "get": { - "description": "Returns a list of all library elements the authenticated user has permission to view.\nUse the `perPage` query parameter to control the maximum number of library elements returned; the default limit is `100`.\nYou can also use the `page` query parameter to fetch library elements from any page other than the first one.", - "tags": ["library_elements"], - "summary": "Get all library elements.", - "operationId": "getLibraryElements", - "parameters": [ - { - "type": "string", - "x-go-name": "SearchString", - "description": "Part of the name or description searched for.", - "name": "searchString", - "in": "query" - }, - { - "enum": [1, 2], - "type": "integer", - "format": "int64", - "x-go-name": "Kind", - "description": "Kind of element to search for.", - "name": "kind", - "in": "query" - }, - { - "enum": ["alpha-asc", "alpha-desc"], - "type": "string", - "x-go-name": "SortDirection", - "description": "Sort order of elements.", - "name": "sortDirection", - "in": "query" - }, - { - "type": "string", - "x-go-name": "TypeFilter", - "description": "A comma separated list of types to filter the elements by", - "name": "typeFilter", - "in": "query" - }, - { - "type": "string", - "x-go-name": "ExcludeUID", - "description": "Element UID to exclude from search results.", - "name": "excludeUid", - "in": "query" - }, - { - "type": "string", - "x-go-name": "FolderFilter", - "description": "A comma separated list of folder ID(s) to filter the elements by.", - "name": "folderFilter", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 100, - "x-go-name": "PerPage", - "description": "The number of results per page.", - "name": "perPage", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 1, - "x-go-name": "Page", - "description": "The page for a set of records, given that only perPage records are returned at a time. Numbering starts at 1.", - "name": "page", - "in": "query" - } - ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scope: `datasources:*`.", + "tags": ["datasources"], + "summary": "Get all data sources.", + "operationId": "getDatasources", "responses": { "200": { - "$ref": "#/responses/getLibraryElementsResponse" + "$ref": "#/responses/getDatasourcesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "post": { - "description": "Creates a new library element.", - "tags": ["library_elements"], - "summary": "Create library element.", - "operationId": "createLibraryElement", + "description": "By defining `password` and `basicAuthPassword` under secureJsonData property\nGrafana encrypts them securely as an encrypted blob in the database.\nThe response then lists the encrypted fields under secureJsonFields.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:create`", + "tags": ["datasources"], + "summary": "Create a data source.", + "operationId": "addDatasource", "parameters": [ { - "x-go-name": "Body", - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateLibraryElementCommand" + "$ref": "#/definitions/AddDataSourceCommand" } } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4032,8 +2397,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4041,28 +2406,31 @@ } } }, - "/library-elements/name/{library_element_name}": { + "/datasources/id/{datasource_name}": { "get": { - "description": "Returns a library element with the given name.", - "tags": ["library_elements"], - "summary": "Get library element by name.", - "operationId": "getLibraryElementByName", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", + "tags": ["datasources"], + "summary": "Get data source Id by Name.", + "operationId": "getDatasourceIdByName", "parameters": [ { "type": "string", - "x-go-name": "Name", - "name": "library_element_name", + "x-go-name": "DatasourceName", + "name": "datasource_name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/getDatasourceIDresponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "404": { "$ref": "#/responses/notFoundError" }, @@ -4072,30 +2440,30 @@ } } }, - "/library-elements/{library_element_uid}": { + "/datasources/name/{datasource_name}": { "get": { - "description": "Returns a library element with the given UID.", - "tags": ["library_elements"], - "summary": "Get library element by UID.", - "operationId": "getLibraryElementByUID", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", + "tags": ["datasources"], + "summary": "Get a single data source by Name.", + "operationId": "getDatasourceByName", "parameters": [ { "type": "string", - "x-go-name": "UID", - "name": "library_element_uid", + "x-go-name": "DatasourceName", + "name": "datasource_name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/getDatasourceResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4103,22 +2471,63 @@ } }, "delete": { - "description": "Deletes an existing library element as specified by the UID. This operation cannot be reverted.\nYou cannot delete a library element that is connected. This operation cannot be reverted.", - "tags": ["library_elements"], - "summary": "Delete library element.", - "operationId": "deleteLibraryElementByUID", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", + "tags": ["datasources"], + "summary": "Delete an existing data source by name.", + "operationId": "deleteDatasourceByName", "parameters": [ { "type": "string", - "x-go-name": "UID", - "name": "library_element_uid", + "x-go-name": "DatasourceName", + "name": "datasource_name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/deleteDatasourceByNameResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/datasources/proxy/{datasource_id}/{datasource_proxy_route}": { + "get": { + "description": "Proxies all calls to the actual data source.", + "tags": ["datasources"], + "summary": "Data source proxy GET calls.", + "operationId": "datasourceProxyGETcalls", + "parameters": [ + { + "type": "string", + "x-go-name": "DatasourceID", + "name": "datasource_id", + "in": "path", + "required": true + }, + { + "type": "string", + "x-go-name": "DatasourceProxyRoute", + "name": "datasource_proxy_route", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "" }, "400": { "$ref": "#/responses/badRequestError" @@ -4137,32 +2546,41 @@ } } }, - "patch": { - "description": "Updates an existing library element identified by uid.", - "tags": ["library_elements"], - "summary": "Update library element.", - "operationId": "updateLibraryElement", + "post": { + "description": "Proxies all calls to the actual data source. The data source should support POST methods for the specific path and role as defined", + "tags": ["datasources"], + "summary": "Data source proxy POST calls.", + "operationId": "datasourceProxyPOSTcalls", "parameters": [ { "type": "string", - "x-go-name": "UID", - "name": "library_element_uid", + "x-go-name": "DatasourceID", + "name": "datasource_id", "in": "path", "required": true }, { - "x-go-name": "Body", - "name": "body", + "type": "string", + "x-go-name": "DatasourceProxyRoute", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, + { + "name": "DatasourceProxyParam", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PatchLibraryElementCommand" + "type": "object" } } ], "responses": { - "200": { - "$ref": "#/responses/getLibraryElementResponse" + "201": { + "description": "" + }, + "202": { + "description": "" }, "400": { "$ref": "#/responses/badRequestError" @@ -4176,37 +2594,45 @@ "404": { "$ref": "#/responses/notFoundError" }, - "412": { - "$ref": "#/responses/preconditionFailedError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/library-elements/{library_element_uid}/connections/": { - "get": { - "description": "Returns a list of connections for a library element based on the UID specified.", - "tags": ["library_elements"], - "summary": "Get library element connections.", - "operationId": "getLibraryElementConnections", + }, + "delete": { + "description": "Proxies all calls to the actual data source.", + "tags": ["datasources"], + "summary": "Data source proxy DELETE calls.", + "operationId": "datasourceProxyDELETEcalls", "parameters": [ { "type": "string", - "x-go-name": "UID", - "name": "library_element_uid", + "x-go-name": "DatasourceID", + "name": "datasource_id", + "in": "path", + "required": true + }, + { + "type": "string", + "x-go-name": "DatasourceProxyRoute", + "name": "datasource_proxy_route", "in": "path", "required": true } ], "responses": { - "200": { - "$ref": "#/responses/getLibraryElementConnectionsResponse" + "202": { + "description": "" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "404": { "$ref": "#/responses/notFoundError" }, @@ -4216,60 +2642,68 @@ } } }, - "/licensing/check": { + "/datasources/uid/{datasource_uid}": { "get": { - "tags": ["licensing", "enterprise"], - "summary": "Check license availability.", - "operationId": "getLicenseStatus", - "responses": { - "200": { - "$ref": "#/responses/getLicenseStatusResponse" + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", + "tags": ["datasources"], + "summary": "Get a single data source by UID.", + "operationId": "getDatasourceByUID", + "parameters": [ + { + "type": "string", + "x-go-name": "DatasourceUID", + "name": "datasource_uid", + "in": "path", + "required": true } - } - } - }, - "/licensing/custom-permissions": { - "get": { - "description": "You need to have a permission with action `licensing.reports:read`.", - "tags": ["licensing", "enterprise"], - "summary": "Get custom permissions report.", - "operationId": "getCustomPermissionsReport", + ], "responses": { "200": { - "$ref": "#/responses/getCustomPermissionsReportResponse" + "$ref": "#/responses/getDatasourceResponse" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/licensing/custom-permissions-csv": { - "get": { - "description": "You need to have a permission with action `licensing.reports:read`.", - "produces": ["text/csv"], - "tags": ["licensing", "enterprise"], - "summary": "Get custom permissions report in CSV format.", - "operationId": "getCustomPermissionsCSV", - "responses": { - "200": { - "$ref": "#/responses/getCustomPermissionsReportResponse" + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/licensing/refresh-stats": { - "get": { - "description": "You need to have a permission with action `licensing:read`.", - "tags": ["licensing", "enterprise"], - "summary": "Refresh license stats.", - "operationId": "refreshLicenseStats", + }, + "delete": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", + "tags": ["datasources"], + "summary": "Delete an existing data source by UID.", + "operationId": "deleteDatasourceByUID", + "parameters": [ + { + "type": "string", + "x-go-name": "DatasourceUID", + "name": "datasource_uid", + "in": "path", + "required": true + } + ], "responses": { "200": { - "$ref": "#/responses/refreshLicenseStatsResponse" + "$ref": "#/responses/okResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4277,65 +2711,96 @@ } } }, - "/licensing/token": { + "/datasources/{datasource_id}": { "get": { - "description": "You need to have a permission with action `licensing:read`.", - "tags": ["licensing", "enterprise"], - "summary": "Get license token.", - "operationId": "getLicenseToken", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).", + "tags": ["datasources"], + "summary": "Get a single data source by Id.", + "operationId": "getDatasourceByID", + "parameters": [ + { + "type": "string", + "x-go-name": "DatasourceID", + "name": "datasource_id", + "in": "path", + "required": true + } + ], "responses": { "200": { - "$ref": "#/responses/getLicenseTokenResponse" + "$ref": "#/responses/getDatasourceResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } }, - "post": { - "description": "You need to have a permission with action `licensing:update`.", - "tags": ["licensing", "enterprise"], - "summary": "Create license token.", - "operationId": "postLicenseToken", + "put": { + "description": "Similar to creating a data source, `password` and `basicAuthPassword` should be defined under\nsecureJsonData in order to be stored securely as an encrypted blob in the database. Then, the\nencrypted fields are listed under secureJsonFields section in the response.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:write` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).", + "tags": ["datasources"], + "summary": "Update an existing data source.", + "operationId": "updateDatasource", "parameters": [ { - "x-go-name": "Body", - "name": "body", + "type": "string", + "x-go-name": "DatasourceID", + "name": "datasource_id", + "in": "path", + "required": true + }, + { + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/DeleteTokenCommand" + "$ref": "#/definitions/UpdateDataSourceCommand" } } ], "responses": { "200": { - "$ref": "#/responses/getLicenseTokenResponse" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } }, "delete": { - "description": "Removes the license stored in the Grafana database. Available in Grafana Enterprise v7.4+.\n\nYou need to have a permission with action `licensing:delete`.", - "tags": ["licensing", "enterprise"], - "summary": "Remove license from database.", - "operationId": "deleteLicenseToken", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).", + "tags": ["datasources"], + "summary": "Delete an existing data source by id.", + "operationId": "deleteDatasourceByID", "parameters": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/DeleteTokenCommand" - } + "type": "string", + "x-go-name": "DatasourceID", + "name": "datasource_id", + "in": "path", + "required": true } ], "responses": { - "202": { - "$ref": "#/responses/acceptedResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "200": { + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4343,8 +2808,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "422": { - "$ref": "#/responses/unprocessableEntityError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4352,12 +2817,12 @@ } } }, - "/licensing/token/renew": { + "/ds/query": { "post": { - "description": "Manually ask license issuer for a new token. Available in Grafana Enterprise v7.4+.\n\nYou need to have a permission with action `licensing:update`.", - "tags": ["licensing", "enterprise"], - "summary": "Manually force license refresh.", - "operationId": "postRenewLicenseToken", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:query`.", + "tags": ["ds"], + "summary": "Query metrics with expressions", + "operationId": "queryMetricsWithExpressions", "parameters": [ { "x-go-name": "Body", @@ -4365,34 +2830,22 @@ "in": "body", "required": true, "schema": { - "type": "object" + "$ref": "#/definitions/MetricRequest" } } ], "responses": { "200": { - "$ref": "#/responses/postRenewLicenseTokenResponse" + "$ref": "#/responses/queryDataResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" - } - } - } - }, - "/login/saml": { - "get": { - "tags": ["saml", "enterprise"], - "summary": "It initiates the login flow by redirecting the user to the IdP.", - "operationId": "getSAMLLogin", - "responses": { - "302": { - "description": "" - }, - "404": { - "$ref": "#/responses/notFoundError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4400,32 +2853,35 @@ } } }, - "/logout/saml": { + "/folders": { "get": { - "tags": ["saml", "enterprise"], - "summary": "GetLogout initiates single logout process.", - "operationId": "getSAMLLogout", - "responses": { - "302": { - "description": "" - }, - "404": { - "$ref": "#/responses/notFoundError" + "description": "Returns all folders that the authenticated user has permission to view.", + "tags": ["folders"], + "summary": "Get all folders.", + "operationId": "getFolders", + "parameters": [ + { + "type": "integer", + "format": "int64", + "default": 1000, + "x-go-name": "Limit", + "description": "Limit the maximum number of folders to return", + "name": "limit", + "in": "query" }, - "500": { - "$ref": "#/responses/internalServerError" + { + "type": "integer", + "format": "int64", + "default": 1, + "x-go-name": "Page", + "description": "Page index for starting fetching folders", + "name": "page", + "in": "query" } - } - } - }, - "/org": { - "get": { - "description": "Get current Organization", - "tags": ["current_org_details"], - "operationId": "getOrg", + ], "responses": { "200": { - "$ref": "#/responses/getOrgResponse" + "$ref": "#/responses/getFoldersResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4438,10 +2894,10 @@ } } }, - "put": { - "tags": ["current_org_details"], - "summary": "Update current Organization.", - "operationId": "updateOrg", + "post": { + "tags": ["folders"], + "summary": "Create folder.", + "operationId": "createFolder", "parameters": [ { "x-go-name": "Body", @@ -4449,13 +2905,13 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgForm" + "$ref": "#/definitions/CreateFolderCommand" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/folderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4466,34 +2922,34 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "409": { + "$ref": "#/responses/conflictError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/address": { - "put": { - "tags": ["current_org_details"], - "summary": "Update current Organization's address.", - "operationId": "updateOrgAddress", + "/folders/id/{folder_id}": { + "get": { + "description": "Returns the folder identified by id.", + "tags": ["folders"], + "summary": "Get folder by id.", + "operationId": "getFolderByID", "parameters": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgAddressForm" - } + "type": "integer", + "format": "int64", + "x-go-name": "FolderID", + "name": "folder_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/folderResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4501,20 +2957,32 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/invites": { + "/folders/{folder_uid}": { "get": { - "tags": ["org_invites"], - "summary": "Get pending invites.", - "operationId": "getInvites", + "tags": ["folders"], + "summary": "Get folder by uid.", + "operationId": "getFolderByUID", + "parameters": [ + { + "type": "string", + "x-go-name": "FolderUID", + "name": "folder_uid", + "in": "path", + "required": true + } + ], "responses": { "200": { - "$ref": "#/responses/getInvitesResponse" + "description": "" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4522,56 +2990,43 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { - "tags": ["org_invites"], - "summary": "Add invite.", - "operationId": "addInvite", + "put": { + "tags": ["folders"], + "summary": "Update folder.", + "operationId": "updateFolder", "parameters": [ + { + "type": "string", + "x-go-name": "FolderUID", + "name": "folder_uid", + "in": "path", + "required": true + }, { "x-go-name": "Body", + "description": "To change the unique identifier (uid), provide another one.\nTo overwrite an existing folder with newer version, set `overwrite` to `true`.\nProvide the current version to safelly update the folder: if the provided version differs from the stored one the request will fail, unless `overwrite` is `true`.", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddInviteForm" + "$ref": "#/definitions/UpdateFolderCommand" } } - ], - "responses": { - "200": { - "$ref": "#/responses/addOrgUser" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "412": { - "$ref": "#/responses/SMTPNotEnabledError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/org/preferences": { - "get": { - "tags": ["org_preferences"], - "summary": "Get Current Org Prefs.", - "operationId": "getOrgPreferences", + ], "responses": { "200": { - "$ref": "#/responses/getPreferencesResponse" + "$ref": "#/responses/folderResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4579,29 +3034,42 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "409": { + "$ref": "#/responses/conflictError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, - "put": { - "tags": ["org_preferences"], - "summary": "Update Current Org Prefs.", - "operationId": "updateOrgPreferences", + "delete": { + "description": "Deletes an existing folder identified by UID along with all dashboards (and their alerts) stored in the folder. This operation cannot be reverted.", + "tags": ["folders"], + "summary": "Delete folder.", + "operationId": "deleteFolder", "parameters": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdatePrefsCmd" - } + "type": "string", + "x-go-name": "FolderUID", + "name": "folder_uid", + "in": "path", + "required": true + }, + { + "type": "boolean", + "default": false, + "x-go-name": "ForceDeleteRules", + "description": "If `true` any Grafana 8 Alerts under this folder will be deleted.\nSet to `false` so that the request will fail if the folder contains any Grafana 8 Alerts.", + "name": "forceDeleteRules", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/addOrgUser" + "$ref": "#/responses/deleteFolderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4612,21 +3080,32 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/users": { + "/folders/{folder_uid}/permissions": { "get": { - "description": "Returns all org users within the current organization. Accessible to users with org admin role.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:read` with scope `users:*`.", - "tags": ["current_org_details"], - "summary": "Get all users within the current organization.", - "operationId": "getOrgUsers", + "tags": ["folder_permissions"], + "summary": "Gets all existing permissions for the folder with the given `uid`.", + "operationId": "getFolderPermissions", + "parameters": [ + { + "type": "string", + "x-go-name": "FolderUID", + "name": "folder_uid", + "in": "path", + "required": true + } + ], "responses": { "200": { - "$ref": "#/responses/getOrgUsersResponse" + "$ref": "#/responses/getDashboardPermissionsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4634,25 +3113,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "post": { - "description": "Adds a global user to the current organization.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:add` with scope `users:*`.", - "tags": ["current_org_details"], - "summary": "Add a new user to the current organization", - "operationId": "addOrgUser", + "tags": ["folder_permissions"], + "summary": "Updates permissions for a folder. This operation will remove existing permissions if they’re not included in the request.", + "operationId": "updateFolderPermissions", "parameters": [ { - "x-go-name": "Body", - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddOrgUserCommand" + "$ref": "#/definitions/UpdateDashboardAclCommand" } + }, + { + "type": "string", + "x-go-name": "FolderUID", + "name": "folder_uid", + "in": "path", + "required": true } ], "responses": { @@ -4665,68 +3152,117 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/users/lookup": { + "/library-elements": { "get": { - "description": "Returns all org users within the current organization, but with less detailed information.\nAccessible to users with org admin role, admin in any folder or admin of any team.\nMainly used by Grafana UI for providing list of users when adding team members and when editing folder/dashboard permissions.", - "tags": ["current_org_details"], - "summary": "Get all users within the current organization (lookup)", - "operationId": "lookupOrgUsers", + "description": "Returns a list of all library elements the authenticated user has permission to view.\nUse the `perPage` query parameter to control the maximum number of library elements returned; the default limit is `100`.\nYou can also use the `page` query parameter to fetch library elements from any page other than the first one.", + "tags": ["library_elements"], + "summary": "Get all library elements.", + "operationId": "getLibraryElements", "parameters": [ { "type": "string", - "x-go-name": "Query", - "name": "query", + "x-go-name": "SearchString", + "description": "Part of the name or description searched for.", + "name": "searchString", "in": "query" }, { + "enum": [1, 2], "type": "integer", "format": "int64", - "x-go-name": "Limit", - "name": "limit", + "x-go-name": "Kind", + "description": "Kind of element to search for.", + "name": "kind", + "in": "query" + }, + { + "enum": ["alpha-asc", "alpha-desc"], + "type": "string", + "x-go-name": "SortDirection", + "description": "Sort order of elements.", + "name": "sortDirection", + "in": "query" + }, + { + "type": "string", + "x-go-name": "TypeFilter", + "description": "A comma separated list of types to filter the elements by", + "name": "typeFilter", + "in": "query" + }, + { + "type": "string", + "x-go-name": "ExcludeUID", + "description": "Element UID to exclude from search results.", + "name": "excludeUid", + "in": "query" + }, + { + "type": "string", + "x-go-name": "FolderFilter", + "description": "A comma separated list of folder ID(s) to filter the elements by.", + "name": "folderFilter", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 100, + "x-go-name": "PerPage", + "description": "The number of results per page.", + "name": "perPage", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1, + "x-go-name": "Page", + "description": "The page for a set of records, given that only perPage records are returned at a time. Numbering starts at 1.", + "name": "page", "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/lookupOrgUsersResponse" + "$ref": "#/responses/getLibraryElementsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/org/users/{user_id}": { - "delete": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:remove` with scope `users:*`.", - "tags": ["current_org_details"], - "summary": "Delete user in current organization", - "operationId": "deleteOrgUser", + }, + "post": { + "description": "Creates a new library element.", + "tags": ["library_elements"], + "summary": "Create library element.", + "operationId": "createLibraryElement", "parameters": [ { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", - "in": "path", - "required": true + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateLibraryElementCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getLibraryElementResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4737,47 +3273,39 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "patch": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users.role:update` with scope `users:*`.", - "tags": ["current_org_details"], - "summary": "Updates the given user", - "operationId": "updateOrgUser", + } + }, + "/library-elements/name/{library_element_name}": { + "get": { + "description": "Returns a library element with the given name.", + "tags": ["library_elements"], + "summary": "Get library element by name.", + "operationId": "getLibraryElementByName", "parameters": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgUserCommand" - } - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "UserID", - "name": "user_id", + "type": "string", + "x-go-name": "Name", + "name": "library_element_name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getLibraryElementResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4785,30 +3313,28 @@ } } }, - "/org/{invitation_code}/invites": { - "delete": { - "tags": ["org_invites"], - "summary": "Revoke invite.", - "operationId": "revokeInvite", + "/library-elements/{library_element_uid}": { + "get": { + "description": "Returns a library element with the given UID.", + "tags": ["library_elements"], + "summary": "Get library element by UID.", + "operationId": "getLibraryElementByUID", "parameters": [ { "type": "string", - "x-go-name": "Code", - "name": "invitation_code", + "x-go-name": "UID", + "name": "library_element_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getLibraryElementResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "404": { "$ref": "#/responses/notFoundError" }, @@ -4816,53 +3342,27 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/orgs": { - "get": { - "security": [ - { - "basic": [] - } - ], - "description": "Search all Organizations", - "tags": ["orgs"], - "operationId": "searchOrg", + }, + "delete": { + "description": "Deletes an existing library element as specified by the UID. This operation cannot be reverted.\nYou cannot delete a library element that is connected. This operation cannot be reverted.", + "tags": ["library_elements"], + "summary": "Delete library element.", + "operationId": "deleteLibraryElementByUID", "parameters": [ - { - "type": "integer", - "format": "int64", - "default": 1, - "x-go-name": "Page", - "name": "page", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 1000, - "x-go-name": "PerPage", - "description": "Number of items per page\nThe totalCount field in the response can be used for pagination list E.g. if totalCount is equal to 100 teams and the perpage parameter is set to 10 then there are 10 pages of teams.", - "name": "perpage", - "in": "query" - }, - { - "type": "string", - "x-go-name": "Name", - "name": "name", - "in": "query" - }, { "type": "string", - "x-go-name": "Query", - "description": "If set it will return results where the query value is contained in the name field. Query values with spaces need to be URL encoded.", - "name": "query", - "in": "query" + "x-go-name": "UID", + "name": "library_element_uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/searchOrgResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4870,33 +3370,43 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { - "description": "Only works if [users.allow_org_create](https://grafana.com/docs/grafana/latest/administration/configuration/#allow_org_create) is set.", - "tags": ["orgs"], - "summary": "Create Organization.", - "operationId": "createOrg", + "patch": { + "description": "Updates an existing library element identified by uid.", + "tags": ["library_elements"], + "summary": "Update library element.", + "operationId": "updateLibraryElement", "parameters": [ + { + "type": "string", + "x-go-name": "UID", + "name": "library_element_uid", + "in": "path", + "required": true + }, { "x-go-name": "Body", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateOrgCommand" + "$ref": "#/definitions/PatchLibraryElementCommand" } } ], "responses": { "200": { - "$ref": "#/responses/createOrgResponse" + "$ref": "#/responses/getLibraryElementResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4904,8 +3414,11 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" + "404": { + "$ref": "#/responses/notFoundError" + }, + "412": { + "$ref": "#/responses/preconditionFailedError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4913,34 +3426,30 @@ } } }, - "/orgs/name/{org_name}": { + "/library-elements/{library_element_uid}/connections/": { "get": { - "security": [ - { - "basic": [] - } - ], - "tags": ["orgs"], - "summary": "Get Organization by ID.", - "operationId": "getOrgByName", + "description": "Returns a list of connections for a library element based on the UID specified.", + "tags": ["library_elements"], + "summary": "Get library element connections.", + "operationId": "getLibraryElementConnections", "parameters": [ { "type": "string", - "x-go-name": "OrgName", - "name": "org_name", + "x-go-name": "UID", + "name": "library_element_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getOrgResponse" + "$ref": "#/responses/getLibraryElementConnectionsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4948,26 +3457,11 @@ } } }, - "/orgs/{org_id}": { + "/org": { "get": { - "security": [ - { - "basic": [] - } - ], - "tags": ["orgs"], - "summary": "Get Organization by ID.", - "operationId": "getOrgByID", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID", - "name": "org_id", - "in": "path", - "required": true - } - ], + "description": "Get current Organization", + "tags": ["current_org_details"], + "operationId": "getOrg", "responses": { "200": { "$ref": "#/responses/getOrgResponse" @@ -4984,14 +3478,9 @@ } }, "put": { - "security": [ - { - "basic": [] - } - ], - "tags": ["orgs"], - "summary": "Update Organization.", - "operationId": "adminUpdateOrg", + "tags": ["current_org_details"], + "summary": "Update current Organization.", + "operationId": "updateOrg", "parameters": [ { "x-go-name": "Body", @@ -5001,14 +3490,6 @@ "schema": { "$ref": "#/definitions/UpdateOrgForm" } - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { @@ -5028,24 +3509,22 @@ "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "security": [ - { - "basic": [] - } - ], - "tags": ["orgs"], - "summary": "Delete Organization.", - "operationId": "adminDeleteOrg", + } + }, + "/org/address": { + "put": { + "tags": ["current_org_details"], + "summary": "Update current Organization's address.", + "operationId": "updateOrgAddress", "parameters": [ { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID", - "name": "org_id", - "in": "path", - "required": true + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgAddressForm" + } } ], "responses": { @@ -5061,20 +3540,36 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs/{org_id}/address": { - "put": { - "tags": ["orgs"], - "summary": "Update Organization's address.", - "operationId": "adminUpdateOrgAddress", + "/org/invites": { + "get": { + "tags": ["org_invites"], + "summary": "Get pending invites.", + "operationId": "getInvites", + "responses": { + "200": { + "$ref": "#/responses/getInvitesResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "post": { + "tags": ["org_invites"], + "summary": "Add invite.", + "operationId": "addInvite", "parameters": [ { "x-go-name": "Body", @@ -5082,21 +3577,13 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgAddressForm" + "$ref": "#/definitions/AddInviteForm" } - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/addOrgUser" }, "400": { "$ref": "#/responses/badRequestError" @@ -5107,31 +3594,23 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/orgs/{org_id}/quotas": { - "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `orgs.quotas:read` and scope `org:id:1` (orgIDScope).\nlist", - "tags": ["orgs"], - "summary": "Fetch Organization quota.", - "operationId": "getOrgQuota", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID", - "name": "org_id", - "in": "path", - "required": true + "412": { + "$ref": "#/responses/SMTPNotEnabledError" + }, + "500": { + "$ref": "#/responses/internalServerError" } - ], + } + } + }, + "/org/preferences": { + "get": { + "tags": ["org_preferences"], + "summary": "Get Current Org Prefs.", + "operationId": "getOrgPreferences", "responses": { "200": { - "$ref": "#/responses/getQuotaResponse" + "$ref": "#/responses/getPreferencesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5139,55 +3618,32 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/orgs/{org_id}/quotas/{quota_target}": { + }, "put": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `orgs.quotas:write` and scope `org:id:1` (orgIDScope).", - "tags": ["orgs"], - "summary": "Update user quota.", - "operationId": "updateOrgQuota", + "tags": ["org_preferences"], + "summary": "Update Current Org Prefs.", + "operationId": "updateOrgPreferences", "parameters": [ - { - "type": "string", - "x-go-name": "QuotaTarget", - "name": "quota_target", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID", - "name": "org_id", - "in": "path", - "required": true - }, { "x-go-name": "Body", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgQuotaCmd" + "$ref": "#/definitions/UpdatePrefsCmd" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/addOrgUser" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5195,36 +3651,18 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs/{org_id}/users": { + "/org/users": { "get": { - "security": [ - { - "basic": [] - } - ], - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:read` with scope `users:*`.", - "tags": ["orgs"], - "summary": "Get Users in Organization.", - "operationId": "adminGetOrgUsers", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID", - "name": "org_id", - "in": "path", - "required": true - } - ], + "description": "Returns all org users within the current organization. Accessible to users with org admin role.\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:read` with scope `users:*`.", + "tags": ["current_org_details"], + "summary": "Get all users within the current organization.", + "operationId": "getOrgUsers", "responses": { "200": { "$ref": "#/responses/getOrgUsersResponse" @@ -5242,9 +3680,9 @@ }, "post": { "description": "Adds a global user to the current organization.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:add` with scope `users:*`.", - "tags": ["orgs"], + "tags": ["current_org_details"], "summary": "Add a new user to the current organization", - "operationId": "adminAddOrgUser", + "operationId": "addOrgUser", "parameters": [ { "x-go-name": "Body", @@ -5254,19 +3692,48 @@ "schema": { "$ref": "#/definitions/AddOrgUserCommand" } + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/org/users/lookup": { + "get": { + "description": "Returns all org users within the current organization, but with less detailed information.\nAccessible to users with org admin role, admin in any folder or admin of any team.\nMainly used by Grafana UI for providing list of users when adding team members and when editing folder/dashboard permissions.", + "tags": ["current_org_details"], + "summary": "Get all users within the current organization (lookup)", + "operationId": "lookupOrgUsers", + "parameters": [ + { + "type": "string", + "x-go-name": "Query", + "name": "query", + "in": "query" }, { "type": "integer", "format": "int64", - "x-go-name": "OrgID", - "name": "org_id", - "in": "path", - "required": true + "x-go-name": "Limit", + "name": "limit", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/lookupOrgUsersResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5280,21 +3747,13 @@ } } }, - "/orgs/{org_id}/users/{user_id}": { + "/org/users/{user_id}": { "delete": { "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:remove` with scope `users:*`.", - "tags": ["orgs"], + "tags": ["current_org_details"], "summary": "Delete user in current organization", - "operationId": "adminDeleteOrgUser", + "operationId": "deleteOrgUser", "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID", - "name": "org_id", - "in": "path", - "required": true - }, { "type": "integer", "format": "int64", @@ -5324,9 +3783,9 @@ }, "patch": { "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users.role:update` with scope `users:*`.", - "tags": ["orgs"], - "summary": "Update Users in Organization.", - "operationId": "adminUpdateOrgUser", + "tags": ["current_org_details"], + "summary": "Updates the given user", + "operationId": "updateOrgUser", "parameters": [ { "x-go-name": "Body", @@ -5337,14 +3796,6 @@ "$ref": "#/definitions/UpdateOrgUserCommand" } }, - { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID", - "name": "org_id", - "in": "path", - "required": true - }, { "type": "integer", "format": "int64", @@ -5373,80 +3824,23 @@ } } }, - "/recording-rules": { - "get": { - "tags": ["recording_rules", "enterprise"], - "summary": "Get all recording rules.", - "operationId": "listRecordingRules", - "responses": { - "200": { - "$ref": "#/responses/listRecordingRulesResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "put": { - "tags": ["recording_rules", "enterprise"], - "summary": "Update a recording rule.", - "operationId": "updateRecordingRule", - "parameters": [ - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RecordingRuleJSON" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/recordingRuleResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "post": { - "tags": ["recording_rules", "enterprise"], - "summary": "Create a new recording rule.", - "operationId": "createRecordingRule", + "/org/{invitation_code}/invites": { + "delete": { + "tags": ["org_invites"], + "summary": "Revoke invite.", + "operationId": "revokeInvite", "parameters": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RecordingRuleJSON" - } + "type": "string", + "x-go-name": "Code", + "name": "invitation_code", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/recordingRuleResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5463,52 +3857,51 @@ } } }, - "/recording-rules/test": { - "post": { - "tags": ["recording_rules", "enterprise"], - "summary": "Test a recording rule.", - "operationId": "testCreateRecordingRule", - "parameters": [ + "/orgs": { + "get": { + "security": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RecordingRuleJSON" - } + "basic": [] } ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "description": "Search all Organizations", + "tags": ["orgs"], + "operationId": "searchOrg", + "parameters": [ + { + "type": "integer", + "format": "int64", + "default": 1, + "x-go-name": "Page", + "name": "page", + "in": "query" }, - "404": { - "$ref": "#/responses/notFoundError" + { + "type": "integer", + "format": "int64", + "default": 1000, + "x-go-name": "PerPage", + "description": "Number of items per page\nThe totalCount field in the response can be used for pagination list E.g. if totalCount is equal to 100 teams and the perpage parameter is set to 10 then there are 10 pages of teams.", + "name": "perpage", + "in": "query" }, - "422": { - "$ref": "#/responses/unprocessableEntityError" + { + "type": "string", + "x-go-name": "Name", + "name": "name", + "in": "query" }, - "500": { - "$ref": "#/responses/internalServerError" + { + "type": "string", + "x-go-name": "Query", + "description": "If set it will return results where the query value is contained in the name field. Query values with spaces need to be URL encoded.", + "name": "query", + "in": "query" } - } - } - }, - "/recording-rules/writer": { - "get": { - "tags": ["recording_rules", "enterprise"], - "summary": "Get the write target.", - "operationId": "getRecordingRuleWriteTarget", + ], "responses": { "200": { - "$ref": "#/responses/recordingRuleWriteTargetResponse" + "$ref": "#/responses/searchOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5516,8 +3909,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -5525,9 +3918,10 @@ } }, "post": { - "tags": ["recording_rules", "enterprise"], - "summary": "Create a new write target.", - "operationId": "createRecordingRuleWriteTarget", + "description": "Only works if [users.allow_org_create](https://grafana.com/docs/grafana/latest/administration/configuration/#allow_org_create) is set.", + "tags": ["orgs"], + "summary": "Create Organization.", + "operationId": "createOrg", "parameters": [ { "x-go-name": "Body", @@ -5535,38 +3929,13 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PrometheusRemoteWriteTargetJSON" + "$ref": "#/definitions/CreateOrgCommand" } } ], "responses": { "200": { - "$ref": "#/responses/recordingRuleWriteTargetResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "422": { - "$ref": "#/responses/unprocessableEntityError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "delete": { - "tags": ["recording_rules", "enterprise"], - "summary": "Delete the write target.", - "operationId": "deleteRecordingRuleWriteTarget", - "responses": { - "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/createOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5574,8 +3943,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -5583,24 +3952,28 @@ } } }, - "/recording-rules/{recordingRuleID}": { - "delete": { - "tags": ["recording_rules", "enterprise"], - "summary": "Delete a recording rule.", - "operationId": "deleteRecordingRule", + "/orgs/name/{org_name}": { + "get": { + "security": [ + { + "basic": [] + } + ], + "tags": ["orgs"], + "summary": "Get Organization by ID.", + "operationId": "getOrgByName", "parameters": [ { - "type": "integer", - "format": "int64", - "x-go-name": "RecordingRuleID", - "name": "recordingRuleID", + "type": "string", + "x-go-name": "OrgName", + "name": "org_name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5608,24 +3981,35 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/reports": { + "/orgs/{org_id}": { "get": { - "description": "Available to org admins only and with a valid or expired license\n\nYou need to have a permission with action `reports:read` with scope `reports:*`.", - "tags": ["reports", "enterprise"], - "summary": "List reports.", - "operationId": "getReports", + "security": [ + { + "basic": [] + } + ], + "tags": ["orgs"], + "summary": "Get Organization by ID.", + "operationId": "getOrgByID", + "parameters": [ + { + "type": "integer", + "format": "int64", + "x-go-name": "OrgID", + "name": "org_id", + "in": "path", + "required": true + } + ], "responses": { "200": { - "$ref": "#/responses/getReportsResponse" + "$ref": "#/responses/getOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5638,11 +4022,15 @@ } } }, - "post": { - "description": "Available to org admins only and with a valid license.\n\nYou need to have a permission with action `reports.admin:create`.", - "tags": ["reports", "enterprise"], - "summary": "Create a report.", - "operationId": "createReport", + "put": { + "security": [ + { + "basic": [] + } + ], + "tags": ["orgs"], + "summary": "Update Organization.", + "operationId": "adminUpdateOrg", "parameters": [ { "x-go-name": "Body", @@ -5650,13 +4038,21 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateOrUpdateConfigCmd" + "$ref": "#/definitions/UpdateOrgForm" } + }, + { + "type": "integer", + "format": "int64", + "x-go-name": "OrgID", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/createReportResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5667,30 +4063,28 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/reports/email": { - "post": { - "description": "Generate and send a report. This API waits for the report to be generated before returning. We recommend that you set the client’s timeout to at least 60 seconds. Available to org admins only and with a valid license.\n\nOnly available in Grafana Enterprise v7.0+.\nThis API endpoint is experimental and may be deprecated in a future release. On deprecation, a migration strategy will be provided and the endpoint will remain functional until the next major release of Grafana.\n\nYou need to have a permission with action `reports:send`.", - "tags": ["reports", "enterprise"], - "summary": "Send a report.", - "operationId": "sendReport", + }, + "delete": { + "security": [ + { + "basic": [] + } + ], + "tags": ["orgs"], + "summary": "Delete Organization.", + "operationId": "adminDeleteOrg", "parameters": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/ReportEmailDTO" - } + "type": "integer", + "format": "int64", + "x-go-name": "OrgID", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { @@ -5715,25 +4109,33 @@ } } }, - "/reports/render/pdf/{DashboardID}": { - "get": { - "description": "Available to all users and with a valid license.", - "produces": ["application/pdf"], - "tags": ["reports", "enterprise"], - "summary": "Render report for dashboard.", - "operationId": "renderReportPDF", + "/orgs/{org_id}/address": { + "put": { + "tags": ["orgs"], + "summary": "Update Organization's address.", + "operationId": "adminUpdateOrgAddress", "parameters": [ + { + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgAddressForm" + } + }, { "type": "integer", "format": "int64", - "name": "DashboardID", + "x-go-name": "OrgID", + "name": "org_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/contentResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5741,25 +4143,6 @@ "401": { "$ref": "#/responses/unauthorisedError" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/reports/settings": { - "get": { - "description": "Available to org admins only and with a valid or expired license\n\nYou need to have a permission with action `reports.settings:read`x.", - "tags": ["reports", "enterprise"], - "summary": "Get settings.", - "operationId": "getReportSettings", - "responses": { - "200": { - "$ref": "#/responses/getReportSettingsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, "403": { "$ref": "#/responses/forbiddenError" }, @@ -5767,29 +4150,27 @@ "$ref": "#/responses/internalServerError" } } - }, - "post": { - "description": "Available to org admins only and with a valid or expired license\n\nYou need to have a permission with action `reports.settings:write`xx.", - "tags": ["reports", "enterprise"], - "summary": "Save settings.", - "operationId": "saveReportSettings", + } + }, + "/orgs/{org_id}/quotas": { + "get": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `orgs.quotas:read` and scope `org:id:1` (orgIDScope).\nlist", + "tags": ["orgs"], + "summary": "Fetch Organization quota.", + "operationId": "getOrgQuota", "parameters": [ { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/SettingsDTO" - } + "type": "integer", + "format": "int64", + "x-go-name": "OrgID", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getQuotaResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5797,26 +4178,49 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/reports/test-email": { - "post": { - "description": "Available to org admins only and with a valid license.\n\nYou need to have a permission with action `reports:send`.", - "tags": ["reports", "enterprise"], - "summary": "Send test report via email.", - "operationId": "sendTestEmail", + "/orgs/{org_id}/quotas/{quota_target}": { + "put": { + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `orgs.quotas:write` and scope `org:id:1` (orgIDScope).", + "tags": ["orgs"], + "summary": "Update user quota.", + "operationId": "updateOrgQuota", "parameters": [ + { + "type": "string", + "x-go-name": "QuotaTarget", + "name": "quota_target", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "x-go-name": "OrgID", + "name": "org_id", + "in": "path", + "required": true + }, { "x-go-name": "Body", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateOrUpdateConfigCmd" + "$ref": "#/definitions/UpdateOrgQuotaCmd" } } ], @@ -5824,9 +4228,6 @@ "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -5842,28 +4243,30 @@ } } }, - "/reports/{reportID}": { + "/orgs/{org_id}/users": { "get": { - "description": "Available to org admins only and with a valid or expired license\n\nYou need to have a permission with action `reports:read` with scope `reports:id:\u003creport ID\u003e`.", - "tags": ["reports", "enterprise"], - "summary": "Get a report.", - "operationId": "getReport", + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:read` with scope `users:*`.", + "tags": ["orgs"], + "summary": "Get Users in Organization.", + "operationId": "adminGetOrgUsers", "parameters": [ { "type": "integer", "format": "int64", - "x-go-name": "ReportID", - "name": "reportID", + "x-go-name": "OrgID", + "name": "org_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getReportResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getOrgUsersResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5871,70 +4274,71 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, - "put": { - "description": "Available to org admins only and with a valid or expired license\n\nYou need to have a permission with action `reports.admin:write` with scope `reports:id:\u003creport ID\u003e`.", - "tags": ["reports", "enterprise"], - "summary": "Update a report.", - "operationId": "updateReport", + "post": { + "description": "Adds a global user to the current organization.\n\nIf you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:add` with scope `users:*`.", + "tags": ["orgs"], + "summary": "Add a new user to the current organization", + "operationId": "adminAddOrgUser", "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "ReportID", - "name": "reportID", - "in": "path", - "required": true - }, { "x-go-name": "Body", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateOrUpdateConfigCmd" + "$ref": "#/definitions/AddOrgUserCommand" } + }, + { + "type": "integer", + "format": "int64", + "x-go-name": "OrgID", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/orgs/{org_id}/users/{user_id}": { "delete": { - "description": "Available to org admins only and with a valid or expired license\n\nYou need to have a permission with action `reports.delete` with scope `reports:id:\u003creport ID\u003e`.", - "tags": ["reports", "enterprise"], - "summary": "Delete a report.", - "operationId": "deleteReport", + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users:remove` with scope `users:*`.", + "tags": ["orgs"], + "summary": "Delete user in current organization", + "operationId": "adminDeleteOrgUser", "parameters": [ { "type": "integer", "format": "int64", - "x-go-name": "ReportID", - "name": "reportID", + "x-go-name": "OrgID", + "name": "org_id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "x-go-name": "UserID", + "name": "user_id", "in": "path", "required": true } @@ -5952,77 +4356,53 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/saml/acs": { - "post": { - "tags": ["saml", "enterprise"], - "summary": "It performs assertion Consumer Service (ACS).", - "operationId": "postACS", + }, + "patch": { + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `org.users.role:update` with scope `users:*`.", + "tags": ["orgs"], + "summary": "Update Users in Organization.", + "operationId": "adminUpdateOrgUser", "parameters": [ { - "type": "string", - "name": "RelayState", - "in": "query" - } - ], - "responses": { - "302": { - "description": "" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "x-go-name": "Body", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgUserCommand" + } }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/saml/metadata": { - "get": { - "produces": ["application/xml;application/samlmetadata+xml"], - "tags": ["saml", "enterprise"], - "summary": "It exposes the SP (Grafana's) metadata for the IdP's consumption.", - "operationId": "getSAMLMetadata", - "responses": { - "200": { - "$ref": "#/responses/contentResponse" - } - } - } - }, - "/saml/slo": { - "post": { - "tags": ["saml", "enterprise"], - "summary": "It performs Single Logout (SLO) callback.", - "operationId": "postSLO", - "parameters": [ { - "type": "string", - "name": "SAMLRequest", - "in": "query" + "type": "integer", + "format": "int64", + "x-go-name": "OrgID", + "name": "org_id", + "in": "path", + "required": true }, { - "type": "string", - "name": "SAMLResponse", - "in": "query" + "type": "integer", + "format": "int64", + "x-go-name": "UserID", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { - "302": { - "description": "" + "200": { + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, "403": { "$ref": "#/responses/forbiddenError" }, @@ -6383,132 +4763,6 @@ } } }, - "/teams/{teamId}/groups": { - "get": { - "tags": ["sync_team_groups", "enterprise"], - "summary": "Get External Groups.", - "operationId": "getTeamGroupsApi", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "TeamID", - "name": "teamId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getTeamGroupsApiResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "post": { - "tags": ["sync_team_groups", "enterprise"], - "summary": "Add External Group.", - "operationId": "addTeamGroupApi", - "parameters": [ - { - "x-go-name": "Body", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/TeamGroupMapping" - } - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "TeamID", - "name": "teamId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/teams/{teamId}/groups/{groupId}": { - "delete": { - "tags": ["sync_team_groups", "enterprise"], - "summary": "Remove External Group.", - "operationId": "removeTeamGroupApi", - "parameters": [ - { - "type": "integer", - "format": "int64", - "x-go-name": "GroupID", - "name": "groupId", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "x-go-name": "TeamID", - "name": "teamId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, "/teams/{team_id}": { "get": { "tags": ["teams"], @@ -7543,56 +5797,12 @@ }, "500": { "$ref": "#/responses/internalServerError" - } - } - } - } - }, - "definitions": { - "ActiveSyncStatusDTO": { - "description": "ActiveSyncStatusDTO holds the information for LDAP background Sync", - "type": "object", - "properties": { - "enabled": { - "type": "boolean", - "x-go-name": "Enabled" - }, - "nextSync": { - "type": "string", - "format": "date-time", - "x-go-name": "NextSync" - }, - "prevSync": { - "$ref": "#/definitions/SyncResult" - }, - "schedule": { - "type": "string", - "x-go-name": "Schedule" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/ldapdebug" - }, - "ActiveUserStats": { - "type": "object", - "properties": { - "active_admins_and_editors": { - "type": "integer", - "format": "int64", - "x-go-name": "ActiveAdminsAndEditors" - }, - "active_users": { - "type": "integer", - "format": "int64", - "x-go-name": "ActiveUsers" - }, - "active_viewers": { - "type": "integer", - "format": "int64", - "x-go-name": "ActiveViewers" + } } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/licensing" - }, + } + } + }, + "definitions": { "AddApiKeyCommand": { "description": "COMMANDS", "type": "object", @@ -7612,26 +5822,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/models" }, - "AddBuiltInRoleCommand": { - "type": "object", - "properties": { - "builtInRole": { - "type": "string", - "enum": ["Viewer", " Editor", " Admin", " Grafana Admin"], - "x-go-name": "BuiltinRole" - }, - "global": { - "description": "A flag indicating if the assignment is global or not. If set to false, the default org ID of the authenticated user will be used from the request to create organization local assignment. Refer to the Built-in role assignments for more information.", - "type": "boolean", - "x-go-name": "Global" - }, - "roleUid": { - "type": "string", - "x-go-name": "RoleUID" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/accesscontrol" - }, "AddDataSourceCommand": { "description": "Also acts as api DTO", "type": "object", @@ -7734,29 +5924,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/models" }, - "AddPermissionDTO": { - "type": "object", - "properties": { - "builtinRole": { - "type": "string", - "x-go-name": "BuiltinRole" - }, - "permission": { - "$ref": "#/definitions/DsPermissionType" - }, - "teamId": { - "type": "integer", - "format": "int64", - "x-go-name": "TeamId" - }, - "userId": { - "type": "integer", - "format": "int64", - "x-go-name": "UserId" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/dspermissions" - }, "AddTeamMemberCommand": { "type": "object", "properties": { @@ -7768,30 +5935,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/models" }, - "AddTeamRoleCommand": { - "type": "object", - "properties": { - "roleUid": { - "type": "string", - "x-go-name": "RoleUID" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/accesscontrol" - }, - "AddUserRoleCommand": { - "type": "object", - "properties": { - "global": { - "type": "boolean", - "x-go-name": "Global" - }, - "roleUid": { - "type": "string", - "x-go-name": "RoleUID" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/accesscontrol" - }, "Address": { "type": "object", "properties": { @@ -8333,32 +6476,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/models" }, - "BrandingOptionsDTO": { - "type": "object", - "properties": { - "emailFooterLink": { - "type": "string", - "x-go-name": "EmailFooterLink" - }, - "emailFooterMode": { - "type": "string", - "x-go-name": "EmailFooterMode" - }, - "emailFooterText": { - "type": "string", - "x-go-name": "EmailFooterText" - }, - "emailLogoUrl": { - "type": "string", - "x-go-name": "EmailLogo" - }, - "reportLogoUrl": { - "type": "string", - "x-go-name": "ReportLogo" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/report" - }, "CalculateDiffTarget": { "type": "object", "properties": { @@ -8392,89 +6509,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/models" }, - "ConfigDTO": { - "description": "ConfigDTO is model representation in transfer", - "type": "object", - "properties": { - "created": { - "type": "string", - "format": "date-time", - "x-go-name": "Created" - }, - "dashboardId": { - "type": "integer", - "format": "int64", - "x-go-name": "DashboardID" - }, - "dashboardName": { - "type": "string", - "x-go-name": "DashboardName" - }, - "dashboardUid": { - "type": "string", - "x-go-name": "DashboardUID" - }, - "enableCsv": { - "type": "boolean", - "x-go-name": "EnableCSV" - }, - "enableDashboardUrl": { - "type": "boolean", - "x-go-name": "EnableDashboardURL" - }, - "id": { - "type": "integer", - "format": "int64", - "x-go-name": "ID" - }, - "message": { - "type": "string", - "x-go-name": "Message" - }, - "name": { - "type": "string", - "x-go-name": "Name" - }, - "options": { - "$ref": "#/definitions/ReportOptionsDTO" - }, - "orgId": { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID" - }, - "recipients": { - "type": "string", - "x-go-name": "Recipients" - }, - "replyTo": { - "type": "string", - "x-go-name": "ReplyTo" - }, - "schedule": { - "$ref": "#/definitions/ScheduleDTO" - }, - "state": { - "type": "string", - "x-go-name": "State" - }, - "templateVars": { - "type": "object", - "x-go-name": "TemplateVars" - }, - "updated": { - "type": "string", - "format": "date-time", - "x-go-name": "Updated" - }, - "userId": { - "type": "integer", - "format": "int64", - "x-go-name": "UserID" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/report" - }, "CreateAlertNotificationCommand": { "type": "object", "properties": { @@ -8596,193 +6630,41 @@ "type": "object", "x-go-name": "Model" }, - "name": { - "description": "Name of the library element.", - "type": "string", - "x-go-name": "Name" - }, - "uid": { - "type": "string", - "x-go-name": "UID" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/services/libraryelements" - }, - "CreateOrUpdateConfigCmd": { - "type": "object", - "properties": { - "dashboardId": { - "type": "integer", - "format": "int64", - "x-go-name": "DashboardID" - }, - "dashboardUid": { - "type": "string", - "x-go-name": "DashboardUID" - }, - "enableCsv": { - "type": "boolean", - "x-go-name": "EnableCSV" - }, - "enableDashboardUrl": { - "type": "boolean", - "x-go-name": "EnableDashboardURL" - }, - "message": { - "type": "string", - "x-go-name": "Message" - }, - "name": { - "type": "string", - "x-go-name": "Name" - }, - "options": { - "$ref": "#/definitions/ReportOptionsDTO" - }, - "recipients": { - "type": "string", - "x-go-name": "Recipients" - }, - "replyTo": { - "type": "string", - "x-go-name": "ReplyTo" - }, - "schedule": { - "$ref": "#/definitions/ScheduleDTO" - }, - "state": { - "type": "string", - "x-go-name": "State" - }, - "templateVars": { - "type": "object", - "x-go-name": "TemplateVars" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/report" - }, - "CreateOrgCommand": { - "type": "object", - "properties": { - "name": { - "type": "string", - "x-go-name": "Name" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/models" - }, - "CreateRoleWithPermissionsCommand": { - "type": "object", - "properties": { - "description": { - "type": "string", - "x-go-name": "Description" - }, - "displayName": { - "type": "string", - "x-go-name": "DisplayName" - }, - "group": { - "type": "string", - "x-go-name": "Group" - }, - "name": { - "type": "string", - "x-go-name": "Name" - }, - "permissions": { - "type": "array", - "items": { - "$ref": "#/definitions/Permission" - }, - "x-go-name": "Permissions" - }, - "uid": { - "type": "string", - "x-go-name": "UID" - }, - "version": { - "type": "integer", - "format": "int64", - "x-go-name": "Version" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/accesscontrol" - }, - "CreateTeamCommand": { - "type": "object", - "properties": { - "email": { - "type": "string", - "x-go-name": "Email" - }, - "name": { - "type": "string", - "x-go-name": "Name" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/models" - }, - "CustomPermissionsRecordDTO": { - "type": "object", - "properties": { - "customPermissions": { - "type": "string", - "x-go-name": "CustomPermissions" - }, - "granteeName": { - "type": "string", - "x-go-name": "GranteeName" - }, - "granteeType": { - "type": "string", - "x-go-name": "GranteeType" - }, - "granteeUrl": { - "type": "string", - "x-go-name": "GranteeURL" - }, - "id": { - "type": "integer", - "format": "int64", - "x-go-name": "ID" - }, - "isFolder": { - "type": "boolean", - "x-go-name": "IsFolder" - }, - "orgId": { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID" - }, - "orgRole": { - "type": "string", - "x-go-name": "OrgRole" - }, - "slug": { - "type": "string", - "x-go-name": "Slug" - }, - "title": { + "name": { + "description": "Name of the library element.", "type": "string", - "x-go-name": "Title" + "x-go-name": "Name" }, "uid": { "type": "string", "x-go-name": "UID" - }, - "url": { + } + }, + "x-go-package": "github.com/grafana/grafana/pkg/services/libraryelements" + }, + "CreateOrgCommand": { + "type": "object", + "properties": { + "name": { "type": "string", - "x-go-name": "URL" + "x-go-name": "Name" + } + }, + "x-go-package": "github.com/grafana/grafana/pkg/models" + }, + "CreateTeamCommand": { + "type": "object", + "properties": { + "email": { + "type": "string", + "x-go-name": "Email" }, - "usersCount": { - "type": "integer", - "format": "int64", - "x-go-name": "UsersCount" + "name": { + "type": "string", + "x-go-name": "Name" } }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/licensing" + "x-go-package": "github.com/grafana/grafana/pkg/models" }, "DashboardAclInfoDTO": { "type": "object", @@ -9583,16 +7465,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/api/dtos" }, - "DeleteTokenCommand": { - "type": "object", - "properties": { - "instance": { - "type": "string", - "x-go-name": "Instance" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/licensing" - }, "DsAccess": { "type": "string", "x-go-package": "github.com/grafana/grafana/pkg/models" @@ -9651,19 +7523,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/api/dtos" }, - "FailedUser": { - "description": "FailedUser holds the information of an user that failed", - "type": "object", - "properties": { - "Error": { - "type": "string" - }, - "Login": { - "type": "string" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/ldapsync" - }, "FindTagsResult": { "type": "object", "title": "FindTagsResult is the result of a tags search.", @@ -10618,31 +8477,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/api/dtos" }, - "Permission": { - "type": "object", - "title": "Permission is the model for access control permissions.", - "properties": { - "action": { - "type": "string", - "x-go-name": "Action" - }, - "created": { - "type": "string", - "format": "date-time", - "x-go-name": "Created" - }, - "scope": { - "type": "string", - "x-go-name": "Scope" - }, - "updated": { - "type": "string", - "format": "date-time", - "x-go-name": "Updated" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/services/accesscontrol" - }, "PermissionType": { "type": "integer", "format": "int64", @@ -10734,24 +8568,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/api/dtos" }, - "PrometheusRemoteWriteTargetJSON": { - "type": "object", - "properties": { - "data_source_uid": { - "type": "string", - "x-go-name": "DatasourceUID" - }, - "id": { - "type": "string", - "x-go-name": "ID" - }, - "remote_write_path": { - "type": "string", - "x-go-name": "WritePath" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/recordedqueries/api" - }, "QueryDataResponse": { "description": "It is the return type of a QueryData call.", "type": "object", @@ -10763,108 +8579,6 @@ }, "x-go-package": "github.com/grafana/grafana-plugin-sdk-go/backend" }, - "RecordingRuleJSON": { - "description": "RecordingRuleJSON is the external representation of a recording rule", - "type": "object", - "properties": { - "active": { - "type": "boolean", - "x-go-name": "Active" - }, - "count": { - "type": "boolean", - "x-go-name": "Count" - }, - "description": { - "type": "string", - "x-go-name": "Description" - }, - "dest_data_source_uid": { - "type": "string", - "x-go-name": "DestDataSourceUID" - }, - "id": { - "type": "string", - "x-go-name": "ID" - }, - "interval": { - "type": "integer", - "format": "int64", - "x-go-name": "Interval" - }, - "name": { - "type": "string", - "x-go-name": "Name" - }, - "prom_name": { - "type": "string", - "x-go-name": "PromName" - }, - "queries": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": { - "type": "object" - } - }, - "x-go-name": "Queries" - }, - "range": { - "type": "integer", - "format": "int64", - "x-go-name": "Range" - }, - "target_ref_id": { - "type": "string", - "x-go-name": "TargetRefID" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/recordedqueries/api" - }, - "ReportEmailDTO": { - "type": "object", - "properties": { - "email": { - "type": "string", - "x-go-name": "Email" - }, - "emails": { - "description": "Comma-separated list of emails to which to send the report to.", - "type": "string", - "x-go-name": "Emails" - }, - "id": { - "description": "Send the report to the emails specified in the report. Required if emails is not present.", - "type": "string", - "format": "int64", - "x-go-name": "Id" - }, - "useEmailsFromReport": { - "description": "Send the report to the emails specified in the report. Required if emails is not present.", - "type": "boolean", - "x-go-name": "UseEmailsFromReport" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/report" - }, - "ReportOptionsDTO": { - "type": "object", - "properties": { - "layout": { - "type": "string", - "x-go-name": "Layout" - }, - "orientation": { - "type": "string", - "x-go-name": "Orientation" - }, - "timeRange": { - "$ref": "#/definitions/TimeRangeDTO" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/report" - }, "Responses": { "description": "The QueryData method the QueryDataHandler method will set the RefId\nproperty on the DataRespones' frames based on these RefIDs.", "type": "object", @@ -10885,58 +8599,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/models" }, - "RoleDTO": { - "type": "object", - "properties": { - "created": { - "type": "string", - "format": "date-time", - "x-go-name": "Created" - }, - "delegatable": { - "type": "boolean", - "x-go-name": "Delegatable" - }, - "description": { - "type": "string", - "x-go-name": "Description" - }, - "displayName": { - "type": "string", - "x-go-name": "DisplayName" - }, - "group": { - "type": "string", - "x-go-name": "Group" - }, - "name": { - "type": "string", - "x-go-name": "Name" - }, - "permissions": { - "type": "array", - "items": { - "$ref": "#/definitions/Permission" - }, - "x-go-name": "Permissions" - }, - "uid": { - "type": "string", - "x-go-name": "UID" - }, - "updated": { - "type": "string", - "format": "date-time", - "x-go-name": "Updated" - }, - "version": { - "type": "integer", - "format": "int64", - "x-go-name": "Version" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/services/accesscontrol" - }, "RoleType": { "type": "string", "x-go-package": "github.com/grafana/grafana/pkg/models" @@ -10980,61 +8642,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/models" }, - "ScheduleDTO": { - "type": "object", - "properties": { - "day": { - "type": "string", - "x-go-name": "Day" - }, - "dayOfMonth": { - "type": "string", - "x-go-name": "DayOfMonth" - }, - "endDate": { - "type": "string", - "format": "date-time", - "x-go-name": "EndDate" - }, - "frequency": { - "type": "string", - "x-go-name": "Frequency" - }, - "hour": { - "type": "integer", - "format": "int64", - "x-go-name": "Hour" - }, - "intervalAmount": { - "type": "integer", - "format": "int64", - "x-go-name": "IntervalAmount" - }, - "intervalFrequency": { - "type": "string", - "x-go-name": "IntervalFrequency" - }, - "minute": { - "type": "integer", - "format": "int64", - "x-go-name": "Minute" - }, - "startDate": { - "type": "string", - "format": "date-time", - "x-go-name": "StartDate" - }, - "timeZone": { - "type": "string", - "x-go-name": "TimeZone" - }, - "workdaysOnly": { - "type": "boolean", - "x-go-name": "WorkdaysOnly" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/report" - }, "SearchTeamQueryResult": { "type": "object", "properties": { @@ -11091,23 +8698,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/models" }, - "SetUserRolesCommand": { - "type": "object", - "properties": { - "global": { - "type": "boolean", - "x-go-name": "Global" - }, - "roleUids": { - "type": "array", - "items": { - "type": "string" - }, - "x-go-name": "RoleUIDs" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/accesscontrol" - }, "SettingsBag": { "type": "object", "additionalProperties": { @@ -11118,40 +8708,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/setting" }, - "SettingsDTO": { - "type": "object", - "properties": { - "branding": { - "$ref": "#/definitions/BrandingOptionsDTO" - }, - "id": { - "type": "integer", - "format": "int64", - "x-go-name": "ID" - }, - "orgId": { - "type": "integer", - "format": "int64", - "x-go-name": "OrgID" - }, - "userId": { - "type": "integer", - "format": "int64", - "x-go-name": "UserID" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/report" - }, - "Status": { - "type": "object", - "properties": { - "enabled": { - "type": "boolean", - "x-go-name": "Enabled" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/accesscontrol" - }, "SuccessResponseBody": { "type": "object", "properties": { @@ -11162,40 +8718,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/api/docs/definitions" }, - "SyncResult": { - "type": "object", - "title": "SyncResult holds the result of a sync with LDAP. This gives us information on which users were updated and how.", - "properties": { - "Elapsed": { - "$ref": "#/definitions/Duration" - }, - "FailedUsers": { - "type": "array", - "items": { - "$ref": "#/definitions/FailedUser" - } - }, - "MissingUserIds": { - "type": "array", - "items": { - "type": "integer", - "format": "int64" - } - }, - "Started": { - "type": "string", - "format": "date-time" - }, - "UpdatedUserIds": { - "type": "array", - "items": { - "type": "integer", - "format": "int64" - } - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/ldapsync" - }, "TagsDTO": { "type": "object", "title": "TagsDTO is the frontend DTO for Tag.", @@ -11255,36 +8777,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/models" }, - "TeamGroupDTO": { - "type": "object", - "properties": { - "groupId": { - "type": "string", - "x-go-name": "GroupId" - }, - "orgId": { - "type": "integer", - "format": "int64", - "x-go-name": "OrgId" - }, - "teamId": { - "type": "integer", - "format": "int64", - "x-go-name": "TeamId" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/teamgroupsync/models" - }, - "TeamGroupMapping": { - "type": "object", - "properties": { - "groupId": { - "type": "string", - "x-go-name": "GroupId" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/teamgroupsync/models" - }, "TeamMemberDTO": { "type": "object", "properties": { @@ -11404,136 +8896,6 @@ "type": "string", "x-go-package": "github.com/grafana/grafana/pkg/models" }, - "TimeRangeDTO": { - "type": "object", - "properties": { - "from": { - "type": "string", - "x-go-name": "From" - }, - "to": { - "type": "string", - "x-go-name": "To" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/report" - }, - "Token": { - "type": "object", - "properties": { - "account": { - "type": "string", - "x-go-name": "Account" - }, - "company": { - "type": "string", - "x-go-name": "Company" - }, - "details_url": { - "type": "string", - "x-go-name": "DetailsUrl" - }, - "exp": { - "type": "integer", - "format": "int64", - "x-go-name": "Expires" - }, - "iat": { - "type": "integer", - "format": "int64", - "x-go-name": "Issued" - }, - "included_admins": { - "type": "integer", - "format": "int64", - "x-go-name": "IncludedAdmins" - }, - "included_users": { - "type": "integer", - "format": "int64", - "x-go-name": "IncludedUsers" - }, - "included_viewers": { - "type": "integer", - "format": "int64", - "x-go-name": "IncludedViewers" - }, - "iss": { - "type": "string", - "x-go-name": "Issuer" - }, - "jti": { - "type": "string", - "x-go-name": "Id" - }, - "lexp": { - "type": "integer", - "format": "int64", - "x-go-name": "LicenseExpires" - }, - "lic_exp_warn_days": { - "type": "integer", - "format": "int64", - "x-go-name": "LicenseExpiresWarnDays" - }, - "lid": { - "type": "string", - "x-go-name": "LicenseId" - }, - "limit_by": { - "type": "string", - "x-go-name": "LimitBy" - }, - "max_concurrent_user_sessions": { - "type": "integer", - "format": "int64", - "x-go-name": "MaxConcurrentUserSessions" - }, - "nbf": { - "type": "integer", - "format": "int64", - "x-go-name": "LicenseIssued" - }, - "prod": { - "type": "array", - "items": { - "type": "string" - }, - "x-go-name": "Products" - }, - "slug": { - "type": "string", - "x-go-name": "Slug" - }, - "status": { - "$ref": "#/definitions/TokenStatus" - }, - "sub": { - "type": "string", - "x-go-name": "Subject" - }, - "tok_exp_warn_days": { - "type": "integer", - "format": "int64", - "x-go-name": "TokenExpiresWarnDays" - }, - "update_days": { - "type": "integer", - "format": "int64", - "x-go-name": "UpdateDays" - }, - "usage_billing": { - "type": "boolean", - "x-go-name": "UsageBilling" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/licensing" - }, - "TokenStatus": { - "type": "integer", - "format": "int64", - "x-go-package": "github.com/grafana/grafana/pkg/extensions/licensing" - }, "TrimDashboardCommand": { "type": "object", "properties": { @@ -11883,44 +9245,6 @@ }, "x-go-package": "github.com/grafana/grafana/pkg/api/dtos" }, - "UpdateRoleCommand": { - "type": "object", - "properties": { - "description": { - "type": "string", - "x-go-name": "Description" - }, - "displayName": { - "type": "string", - "x-go-name": "DisplayName" - }, - "global": { - "type": "boolean", - "x-go-name": "Global" - }, - "group": { - "type": "string", - "x-go-name": "Group" - }, - "name": { - "type": "string", - "x-go-name": "Name" - }, - "permissions": { - "type": "array", - "items": { - "$ref": "#/definitions/Permission" - }, - "x-go-name": "Permissions" - }, - "version": { - "type": "integer", - "format": "int64", - "x-go-name": "Version" - } - }, - "x-go-package": "github.com/grafana/grafana/pkg/extensions/accesscontrol" - }, "UpdateTeamCommand": { "type": "object", "properties": { @@ -12281,16 +9605,6 @@ "$ref": "#/definitions/ErrorResponseBody" } }, - "contentResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "type": "integer", - "format": "uint8" - } - } - }, "createAnnotationResponse": { "description": "", "schema": { @@ -12365,12 +9679,6 @@ } } }, - "createReportResponse": { - "description": "", - "schema": { - "type": "object" - } - }, "createSnapshotResponse": { "description": "", "schema": { @@ -12592,12 +9900,6 @@ } } }, - "getAccessControlStatusResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/Status" - } - }, "getAlertNotificationChannelResponse": { "description": "", "schema": { @@ -12631,15 +9933,6 @@ } } }, - "getAllRolesResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/RoleDTO" - } - } - }, "getAnnotationTagsResponse": { "description": "", "schema": { @@ -12664,15 +9957,6 @@ } } }, - "getCustomPermissionsReportResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/CustomPermissionsRecordDTO" - } - } - }, "getDashboardPermissionsResponse": { "description": "", "schema": { @@ -12743,12 +10027,6 @@ } } }, - "getLDAPSyncStatusResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/ActiveSyncStatusDTO" - } - }, "getLibraryElementConnectionsResponse": { "description": "", "schema": { @@ -12767,15 +10045,6 @@ "$ref": "#/definitions/LibraryElementSearchResponse" } }, - "getLicenseStatusResponse": { - "description": "" - }, - "getLicenseTokenResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/Token" - } - }, "getOrgResponse": { "description": "", "schema": { @@ -12791,12 +10060,6 @@ } } }, - "getPermissionseResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/AddPermissionDTO" - } - }, "getPreferencesResponse": { "description": "", "schema": { @@ -12812,33 +10075,6 @@ } } }, - "getReportResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/ConfigDTO" - } - }, - "getReportSettingsResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/SettingsDTO" - } - }, - "getReportsResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/ConfigDTO" - } - } - }, - "getRoleResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/RoleDTO" - } - }, "getSettingsResponse": { "description": "", "schema": { @@ -12880,15 +10116,6 @@ "$ref": "#/definitions/AdminStats" } }, - "getTeamGroupsApiResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/TeamGroupDTO" - } - } - }, "getTeamMembersResponse": { "description": "", "schema": { @@ -12951,27 +10178,6 @@ "$ref": "#/definitions/ErrorResponseBody" } }, - "listBuiltinRolesResponse": { - "description": "", - "schema": { - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "$ref": "#/definitions/RoleDTO" - } - } - } - }, - "listRecordingRulesResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/RecordingRuleJSON" - } - } - }, "lookupAlertNotificationChannelsResponse": { "description": "", "schema": { @@ -13101,9 +10307,6 @@ } } }, - "postRenewLicenseTokenResponse": { - "description": "" - }, "preconditionFailedError": { "description": "PreconditionFailedError", "schema": { @@ -13122,24 +10325,6 @@ "$ref": "#/definitions/DataResponse" } }, - "recordingRuleResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/RecordingRuleJSON" - } - }, - "recordingRuleWriteTargetResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/PrometheusRemoteWriteTargetJSON" - } - }, - "refreshLicenseStatsResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/ActiveUserStats" - } - }, "searchOrgResponse": { "description": "", "schema": {