From 2073179d4aa025d2d479dca10486b25d0e9e1a8b Mon Sep 17 00:00:00 2001 From: sfranzis Date: Sat, 20 Aug 2022 10:00:34 +0200 Subject: [PATCH 01/25] GraphPanel: Setting the neutral-point of a gauge If min and max of a gauge panel are opposite numbers, e.g. min=-500, max=500 then the neutral point of the gauge is put at 12 o'clock. Negative values are plotted to the left side, positive values to the right side. See Gitlab discussions #38273 --- public/vendor/flot/jquery.flot.gauge.js | 37 ++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/public/vendor/flot/jquery.flot.gauge.js b/public/vendor/flot/jquery.flot.gauge.js index 760354cecd4f..694858759650 100644 --- a/public/vendor/flot/jquery.flot.gauge.js +++ b/public/vendor/flot/jquery.flot.gauge.js @@ -7,6 +7,8 @@ * Licensed under the MIT license. */ +const { angularModules } = require("app/angular/core_module"); + /** * @module flot.gauge */ @@ -328,7 +330,6 @@ var blur = gaugeOptionsi.gauge.shadow.show ? gaugeOptionsi.gauge.shadow.blur : 0; - // draw gauge frame drawArcWithShadow( cellLayout.cx, // center x @@ -344,20 +345,48 @@ // draw gauge var c1 = getColor(gaugeOptionsi, data); - var a2 = calculateAngle(gaugeOptionsi, layout, data); + var angles = calculateAnglesForGauge(gaugeOptionsi, layout, data); + drawArcWithShadow( cellLayout.cx, // center x cellLayout.cy, // center y layout.radius - 1, layout.width - 2, - toRad(gaugeOptionsi.gauge.startAngle), - toRad(a2), + toRad(angles.a1), + toRad(angles.a2), c1, // line color 1, // line width c1, // fill color blur); } + + /** + * if gauge min is negative and has the absolute value of min and max are the same + * then calculate a1 and a2 in a way, that zero is at 12 o'clock + * + * @method calculateAnglesForGauge + * @param {Object} gaugeOptionsi the options of the gauge + * @returns {Object} + */ + function calculateAnglesForGauge(gaugeOptionsi, layout, data) { + let angles = {}; + var setNorth = (gaugeOptionsi.gauge.min + gaugeOptionsi.gauge.max) == 0.0 + + angles.a1 = gaugeOptionsi.gauge.startAngle; + angles.a2 = calculateAngle(gaugeOptionsi, layout, data); + + if(setNorth && angles.a2<=1.5) { + angles.a1 = angles.a2; + angles.a2 = 1.5; + } + if(setNorth && angles.a2>1.5) { + angles.a1 = 1.5; + } + + return angles; + } + /** * decide the color of the data from the threshold options * From aac870840ff08375e51592b90fea2016f3611a62 Mon Sep 17 00:00:00 2001 From: sfranzis Date: Sat, 20 Aug 2022 10:12:11 +0200 Subject: [PATCH 02/25] GraphPanel: Setting the neutral-point of a gauge remove unneded const angularModules --- public/vendor/flot/jquery.flot.gauge.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/public/vendor/flot/jquery.flot.gauge.js b/public/vendor/flot/jquery.flot.gauge.js index 694858759650..479151668c93 100644 --- a/public/vendor/flot/jquery.flot.gauge.js +++ b/public/vendor/flot/jquery.flot.gauge.js @@ -7,8 +7,6 @@ * Licensed under the MIT license. */ -const { angularModules } = require("app/angular/core_module"); - /** * @module flot.gauge */ From a3e0a9decc65c9fec03a037afb47cb3c58047df8 Mon Sep 17 00:00:00 2001 From: sfranzis Date: Sat, 20 Aug 2022 11:19:23 +0200 Subject: [PATCH 03/25] Update gauge docs --- docs/sources/visualizations/gauge-panel.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/sources/visualizations/gauge-panel.md b/docs/sources/visualizations/gauge-panel.md index 8506d1d8fb4c..a47ed8674ab4 100644 --- a/docs/sources/visualizations/gauge-panel.md +++ b/docs/sources/visualizations/gauge-panel.md @@ -53,3 +53,10 @@ Adjust the sizes of the gauge text. - **Title -** Enter a numeric value for the gauge title size. - **Value -** Enter a numeric value for the gauge value size. + +## Standard options + +Adjust various options. + +- **Min/Max -** If the values of min and max are additive inverse numbers (e.g. min=-500, max=500), then the neutral point of the gauge is put at 12 o'clock. Negative values are plotted to the left side, positive values to the right side. + From d1312e2bac8869778ce187ae415ae12bf8c208bf Mon Sep 17 00:00:00 2001 From: sfranzis Date: Sat, 15 Oct 2022 14:49:08 +0200 Subject: [PATCH 04/25] Setting the neutral-point of a gauge. make it default behaviour and add zero marker --- public/vendor/flot/jquery.flot.gauge.js | 71 +++++++++++++++++-------- 1 file changed, 50 insertions(+), 21 deletions(-) diff --git a/public/vendor/flot/jquery.flot.gauge.js b/public/vendor/flot/jquery.flot.gauge.js index 479151668c93..1726309ad1ed 100644 --- a/public/vendor/flot/jquery.flot.gauge.js +++ b/public/vendor/flot/jquery.flot.gauge.js @@ -325,8 +325,10 @@ */ Gauge.prototype.drawGauge = function(gaugeOptionsi, layout, cellLayout, label, data) { - var blur = gaugeOptionsi.gauge.shadow.show ? gaugeOptionsi.gauge.shadow.blur : 0; + var color = getColor(gaugeOptionsi, data); + var hasNegative = gaugeOptionsi.gauge.min < 0.0 + var angles = calculateAnglesForGauge(gaugeOptionsi, layout, data, hasNegative); // draw gauge frame drawArcWithShadow( @@ -342,9 +344,6 @@ blur); // draw gauge - var c1 = getColor(gaugeOptionsi, data); - var angles = calculateAnglesForGauge(gaugeOptionsi, layout, data); - drawArcWithShadow( cellLayout.cx, // center x cellLayout.cy, // center y @@ -352,39 +351,69 @@ layout.width - 2, toRad(angles.a1), toRad(angles.a2), - c1, // line color + color, 1, // line width - c1, // fill color + color, // fill color blur); + + if(hasNegative) + drawZeroMarker(gaugeOptionsi, layout, cellLayout, color); } - /** - * if gauge min is negative and has the absolute value of min and max are the same - * then calculate a1 and a2 in a way, that zero is at 12 o'clock + * Calcualte the angles for the gauge, depending on if there are + * negative numbers or not. * * @method calculateAnglesForGauge * @param {Object} gaugeOptionsi the options of the gauge + * @param {Number} data the value of the gauge * @returns {Object} */ - function calculateAnglesForGauge(gaugeOptionsi, layout, data) { + function calculateAnglesForGauge(gaugeOptionsi, layout, data, hasNegative) { let angles = {}; - var setNorth = (gaugeOptionsi.gauge.min + gaugeOptionsi.gauge.max) == 0.0 - - angles.a1 = gaugeOptionsi.gauge.startAngle; - angles.a2 = calculateAngle(gaugeOptionsi, layout, data); + var isNegative = data < 0.0 - if(setNorth && angles.a2<=1.5) { - angles.a1 = angles.a2; - angles.a2 = 1.5; - } - if(setNorth && angles.a2>1.5) { - angles.a1 = 1.5; + if (hasNegative) { + if (isNegative) { + angles.a1 = calculateAngle(gaugeOptionsi, layout, data); + angles.a2 = calculateAngle(gaugeOptionsi, layout, 0.0); + } else { + angles.a1 = calculateAngle(gaugeOptionsi, layout, 0.0); + angles.a2 = calculateAngle(gaugeOptionsi, layout, data); + } + alert(gaugeOptionsi.gauge.min + " - " + gaugeOptionsi.gauge.max); + } else { + angles.a1 = gaugeOptionsi.gauge.startAngle; + angles.a2 = calculateAngle(gaugeOptionsi, layout, data); } return angles; } + /** + * Draw zero marker for Gauge with negative values + * + * @method drawZeroMarker + * @param {Object} gaugeOptionsi the options of the gauge + * @param {Object} layout the layout properties + * @param {Object} cellLayout the cell layout properties + * @param {String} color line color + */ + function drawZeroMarker(gaugeOptionsi, layout, cellLayout, color) { + var diff = (gaugeOptionsi.gauge.max - gaugeOptionsi.gauge.min) / 800; + + drawArc(context, + cellLayout.cx, + cellLayout.cy, + layout.radius - 2, + layout.width - 4, + toRad(calculateAngle(gaugeOptionsi, layout, -diff)), + toRad(calculateAngle(gaugeOptionsi, layout, diff)), + color, + 2, + gaugeOptionsi.gauge.background.color); + } + /** * decide the color of the data from the threshold options * @@ -609,7 +638,7 @@ * @param {Object} textOptions the option of the text * @param {Number} [a] the angle of the value drawn */ - function drawText(x, y, id, text, textOptions, a) { + function drawText(x, y, id, text, textOptions, a) { var span = $(placeholder).find("#" + id); var exists = span.length; if (!exists) { From 329e29920cc27a134ab5cc0803a036d70c75ff46 Mon Sep 17 00:00:00 2001 From: sfranzis Date: Sat, 15 Oct 2022 14:51:02 +0200 Subject: [PATCH 05/25] Setting the neutral-point of a gauge. make it default behaviour and add zero marker --- public/vendor/flot/jquery.flot.gauge.js | 1 - 1 file changed, 1 deletion(-) diff --git a/public/vendor/flot/jquery.flot.gauge.js b/public/vendor/flot/jquery.flot.gauge.js index 1726309ad1ed..ae27e9ac4aef 100644 --- a/public/vendor/flot/jquery.flot.gauge.js +++ b/public/vendor/flot/jquery.flot.gauge.js @@ -381,7 +381,6 @@ angles.a1 = calculateAngle(gaugeOptionsi, layout, 0.0); angles.a2 = calculateAngle(gaugeOptionsi, layout, data); } - alert(gaugeOptionsi.gauge.min + " - " + gaugeOptionsi.gauge.max); } else { angles.a1 = gaugeOptionsi.gauge.startAngle; angles.a2 = calculateAngle(gaugeOptionsi, layout, data); From 7796d460cf7128858b8345d2c42181d42534c80f Mon Sep 17 00:00:00 2001 From: sfranzis Date: Sat, 15 Oct 2022 15:00:19 +0200 Subject: [PATCH 06/25] Remove hint to set min/max as the neutral point is now set automatically --- docs/sources/visualizations/gauge-panel.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/docs/sources/visualizations/gauge-panel.md b/docs/sources/visualizations/gauge-panel.md index a47ed8674ab4..8506d1d8fb4c 100644 --- a/docs/sources/visualizations/gauge-panel.md +++ b/docs/sources/visualizations/gauge-panel.md @@ -53,10 +53,3 @@ Adjust the sizes of the gauge text. - **Title -** Enter a numeric value for the gauge title size. - **Value -** Enter a numeric value for the gauge value size. - -## Standard options - -Adjust various options. - -- **Min/Max -** If the values of min and max are additive inverse numbers (e.g. min=-500, max=500), then the neutral point of the gauge is put at 12 o'clock. Negative values are plotted to the left side, positive values to the right side. - From b31bbdbf83ec18e31802867fd5102feb94f99be6 Mon Sep 17 00:00:00 2001 From: sfranzis Date: Thu, 10 Nov 2022 10:51:14 +0100 Subject: [PATCH 07/25] zero option --- .../grafana-ui/src/components/Gauge/Gauge.tsx | 5 +- public/api-merged.json | 9054 ++++++----------- public/api-spec.json | 8234 +++++---------- public/app/plugins/panel/gauge/GaugePanel.tsx | 1 + public/app/plugins/panel/gauge/models.cue | 1 + public/app/plugins/panel/gauge/models.gen.ts | 1 + public/app/plugins/panel/gauge/module.tsx | 6 + public/vendor/flot/jquery.flot.gauge.js | 23 +- yarn.lock | 36 +- 9 files changed, 5540 insertions(+), 11821 deletions(-) diff --git a/packages/grafana-ui/src/components/Gauge/Gauge.tsx b/packages/grafana-ui/src/components/Gauge/Gauge.tsx index ebdcf84e6ff6..2bb4220f2159 100644 --- a/packages/grafana-ui/src/components/Gauge/Gauge.tsx +++ b/packages/grafana-ui/src/components/Gauge/Gauge.tsx @@ -21,6 +21,7 @@ export interface Props extends Themeable { field: FieldConfig; showThresholdMarkers: boolean; showThresholdLabels: boolean; + neutral: Number; width: number; value: DisplayValue; text?: VizTextDisplayOptions; @@ -50,7 +51,7 @@ export class Gauge extends PureComponent { } draw() { - const { field, showThresholdLabels, showThresholdMarkers, width, height, theme, value } = this.props; + const { field, showThresholdLabels, showThresholdMarkers, width, height, theme, value, neutral } = this.props; const autoProps = calculateGaugeAutoProps(width, height, value.title); const dimension = Math.min(width, autoProps.gaugeHeight); @@ -58,6 +59,7 @@ export class Gauge extends PureComponent { const gaugeWidthReduceRatio = showThresholdLabels ? 1.5 : 1; const gaugeWidth = Math.min(dimension / 5.5, 40) / gaugeWidthReduceRatio; const thresholdMarkersWidth = gaugeWidth / 5; + const neutralValue = neutral; const text = formattedValueToString(value); // This not 100% accurate as I am unsure of flot's calculations here const valueWidthBase = Math.min(width, dimension * 1.3) * 0.9; @@ -96,6 +98,7 @@ export class Gauge extends PureComponent { gauge: { min, max, + neutralValue, background: { color: backgroundColor }, border: { color: null }, shadow: { show: false }, diff --git a/public/api-merged.json b/public/api-merged.json index eff155dbab49..0212b3e19146 100644 --- a/public/api-merged.json +++ b/public/api-merged.json @@ -22,58 +22,25 @@ }, "basePath": "/api", "paths": { - "/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:read` and scope `roles:*`.", - "tags": [ - "access_control", - "enterprise" - ], - "summary": "Get all roles.", - "operationId": "listRoles", - "parameters": [ + "/admin/ldap/reload": { + "post": { + "security": [ { - "type": "boolean", - "name": "delegatable", - "in": "query" + "basic": [] } ], - "responses": { - "200": { - "$ref": "#/responses/listRolesResponse" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "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:type:delegate`. `permissions:type: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.", + "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": [ - "access_control", - "enterprise" - ], - "summary": "Create a new custom role.", - "operationId": "createRole", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateRoleForm" - } - } + "admin_ldap" ], + "summary": "Reloads the LDAP configuration.", + "operationId": "reloadLDAPCfg", "responses": { - "201": { - "$ref": "#/responses/createRoleResponse" + "200": { + "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -84,26 +51,25 @@ } } }, - "/access-control/roles/{roleUID}": { + "/admin/ldap/status": { "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", - "parameters": [ + "security": [ { - "type": "string", - "name": "roleUID", - "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 `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/getRoleResponse" + "$ref": "#/responses/okResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -112,71 +78,63 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "You need to have a permission with action `roles:write` and scope `permissions:type:delegate`. `permissions:type:delegate` scope ensures that users can only create custom roles with the same, or a subset of permissions which the user has.", + } + }, + "/admin/ldap/sync/{user_id}": { + "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": [ - "access_control", - "enterprise" + "admin_ldap" ], - "summary": "Update a custom role.", - "operationId": "updateRole", + "summary": "Enables a single Grafana user to be synchronized against LDAP.", + "operationId": "postSyncUserWithLDAP", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateRoleCommand" - } - }, - { - "type": "string", - "name": "roleUID", + "type": "integer", + "format": "int64", + "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" }, - "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:type:delegate`. `permissions:type: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.", + } + }, + "/admin/ldap/{user_name}": { + "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 `ldap.user:read`.", "tags": [ - "access_control", - "enterprise" + "admin_ldap" ], - "summary": "Delete a custom role.", - "operationId": "deleteRole", + "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": "getUserFromLDAP", "parameters": [ - { - "type": "boolean", - "name": "force", - "in": "query" - }, - { - "type": "boolean", - "name": "global", - "in": "query" - }, { "type": "string", - "name": "roleUID", + "name": "user_name", "in": "path", "required": true } @@ -185,8 +143,8 @@ "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -197,127 +155,121 @@ } } }, - "/access-control/roles/{roleUID}/assignments": { - "get": { - "description": "Get role assignments for the role with the given UID.\n\nYou need to have a permission with action `teams.roles:list` and scope `teams:id:*` and `users.roles:list` and scope `users:id:*`.", + "/admin/pause-all-alerts": { + "post": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "access_control", - "enterprise" + "admin" ], - "summary": "Get role assignments.", - "operationId": "getRoleAssignments", + "summary": "Pause/unpause all (legacy) alerts.", + "operationId": "pauseAllAlerts", "parameters": [ { - "type": "string", - "name": "roleUID", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PauseAllAlertsCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/getRoleAssignmentsResponse" + "$ref": "#/responses/pauseAlertsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "Set role assignments for the role with the given UID.\n\nYou need to have a permission with action `teams.roles:add` and `teams.roles:remove` and scope `permissions:type:delegate`, and `users.roles:add` and `users.roles:remove` and scope `permissions:type:delegate`.", - "tags": [ - "access_control", - "enterprise" - ], - "summary": "Set role assignments.", - "operationId": "setRoleAssignments", - "parameters": [ - { - "type": "string", - "name": "roleUID", - "in": "path", - "required": true - }, + } + }, + "/admin/provisioning/dashboards/reload": { + "post": { + "security": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/SetRoleAssignmentsCommand" - } + "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": "adminProvisioningReloadDashboards", "responses": { "200": { - "$ref": "#/responses/setRoleAssignmentsResponse" + "$ref": "#/responses/okResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/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`.", + "/admin/provisioning/datasources/reload": { + "post": { + "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": [ - "access_control", - "enterprise" + "admin_provisioning" ], - "summary": "Get status.", - "operationId": "getAccessControlStatus", + "summary": "Reload datasource provisioning configurations.", + "operationId": "adminProvisioningReloadDatasources", "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:read` and scope `teams:id:\u003cteam ID\u003e`.", - "tags": [ - "access_control", - "enterprise" - ], - "summary": "Get team roles.", - "operationId": "listTeamRoles", - "parameters": [ + "/admin/provisioning/notifications/reload": { + "post": { + "security": [ { - "type": "integer", - "format": "int64", - "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": "adminProvisioningReloadNotifications", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -326,226 +278,150 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "You need to have a permission with action `teams.roles:add` and `teams.roles:remove` and scope `permissions:type:delegate` for each.", - "tags": [ - "access_control", - "enterprise" - ], - "summary": "Update team role.", - "operationId": "setTeamRoles", - "parameters": [ + } + }, + "/admin/provisioning/plugins/reload": { + "post": { + "security": [ { - "type": "integer", - "format": "int64", - "name": "teamId", - "in": "path", - "required": true + "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": "adminProvisioningReloadPlugins", "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" } } - }, - "post": { - "description": "You need to have a permission with action `teams.roles:add` and scope `permissions:type:delegate`.", - "tags": [ - "access_control", - "enterprise" - ], - "summary": "Add team role.", - "operationId": "addTeamRole", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AddTeamRoleCommand" - } - }, + } + }, + "/admin/settings": { + "get": { + "security": [ { - "type": "integer", - "format": "int64", - "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": "adminGetSettings", "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/adminGetSettingsResponse" }, - "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:type:delegate`.", + "/admin/stats": { + "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": [ - "access_control", - "enterprise" - ], - "summary": "Remove team role.", - "operationId": "removeTeamRole", - "parameters": [ - { - "type": "string", - "name": "roleUID", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "teamId", - "in": "path", - "required": true - } + "admin" ], + "summary": "Fetch Grafana Stats.", + "operationId": "adminGetStats", "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/adminGetStatsResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/access-control/users/{userId}/roles": { - "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:read` and scope `users:id:\u003cuser ID\u003e`.", - "tags": [ - "access_control", - "enterprise" - ], - "summary": "List roles assigned to a user.", - "operationId": "listUserRoles", - "parameters": [ + "/admin/users": { + "post": { + "security": [ { - "type": "integer", - "format": "int64", - "name": "userId", - "in": "path", - "required": true + "basic": [] } ], - "responses": { - "200": { - "$ref": "#/responses/getAllRolesResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$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:type:delegate` for each. `permissions:type: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.", + "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": [ - "access_control", - "enterprise" + "admin_users" ], - "summary": "Set user role assignments.", - "operationId": "setUserRoles", + "summary": "Create new user.", + "operationId": "adminCreateUser", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/SetUserRolesCommand" + "$ref": "#/definitions/AdminCreateUserForm" } - }, - { - "type": "integer", - "format": "int64", - "name": "userId", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/adminCreateUserResponse" }, "400": { "$ref": "#/responses/badRequestError" }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "412": { + "$ref": "#/responses/preconditionFailedError" }, "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:type:delegate`. `permissions:type: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.", + } + }, + "/admin/users/{user_id}": { + "delete": { + "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:delete` and scope `global.users:*`.", "tags": [ - "access_control", - "enterprise" + "admin_users" ], - "summary": "Add a user role assignment.", - "operationId": "addUserRole", + "summary": "Delete global User.", + "operationId": "adminDeleteUser", "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AddUserRoleCommand" - } - }, { "type": "integer", "format": "int64", - "name": "userId", + "name": "user_id", "in": "path", "required": true } @@ -554,6 +430,9 @@ "200": { "$ref": "#/responses/okResponse" }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, "403": { "$ref": "#/responses/forbiddenError" }, @@ -566,66 +445,31 @@ } } }, - "/access-control/users/{userId}/roles/{roleUID}": { - "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:type:delegate`. `permissions:type: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.", + "/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": [ - "access_control", - "enterprise" + "admin_users" ], - "summary": "Remove a user role assignment.", - "operationId": "removeUserRole", + "summary": "Return a list of all auth tokens (devices) that the user currently have logged in from.", + "operationId": "adminGetUserAuthTokens", "parameters": [ - { - "type": "boolean", - "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" - }, - { - "type": "string", - "name": "roleUID", - "in": "path", - "required": true - }, { "type": "integer", "format": "int64", - "name": "userId", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/admin/ldap-sync-status": { - "get": { - "description": "You need to have a permission with action `ldap.status:read`.", - "tags": [ - "ldap_debug" - ], - "summary": "Returns the current state of the LDAP background sync integration.", - "operationId": "getSyncStatus", - "responses": { - "200": { - "$ref": "#/responses/getSyncStatusResponse" + "$ref": "#/responses/adminGetUserAuthTokensResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -639,19 +483,28 @@ } } }, - "/admin/ldap/reload": { + "/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.config:reload`.", + "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_ldap" + "admin_users" + ], + "summary": "Disable user.", + "operationId": "adminDisableUser", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true + } ], - "summary": "Reloads the LDAP configuration.", - "operationId": "reloadLDAPCfg", "responses": { "200": { "$ref": "#/responses/okResponse" @@ -662,25 +515,37 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/ldap/status": { - "get": { + "/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.status:read`.", + "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_ldap" + "admin_users" + ], + "summary": "Enable user.", + "operationId": "adminEnableUser", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true + } ], - "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" @@ -691,25 +556,28 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/ldap/sync/{user_id}": { + "/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:sync`.", + "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_ldap" + "admin_users" ], - "summary": "Enables a single Grafana user to be synchronized against LDAP.", - "operationId": "postSyncUserWithLDAP", + "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": "adminLogoutUser", "parameters": [ { "type": "integer", @@ -723,35 +591,50 @@ "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/ldap/{user_name}": { - "get": { + "/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 `ldap.user:read`.", + "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_ldap" + "admin_users" ], - "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": "getUserFromLDAP", + "summary": "Set password for user.", + "operationId": "adminUpdateUserPassword", "parameters": [ { - "type": "string", - "name": "user_name", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AdminUpdateUserPasswordForm" + } + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } @@ -760,6 +643,9 @@ "200": { "$ref": "#/responses/okResponse" }, + "400": { + "$ref": "#/responses/badRequestError" + }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -772,31 +658,37 @@ } } }, - "/admin/pause-all-alerts": { - "post": { - "security": [ - { - "basic": [] - } - ], + "/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" + "admin_users" ], - "summary": "Pause/unpause all (legacy) alerts.", - "operationId": "pauseAllAlerts", + "summary": "Set permissions for user.", + "operationId": "adminUpdateUserPermissions", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PauseAllAlertsCommand" + "$ref": "#/definitions/AdminUpdateUserPermissionsForm" } + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/pauseAlertsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -810,43 +702,31 @@ } } }, - "/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" - }, - "403": { - "$ref": "#/responses/forbiddenError" - } - } - } - }, - "/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`.", + "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_provisioning" + "admin_users" + ], + "summary": "Fetch user quota.", + "operationId": "getUserQuota", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true + } ], - "summary": "Reload dashboard provisioning configurations.", - "operationId": "adminProvisioningReloadDashboards", "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQuotaResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -854,25 +734,51 @@ "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`.", + "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_provisioning" + "admin_users" + ], + "summary": "Update user quota.", + "operationId": "updateUserQuota", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateUserQuotaCmd" + } + }, + { + "type": "string", + "name": "quota_target", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true + } ], - "summary": "Reload datasource provisioning configurations.", - "operationId": "adminProvisioningReloadDatasources", "responses": { "200": { "$ref": "#/responses/okResponse" @@ -883,57 +789,78 @@ "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`.", + "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_provisioning" + "admin_users" + ], + "summary": "Revoke auth token for user.", + "operationId": "adminRevokeUserAuthToken", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RevokeAuthTokenCmd" + } + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true + } ], - "summary": "Reload legacy alert notifier provisioning configurations.", - "operationId": "adminProvisioningReloadNotifications", "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`.", + "/alert-notifications": { + "get": { + "description": "Returns all notification channels that the authenticated user has permission to view.", "tags": [ - "admin_provisioning" + "legacy_alerts_notification_channels" ], - "summary": "Reload plugin provisioning configurations.", - "operationId": "adminProvisioningReloadPlugins", + "summary": "Get all notification channels.", + "operationId": "getAlertNotificationChannels", "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getAlertNotificationChannelsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -945,45 +872,54 @@ "$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": [] + "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": "adminGetSettings", "responses": { "200": { - "$ref": "#/responses/adminGetSettingsResponse" + "$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`.", + "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": [ - "admin" + "legacy_alerts_notification_channels" ], - "summary": "Fetch Grafana Stats.", - "operationId": "adminGetStats", + "summary": "Get all notification channels (lookup).", + "operationId": "getAlertNotificationLookup", "responses": { "200": { - "$ref": "#/responses/adminGetStatsResponse" + "$ref": "#/responses/getAlertNotificationLookupResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -997,32 +933,27 @@ } } }, - "/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`.", + "description": "Sends a test notification to the channel.", "tags": [ - "admin_users" + "legacy_alerts_notification_channels" ], - "summary": "Create new user.", - "operationId": "adminCreateUser", + "summary": "Test notification channel.", + "operationId": "notificationChannelTest", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AdminCreateUserForm" + "$ref": "#/definitions/NotificationTestCommand" } } ], "responses": { "200": { - "$ref": "#/responses/adminCreateUserResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -1034,7 +965,7 @@ "$ref": "#/responses/forbiddenError" }, "412": { - "$ref": "#/responses/preconditionFailedError" + "$ref": "#/responses/SMTPNotEnabledError" }, "500": { "$ref": "#/responses/internalServerError" @@ -1042,31 +973,25 @@ } } }, - "/admin/users/{user_id}": { - "delete": { - "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:delete` and scope `global.users:*`.", + "/alert-notifications/uid/{notification_channel_uid}": { + "get": { + "description": "Returns the notification channel given the notification channel UID.", "tags": [ - "admin_users" + "legacy_alerts_notification_channels" ], - "summary": "Delete global User.", - "operationId": "adminDeleteUser", + "summary": "Get notification channel by UID.", + "operationId": "getAlertNotificationChannelByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "name": "notification_channel_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1081,71 +1006,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:*`.", + }, + "put": { + "description": "Updates an existing notification channel identified by uid.", "tags": [ - "admin_users" + "legacy_alerts_notification_channels" ], - "summary": "Return a list of all auth tokens (devices) that the user currently have logged in from.", - "operationId": "adminGetUserAuthTokens", + "summary": "Update notification channel by UID.", + "operationId": "updateAlertNotificationChannelByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/adminGetUserAuthTokensResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateAlertNotificationWithUidCommand" + } }, - "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": "adminDisableUser", - "parameters": [ { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "name": "notification_channel_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1160,33 +1047,25 @@ "$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).", + }, + "delete": { + "description": "Deletes an existing notification channel identified by UID.", "tags": [ - "admin_users" + "legacy_alerts_notification_channels" ], - "summary": "Enable user.", - "operationId": "adminEnableUser", + "summary": "Delete alert notification by UID.", + "operationId": "deleteAlertNotificationChannelByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "name": "notification_channel_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/deleteAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1203,34 +1082,26 @@ } } }, - "/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:*`.", + "/alert-notifications/{notification_channel_id}": { + "get": { + "description": "Returns the notification channel given the notification channel ID.", "tags": [ - "admin_users" + "legacy_alerts_notification_channels" ], - "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": "adminLogoutUser", + "summary": "Get notification channel by ID.", + "operationId": "getAlertNotificationChannelByID", "parameters": [ { "type": "integer", "format": "int64", - "name": "user_id", + "name": "notification_channel_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1245,44 +1116,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:*`.", + "description": "Updates an existing notification channel identified by ID.", "tags": [ - "admin_users" + "legacy_alerts_notification_channels" ], - "summary": "Set password for user.", - "operationId": "adminUpdateUserPassword", + "summary": "Update notification channel by ID.", + "operationId": "updateAlertNotificationChannel", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AdminUpdateUserPasswordForm" + "$ref": "#/definitions/UpdateAlertNotificationCommand" } }, { "type": "integer", "format": "int64", - "name": "user_id", + "name": "notification_channel_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1290,33 +1151,26 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "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:*`.", + }, + "delete": { + "description": "Deletes an existing notification channel identified by ID.", "tags": [ - "admin_users" + "legacy_alerts_notification_channels" ], - "summary": "Set permissions for user.", - "operationId": "adminUpdateUserPermissions", + "summary": "Delete alert notification by ID.", + "operationId": "deleteAlertNotificationChannel", "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AdminUpdateUserPermissionsForm" - } - }, { "type": "integer", "format": "int64", - "name": "user_id", + "name": "notification_channel_id", "in": "path", "required": true } @@ -1325,221 +1179,170 @@ "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/users/{user_id}/quotas": { + "/alerts": { "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" + "legacy_alerts" ], - "summary": "Fetch user quota.", - "operationId": "getUserQuota", + "summary": "Get legacy alerts.", + "operationId": "getAlerts", "parameters": [ + { + "type": "array", + "items": { + "type": "string" + }, + "description": "Limit response to alerts in specified dashboard(s). You can specify multiple dashboards.", + "name": "dashboardId", + "in": "query" + }, { "type": "integer", "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getQuotaResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "description": "Limit response to alert for a specified panel on a dashboard.", + "name": "panelId", + "in": "query" }, - "404": { - "$ref": "#/responses/notFoundError" + { + "type": "string", + "description": "Limit response to alerts having a name like this value.", + "name": "query", + "in": "query" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/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": [ + "enum": [ + "all", + "no_data", + "paused", + "alerting", + "ok", + "pending", + "unknown" + ], + "type": "string", + "description": "Return alerts with one or more of the following alert states", + "name": "state", + "in": "query" + }, { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateUserQuotaCmd" - } + "type": "integer", + "format": "int64", + "description": "Limit response to X number of alerts.", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "Limit response to alerts of dashboards in specified folder(s). You can specify multiple folders", + "name": "folderId", + "in": "query" }, { "type": "string", - "name": "quota_target", - "in": "path", - "required": true + "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": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "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:*`.", + "/alerts/states-for-dashboard": { + "get": { "tags": [ - "admin_users" + "legacy_alerts" ], - "summary": "Revoke auth token for user.", - "operationId": "adminRevokeUserAuthToken", + "summary": "Get alert states for a dashboard.", + "operationId": "getDashboardStates", "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RevokeAuthTokenCmd" - } - }, { "type": "integer", "format": "int64", - "name": "user_id", - "in": "path", + "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" + "legacy_alerts" ], - "summary": "Create notification channel.", - "operationId": "createAlertNotificationChannel", + "summary": "Test alert.", + "operationId": "testAlert", "parameters": [ { "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" @@ -1547,54 +1350,61 @@ } } }, - "/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.", + "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_notification_channels" + "legacy_alerts" + ], + "summary": "Get alert by ID.", + "operationId": "getAlertByID", + "parameters": [ + { + "type": "string", + "name": "alert_id", + "in": "path", + "required": true + } ], - "summary": "Get all notification channels (lookup).", - "operationId": "getAlertNotificationLookup", "responses": { "200": { - "$ref": "#/responses/getAlertNotificationLookupResponse" + "$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" + "legacy_alerts" ], - "summary": "Test notification channel.", - "operationId": "notificationChannelTest", + "summary": "Pause/unpause alert by id.", + "operationId": "pauseAlert", "parameters": [ + { + "type": "string", + "name": "alert_id", + "in": "path", + "required": true + }, { "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" @@ -1602,8 +1412,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "412": { - "$ref": "#/responses/SMTPNotEnabledError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -1611,99 +1421,132 @@ } } }, - "/alert-notifications/uid/{notification_channel_uid}": { + "/annotations": { "get": { - "description": "Returns the notification channel given the notification channel UID.", + "description": "Starting in Grafana v6.4 regions annotations are now returned in one entity that now includes the timeEnd property.", "tags": [ - "legacy_alerts_notification_channels" + "annotations" ], - "summary": "Get notification channel by UID.", - "operationId": "getAlertNotificationChannelByUID", + "summary": "Find Annotations.", + "operationId": "getAnnotations", "parameters": [ { - "type": "string", - "name": "notification_channel_uid", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "type": "integer", + "format": "int64", + "description": "Find annotations created after specific epoch datetime in milliseconds.", + "name": "from", + "in": "query" }, - "403": { - "$ref": "#/responses/forbiddenError" + { + "type": "integer", + "format": "int64", + "description": "Find annotations created before specific epoch datetime in milliseconds.", + "name": "to", + "in": "query" }, - "404": { - "$ref": "#/responses/notFoundError" + { + "type": "integer", + "format": "int64", + "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 uid.", - "tags": [ - "legacy_alerts_notification_channels" - ], - "summary": "Update notification channel by UID.", - "operationId": "updateAlertNotificationChannelByUID", - "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateAlertNotificationWithUidCommand" - } + "type": "integer", + "format": "int64", + "description": "Find annotations for a specified alert.", + "name": "alertId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations that are scoped to a specific dashboard", + "name": "dashboardId", + "in": "query" }, { "type": "string", - "name": "notification_channel_uid", - "in": "path", - "required": true + "description": "Find annotations that are scoped to a specific dashboard", + "name": "dashboardUID", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations that are scoped to a specific panel", + "name": "panelId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Max limit for results returned.", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "Use this to filter organization annotations. Organization 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", + "description": "Return alerts or user created annotations", + "name": "type", + "in": "query" + }, + { + "type": "boolean", + "description": "Match any or all tags", + "name": "matchAny", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/getAnnotationsResponse" }, "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.", + "post": { + "description": "Creates an annotation in the Grafana database. The dashboardId and panelId fields are optional. If they are not specified then an organization 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": [ - "legacy_alerts_notification_channels" + "annotations" ], - "summary": "Delete alert notification by UID.", - "operationId": "deleteAlertNotificationChannelByUID", + "summary": "Create Annotation.", + "operationId": "postAnnotation", "parameters": [ { - "type": "string", - "name": "notification_channel_uid", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PostAnnotationsCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/deleteAlertNotificationChannelResponse" + "$ref": "#/responses/postAnnotationResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1711,35 +1554,36 @@ "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.", + "/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": [ - "legacy_alerts_notification_channels" + "annotations" ], - "summary": "Get notification channel by ID.", - "operationId": "getAlertNotificationChannelByID", + "summary": "Create Annotation in Graphite format.", + "operationId": "postGraphiteAnnotation", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "notification_channel_id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PostGraphiteAnnotationsCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/postAnnotationResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1747,240 +1591,211 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "Updates an existing notification channel identified by ID.", + } + }, + "/annotations/mass-delete": { + "post": { "tags": [ - "legacy_alerts_notification_channels" + "annotations" ], - "summary": "Update notification channel by ID.", - "operationId": "updateAlertNotificationChannel", + "summary": "Delete multiple annotations.", + "operationId": "massDeleteAnnotations", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateAlertNotificationCommand" + "$ref": "#/definitions/MassDeleteAnnotationsCmd" } - }, - { - "type": "integer", - "format": "int64", - "name": "notification_channel_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" }, "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.", + } + }, + "/annotations/tags": { + "get": { + "description": "Find all the event tags created in the annotations.", "tags": [ - "legacy_alerts_notification_channels" + "annotations" ], - "summary": "Delete alert notification by ID.", - "operationId": "deleteAlertNotificationChannel", + "summary": "Find Annotations Tags.", + "operationId": "getAnnotationTags", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "notification_channel_id", - "in": "path", - "required": true + "type": "string", + "description": "Tag is a string that you can use to filter tags.", + "name": "tag", + "in": "query" + }, + { + "type": "string", + "default": "100", + "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" } } } }, - "/alerts": { + "/annotations/{annotation_id}": { "get": { "tags": [ - "legacy_alerts" + "annotations" ], - "summary": "Get legacy alerts.", - "operationId": "getAlerts", + "summary": "Get Annotation by ID.", + "operationId": "getAnnotationByID", "parameters": [ { - "type": "array", - "items": { - "type": "string" - }, - "description": "Limit response to alerts in specified dashboard(s). You can specify multiple dashboards.", - "name": "dashboardId", - "in": "query" + "type": "string", + "name": "annotation_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAnnotationByIDResponse" }, - { - "type": "integer", - "format": "int64", - "description": "Limit response to alert for a specified panel on a dashboard.", - "name": "panelId", - "in": "query" + "401": { + "$ref": "#/responses/unauthorisedError" }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "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", - "description": "Limit response to alerts having a name like this value.", - "name": "query", - "in": "query" + "name": "annotation_id", + "in": "path", + "required": true }, { - "enum": [ - "all", - "no_data", - "paused", - "alerting", - "ok", - "pending", - "unknown" - ], - "type": "string", - "description": "Return alerts with one or more of the following alert states", - "name": "state", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Limit response to X number of alerts.", - "name": "limit", - "in": "query" - }, - { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "description": "Limit response to alerts of dashboards in specified folder(s). You can specify multiple folders", - "name": "folderId", - "in": "query" - }, - { - "type": "string", - "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", - "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" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateAnnotationsCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/getAlertsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/alerts/states-for-dashboard": { - "get": { + }, + "delete": { + "description": "Deletes the annotation that matches the specified ID.", "tags": [ - "legacy_alerts" + "annotations" ], - "summary": "Get alert states for a dashboard.", - "operationId": "getDashboardStates", + "summary": "Delete Annotation By ID.", + "operationId": "deleteAnnotationByID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "dashboardId", - "in": "query", + "type": "string", + "name": "annotation_id", + "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDashboardStatesResponse" + "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/alerts/test": { - "post": { + }, + "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": [ - "legacy_alerts" + "annotations" ], - "summary": "Test alert.", - "operationId": "testAlert", + "summary": "Patch Annotation.", + "operationId": "patchAnnotation", "parameters": [ + { + "type": "string", + "name": "annotation_id", + "in": "path", + "required": true + }, { "name": "body", "in": "body", + "required": true, "schema": { - "$ref": "#/definitions/AlertTestCommand" + "$ref": "#/definitions/PatchAnnotationsCmd" } } ], "responses": { "200": { - "$ref": "#/responses/testAlertResponse" + "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "422": { - "$ref": "#/responses/unprocessableEntityError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -1988,2292 +1803,673 @@ } } }, - "/alerts/{alert_id}": { + "/api/v1/provisioning/alert-rules": { + "post": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Create a new alert rule.", + "operationId": "RoutePostAlertRule", + "parameters": [ + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/ProvisionedAlertRule" + } + } + ], + "responses": { + "201": { + "description": "ProvisionedAlertRule", + "schema": { + "$ref": "#/definitions/ProvisionedAlertRule" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + } + }, + "/api/v1/provisioning/alert-rules/{UID}": { "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" + "provisioning" ], - "summary": "Get alert by ID.", - "operationId": "getAlertByID", + "summary": "Get a specific alert rule by UID.", + "operationId": "RouteGetAlertRule", "parameters": [ { "type": "string", - "name": "alert_id", + "description": "Alert rule UID", + "name": "UID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "description": "ProvisionedAlertRule", + "schema": { + "$ref": "#/definitions/ProvisionedAlertRule" + } }, - "500": { - "$ref": "#/responses/internalServerError" + "404": { + "description": " Not found." } } - } - }, - "/alerts/{alert_id}/pause": { - "post": { + }, + "put": { + "consumes": [ + "application/json" + ], "tags": [ - "legacy_alerts" + "provisioning" ], - "summary": "Pause/unpause alert by id.", - "operationId": "pauseAlert", + "summary": "Update an existing alert rule.", + "operationId": "RoutePutAlertRule", "parameters": [ { "type": "string", - "name": "alert_id", + "description": "Alert rule UID", + "name": "UID", "in": "path", "required": true }, { - "name": "body", + "name": "Body", "in": "body", - "required": true, "schema": { - "$ref": "#/definitions/PauseAlertCommand" + "$ref": "#/definitions/ProvisionedAlertRule" } } ], "responses": { "200": { - "$ref": "#/responses/pauseAlertResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "description": "ProvisionedAlertRule", + "schema": { + "$ref": "#/definitions/ProvisionedAlertRule" + } }, - "500": { - "$ref": "#/responses/internalServerError" + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + }, + "delete": { + "tags": [ + "provisioning" + ], + "summary": "Delete a specific alert rule by UID.", + "operationId": "RouteDeleteAlertRule", + "parameters": [ + { + "type": "string", + "description": "Alert rule UID", + "name": "UID", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": " The alert rule was deleted successfully." } } } }, - "/annotations": { + "/api/v1/provisioning/contact-points": { "get": { - "description": "Starting in Grafana v6.4 regions annotations are now returned in one entity that now includes the timeEnd property.", "tags": [ - "annotations" + "provisioning" ], - "summary": "Find Annotations.", - "operationId": "getAnnotations", + "summary": "Get all the contact points.", + "operationId": "RouteGetContactpoints", "parameters": [ { - "type": "integer", - "format": "int64", - "description": "Find annotations created after specific epoch datetime in milliseconds.", - "name": "from", + "type": "string", + "description": "Filter by name", + "name": "name", "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations created before specific epoch datetime in milliseconds.", - "name": "to", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Limit response to annotations created by specific user.", - "name": "userId", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations for a specified alert.", - "name": "alertId", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations that are scoped to a specific dashboard", - "name": "dashboardId", - "in": "query" - }, - { - "type": "string", - "description": "Find annotations that are scoped to a specific dashboard", - "name": "dashboardUID", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations that are scoped to a specific panel", - "name": "panelId", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Max limit for results returned.", - "name": "limit", - "in": "query" - }, - { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "description": "Use this to filter organization annotations. Organization 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", - "description": "Return alerts or user created annotations", - "name": "type", - "in": "query" - }, - { - "type": "boolean", - "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 an organization 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": "postAnnotation", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PostAnnotationsCmd" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/postAnnotationResponse" - }, - "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": "postGraphiteAnnotation", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PostGraphiteAnnotationsCmd" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/postAnnotationResponse" - }, - "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": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/MassDeleteAnnotationsCmd" - } - } - ], - "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", - "description": "Tag is a string that you can use to filter tags.", - "name": "tag", - "in": "query" - }, - { - "type": "string", - "default": "100", - "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}": { - "get": { - "tags": [ - "annotations" - ], - "summary": "Get Annotation by ID.", - "operationId": "getAnnotationByID", - "parameters": [ - { - "type": "string", - "name": "annotation_id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAnnotationByIDResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "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", - "name": "annotation_id", - "in": "path", - "required": true - }, - { - "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": "deleteAnnotationByID", - "parameters": [ - { - "type": "string", - "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", - "name": "annotation_id", - "in": "path", - "required": true - }, - { - "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" - } - } - } - }, - "/api/v1/provisioning/alert-rules": { - "post": { - "consumes": [ - "application/json" - ], - "tags": [ - "provisioning" - ], - "summary": "Create a new alert rule.", - "operationId": "RoutePostAlertRule", - "parameters": [ - { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/ProvisionedAlertRule" - } - } - ], - "responses": { - "201": { - "description": "ProvisionedAlertRule", - "schema": { - "$ref": "#/definitions/ProvisionedAlertRule" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - } - }, - "/api/v1/provisioning/alert-rules/{UID}": { - "get": { - "tags": [ - "provisioning" - ], - "summary": "Get a specific alert rule by UID.", - "operationId": "RouteGetAlertRule", - "parameters": [ - { - "type": "string", - "description": "Alert rule UID", - "name": "UID", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ProvisionedAlertRule", - "schema": { - "$ref": "#/definitions/ProvisionedAlertRule" - } - }, - "404": { - "description": " Not found." - } - } - }, - "put": { - "consumes": [ - "application/json" - ], - "tags": [ - "provisioning" - ], - "summary": "Update an existing alert rule.", - "operationId": "RoutePutAlertRule", - "parameters": [ - { - "type": "string", - "description": "Alert rule UID", - "name": "UID", - "in": "path", - "required": true - }, - { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/ProvisionedAlertRule" - } - } - ], - "responses": { - "200": { - "description": "ProvisionedAlertRule", - "schema": { - "$ref": "#/definitions/ProvisionedAlertRule" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - }, - "delete": { - "tags": [ - "provisioning" - ], - "summary": "Delete a specific alert rule by UID.", - "operationId": "RouteDeleteAlertRule", - "parameters": [ - { - "type": "string", - "description": "Alert rule UID", - "name": "UID", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": " The alert rule was deleted successfully." - } - } - } - }, - "/api/v1/provisioning/contact-points": { - "get": { - "tags": [ - "provisioning" - ], - "summary": "Get all the contact points.", - "operationId": "RouteGetContactpoints", - "parameters": [ - { - "type": "string", - "description": "Filter by name", - "name": "name", - "in": "query" - } - ], - "responses": { - "200": { - "description": "ContactPoints", - "schema": { - "$ref": "#/definitions/ContactPoints" - } - } - } - }, - "post": { - "consumes": [ - "application/json" - ], - "tags": [ - "provisioning" - ], - "summary": "Create a contact point.", - "operationId": "RoutePostContactpoints", - "parameters": [ - { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/EmbeddedContactPoint" - } - } - ], - "responses": { - "202": { - "description": "EmbeddedContactPoint", - "schema": { - "$ref": "#/definitions/EmbeddedContactPoint" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - } - }, - "/api/v1/provisioning/contact-points/{UID}": { - "put": { - "consumes": [ - "application/json" - ], - "tags": [ - "provisioning" - ], - "summary": "Update an existing contact point.", - "operationId": "RoutePutContactpoint", - "parameters": [ - { - "type": "string", - "description": "UID is the contact point unique identifier", - "name": "UID", - "in": "path", - "required": true - }, - { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/EmbeddedContactPoint" - } - } - ], - "responses": { - "202": { - "description": "Ack", - "schema": { - "$ref": "#/definitions/Ack" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - }, - "delete": { - "consumes": [ - "application/json" - ], - "tags": [ - "provisioning" - ], - "summary": "Delete a contact point.", - "operationId": "RouteDeleteContactpoints", - "parameters": [ - { - "type": "string", - "description": "UID is the contact point unique identifier", - "name": "UID", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": " The contact point was deleted successfully." - } - } - } - }, - "/api/v1/provisioning/folder/{FolderUID}/rule-groups/{Group}": { - "get": { - "tags": [ - "provisioning" - ], - "summary": "Get a rule group.", - "operationId": "RouteGetAlertRuleGroup", - "parameters": [ - { - "type": "string", - "name": "FolderUID", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "Group", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "AlertRuleGroup", - "schema": { - "$ref": "#/definitions/AlertRuleGroup" - } - }, - "404": { - "description": " Not found." - } - } - }, - "put": { - "consumes": [ - "application/json" - ], - "tags": [ - "provisioning" - ], - "summary": "Update the interval of a rule group.", - "operationId": "RoutePutAlertRuleGroup", - "parameters": [ - { - "type": "string", - "name": "FolderUID", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "Group", - "in": "path", - "required": true - }, - { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/AlertRuleGroup" - } - } - ], - "responses": { - "200": { - "description": "AlertRuleGroup", - "schema": { - "$ref": "#/definitions/AlertRuleGroup" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - } - }, - "/api/v1/provisioning/mute-timings": { - "get": { - "tags": [ - "provisioning" - ], - "summary": "Get all the mute timings.", - "operationId": "RouteGetMuteTimings", - "responses": { - "200": { - "description": "MuteTimings", - "schema": { - "$ref": "#/definitions/MuteTimings" - } - } - } - }, - "post": { - "consumes": [ - "application/json" - ], - "tags": [ - "provisioning" - ], - "summary": "Create a new mute timing.", - "operationId": "RoutePostMuteTiming", - "parameters": [ - { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/MuteTimeInterval" - } - } - ], - "responses": { - "201": { - "description": "MuteTimeInterval", - "schema": { - "$ref": "#/definitions/MuteTimeInterval" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - } - }, - "/api/v1/provisioning/mute-timings/{name}": { - "get": { - "tags": [ - "provisioning" - ], - "summary": "Get a mute timing.", - "operationId": "RouteGetMuteTiming", - "parameters": [ - { - "type": "string", - "description": "Mute timing name", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "MuteTimeInterval", - "schema": { - "$ref": "#/definitions/MuteTimeInterval" - } - }, - "404": { - "description": " Not found." - } - } - }, - "put": { - "consumes": [ - "application/json" - ], - "tags": [ - "provisioning" - ], - "summary": "Replace an existing mute timing.", - "operationId": "RoutePutMuteTiming", - "parameters": [ - { - "type": "string", - "description": "Mute timing name", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/MuteTimeInterval" - } - } - ], - "responses": { - "200": { - "description": "MuteTimeInterval", - "schema": { - "$ref": "#/definitions/MuteTimeInterval" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - }, - "delete": { - "tags": [ - "provisioning" - ], - "summary": "Delete a mute timing.", - "operationId": "RouteDeleteMuteTiming", - "parameters": [ - { - "type": "string", - "description": "Mute timing name", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": " The mute timing was deleted successfully." - } - } - } - }, - "/api/v1/provisioning/policies": { - "get": { - "tags": [ - "provisioning" - ], - "summary": "Get the notification policy tree.", - "operationId": "RouteGetPolicyTree", - "responses": { - "200": { - "description": "Route", - "schema": { - "$ref": "#/definitions/Route" - } - } - } - }, - "put": { - "consumes": [ - "application/json" - ], - "tags": [ - "provisioning" - ], - "summary": "Sets the notification policy tree.", - "operationId": "RoutePutPolicyTree", - "parameters": [ - { - "description": "The new notification routing tree to use", - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/Route" - } - } - ], - "responses": { - "202": { - "description": "Ack", - "schema": { - "$ref": "#/definitions/Ack" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - }, - "delete": { - "consumes": [ - "application/json" - ], - "tags": [ - "provisioning" - ], - "summary": "Clears the notification policy tree.", - "operationId": "RouteResetPolicyTree", - "responses": { - "202": { - "description": "Ack", - "schema": { - "$ref": "#/definitions/Ack" - } - } - } - } - }, - "/api/v1/provisioning/templates": { - "get": { - "tags": [ - "provisioning" - ], - "summary": "Get all message templates.", - "operationId": "RouteGetTemplates", - "responses": { - "200": { - "description": "MessageTemplates", - "schema": { - "$ref": "#/definitions/MessageTemplates" - } - }, - "404": { - "description": " Not found." - } - } - } - }, - "/api/v1/provisioning/templates/{name}": { - "get": { - "tags": [ - "provisioning" - ], - "summary": "Get a message template.", - "operationId": "RouteGetTemplate", - "parameters": [ - { - "type": "string", - "description": "Template Name", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "MessageTemplate", - "schema": { - "$ref": "#/definitions/MessageTemplate" - } - }, - "404": { - "description": " Not found." - } - } - }, - "put": { - "consumes": [ - "application/json" - ], - "tags": [ - "provisioning" - ], - "summary": "Updates an existing template.", - "operationId": "RoutePutTemplate", - "parameters": [ - { - "type": "string", - "description": "Template Name", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/MessageTemplateContent" - } - } - ], - "responses": { - "202": { - "description": "MessageTemplate", - "schema": { - "$ref": "#/definitions/MessageTemplate" - } - }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - }, - "delete": { - "tags": [ - "provisioning" - ], - "summary": "Delete a template.", - "operationId": "RouteDeleteTemplate", - "parameters": [ - { - "type": "string", - "description": "Template Name", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": " The template was deleted successfully." - } - } - } - }, - "/auth/keys": { - "get": { - "description": "Will return auth keys.", - "tags": [ - "api_keys" - ], - "summary": "Get auth keys.", - "operationId": "getAPIkeys", - "parameters": [ - { - "type": "boolean", - "default": false, - "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/AddCommand" - } - } - ], - "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", - "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": "searchDashboardSnapshots", - "parameters": [ - { - "type": "string", - "description": "Search Query", - "name": "query", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 1000, - "description": "Limit the number of returned results", - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "$ref": "#/responses/searchDashboardSnapshotsResponse" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboards/calculate-diff": { - "post": { - "produces": [ - "application/json", - "text/html" - ], - "tags": [ - "dashboards" - ], - "summary": "Perform diff on two dashboards.", - "operationId": "calculateDashboardDiff", - "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" - ] - }, - "new": { - "$ref": "#/definitions/CalculateDiffTarget" - } - } - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/calculateDashboardDiffResponse" - }, - "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": { - "description": "Please refer to [updated API](#/dashboard_permissions/getDashboardPermissionsListByUID) instead", - "tags": [ - "dashboard_permissions" - ], - "summary": "Gets all existing permissions for the given dashboard.", - "operationId": "getDashboardPermissionsListByID", - "deprecated": true, - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "DashboardID", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getDashboardPermissionsListResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "post": { - "description": "Please refer to [updated API](#/dashboard_permissions/updateDashboardPermissionsByUID) instead\n\nThis operation will remove existing permissions if they’re not included in the request.", - "tags": [ - "dashboard_permissions" - ], - "summary": "Updates permissions for a dashboard.", - "operationId": "updateDashboardPermissionsByID", - "deprecated": true, - "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": { - "description": "Please refer to [updated API](#/dashboard_versions/restoreDashboardVersionByUID) instead", - "tags": [ - "dashboard_versions" - ], - "summary": "Restore a dashboard to a given dashboard version.", - "operationId": "restoreDashboardVersionByID", - "deprecated": true, - "parameters": [ - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RestoreDashboardVersionCommand" - } - }, - { - "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": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionsByUID) instead", - "tags": [ - "dashboard_versions" - ], - "summary": "Gets all existing versions for the dashboard.", - "operationId": "getDashboardVersionsByID", - "deprecated": true, - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "DashboardID", - "in": "path", - "required": true - } - ], - "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": { - "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionByUID) instead", - "tags": [ - "dashboard_versions" - ], - "summary": "Get a specific dashboard version.", - "operationId": "getDashboardVersionByID", - "deprecated": true, - "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/getDashboardsTagsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "description": "ContactPoints", + "schema": { + "$ref": "#/definitions/ContactPoints" + } } } - } - }, - "/dashboards/trim": { + }, "post": { + "consumes": [ + "application/json" + ], "tags": [ - "dashboards" + "provisioning" ], - "summary": "Trim defaults from dashboard.", - "operationId": "trimDashboard", + "summary": "Create a contact point.", + "operationId": "RoutePostContactpoints", "parameters": [ { "name": "Body", "in": "body", - "required": true, "schema": { - "$ref": "#/definitions/TrimDashboardCommand" + "$ref": "#/definitions/EmbeddedContactPoint" } } ], "responses": { - "200": { - "$ref": "#/responses/trimDashboardResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "202": { + "description": "EmbeddedContactPoint", + "schema": { + "$ref": "#/definitions/EmbeddedContactPoint" + } }, - "500": { - "$ref": "#/responses/internalServerError" + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } } }, - "/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", - "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", - "name": "uid", - "in": "path", - "required": true - } + "/api/v1/provisioning/contact-points/{UID}": { + "put": { + "consumes": [ + "application/json" ], - "responses": { - "200": { - "$ref": "#/responses/deleteDashboardResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboards/uid/{uid}/permissions": { - "get": { "tags": [ - "dashboard_permissions" + "provisioning" ], - "summary": "Gets all existing permissions for the given dashboard.", - "operationId": "getDashboardPermissionsListByUID", + "summary": "Update an existing contact point.", + "operationId": "RoutePutContactpoint", "parameters": [ { "type": "string", - "name": "uid", + "description": "UID is the contact point unique identifier", + "name": "UID", "in": "path", "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getDashboardPermissionsListResponse" - }, - "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": "updateDashboardPermissionsByUID", - "parameters": [ { "name": "Body", "in": "body", - "required": true, "schema": { - "$ref": "#/definitions/UpdateDashboardACLCommand" + "$ref": "#/definitions/EmbeddedContactPoint" } - }, - { - "type": "string", - "name": "uid", - "in": "path", - "required": true } ], "responses": { - "200": { - "$ref": "#/responses/okResponse" + "202": { + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } }, "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } - } - }, - "/dashboards/uid/{uid}/restore": { - "post": { + }, + "delete": { + "consumes": [ + "application/json" + ], "tags": [ - "dashboard_versions" + "provisioning" ], - "summary": "Restore a dashboard to a given dashboard version using UID.", - "operationId": "restoreDashboardVersionByUID", + "summary": "Delete a contact point.", + "operationId": "RouteDeleteContactpoints", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RestoreDashboardVersionCommand" - } - }, - { - "type": "string", - "name": "uid", - "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" + "type": "string", + "description": "UID is the contact point unique identifier", + "name": "UID", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": " The contact point was deleted successfully." } } } }, - "/dashboards/uid/{uid}/versions": { + "/api/v1/provisioning/folder/{FolderUID}/rule-groups/{Group}": { "get": { "tags": [ - "dashboard_versions" + "provisioning" ], - "summary": "Gets all existing versions for the dashboard using UID.", - "operationId": "getDashboardVersionsByUID", + "summary": "Get a rule group.", + "operationId": "RouteGetAlertRuleGroup", "parameters": [ { "type": "string", - "name": "uid", + "name": "FolderUID", "in": "path", "required": true }, { - "type": "integer", - "format": "int64", - "default": 0, - "description": "Maximum number of results to return", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 0, - "description": "Version to start from when returning queries", - "name": "start", - "in": "query" + "type": "string", + "name": "Group", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "description": "AlertRuleGroup", + "schema": { + "$ref": "#/definitions/AlertRuleGroup" + } }, "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "description": " Not found." } } - } - }, - "/dashboards/uid/{uid}/versions/{DashboardVersionID}": { - "get": { + }, + "put": { + "consumes": [ + "application/json" + ], "tags": [ - "dashboard_versions" + "provisioning" ], - "summary": "Get a specific dashboard version using UID.", - "operationId": "getDashboardVersionByUID", + "summary": "Update the interval of a rule group.", + "operationId": "RoutePutAlertRuleGroup", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardVersionID", + "type": "string", + "name": "FolderUID", "in": "path", "required": true }, { "type": "string", - "name": "uid", + "name": "Group", "in": "path", "required": true + }, + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/AlertRuleGroup" + } } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "description": "AlertRuleGroup", + "schema": { + "$ref": "#/definitions/AlertRuleGroup" + } }, - "500": { - "$ref": "#/responses/internalServerError" + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } } }, - "/datasources": { + "/api/v1/provisioning/mute-timings": { "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" + "provisioning" ], - "summary": "Get all data sources.", - "operationId": "getDataSources", + "summary": "Get all the mute timings.", + "operationId": "RouteGetMuteTimings", "responses": { "200": { - "$ref": "#/responses/getDataSourcesResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "description": "MuteTimings", + "schema": { + "$ref": "#/definitions/MuteTimings" + } } } }, "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`", + "consumes": [ + "application/json" + ], "tags": [ - "datasources" + "provisioning" ], - "summary": "Create a data source.", - "operationId": "addDataSource", + "summary": "Create a new mute timing.", + "operationId": "RoutePostMuteTiming", "parameters": [ { "name": "Body", "in": "body", - "required": true, "schema": { - "$ref": "#/definitions/AddDataSourceCommand" + "$ref": "#/definitions/MuteTimeInterval" } } ], "responses": { - "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "409": { - "$ref": "#/responses/conflictError" + "201": { + "description": "MuteTimeInterval", + "schema": { + "$ref": "#/definitions/MuteTimeInterval" + } }, - "500": { - "$ref": "#/responses/internalServerError" + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } } }, - "/datasources/correlations": { + "/api/v1/provisioning/mute-timings/{name}": { "get": { "tags": [ - "correlations" + "provisioning" + ], + "summary": "Get a mute timing.", + "operationId": "RouteGetMuteTiming", + "parameters": [ + { + "type": "string", + "description": "Mute timing name", + "name": "name", + "in": "path", + "required": true + } ], - "summary": "Gets all correlations.", - "operationId": "getCorrelations", "responses": { "200": { - "$ref": "#/responses/getCorrelationsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "description": "MuteTimeInterval", + "schema": { + "$ref": "#/definitions/MuteTimeInterval" + } }, "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "description": " Not found." } } - } - }, - "/datasources/id/{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).", + }, + "put": { + "consumes": [ + "application/json" + ], "tags": [ - "datasources" + "provisioning" ], - "summary": "Get data source Id by Name.", - "operationId": "getDataSourceIdByName", + "summary": "Replace an existing mute timing.", + "operationId": "RoutePutMuteTiming", "parameters": [ { "type": "string", + "description": "Mute timing name", "name": "name", "in": "path", "required": true + }, + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/MuteTimeInterval" + } } ], "responses": { "200": { - "$ref": "#/responses/getDataSourceIDResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "description": "MuteTimeInterval", + "schema": { + "$ref": "#/definitions/MuteTimeInterval" + } }, - "500": { - "$ref": "#/responses/internalServerError" + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + }, + "delete": { + "tags": [ + "provisioning" + ], + "summary": "Delete a mute timing.", + "operationId": "RouteDeleteMuteTiming", + "parameters": [ + { + "type": "string", + "description": "Mute timing name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": " The mute timing was deleted successfully." } } } }, - "/datasources/name/{name}": { + "/api/v1/provisioning/policies": { "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" + "provisioning" ], - "summary": "Get a single data source by Name.", - "operationId": "getDataSourceByName", + "summary": "Get the notification policy tree.", + "operationId": "RouteGetPolicyTree", + "responses": { + "200": { + "description": "Route", + "schema": { + "$ref": "#/definitions/Route" + } + } + } + }, + "put": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Sets the notification policy tree.", + "operationId": "RoutePutPolicyTree", "parameters": [ { - "type": "string", - "name": "name", - "in": "path", - "required": true + "description": "The new notification routing tree to use", + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/Route" + } } ], "responses": { - "200": { - "$ref": "#/responses/getDataSourceResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "202": { + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } }, - "500": { - "$ref": "#/responses/internalServerError" + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } }, "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).", + "consumes": [ + "application/json" + ], "tags": [ - "datasources" + "provisioning" ], - "summary": "Delete an existing data source by name.", - "operationId": "deleteDataSourceByName", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true + "summary": "Clears the notification policy tree.", + "operationId": "RouteResetPolicyTree", + "responses": { + "202": { + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } } + } + } + }, + "/api/v1/provisioning/templates": { + "get": { + "tags": [ + "provisioning" ], + "summary": "Get all message templates.", + "operationId": "RouteGetTemplates", "responses": { "200": { - "$ref": "#/responses/deleteDataSourceByNameResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "description": "MessageTemplates", + "schema": { + "$ref": "#/definitions/MessageTemplates" + } }, "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "description": " Not found." } } } }, - "/datasources/proxy/uid/{uid}/{datasource_proxy_route}": { + "/api/v1/provisioning/templates/{name}": { "get": { - "description": "Proxies all calls to the actual data source.", "tags": [ - "datasources" + "provisioning" ], - "summary": "Data source proxy GET calls.", - "operationId": "datasourceProxyGETByUIDcalls", + "summary": "Get a message template.", + "operationId": "RouteGetTemplate", "parameters": [ { "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "uid", + "description": "Template Name", + "name": "name", "in": "path", "required": true } ], "responses": { "200": { - "description": "(empty)" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "description": "MessageTemplate", + "schema": { + "$ref": "#/definitions/MessageTemplate" + } }, "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "description": " Not found." } } }, - "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", + "put": { + "consumes": [ + "application/json" + ], "tags": [ - "datasources" + "provisioning" ], - "summary": "Data source proxy POST calls.", - "operationId": "datasourceProxyPOSTByUIDcalls", + "summary": "Updates an existing template.", + "operationId": "RoutePutTemplate", "parameters": [ - { - "name": "DatasourceProxyParam", - "in": "body", - "required": true, - "schema": {} - }, { "type": "string", - "name": "datasource_proxy_route", + "description": "Template Name", + "name": "name", "in": "path", "required": true }, { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/MessageTemplateContent" + } } ], "responses": { - "201": { - "description": "(empty)" - }, "202": { - "description": "(empty)" + "description": "MessageTemplate", + "schema": { + "$ref": "#/definitions/MessageTemplate" + } }, "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } }, "delete": { - "description": "Proxies all calls to the actual data source.", "tags": [ - "datasources" + "provisioning" ], - "summary": "Data source proxy DELETE calls.", - "operationId": "datasourceProxyDELETEByUIDcalls", + "summary": "Delete a template.", + "operationId": "RouteDeleteTemplate", "parameters": [ { "type": "string", - "name": "uid", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "datasource_proxy_route", + "description": "Template Name", + "name": "name", "in": "path", "required": true } ], "responses": { - "202": { - "description": "(empty)" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "204": { + "description": " The template was deleted successfully." } } } }, - "/datasources/proxy/{id}/{datasource_proxy_route}": { + "/auth/keys": { "get": { - "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyGETByUIDcalls) instead", + "description": "Will return auth keys.", "tags": [ - "datasources" + "api_keys" ], - "summary": "Data source proxy GET calls.", - "operationId": "datasourceProxyGETcalls", - "deprecated": true, - "parameters": [ - { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", - "in": "path", - "required": true + "summary": "Get auth keys.", + "operationId": "getAPIkeys", + "parameters": [ + { + "type": "boolean", + "default": false, + "description": "Show expired keys", + "name": "includeExpired", + "in": "query" } ], "responses": { "200": { - "description": "(empty)" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getAPIkeyResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4290,39 +2486,25 @@ } }, "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\n\nPlease refer to [updated API](#/datasources/datasourceProxyPOSTByUIDcalls) instead", + "description": "Will return details of the created API key.", "tags": [ - "datasources" + "api_keys" ], - "summary": "Data source proxy POST calls.", - "operationId": "datasourceProxyPOSTcalls", - "deprecated": true, + "summary": "Creates an API key.", + "operationId": "addAPIkey", "parameters": [ { - "name": "DatasourceProxyParam", + "name": "Body", "in": "body", "required": true, - "schema": {} - }, - { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", - "in": "path", - "required": true + "schema": { + "$ref": "#/definitions/AddCommand" + } } ], "responses": { - "201": { - "description": "(empty)" - }, - "202": { - "description": "(empty)" + "200": { + "$ref": "#/responses/postAPIkeyResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4333,42 +2515,34 @@ "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.\n\nPlease refer to [updated API](#/datasources/datasourceProxyDELETEByUIDcalls) instead", "tags": [ - "datasources" + "api_keys" ], - "summary": "Data source proxy DELETE calls.", - "operationId": "datasourceProxyDELETEcalls", - "deprecated": true, + "summary": "Delete API key.", + "operationId": "deleteAPIkey", "parameters": [ { - "type": "string", + "type": "integer", + "format": "int64", "name": "id", "in": "path", "required": true - }, - { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true } ], "responses": { - "202": { - "description": "(empty)" - }, - "400": { - "$ref": "#/responses/badRequestError" + "200": { + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4385,64 +2559,79 @@ } } }, - "/datasources/uid/{sourceUID}/correlations": { + "/dashboard/snapshots": { "get": { "tags": [ - "correlations" + "snapshots" ], - "summary": "Gets all correlations originating from the given data source.", - "operationId": "getCorrelationsBySourceUID", + "summary": "List snapshots.", + "operationId": "searchDashboardSnapshots", "parameters": [ { "type": "string", - "name": "sourceUID", - "in": "path", - "required": true + "description": "Search Query", + "name": "query", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1000, + "description": "Limit the number of returned results", + "name": "limit", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/getCorrelationsBySourceUIDResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "$ref": "#/responses/searchDashboardSnapshotsResponse" }, "500": { "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/dashboards/calculate-diff": { "post": { + "produces": [ + "application/json", + "text/html" + ], "tags": [ - "correlations" + "dashboards" ], - "summary": "Add correlation.", - "operationId": "createCorrelation", + "summary": "Perform diff on two dashboards.", + "operationId": "calculateDashboardDiff", "parameters": [ { - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateCorrelationCommand" + "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" + ] + }, + "new": { + "$ref": "#/definitions/CalculateDiffTarget" + } + } } - }, - { - "type": "string", - "name": "sourceUID", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/createCorrelationResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/calculateDashboardDiffResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4450,122 +2639,99 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources/uid/{sourceUID}/correlations/{correlationUID}": { - "get": { + "/dashboards/db": { + "post": { + "description": "Creates a new dashboard or updates an existing dashboard.", "tags": [ - "correlations" + "dashboards" ], - "summary": "Gets a correlation.", - "operationId": "getCorrelation", + "summary": "Create / Update dashboard", + "operationId": "postDashboard", "parameters": [ { - "type": "string", - "name": "sourceUID", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "correlationUID", - "in": "path", - "required": true + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/SaveDashboardCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/getCorrelationResponse" + "$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" } } - }, - "patch": { + } + }, + "/dashboards/home": { + "get": { "tags": [ - "correlations" - ], - "summary": "Updates a correlation.", - "operationId": "updateCorrelation", - "parameters": [ - { - "type": "string", - "name": "sourceUID", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "correlationUID", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "schema": { - "$ref": "#/definitions/UpdateCorrelationCommand" - } - } + "dashboards" ], + "summary": "Get home dashboard.", + "operationId": "getHomeDashboard", "responses": { "200": { - "$ref": "#/responses/updateCorrelationResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getHomeDashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources/uid/{uid}": { + "/dashboards/id/{DashboardID}/permissions": { "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).", + "description": "Please refer to [updated API](#/dashboard_permissions/getDashboardPermissionsListByUID) instead", "tags": [ - "datasources" + "dashboard_permissions" ], - "summary": "Get a single data source by UID.", - "operationId": "getDataSourceByUID", + "summary": "Gets all existing permissions for the given dashboard.", + "operationId": "getDashboardPermissionsListByID", + "deprecated": true, "parameters": [ - { - "type": "string", - "name": "uid", + { + "type": "integer", + "format": "int64", + "name": "DashboardID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDataSourceResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getDashboardPermissionsListResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4581,55 +2747,27 @@ } } }, - "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:uid:*` and `datasources:uid:1` (single data source).", + "post": { + "description": "Please refer to [updated API](#/dashboard_permissions/updateDashboardPermissionsByUID) instead\n\nThis operation will remove existing permissions if they’re not included in the request.", "tags": [ - "datasources" + "dashboard_permissions" ], - "summary": "Update an existing data source.", - "operationId": "updateDataSourceByUID", + "summary": "Updates permissions for a dashboard.", + "operationId": "updateDashboardPermissionsByID", + "deprecated": true, "parameters": [ { "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDataSourceCommand" + "$ref": "#/definitions/UpdateDashboardACLCommand" } }, { - "type": "string", - "name": "uid", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" - }, - "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:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", - "tags": [ - "datasources" - ], - "summary": "Delete an existing data source by UID.", - "operationId": "deleteDataSourceByUID", - "parameters": [ - { - "type": "string", - "name": "uid", + "type": "integer", + "format": "int64", + "name": "DashboardID", "in": "path", "required": true } @@ -4638,6 +2776,9 @@ "200": { "$ref": "#/responses/okResponse" }, + "400": { + "$ref": "#/responses/badRequestError" + }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -4653,30 +2794,35 @@ } } }, - "/datasources/uid/{uid}/correlations/{correlationUID}": { - "delete": { + "/dashboards/id/{DashboardID}/restore": { + "post": { + "description": "Please refer to [updated API](#/dashboard_versions/restoreDashboardVersionByUID) instead", "tags": [ - "correlations" + "dashboard_versions" ], - "summary": "Delete a correlation.", - "operationId": "deleteCorrelation", + "summary": "Restore a dashboard to a given dashboard version.", + "operationId": "restoreDashboardVersionByID", + "deprecated": true, "parameters": [ { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RestoreDashboardVersionCommand" + } }, { - "type": "string", - "name": "correlationUID", + "type": "integer", + "format": "int64", + "name": "DashboardID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/deleteCorrelationResponse" + "$ref": "#/responses/postDashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4693,27 +2839,27 @@ } } }, - "/datasources/uid/{uid}/health": { + "/dashboards/id/{DashboardID}/versions": { "get": { + "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionsByUID) instead", "tags": [ - "datasources" + "dashboard_versions" ], - "summary": "Sends a health check request to the plugin datasource identified by the UID.", - "operationId": "checkDatasourceHealthWithUID", + "summary": "Gets all existing versions for the dashboard.", + "operationId": "getDashboardVersionsByID", + "deprecated": true, "parameters": [ { - "type": "string", - "name": "uid", + "type": "integer", + "format": "int64", + "name": "DashboardID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/dashboardVersionsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4721,39 +2867,43 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources/uid/{uid}/resources/{datasource_proxy_route}": { + "/dashboards/id/{DashboardID}/versions/{DashboardVersionID}": { "get": { + "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionByUID) instead", "tags": [ - "datasources" + "dashboard_versions" ], - "summary": "Fetch data source resources.", - "operationId": "callDatasourceResourceWithUID", + "summary": "Get a specific dashboard version.", + "operationId": "getDashboardVersionByID", + "deprecated": true, "parameters": [ { - "type": "string", - "name": "datasource_proxy_route", + "type": "integer", + "format": "int64", + "name": "DashboardID", "in": "path", "required": true }, { - "type": "string", - "name": "uid", + "type": "integer", + "format": "int64", + "name": "DashboardVersionID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/dashboardVersionResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4770,26 +2920,26 @@ } } }, - "/datasources/{datasourceId}/disable-permissions": { + "/dashboards/import": { "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" + "dashboards" ], - "summary": "Disable permissions for a data source.", - "operationId": "disablePermissions", + "summary": "Import dashboard.", + "operationId": "importDashboard", "parameters": [ { - "type": "string", - "name": "datasourceId", - "in": "path", - "required": true + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ImportDashboardRequest" + } } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" + "$ref": "#/responses/importDashboardResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4797,11 +2947,11 @@ "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" + "412": { + "$ref": "#/responses/preconditionFailedError" }, - "404": { - "$ref": "#/responses/notFoundError" + "422": { + "$ref": "#/responses/unprocessableEntityError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4809,122 +2959,75 @@ } } }, - "/datasources/{datasourceId}/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).", + "/dashboards/tags": { + "get": { "tags": [ - "datasource_permissions", - "enterprise" - ], - "summary": "Enable permissions for a data source.", - "operationId": "enablePermissions", - "parameters": [ - { - "type": "string", - "name": "datasourceId", - "in": "path", - "required": true - } + "dashboards" ], + "summary": "Get all dashboards tags of an organisation.", + "operationId": "getDashboardTags", "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getDashboardsTagsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources/{datasourceId}/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).", + "/dashboards/trim": { + "post": { "tags": [ - "datasource_permissions", - "enterprise" + "dashboards" ], - "summary": "Get permissions for a data source.", - "operationId": "getAllPermissions", + "summary": "Trim defaults from dashboard.", + "operationId": "trimDashboard", "parameters": [ { - "type": "string", - "name": "datasourceId", - "in": "path", - "required": true + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/TrimDashboardCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/getAllPermissionseResponse" + "$ref": "#/responses/trimDashboardResponse" }, "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 `datasources.permissions:read` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", + } + }, + "/dashboards/uid/{uid}": { + "get": { + "description": "Will return the dashboard given the dashboard unique identifier (uid).", "tags": [ - "datasource_permissions", - "enterprise" + "dashboards" ], - "summary": "Add permissions for a data source.", - "operationId": "addPermission", + "summary": "Get dashboard by uid.", + "operationId": "getDashboardByUID", "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "userId", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "name": "teamId", - "in": "query" - }, - { - "type": "string", - "name": "builtinRole", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "name": "permission", - "in": "query" - }, { "type": "string", - "name": "datasourceId", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/addPermissionResponse" + "$ref": "#/responses/dashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4939,34 +3042,25 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/{datasourceId}/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).", + "description": "Will delete the dashboard given the specified unique identifier (uid).", "tags": [ - "datasource_permissions", - "enterprise" + "dashboards" ], - "summary": "Remove permission for a data source.", - "operationId": "deletePermissions", + "summary": "Delete dashboard by uid.", + "operationId": "deleteDashboardByUID", "parameters": [ { "type": "string", - "name": "datasourceId", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "permissionId", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/deleteDashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4976,33 +3070,31 @@ }, "404": { "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/datasources/{id}": { + "/dashboards/uid/{uid}/permissions": { "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).\n\nPlease refer to [updated API](#/datasources/getDataSourceByUID) instead", "tags": [ - "datasources" + "dashboard_permissions" ], - "summary": "Get a single data source by Id.", - "operationId": "getDataSourceByID", - "deprecated": true, + "summary": "Gets all existing permissions for the given dashboard.", + "operationId": "getDashboardPermissionsListByUID", "parameters": [ { "type": "string", - "name": "id", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDataSourceResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getDashboardPermissionsListResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5018,33 +3110,35 @@ } } }, - "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).\n\nPlease refer to [updated API](#/datasources/updateDataSourceByUID) instead", + "post": { + "description": "This operation will remove existing permissions if they’re not included in the request.", "tags": [ - "datasources" + "dashboard_permissions" ], - "summary": "Update an existing data source by its sequential ID.", - "operationId": "updateDataSourceByID", - "deprecated": true, + "summary": "Updates permissions for a dashboard.", + "operationId": "updateDashboardPermissionsByUID", "parameters": [ { "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDataSourceCommand" + "$ref": "#/definitions/UpdateDashboardACLCommand" } }, { "type": "string", - "name": "id", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5052,30 +3146,41 @@ "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:id:*` and `datasources:id:1` (single data source).\n\nPlease refer to [updated API](#/datasources/deleteDataSourceByUID) instead", + } + }, + "/dashboards/uid/{uid}/restore": { + "post": { "tags": [ - "datasources" + "dashboard_versions" ], - "summary": "Delete an existing data source by id.", - "operationId": "deleteDataSourceByID", - "deprecated": true, + "summary": "Restore a dashboard to a given dashboard version using UID.", + "operationId": "restoreDashboardVersionByUID", "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RestoreDashboardVersionCommand" + } + }, { "type": "string", - "name": "id", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/postDashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5092,29 +3197,40 @@ } } }, - "/datasources/{id}/health": { + "/dashboards/uid/{uid}/versions": { "get": { - "description": "Please refer to [updated API](#/datasources/checkDatasourceHealthWithUID) instead", "tags": [ - "datasources" + "dashboard_versions" ], - "summary": "Sends a health check request to the plugin datasource identified by the ID.", - "operationId": "checkDatasourceHealthByID", - "deprecated": true, + "summary": "Gets all existing versions for the dashboard using UID.", + "operationId": "getDashboardVersionsByUID", "parameters": [ { "type": "string", - "name": "id", + "name": "uid", "in": "path", "required": true + }, + { + "type": "integer", + "format": "int64", + "default": 0, + "description": "Maximum number of results to return", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 0, + "description": "Version to start from when returning queries", + "name": "start", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/dashboardVersionsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5122,41 +3238,40 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources/{id}/resources/{datasource_proxy_route}": { + "/dashboards/uid/{uid}/versions/{DashboardVersionID}": { "get": { - "description": "Please refer to [updated API](#/datasources/callDatasourceResourceWithUID) instead", "tags": [ - "datasources" + "dashboard_versions" ], - "summary": "Fetch data source resources by Id.", - "operationId": "callDatasourceResourceByID", - "deprecated": true, + "summary": "Get a specific dashboard version using UID.", + "operationId": "getDashboardVersionByUID", "parameters": [ { - "type": "string", - "name": "datasource_proxy_route", + "type": "integer", + "format": "int64", + "name": "DashboardVersionID", "in": "path", "required": true }, { "type": "string", - "name": "id", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/dashboardVersionResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5173,33 +3288,49 @@ } } }, - "/ds/query": { + "/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": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:query`.", + "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": [ - "ds" + "datasources" ], - "summary": "DataSource query metrics with expressions.", - "operationId": "queryMetricsWithExpressions", + "summary": "Create a data source.", + "operationId": "addDataSource", "parameters": [ { - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/MetricRequest" + "$ref": "#/definitions/AddDataSourceCommand" } } ], "responses": { "200": { - "$ref": "#/responses/queryMetricsWithExpressionsRespons" - }, - "207": { - "$ref": "#/responses/queryMetricsWithExpressionsRespons" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5207,41 +3338,57 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "409": { + "$ref": "#/responses/conflictError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/folders": { + "/datasources/correlations": { "get": { - "description": "Returns all folders that the authenticated user has permission to view.", "tags": [ - "folders" + "correlations" ], - "summary": "Get all folders.", - "operationId": "getFolders", - "parameters": [ - { - "type": "integer", - "format": "int64", - "default": 1000, - "description": "Limit the maximum number of folders to return", - "name": "limit", - "in": "query" + "summary": "Gets all correlations.", + "operationId": "getCorrelations", + "responses": { + "200": { + "$ref": "#/responses/getCorrelationsResponse" }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/datasources/id/{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": "integer", - "format": "int64", - "default": 1, - "description": "Page index for starting fetching folders", - "name": "page", - "in": "query" + "type": "string", + "name": "name", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getFoldersResponse" + "$ref": "#/responses/getDataSourceIDResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5249,33 +3396,34 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "post": { + } + }, + "/datasources/name/{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": [ - "folders" + "datasources" ], - "summary": "Create folder.", - "operationId": "createFolder", + "summary": "Get a single data source by Name.", + "operationId": "getDataSourceByName", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateFolderCommand" - } + "type": "string", + "name": "name", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getDataSourceResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5283,35 +3431,29 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/folders/id/{folder_id}": { - "get": { - "description": "Returns the folder identified by id.", + }, + "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": [ - "folders" + "datasources" ], - "summary": "Get folder by id.", - "operationId": "getFolderByID", + "summary": "Delete an existing data source by name.", + "operationId": "deleteDataSourceByName", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "folder_id", + "type": "string", + "name": "name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/deleteDataSourceByNameResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5328,24 +3470,34 @@ } } }, - "/folders/{folder_uid}": { + "/datasources/proxy/uid/{uid}/{datasource_proxy_route}": { "get": { + "description": "Proxies all calls to the actual data source.", "tags": [ - "folders" + "datasources" ], - "summary": "Get folder by uid.", - "operationId": "getFolderByUID", + "summary": "Data source proxy GET calls.", + "operationId": "datasourceProxyGETByUIDcalls", "parameters": [ { "type": "string", - "name": "folder_uid", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" + "description": "(empty)" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5361,32 +3513,39 @@ } } }, - "put": { + "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": [ - "folders" + "datasources" ], - "summary": "Update folder.", - "operationId": "updateFolder", + "summary": "Data source proxy POST calls.", + "operationId": "datasourceProxyPOSTByUIDcalls", "parameters": [ + { + "name": "DatasourceProxyParam", + "in": "body", + "required": true, + "schema": {} + }, { "type": "string", - "name": "folder_uid", + "name": "datasource_proxy_route", "in": "path", "required": true }, { - "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/UpdateFolderCommand" - } + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { - "200": { - "$ref": "#/responses/folderResponse" + "201": { + "description": "(empty)" + }, + "202": { + "description": "(empty)" }, "400": { "$ref": "#/responses/badRequestError" @@ -5400,39 +3559,35 @@ "404": { "$ref": "#/responses/notFoundError" }, - "409": { - "$ref": "#/responses/conflictError" - }, "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.", + "description": "Proxies all calls to the actual data source.", "tags": [ - "folders" + "datasources" ], - "summary": "Delete folder.", - "operationId": "deleteFolder", + "summary": "Data source proxy DELETE calls.", + "operationId": "datasourceProxyDELETEByUIDcalls", "parameters": [ { "type": "string", - "name": "folder_uid", + "name": "uid", "in": "path", "required": true }, { - "type": "boolean", - "default": false, - "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" + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true } ], "responses": { - "200": { - "$ref": "#/responses/deleteFolderResponse" + "202": { + "description": "(empty)" }, "400": { "$ref": "#/responses/badRequestError" @@ -5452,24 +3607,35 @@ } } }, - "/folders/{folder_uid}/permissions": { + "/datasources/proxy/{id}/{datasource_proxy_route}": { "get": { + "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyGETByUIDcalls) instead", "tags": [ - "folder_permissions" + "datasources" ], - "summary": "Gets all existing permissions for the folder with the given `uid`.", - "operationId": "getFolderPermissionList", + "summary": "Data source proxy GET calls.", + "operationId": "datasourceProxyGETcalls", + "deprecated": true, "parameters": [ { "type": "string", - "name": "folder_uid", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getFolderPermissionListResponse" + "description": "(empty)" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5486,30 +3652,42 @@ } }, "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\n\nPlease refer to [updated API](#/datasources/datasourceProxyPOSTByUIDcalls) instead", "tags": [ - "folder_permissions" + "datasources" ], - "summary": "Updates permissions for a folder. This operation will remove existing permissions if they’re not included in the request.", - "operationId": "updateFolderPermissions", + "summary": "Data source proxy POST calls.", + "operationId": "datasourceProxyPOSTcalls", + "deprecated": true, "parameters": [ + { + "name": "DatasourceProxyParam", + "in": "body", + "required": true, + "schema": {} + }, { "type": "string", - "name": "folder_uid", + "name": "datasource_proxy_route", "in": "path", "required": true }, { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateDashboardACLCommand" - } + "type": "string", + "name": "id", + "in": "path", + "required": true } ], "responses": { - "200": { - "$ref": "#/responses/okResponse" + "201": { + "description": "(empty)" + }, + "202": { + "description": "(empty)" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5524,111 +3702,106 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/library-elements": { - "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.", + }, + "delete": { + "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyDELETEByUIDcalls) instead", "tags": [ - "library_elements" + "datasources" ], - "summary": "Get all library elements.", - "operationId": "getLibraryElements", + "summary": "Data source proxy DELETE calls.", + "operationId": "datasourceProxyDELETEcalls", + "deprecated": true, "parameters": [ { "type": "string", - "description": "Part of the name or description searched for.", - "name": "searchString", - "in": "query" - }, - { - "enum": [ - 1, - 2 - ], - "type": "integer", - "format": "int64", - "description": "Kind of element to search for.", - "name": "kind", - "in": "query" + "name": "id", + "in": "path", + "required": true }, { - "enum": [ - "alpha-asc", - "alpha-desc" - ], "type": "string", - "description": "Sort order of elements.", - "name": "sortDirection", - "in": "query" + "name": "datasource_proxy_route", + "in": "path", + "required": true + } + ], + "responses": { + "202": { + "description": "(empty)" }, - { - "type": "string", - "description": "A comma separated list of types to filter the elements by", - "name": "typeFilter", - "in": "query" + "400": { + "$ref": "#/responses/badRequestError" }, - { - "type": "string", - "description": "Element UID to exclude from search results.", - "name": "excludeUid", - "in": "query" + "401": { + "$ref": "#/responses/unauthorisedError" }, - { - "type": "string", - "description": "A comma separated list of folder ID(s) to filter the elements by.", - "name": "folderFilter", - "in": "query" + "403": { + "$ref": "#/responses/forbiddenError" }, - { - "type": "integer", - "format": "int64", - "default": 100, - "description": "The number of results per page.", - "name": "perPage", - "in": "query" + "404": { + "$ref": "#/responses/notFoundError" }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/datasources/uid/{sourceUID}/correlations": { + "get": { + "tags": [ + "correlations" + ], + "summary": "Gets all correlations originating from the given data source.", + "operationId": "getCorrelationsBySourceUID", + "parameters": [ { - "type": "integer", - "format": "int64", - "default": 1, - "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" + "type": "string", + "name": "sourceUID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementsResponse" + "$ref": "#/responses/getCorrelationsBySourceUIDResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "post": { - "description": "Creates a new library element.", "tags": [ - "library_elements" + "correlations" ], - "summary": "Create library element.", - "operationId": "createLibraryElement", + "summary": "Add correlation.", + "operationId": "createCorrelation", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateLibraryElementCommand" + "$ref": "#/definitions/CreateCorrelationCommand" } + }, + { + "type": "string", + "name": "sourceUID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/createCorrelationResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5648,25 +3821,30 @@ } } }, - "/library-elements/name/{library_element_name}": { + "/datasources/uid/{sourceUID}/correlations/{correlationUID}": { "get": { - "description": "Returns a library element with the given name.", "tags": [ - "library_elements" + "correlations" ], - "summary": "Get library element by name.", - "operationId": "getLibraryElementByName", + "summary": "Gets a correlation.", + "operationId": "getCorrelation", "parameters": [ { "type": "string", - "name": "library_element_name", + "name": "sourceUID", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "correlationUID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/getCorrelationResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5678,31 +3856,47 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/library-elements/{library_element_uid}": { - "get": { - "description": "Returns a library element with the given UID.", + }, + "patch": { "tags": [ - "library_elements" + "correlations" ], - "summary": "Get library element by UID.", - "operationId": "getLibraryElementByUID", + "summary": "Updates a correlation.", + "operationId": "updateCorrelation", "parameters": [ { "type": "string", - "name": "library_element_uid", + "name": "sourceUID", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "correlationUID", "in": "path", "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/UpdateCorrelationCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/updateCorrelationResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "404": { "$ref": "#/responses/notFoundError" }, @@ -5710,25 +3904,27 @@ "$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.", + } + }, + "/datasources/uid/{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": [ - "library_elements" + "datasources" ], - "summary": "Delete library element.", - "operationId": "deleteLibraryElementByUID", + "summary": "Get a single data source by UID.", + "operationId": "getDataSourceByUID", "parameters": [ { "type": "string", - "name": "library_element_uid", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getDataSourceResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5747,35 +3943,32 @@ } } }, - "patch": { - "description": "Updates an existing library element identified by uid.", + "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:uid:*` and `datasources:uid:1` (single data source).", "tags": [ - "library_elements" + "datasources" ], - "summary": "Update library element.", - "operationId": "updateLibraryElement", + "summary": "Update an existing data source.", + "operationId": "updateDataSourceByUID", "parameters": [ { - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PatchLibraryElementCommand" + "$ref": "#/definitions/UpdateDataSourceCommand" } }, { "type": "string", - "name": "library_element_uid", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5783,41 +3976,36 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "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.", + }, + "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": [ - "library_elements" + "datasources" ], - "summary": "Get library element connections.", - "operationId": "getLibraryElementConnections", + "summary": "Delete an existing data source by UID.", + "operationId": "deleteDataSourceByUID", "parameters": [ { "type": "string", - "name": "library_element_uid", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementConnectionsResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "404": { "$ref": "#/responses/notFoundError" }, @@ -5827,33 +4015,39 @@ } } }, - "/licensing/check": { - "get": { + "/datasources/uid/{uid}/correlations/{correlationUID}": { + "delete": { "tags": [ - "licensing", - "enterprise" + "correlations" ], - "summary": "Check license availability.", - "operationId": "getStatus", - "responses": { - "200": { - "$ref": "#/responses/getStatusResponse" + "summary": "Delete a correlation.", + "operationId": "deleteCorrelation", + "parameters": [ + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "correlationUID", + "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/deleteCorrelationResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -5861,21 +4055,33 @@ } } }, - "/licensing/custom-permissions-csv": { + "/datasources/uid/{uid}/health": { "get": { - "description": "You need to have a permission with action `licensing.reports:read`.", - "produces": [ - "text/csv" - ], "tags": [ - "licensing", - "enterprise" + "datasources" + ], + "summary": "Sends a health check request to the plugin datasource identified by the UID.", + "operationId": "checkDatasourceHealthWithUID", + "parameters": [ + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + } ], - "summary": "Get custom permissions report in CSV format.", - "operationId": "getCustomPermissionsCSV", "responses": { "200": { - "$ref": "#/responses/getCustomPermissionsReportResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -5883,91 +4089,114 @@ } } }, - "/licensing/refresh-stats": { + "/datasources/uid/{uid}/resources/{datasource_proxy_route}": { "get": { - "description": "You need to have a permission with action `licensing:read`.", "tags": [ - "licensing", - "enterprise" + "datasources" ], - "summary": "Refresh license stats.", - "operationId": "refreshLicenseStats", - "responses": { - "200": { - "$ref": "#/responses/refreshLicenseStatsResponse" + "summary": "Fetch data source resources.", + "operationId": "callDatasourceResourceWithUID", + "parameters": [ + { + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true }, - "500": { - "$ref": "#/responses/internalServerError" + { + "type": "string", + "name": "uid", + "in": "path", + "required": true } - } - } - }, - "/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" + "$ref": "#/responses/okResponse" + }, + "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`.", + } + } + }, + "/datasources/{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).\n\nPlease refer to [updated API](#/datasources/getDataSourceByUID) instead", "tags": [ - "licensing", - "enterprise" + "datasources" ], - "summary": "Create license token.", - "operationId": "postLicenseToken", + "summary": "Get a single data source by Id.", + "operationId": "getDataSourceByID", + "deprecated": true, "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/DeleteTokenCommand" - } + "type": "string", + "name": "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" } } }, - "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`.", + "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).\n\nPlease refer to [updated API](#/datasources/updateDataSourceByUID) instead", "tags": [ - "licensing", - "enterprise" + "datasources" ], - "summary": "Remove license from database.", - "operationId": "deleteLicenseToken", + "summary": "Update an existing data source by its sequential ID.", + "operationId": "updateDataSourceByID", + "deprecated": true, "parameters": [ { - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/DeleteTokenCommand" + "$ref": "#/definitions/UpdateDataSourceCommand" } + }, + { + "type": "string", + "name": "id", + "in": "path", + "required": true } ], "responses": { - "202": { - "$ref": "#/responses/acceptedResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "200": { + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5975,58 +4204,36 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "422": { - "$ref": "#/responses/unprocessableEntityError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/licensing/token/renew": { - "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`.", + }, + "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).\n\nPlease refer to [updated API](#/datasources/deleteDataSourceByUID) instead", "tags": [ - "licensing", - "enterprise" + "datasources" ], - "summary": "Manually force license refresh.", - "operationId": "postRenewLicenseToken", + "summary": "Delete an existing data source by id.", + "operationId": "deleteDataSourceByID", + "deprecated": true, "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object" - } + "type": "string", + "name": "id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/postRenewLicenseTokenResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" - } - } - } - }, - "/logout/saml": { - "get": { - "tags": [ - "saml", - "enterprise" - ], - "summary": "GetLogout initiates single logout process.", - "operationId": "getSAMLLogout", - "responses": { - "302": { - "description": "(empty)" + "403": { + "$ref": "#/responses/forbiddenError" }, "404": { "$ref": "#/responses/notFoundError" @@ -6037,16 +4244,29 @@ } } }, - "/org": { + "/datasources/{id}/health": { "get": { + "description": "Please refer to [updated API](#/datasources/checkDatasourceHealthWithUID) instead", "tags": [ - "org" + "datasources" + ], + "summary": "Sends a health check request to the plugin datasource identified by the ID.", + "operationId": "checkDatasourceHealthByID", + "deprecated": true, + "parameters": [ + { + "type": "string", + "name": "id", + "in": "path", + "required": true + } ], - "summary": "Get current Organization.", - "operationId": "getCurrentOrg", "responses": { "200": { - "$ref": "#/responses/getCurrentOrgResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6058,21 +4278,29 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { + } + }, + "/datasources/{id}/resources/{datasource_proxy_route}": { + "get": { + "description": "Please refer to [updated API](#/datasources/callDatasourceResourceWithUID) instead", "tags": [ - "org" + "datasources" ], - "summary": "Update current Organization.", - "operationId": "updateCurrentOrg", + "summary": "Fetch data source resources by Id.", + "operationId": "callDatasourceResourceByID", + "deprecated": true, "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgForm" - } + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "id", + "in": "path", + "required": true } ], "responses": { @@ -6088,32 +4316,39 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/address": { - "put": { + "/ds/query": { + "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": [ - "org" + "ds" ], - "summary": "Update current Organization's address.", - "operationId": "updateCurrentOrgAddress", + "summary": "DataSource query metrics with expressions.", + "operationId": "queryMetricsWithExpressions", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgAddressForm" + "$ref": "#/definitions/MetricRequest" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/queryMetricsWithExpressionsRespons" + }, + "207": { + "$ref": "#/responses/queryMetricsWithExpressionsRespons" }, "400": { "$ref": "#/responses/badRequestError" @@ -6130,16 +4365,35 @@ } } }, - "/org/invites": { + "/folders": { "get": { + "description": "Returns all folders that the authenticated user has permission to view.", "tags": [ - "org_invites" + "folders" + ], + "summary": "Get all folders.", + "operationId": "getFolders", + "parameters": [ + { + "type": "integer", + "format": "int64", + "default": 1000, + "description": "Limit the maximum number of folders to return", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1, + "description": "Page index for starting fetching folders", + "name": "page", + "in": "query" + } ], - "summary": "Get pending invites.", - "operationId": "getPendingOrgInvites", "responses": { "200": { - "$ref": "#/responses/getPendingOrgInvitesResponse" + "$ref": "#/responses/getFoldersResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6154,23 +4408,23 @@ }, "post": { "tags": [ - "org_invites" + "folders" ], - "summary": "Add invite.", - "operationId": "addOrgInvite", + "summary": "Create folder.", + "operationId": "createFolder", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddInviteForm" + "$ref": "#/definitions/CreateFolderCommand" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/folderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -6181,8 +4435,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "412": { - "$ref": "#/responses/SMTPNotEnabledError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -6190,24 +4444,26 @@ } } }, - "/org/invites/{invitation_code}/revoke": { - "delete": { + "/folders/id/{folder_id}": { + "get": { + "description": "Returns the folder identified by id.", "tags": [ - "org_invites" + "folders" ], - "summary": "Revoke invite.", - "operationId": "revokeInvite", + "summary": "Get folder by id.", + "operationId": "getFolderByID", "parameters": [ { - "type": "string", - "name": "invitation_code", + "type": "integer", + "format": "int64", + "name": "folder_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/folderResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6224,16 +4480,24 @@ } } }, - "/org/preferences": { + "/folders/{folder_uid}": { "get": { "tags": [ - "org_preferences" + "folders" + ], + "summary": "Get folder by uid.", + "operationId": "getFolderByUID", + "parameters": [ + { + "type": "string", + "name": "folder_uid", + "in": "path", + "required": true + } ], - "summary": "Get Current Org Prefs.", - "operationId": "getOrgPreferences", "responses": { "200": { - "$ref": "#/responses/getPreferencesResponse" + "$ref": "#/responses/folderResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6241,6 +4505,9 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } @@ -6248,23 +4515,30 @@ }, "put": { "tags": [ - "org_preferences" + "folders" ], - "summary": "Update Current Org Prefs.", - "operationId": "updateOrgPreferences", + "summary": "Update folder.", + "operationId": "updateFolder", "parameters": [ { + "type": "string", + "name": "folder_uid", + "in": "path", + "required": true + }, + { + "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/UpdatePrefsCmd" + "$ref": "#/definitions/UpdateFolderCommand" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/folderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -6275,30 +4549,42 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "409": { + "$ref": "#/responses/conflictError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, - "patch": { + "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": [ - "org_preferences" + "folders" ], - "summary": "Patch Current Org Prefs.", - "operationId": "patchOrgPreferences", + "summary": "Delete folder.", + "operationId": "deleteFolder", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PatchPrefsCmd" - } + "type": "string", + "name": "folder_uid", + "in": "path", + "required": true + }, + { + "type": "boolean", + "default": false, + "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/okResponse" + "$ref": "#/responses/deleteFolderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -6309,23 +4595,33 @@ "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": [ - "org" + "folder_permissions" + ], + "summary": "Gets all existing permissions for the folder with the given `uid`.", + "operationId": "getFolderPermissionList", + "parameters": [ + { + "type": "string", + "name": "folder_uid", + "in": "path", + "required": true + } ], - "summary": "Get all users within the current organization.", - "operationId": "getOrgUsersForCurrentOrg", "responses": { "200": { - "$ref": "#/responses/getOrgUsersForCurrentOrgResponse" + "$ref": "#/responses/getFolderPermissionListResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6333,25 +4629,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": [ - "org" + "folder_permissions" ], - "summary": "Add a new user to the current organization.", - "operationId": "addOrgUserToCurrentOrg", + "summary": "Updates permissions for a folder. This operation will remove existing permissions if they’re not included in the request.", + "operationId": "updateFolderPermissions", "parameters": [ { - "name": "body", + "type": "string", + "name": "folder_uid", + "in": "path", + "required": true + }, + { + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddOrgUserCommand" + "$ref": "#/definitions/UpdateDashboardACLCommand" } } ], @@ -6365,69 +4669,118 @@ "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.", + "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": [ - "org" + "library_elements" ], - "summary": "Get all users within the current organization (lookup)", - "operationId": "getOrgUsersForCurrentOrgLookup", + "summary": "Get all library elements.", + "operationId": "getLibraryElements", "parameters": [ { "type": "string", - "name": "query", + "description": "Part of the name or description searched for.", + "name": "searchString", "in": "query" }, { + "enum": [ + 1, + 2 + ], "type": "integer", "format": "int64", - "name": "limit", + "description": "Kind of element to search for.", + "name": "kind", + "in": "query" + }, + { + "enum": [ + "alpha-asc", + "alpha-desc" + ], + "type": "string", + "description": "Sort order of elements.", + "name": "sortDirection", + "in": "query" + }, + { + "type": "string", + "description": "A comma separated list of types to filter the elements by", + "name": "typeFilter", + "in": "query" + }, + { + "type": "string", + "description": "Element UID to exclude from search results.", + "name": "excludeUid", + "in": "query" + }, + { + "type": "string", + "description": "A comma separated list of folder ID(s) to filter the elements by.", + "name": "folderFilter", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 100, + "description": "The number of results per page.", + "name": "perPage", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1, + "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/getOrgUsersForCurrentOrgLookupResponse" + "$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:*`.", + }, + "post": { + "description": "Creates a new library element.", "tags": [ - "org" + "library_elements" ], - "summary": "Delete user in current organization.", - "operationId": "removeOrgUserForCurrentOrg", + "summary": "Create library element.", + "operationId": "createLibraryElement", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateLibraryElementCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getLibraryElementResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -6438,47 +4791,40 @@ "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:*`.", + } + }, + "/library-elements/name/{library_element_name}": { + "get": { + "description": "Returns a library element with the given name.", "tags": [ - "org" + "library_elements" ], - "summary": "Updates the given user.", - "operationId": "updateOrgUserForCurrentOrg", + "summary": "Get library element by name.", + "operationId": "getLibraryElementByName", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgUserCommand" - } - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "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" @@ -6486,49 +4832,58 @@ } } }, - "/orgs": { + "/library-elements/{library_element_uid}": { "get": { - "security": [ - { - "basic": [] - } - ], + "description": "Returns a library element with the given UID.", "tags": [ - "orgs" + "library_elements" ], - "summary": "Search all Organizations.", - "operationId": "searchOrgs", + "summary": "Get library element by UID.", + "operationId": "getLibraryElementByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "default": 1, - "name": "page", - "in": "query" + "type": "string", + "name": "library_element_uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getLibraryElementResponse" }, - { - "type": "integer", - "format": "int64", - "default": 1000, - "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", - "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", - "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" + "name": "library_element_uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/searchOrgsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6536,34 +4891,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.", + "patch": { + "description": "Updates an existing library element identified by uid.", "tags": [ - "orgs" + "library_elements" ], - "summary": "Create Organization.", - "operationId": "createOrg", + "summary": "Update library element.", + "operationId": "updateLibraryElement", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateOrgCommand" + "$ref": "#/definitions/PatchLibraryElementCommand" } + }, + { + "type": "string", + "name": "library_element_uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/createOrgResponse" + "$ref": "#/responses/getLibraryElementResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6571,8 +4935,11 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" + "404": { + "$ref": "#/responses/notFoundError" + }, + "412": { + "$ref": "#/responses/preconditionFailedError" }, "500": { "$ref": "#/responses/internalServerError" @@ -6580,35 +4947,31 @@ } } }, - "/orgs/name/{org_name}": { + "/library-elements/{library_element_uid}/connections/": { "get": { - "security": [ - { - "basic": [] - } - ], + "description": "Returns a list of connections for a library element based on the UID specified.", "tags": [ - "orgs" + "library_elements" ], - "summary": "Get Organization by ID.", - "operationId": "getOrgByName", + "summary": "Get library element connections.", + "operationId": "getLibraryElementConnections", "parameters": [ { "type": "string", - "name": "org_name", + "name": "library_element_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getOrgByNameResponse" + "$ref": "#/responses/getLibraryElementConnectionsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -6616,30 +4979,16 @@ } } }, - "/orgs/{org_id}": { + "/org": { "get": { - "security": [ - { - "basic": [] - } - ], "tags": [ - "orgs" - ], - "summary": "Get Organization by ID.", - "operationId": "getOrgByID", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - } + "org" ], + "summary": "Get current Organization.", + "operationId": "getCurrentOrg", "responses": { "200": { - "$ref": "#/responses/getOrgByIDResponse" + "$ref": "#/responses/getCurrentOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6653,16 +5002,11 @@ } }, "put": { - "security": [ - { - "basic": [] - } - ], "tags": [ - "orgs" + "org" ], - "summary": "Update Organization.", - "operationId": "updateOrg", + "summary": "Update current Organization.", + "operationId": "updateCurrentOrg", "parameters": [ { "name": "body", @@ -6671,13 +5015,6 @@ "schema": { "$ref": "#/definitions/UpdateOrgForm" } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { @@ -6697,25 +5034,23 @@ "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "security": [ - { - "basic": [] - } - ], + } + }, + "/org/address": { + "put": { "tags": [ - "orgs" + "org" ], - "summary": "Delete Organization.", - "operationId": "deleteOrgByID", + "summary": "Update current Organization's address.", + "operationId": "updateCurrentOrgAddress", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgAddressForm" + } } ], "responses": { @@ -6731,45 +5066,22 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs/{org_id}/address": { - "put": { + "/org/invites": { + "get": { "tags": [ - "orgs" - ], - "summary": "Update Organization's address.", - "operationId": "updateOrgAddress", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgAddressForm" - } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - } + "org_invites" ], + "summary": "Get pending invites.", + "operationId": "getPendingOrgInvites", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getPendingOrgInvitesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6781,28 +5093,29 @@ "$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).", + }, + "post": { "tags": [ - "orgs" + "org_invites" ], - "summary": "Fetch Organization quota.", - "operationId": "getOrgQuota", + "summary": "Add invite.", + "operationId": "addOrgInvite", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddInviteForm" + } } ], "responses": { "200": { - "$ref": "#/responses/getQuotaResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6810,8 +5123,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "412": { + "$ref": "#/responses/SMTPNotEnabledError" }, "500": { "$ref": "#/responses/internalServerError" @@ -6819,38 +5132,17 @@ } } }, - "/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).", + "/org/invites/{invitation_code}/revoke": { + "delete": { "tags": [ - "orgs" + "org_invites" ], - "summary": "Update user quota.", - "operationId": "updateOrgQuota", + "summary": "Revoke invite.", + "operationId": "revokeInvite", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgQuotaCmd" - } - }, - { - "type": "string", - "name": "quota_target", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", + "type": "string", + "name": "invitation_code", "in": "path", "required": true } @@ -6874,31 +5166,16 @@ } } }, - "/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": "getOrgUsers", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - } + "org_preferences" ], + "summary": "Get Current Org Prefs.", + "operationId": "getOrgPreferences", "responses": { "200": { - "$ref": "#/responses/getOrgUsersResponse" + "$ref": "#/responses/getPreferencesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6911,34 +5188,29 @@ } } }, - "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:*`.", + "put": { "tags": [ - "orgs" + "org_preferences" ], - "summary": "Add a new user to the current organization.", - "operationId": "addOrgUser", + "summary": "Update Current Org Prefs.", + "operationId": "updateOrgPreferences", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddOrgUserCommand" + "$ref": "#/definitions/UpdatePrefsCmd" } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { "200": { "$ref": "#/responses/okResponse" }, + "400": { + "$ref": "#/responses/badRequestError" + }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -6949,30 +5221,21 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/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:*`.", + }, + "patch": { "tags": [ - "orgs" + "org_preferences" ], - "summary": "Delete user in current organization.", - "operationId": "removeOrgUser", + "summary": "Patch Current Org Prefs.", + "operationId": "patchOrgPreferences", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PatchPrefsCmd" + } } ], "responses": { @@ -6992,45 +5255,52 @@ "$ref": "#/responses/internalServerError" } } + } + }, + "/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": [ + "org" + ], + "summary": "Get all users within the current organization.", + "operationId": "getOrgUsersForCurrentOrg", + "responses": { + "200": { + "$ref": "#/responses/getOrgUsersForCurrentOrgResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "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:*`.", + "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" + "org" ], - "summary": "Update Users in Organization.", - "operationId": "updateOrgUser", + "summary": "Add a new user to the current organization.", + "operationId": "addOrgUserToCurrentOrg", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgUserCommand" + "$ref": "#/definitions/AddOrgUserCommand" } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true } ], "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -7043,13 +5313,14 @@ } } }, - "/playlists": { + "/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": [ - "playlists" + "org" ], - "summary": "Get playlists.", - "operationId": "searchPlaylists", + "summary": "Get all users within the current organization (lookup)", + "operationId": "getOrgUsersForCurrentOrgLookup", "parameters": [ { "type": "string", @@ -7059,39 +5330,49 @@ { "type": "integer", "format": "int64", - "description": "in:limit", "name": "limit", "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/searchPlaylistsResponse" + "$ref": "#/responses/getOrgUsersForCurrentOrgLookupResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "post": { + } + }, + "/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": [ - "playlists" + "org" ], - "summary": "Create playlist.", - "operationId": "createPlaylist", + "summary": "Delete user in current organization.", + "operationId": "removeOrgUserForCurrentOrg", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreatePlaylistCommand" - } + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/createPlaylistResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7099,33 +5380,41 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/playlists/{uid}": { - "get": { + }, + "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": [ - "playlists" + "org" ], - "summary": "Get playlist.", - "operationId": "getPlaylist", + "summary": "Updates the given user.", + "operationId": "updateOrgUserForCurrentOrg", "parameters": [ { - "type": "string", - "name": "uid", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgUserCommand" + } + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getPlaylistResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7133,39 +5422,55 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "put": { + } + }, + "/orgs": { + "get": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "playlists" + "orgs" ], - "summary": "Update playlist.", - "operationId": "updatePlaylist", + "summary": "Search all Organizations.", + "operationId": "searchOrgs", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdatePlaylistCommand" - } + "type": "integer", + "format": "int64", + "default": 1, + "name": "page", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1000, + "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", + "name": "name", + "in": "query" }, { "type": "string", - "name": "uid", - "in": "path", - "required": true + "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/updatePlaylistResponse" + "$ref": "#/responses/searchOrgsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7173,31 +5478,34 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" } } }, - "delete": { + "post": { + "description": "Only works if [users.allow_org_create](https://grafana.com/docs/grafana/latest/administration/configuration/#allow_org_create) is set.", "tags": [ - "playlists" + "orgs" ], - "summary": "Delete playlist.", - "operationId": "deletePlaylist", + "summary": "Create Organization.", + "operationId": "createOrg", "parameters": [ { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateOrgCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/createOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7205,8 +5513,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -7214,24 +5522,29 @@ } } }, - "/playlists/{uid}/dashboards": { + "/orgs/name/{org_name}": { "get": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "playlists" + "orgs" ], - "summary": "Get playlist dashboards.", - "operationId": "getPlaylistDashboards", + "summary": "Get Organization by ID.", + "operationId": "getOrgByName", "parameters": [ { "type": "string", - "name": "uid", + "name": "org_name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getPlaylistDashboardsResponse" + "$ref": "#/responses/getOrgByNameResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7239,33 +5552,36 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/playlists/{uid}/items": { + "/orgs/{org_id}": { "get": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "playlists" + "orgs" ], - "summary": "Get playlist items.", - "operationId": "getPlaylistItems", + "summary": "Get Organization by ID.", + "operationId": "getOrgByID", "parameters": [ { - "type": "string", - "name": "uid", + "type": "integer", + "format": "int64", + "name": "org_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getPlaylistItemsResponse" + "$ref": "#/responses/getOrgByIDResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7273,118 +5589,80 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/query-history": { - "get": { - "description": "Returns a list of queries in the query history that matches the search criteria.\nQuery history search supports pagination. Use the `limit` parameter to control the maximum number of queries returned; the default limit is 100.\nYou can also use the `page` query parameter to fetch queries from any page other than the first one.", + }, + "put": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "query_history" + "orgs" ], - "summary": "Query history search.", - "operationId": "searchQueries", + "summary": "Update Organization.", + "operationId": "updateOrg", "parameters": [ { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "description": "List of data source UIDs to search for", - "name": "datasourceUid", - "in": "query" - }, - { - "type": "string", - "description": "Text inside query or comments that is searched for", - "name": "searchString", - "in": "query" - }, - { - "type": "boolean", - "description": "Flag indicating if only starred queries should be returned", - "name": "onlyStarred", - "in": "query" - }, - { - "enum": [ - "time-desc", - "time-asc" - ], - "type": "string", - "default": "time-desc", - "description": "Sort method", - "name": "sort", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Use this parameter to access hits beyond limit. Numbering starts at 1. limit param acts as page size.", - "name": "page", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Limit the number of returned results", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "From range for the query history search", - "name": "from", - "in": "query" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgForm" + } }, { "type": "integer", "format": "int64", - "description": "To range for the query history search", - "name": "to", - "in": "query" + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistorySearchResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { - "description": "Adds new query to query history.", + "delete": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "query_history" + "orgs" ], - "summary": "Add query to query history.", - "operationId": "createQuery", + "summary": "Delete Organization.", + "operationId": "deleteOrgByID", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateQueryInQueryHistoryCommand" - } + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -7392,33 +5670,45 @@ "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/query-history/migrate": { - "post": { - "description": "Adds multiple queries to query history.", + "/orgs/{org_id}/address": { + "put": { "tags": [ - "query_history" + "orgs" ], - "summary": "Migrate queries to query history.", - "operationId": "migrateQueries", + "summary": "Update Organization's address.", + "operationId": "updateOrgAddress", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/MigrateQueriesToQueryHistoryCommand" + "$ref": "#/definitions/UpdateOrgAddressForm" } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryMigrationResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -7426,146 +5716,213 @@ "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/query-history/star/{query_history_uid}": { - "post": { - "description": "Adds star to query in query history as specified by the UID.", + "/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).", "tags": [ - "query_history" + "orgs" ], - "summary": "Add star to query in query history.", - "operationId": "starQuery", + "summary": "Fetch Organization quota.", + "operationId": "getOrgQuota", "parameters": [ { - "type": "string", - "name": "query_history_uid", + "type": "integer", + "format": "int64", + "name": "org_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "$ref": "#/responses/getQuotaResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Removes star from query in query history as specified by the UID.", + } + }, + "/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": [ - "query_history" + "orgs" ], - "summary": "Remove star to query in query history.", - "operationId": "unstarQuery", + "summary": "Update user quota.", + "operationId": "updateOrgQuota", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgQuotaCmd" + } + }, { "type": "string", - "name": "query_history_uid", + "name": "quota_target", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/query-history/{query_history_uid}": { - "delete": { - "description": "Deletes an existing query in query history as specified by the UID. This operation cannot be reverted.", + "/orgs/{org_id}/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": [ - "query_history" + "orgs" ], - "summary": "Delete query in query history.", - "operationId": "deleteQuery", + "summary": "Get Users in Organization.", + "operationId": "getOrgUsers", "parameters": [ { - "type": "string", - "name": "query_history_uid", + "type": "integer", + "format": "int64", + "name": "org_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryDeleteQueryResponse" + "$ref": "#/responses/getOrgUsersResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, - "patch": { - "description": "Updates comment for query in query history as specified by the UID.", + "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": [ - "query_history" + "orgs" ], - "summary": "Update comment for query in query history.", - "operationId": "patchQueryComment", + "summary": "Add a new user to the current organization.", + "operationId": "addOrgUser", "parameters": [ - { - "type": "string", - "name": "query_history_uid", - "in": "path", - "required": true - }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PatchQueryCommentInQueryHistoryCommand" + "$ref": "#/definitions/AddOrgUserCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/recording-rules": { - "get": { + "/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": [ - "recording_rules", - "enterprise" + "orgs" + ], + "summary": "Delete user in current organization.", + "operationId": "removeOrgUser", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true + } ], - "summary": "Lists all rules in the database: active or deleted.", - "operationId": "listRecordingRules", "responses": { "200": { - "$ref": "#/responses/listRecordingRulesResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7573,34 +5930,48 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, - "put": { + "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": [ - "recording_rules", - "enterprise" + "orgs" ], - "summary": "Update the active status of a rule.", - "operationId": "updateRecordingRule", + "summary": "Update Users in Organization.", + "operationId": "updateOrgUser", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/RecordingRuleJSON" + "$ref": "#/definitions/UpdateOrgUserCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/recordingRuleResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7608,71 +5979,61 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "post": { + } + }, + "/playlists": { + "get": { "tags": [ - "recording_rules", - "enterprise" + "playlists" ], - "summary": "Create a recording rule that is then registered and started.", - "operationId": "createRecordingRule", + "summary": "Get playlists.", + "operationId": "searchPlaylists", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RecordingRuleJSON" - } + "type": "string", + "name": "query", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "in:limit", + "name": "limit", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/recordingRuleResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "$ref": "#/responses/searchPlaylistsResponse" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/recording-rules/test": { + }, "post": { "tags": [ - "recording_rules", - "enterprise" + "playlists" ], - "summary": "Test a recording rule.", - "operationId": "testCreateRecordingRule", + "summary": "Create playlist.", + "operationId": "createPlaylist", "parameters": [ { - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/RecordingRuleJSON" + "$ref": "#/definitions/CreatePlaylistCommand" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/createPlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7683,26 +6044,30 @@ "404": { "$ref": "#/responses/notFoundError" }, - "422": { - "$ref": "#/responses/unprocessableEntityError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/recording-rules/writer": { + "/playlists/{uid}": { "get": { "tags": [ - "recording_rules", - "enterprise" + "playlists" + ], + "summary": "Get playlist.", + "operationId": "getPlaylist", + "parameters": [ + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + } ], - "summary": "Return the prometheus remote write target.", - "operationId": "getRecordingRuleWriteTarget", "responses": { "200": { - "$ref": "#/responses/recordingRuleWriteTargetResponse" + "$ref": "#/responses/getPlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7718,55 +6083,31 @@ } } }, - "post": { - "description": "It returns a 422 if there is not an existing prometheus data source configured.", + "put": { "tags": [ - "recording_rules", - "enterprise" + "playlists" ], - "summary": "Create a remote write target.", - "operationId": "createRecordingRuleWriteTarget", + "summary": "Update playlist.", + "operationId": "updatePlaylist", "parameters": [ { - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PrometheusRemoteWriteTargetJSON" + "$ref": "#/definitions/UpdatePlaylistCommand" } - } - ], - "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" + { + "type": "string", + "name": "uid", + "in": "path", + "required": true } - } - }, - "delete": { - "tags": [ - "recording_rules", - "enterprise" ], - "summary": "Delete the remote write target.", - "operationId": "deleteRecordingRuleWriteTarget", "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/updatePlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7781,21 +6122,17 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/recording-rules/{recordingRuleID}": { + }, "delete": { "tags": [ - "recording_rules", - "enterprise" + "playlists" ], - "summary": "Delete removes the rule from the registry and stops it.", - "operationId": "deleteRecordingRule", + "summary": "Delete playlist.", + "operationId": "deletePlaylist", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "recordingRuleID", + "type": "string", + "name": "uid", "in": "path", "required": true } @@ -7819,54 +6156,24 @@ } } }, - "/reports": { + "/playlists/{uid}/dashboards": { "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" + "playlists" ], - "summary": "Create a report.", - "operationId": "createReport", + "summary": "Get playlist dashboards.", + "operationId": "getPlaylistDashboards", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateOrUpdateConfigCmd" - } + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/createReportResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getPlaylistDashboardsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7883,31 +6190,24 @@ } } }, - "/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`.", + "/playlists/{uid}/items": { + "get": { "tags": [ - "reports", - "enterprise" + "playlists" ], - "summary": "Send a report.", - "operationId": "sendReport", + "summary": "Get playlist items.", + "operationId": "getPlaylistItems", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/ReportEmailDTO" - } + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getPlaylistItemsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7924,249 +6224,109 @@ } } }, - "/reports/render/pdf/{dashboardID}": { + "/query-history": { "get": { - "description": "Please refer to [reports enterprise](#/reports/renderReportPDFs) instead. This will be removed in Grafana 10.", - "produces": [ - "application/pdf" - ], + "description": "Returns a list of queries in the query history that matches the search criteria.\nQuery history search supports pagination. Use the `limit` parameter to control the maximum number of queries returned; the default limit is 100.\nYou can also use the `page` query parameter to fetch queries from any page other than the first one.", "tags": [ - "reports", - "enterprise" + "query_history" ], - "summary": "Render report for dashboard.", - "operationId": "renderReportPDF", - "deprecated": true, + "summary": "Query history search.", + "operationId": "searchQueries", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardID", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "dashboardID", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "title", - "in": "query" - }, - { - "type": "string", - "name": "variables", + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "List of data source UIDs to search for", + "name": "datasourceUid", "in": "query" }, { "type": "string", - "name": "from", + "description": "Text inside query or comments that is searched for", + "name": "searchString", "in": "query" }, { - "type": "string", - "name": "to", + "type": "boolean", + "description": "Flag indicating if only starred queries should be returned", + "name": "onlyStarred", "in": "query" }, { + "enum": [ + "time-desc", + "time-asc" + ], "type": "string", - "name": "orientation", + "default": "time-desc", + "description": "Sort method", + "name": "sort", "in": "query" }, { - "type": "string", - "name": "layout", + "type": "integer", + "format": "int64", + "description": "Use this parameter to access hits beyond limit. Numbering starts at 1. limit param acts as page size.", + "name": "page", "in": "query" - } - ], - "responses": { - "200": { - "$ref": "#/responses/contentResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/reports/render/pdfs": { - "get": { - "description": "Available to all users and with a valid license.", - "produces": [ - "application/pdf" - ], - "tags": [ - "reports", - "enterprise" - ], - "summary": "Render report for multiple dashboards.", - "operationId": "renderReportPDFs", - "parameters": [ { - "type": "string", - "name": "dashboardID", + "type": "integer", + "format": "int64", + "description": "Limit the number of returned results", + "name": "limit", "in": "query" }, { - "type": "string", - "name": "orientation", + "type": "integer", + "format": "int64", + "description": "From range for the query history search", + "name": "from", "in": "query" }, { - "type": "string", - "name": "layout", + "type": "integer", + "format": "int64", + "description": "To range for the query history search", + "name": "to", "in": "query" } ], "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/getQueryHistorySearchResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "500": { "$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", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/SettingsDTO" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "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`.", + "description": "Adds new query to query history.", "tags": [ - "reports", - "enterprise" + "query_history" ], - "summary": "Send test report via email.", - "operationId": "sendTestEmail", + "summary": "Add query to query history.", + "operationId": "createQuery", "parameters": [ { "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" - } - } - } - }, - "/reports/{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:id:\u003creport ID\u003e`.", - "tags": [ - "reports", - "enterprise" - ], - "summary": "Get a report.", - "operationId": "getReport", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "id", - "in": "path", - "required": true + "schema": { + "$ref": "#/definitions/CreateQueryInQueryHistoryCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/getReportResponse" + "$ref": "#/responses/getQueryHistoryResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -8174,45 +6334,33 @@ "401": { "$ref": "#/responses/unauthorisedError" }, - "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`.", + } + }, + "/query-history/migrate": { + "post": { + "description": "Adds multiple queries to query history.", "tags": [ - "reports", - "enterprise" + "query_history" ], - "summary": "Update a report.", - "operationId": "updateReport", + "summary": "Migrate queries to query history.", + "operationId": "migrateQueries", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateOrUpdateConfigCmd" + "$ref": "#/definitions/MigrateQueriesToQueryHistoryCommand" } - }, - { - "type": "integer", - "format": "int64", - "name": "id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQueryHistoryMigrationResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -8220,77 +6368,61 @@ "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "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`.", + } + }, + "/query-history/star/{query_history_uid}": { + "post": { + "description": "Adds star to query in query history as specified by the UID.", "tags": [ - "reports", - "enterprise" + "query_history" ], - "summary": "Delete a report.", - "operationId": "deleteReport", + "summary": "Add star to query in query history.", + "operationId": "starQuery", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "id", + "type": "string", + "name": "query_history_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getQueryHistoryResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/saml/acs": { - "post": { + }, + "delete": { + "description": "Removes star from query in query history as specified by the UID.", "tags": [ - "saml", - "enterprise" + "query_history" ], - "summary": "It performs assertion Consumer Service (ACS).", - "operationId": "postACS", + "summary": "Remove star to query in query history.", + "operationId": "unstarQuery", "parameters": [ { "type": "string", - "name": "RelayState", - "in": "query" + "name": "query_history_uid", + "in": "path", + "required": true } ], "responses": { - "302": { - "description": "(empty)" + "200": { + "$ref": "#/responses/getQueryHistoryResponse" }, - "403": { - "$ref": "#/responses/forbiddenError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "500": { "$ref": "#/responses/internalServerError" @@ -8298,77 +6430,66 @@ } } }, - "/saml/metadata": { - "get": { - "produces": [ - "application/xml;application/samlmetadata+xml" - ], + "/query-history/{query_history_uid}": { + "delete": { + "description": "Deletes an existing query in query history as specified by the UID. This operation cannot be reverted.", "tags": [ - "saml", - "enterprise" + "query_history" ], - "summary": "It exposes the SP (Grafana's) metadata for the IdP's consumption.", - "operationId": "getMetadata", - "responses": { - "200": { - "$ref": "#/responses/contentResponse" + "summary": "Delete query in query history.", + "operationId": "deleteQuery", + "parameters": [ + { + "type": "string", + "name": "query_history_uid", + "in": "path", + "required": true } - } - } - }, - "/saml/slo": { - "get": { - "description": "There might be two possible requests:\n1. Logout response (callback) when Grafana initiates single logout and IdP returns response to logout request.\n2. Logout request when another SP initiates single logout and IdP sends logout request to the Grafana,\nor in case of IdP-initiated logout.", - "tags": [ - "saml", - "enterprise" ], - "summary": "It performs Single Logout (SLO) callback.", - "operationId": "getSLO", "responses": { - "302": { - "description": "(empty)" - }, - "400": { - "$ref": "#/responses/badRequestError" + "200": { + "$ref": "#/responses/getQueryHistoryDeleteQueryResponse" }, - "403": { - "$ref": "#/responses/forbiddenError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { - "description": "There might be two possible requests:\n1. Logout response (callback) when Grafana initiates single logout and IdP returns response to logout request.\n2. Logout request when another SP initiates single logout and IdP sends logout request to the Grafana,\nor in case of IdP-initiated logout.", + "patch": { + "description": "Updates comment for query in query history as specified by the UID.", "tags": [ - "saml", - "enterprise" + "query_history" ], - "summary": "It performs Single Logout (SLO) callback.", - "operationId": "postSLO", + "summary": "Update comment for query in query history.", + "operationId": "patchQueryComment", "parameters": [ { "type": "string", - "name": "SAMLRequest", - "in": "query" + "name": "query_history_uid", + "in": "path", + "required": true }, { - "type": "string", - "name": "SAMLResponse", - "in": "query" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PatchQueryCommentInQueryHistoryCommand" + } } ], "responses": { - "302": { - "description": "(empty)" + "200": { + "$ref": "#/responses/getQueryHistoryResponse" }, "400": { "$ref": "#/responses/badRequestError" }, - "403": { - "$ref": "#/responses/forbiddenError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "500": { "$ref": "#/responses/internalServerError" @@ -8961,156 +7082,30 @@ "$ref": "#/responses/badRequestError" }, "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "delete": { - "tags": [ - "snapshots" - ], - "summary": "Delete Snapshot by Key.", - "operationId": "deleteDashboardSnapshot", - "parameters": [ - { - "type": "string", - "name": "key", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/teams": { - "post": { - "tags": [ - "teams" - ], - "summary": "Add Team.", - "operationId": "createTeam", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateTeamCommand" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/createTeamResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "409": { - "$ref": "#/responses/conflictError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/teams/search": { - "get": { - "tags": [ - "teams" - ], - "summary": "Team Search With Paging.", - "operationId": "searchTeams", - "parameters": [ - { - "type": "integer", - "format": "int64", - "default": 1, - "name": "page", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 1000, - "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", - "name": "name", - "in": "query" - }, - { - "type": "string", - "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/searchTeamsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/teams/{teamId}/groups": { - "get": { + }, + "delete": { "tags": [ - "sync_team_groups", - "enterprise" + "snapshots" ], - "summary": "Get External Groups.", - "operationId": "getTeamGroupsApi", + "summary": "Delete Snapshot by Key.", + "operationId": "deleteDashboardSnapshot", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "teamId", + "type": "string", + "name": "key", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getTeamGroupsApiResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "$ref": "#/responses/okResponse" }, "403": { "$ref": "#/responses/forbiddenError" @@ -9122,37 +7117,28 @@ "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/teams": { "post": { "tags": [ - "sync_team_groups", - "enterprise" + "teams" ], - "summary": "Add External Group.", - "operationId": "addTeamGroupApi", + "summary": "Add Team.", + "operationId": "createTeam", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/TeamGroupMapping" + "$ref": "#/definitions/CreateTeamCommand" } - }, - { - "type": "integer", - "format": "int64", - "name": "teamId", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/createTeamResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -9160,8 +7146,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -9169,35 +7155,44 @@ } } }, - "/teams/{teamId}/groups/{groupId}": { - "delete": { + "/teams/search": { + "get": { "tags": [ - "sync_team_groups", - "enterprise" + "teams" ], - "summary": "Remove External Group.", - "operationId": "removeTeamGroupApi", + "summary": "Team Search With Paging.", + "operationId": "searchTeams", "parameters": [ { - "type": "string", - "name": "groupId", - "in": "path", - "required": true + "type": "integer", + "format": "int64", + "default": 1, + "name": "page", + "in": "query" }, { "type": "integer", "format": "int64", - "name": "teamId", - "in": "path", - "required": true + "default": 1000, + "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", + "name": "name", + "in": "query" + }, + { + "type": "string", + "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/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/searchTeamsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -9205,9 +7200,6 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } @@ -10360,42 +8352,6 @@ "Ack": { "type": "object" }, - "ActiveSyncStatusDTO": { - "description": "ActiveSyncStatusDTO holds the information for LDAP background Sync", - "type": "object", - "properties": { - "enabled": { - "type": "boolean" - }, - "nextSync": { - "type": "string", - "format": "date-time" - }, - "prevSync": { - "$ref": "#/definitions/SyncResult" - }, - "schedule": { - "type": "string" - } - } - }, - "ActiveUserStats": { - "type": "object", - "properties": { - "active_admins_and_editors": { - "type": "integer", - "format": "int64" - }, - "active_users": { - "type": "integer", - "format": "int64" - }, - "active_viewers": { - "type": "integer", - "format": "int64" - } - } - }, "AddCommand": { "type": "object", "properties": { @@ -10502,25 +8458,6 @@ } } }, - "AddPermissionDTO": { - "type": "object", - "properties": { - "builtinRole": { - "type": "string" - }, - "permission": { - "$ref": "#/definitions/DsPermissionType" - }, - "teamId": { - "type": "integer", - "format": "int64" - }, - "userId": { - "type": "integer", - "format": "int64" - } - } - }, "AddServiceAccountTokenCommand": { "type": "object", "properties": { @@ -10542,25 +8479,6 @@ } } }, - "AddTeamRoleCommand": { - "type": "object", - "properties": { - "roleUid": { - "type": "string" - } - } - }, - "AddUserRoleCommand": { - "type": "object", - "properties": { - "global": { - "type": "boolean" - }, - "roleUid": { - "type": "string" - } - } - }, "Address": { "type": "object", "properties": { @@ -11258,26 +9176,6 @@ } } }, - "BrandingOptionsDTO": { - "type": "object", - "properties": { - "emailFooterLink": { - "type": "string" - }, - "emailFooterMode": { - "type": "string" - }, - "emailFooterText": { - "type": "string" - }, - "emailLogoUrl": { - "type": "string" - }, - "reportLogoUrl": { - "type": "string" - } - } - }, "CalculateDiffTarget": { "type": "object", "properties": { @@ -11340,84 +9238,6 @@ } } }, - "ConfigDTO": { - "description": "ConfigDTO is model representation in transfer", - "type": "object", - "properties": { - "created": { - "type": "string", - "format": "date-time" - }, - "dashboardId": { - "type": "integer", - "format": "int64" - }, - "dashboardName": { - "type": "string" - }, - "dashboardUid": { - "type": "string" - }, - "dashboards": { - "type": "array", - "items": { - "$ref": "#/definitions/DashboardDTO" - } - }, - "enableCsv": { - "type": "boolean" - }, - "enableDashboardUrl": { - "type": "boolean" - }, - "formats": { - "type": "array", - "items": { - "$ref": "#/definitions/Type" - } - }, - "id": { - "type": "integer", - "format": "int64" - }, - "message": { - "type": "string" - }, - "name": { - "type": "string" - }, - "options": { - "$ref": "#/definitions/ReportOptionsDTO" - }, - "orgId": { - "type": "integer", - "format": "int64" - }, - "recipients": { - "type": "string" - }, - "replyTo": { - "type": "string" - }, - "schedule": { - "$ref": "#/definitions/ScheduleDTO" - }, - "state": { - "$ref": "#/definitions/State" - }, - "templateVars": { - "type": "object" - }, - "updated": { - "type": "string", - "format": "date-time" - }, - "userId": { - "type": "integer", - "format": "int64" - } - } - }, "ContactPoints": { "type": "array", "items": { @@ -11658,62 +9478,8 @@ "description": "Name of the library element.", "type": "string" }, - "uid": { - "type": "string" - } - } - }, - "CreateOrUpdateConfigCmd": { - "type": "object", - "properties": { - "dashboardId": { - "type": "integer", - "format": "int64" - }, - "dashboardUid": { - "type": "string" - }, - "dashboards": { - "type": "array", - "items": { - "$ref": "#/definitions/DashboardDTO" - } - }, - "enableCsv": { - "type": "boolean" - }, - "enableDashboardUrl": { - "type": "boolean" - }, - "formats": { - "type": "array", - "items": { - "$ref": "#/definitions/Type" - } - }, - "message": { - "type": "string" - }, - "name": { - "type": "string" - }, - "options": { - "$ref": "#/definitions/ReportOptionsDTO" - }, - "recipients": { - "type": "string" - }, - "replyTo": { - "type": "string" - }, - "schedule": { - "$ref": "#/definitions/ScheduleDTO" - }, - "state": { - "$ref": "#/definitions/State" - }, - "templateVars": { - "type": "object" + "uid": { + "type": "string" } } }, @@ -11759,42 +9525,6 @@ } } }, - "CreateRoleForm": { - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "displayName": { - "type": "string" - }, - "global": { - "type": "boolean" - }, - "group": { - "type": "string" - }, - "hidden": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "permissions": { - "type": "array", - "items": { - "$ref": "#/definitions/Permission" - } - }, - "uid": { - "type": "string" - }, - "version": { - "type": "integer", - "format": "int64" - } - } - }, "CreateServiceAccountForm": { "type": "object", "properties": { @@ -11828,53 +9558,6 @@ } } }, - "CustomPermissionsRecordDTO": { - "type": "object", - "properties": { - "customPermissions": { - "type": "string" - }, - "granteeName": { - "type": "string" - }, - "granteeType": { - "type": "string" - }, - "granteeUrl": { - "type": "string" - }, - "id": { - "type": "integer", - "format": "int64" - }, - "isFolder": { - "type": "boolean" - }, - "orgId": { - "type": "integer", - "format": "int64" - }, - "orgRole": { - "type": "string" - }, - "slug": { - "type": "string" - }, - "title": { - "type": "string" - }, - "uid": { - "type": "string" - }, - "url": { - "type": "string" - }, - "usersCount": { - "type": "integer", - "format": "int64" - } - } - }, "DashboardACLInfoDTO": { "type": "object", "properties": { @@ -11978,20 +9661,6 @@ } } }, - "DashboardDTO": { - "type": "object", - "properties": { - "dashboard": { - "$ref": "#/definitions/DashboardReportDTO" - }, - "reportVariables": { - "type": "object" - }, - "timeRange": { - "$ref": "#/definitions/TimeRangeDTO" - } - } - }, "DashboardFullWithMeta": { "type": "object", "properties": { @@ -12105,21 +9774,6 @@ } } }, - "DashboardReportDTO": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "uid": { - "type": "string" - } - } - }, "DashboardSnapshot": { "description": "DashboardSnapshot model", "type": "object", @@ -12468,83 +10122,6 @@ } } }, - "DataSourcePermissionRuleDTO": { - "type": "object", - "properties": { - "builtInRole": { - "type": "string" - }, - "created": { - "type": "string", - "format": "date-time" - }, - "datasourceId": { - "type": "integer", - "format": "int64" - }, - "id": { - "type": "integer", - "format": "int64" - }, - "isManaged": { - "type": "boolean" - }, - "permission": { - "$ref": "#/definitions/DsPermissionType" - }, - "permissionName": { - "type": "string" - }, - "team": { - "type": "string" - }, - "teamAvatarUrl": { - "type": "string" - }, - "teamEmail": { - "type": "string" - }, - "teamId": { - "type": "integer", - "format": "int64" - }, - "updated": { - "type": "string", - "format": "date-time" - }, - "userAvatarUrl": { - "type": "string" - }, - "userEmail": { - "type": "string" - }, - "userId": { - "type": "integer", - "format": "int64" - }, - "userLogin": { - "type": "string" - } - } - }, - "DataSourcePermissionsDTO": { - "type": "object", - "properties": { - "datasourceId": { - "type": "integer", - "format": "int64" - }, - "enabled": { - "type": "boolean" - }, - "permissions": { - "type": "array", - "items": { - "$ref": "#/definitions/DataSourcePermissionRuleDTO" - } - } - } - }, "DataTopic": { "type": "string", "title": "DataTopic is used to identify which topic the frame should be assigned to." @@ -12558,14 +10135,6 @@ } } }, - "DeleteTokenCommand": { - "type": "object", - "properties": { - "instance": { - "type": "string" - } - } - }, "DiscoveryBase": { "type": "object", "required": [ @@ -12811,18 +10380,6 @@ } } }, - "FailedUser": { - "description": "FailedUser holds the information of an user that failed", - "type": "object", - "properties": { - "Error": { - "type": "string" - }, - "Login": { - "type": "string" - } - } - }, "Failure": { "$ref": "#/definitions/ResponseDetails" }, @@ -14916,26 +12473,6 @@ } } }, - "Permission": { - "type": "object", - "title": "Permission is the model for access control permissions.", - "properties": { - "action": { - "type": "string" - }, - "created": { - "type": "string", - "format": "date-time" - }, - "scope": { - "type": "string" - }, - "updated": { - "type": "string", - "format": "date-time" - } - } - }, "PermissionDenied": { "type": "object" }, @@ -15387,20 +12924,6 @@ } } }, - "PrometheusRemoteWriteTargetJSON": { - "type": "object", - "properties": { - "data_source_uid": { - "type": "string" - }, - "id": { - "type": "string" - }, - "remote_write_path": { - "type": "string" - } - } - }, "Provenance": { "type": "string" }, @@ -15850,76 +13373,31 @@ "type": "array", "items": { "$ref": "#/definitions/SNSConfig" - } - }, - "telegram_configs": { - "type": "array", - "items": { - "$ref": "#/definitions/TelegramConfig" - } - }, - "victorops_configs": { - "type": "array", - "items": { - "$ref": "#/definitions/VictorOpsConfig" - } - }, - "webhook_configs": { - "type": "array", - "items": { - "$ref": "#/definitions/WebhookConfig" - } - }, - "wechat_configs": { - "type": "array", - "items": { - "$ref": "#/definitions/WechatConfig" - } - } - } - }, - "RecordingRuleJSON": { - "description": "RecordingRuleJSON is the external representation of a recording rule", - "type": "object", - "properties": { - "active": { - "type": "boolean" - }, - "count": { - "type": "boolean" - }, - "description": { - "type": "string" - }, - "dest_data_source_uid": { - "type": "string" - }, - "id": { - "type": "string" - }, - "interval": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" + } }, - "prom_name": { - "type": "string" + "telegram_configs": { + "type": "array", + "items": { + "$ref": "#/definitions/TelegramConfig" + } }, - "queries": { + "victorops_configs": { "type": "array", "items": { - "type": "object", - "additionalProperties": false + "$ref": "#/definitions/VictorOpsConfig" } }, - "range": { - "type": "integer", - "format": "int64" + "webhook_configs": { + "type": "array", + "items": { + "$ref": "#/definitions/WebhookConfig" + } }, - "target_ref_id": { - "type": "string" + "wechat_configs": { + "type": "array", + "items": { + "$ref": "#/definitions/WechatConfig" + } } } }, @@ -15940,41 +13418,6 @@ } } }, - "ReportEmailDTO": { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "emails": { - "description": "Comma-separated list of emails to which to send the report to.", - "type": "string" - }, - "id": { - "description": "Send the report to the emails specified in the report. Required if emails is not present.", - "type": "string", - "format": "int64" - }, - "useEmailsFromReport": { - "description": "Send the report to the emails specified in the report. Required if emails is not present.", - "type": "boolean" - } - } - }, - "ReportOptionsDTO": { - "type": "object", - "properties": { - "layout": { - "type": "string" - }, - "orientation": { - "type": "string" - }, - "timeRange": { - "$ref": "#/definitions/TimeRangeDTO" - } - } - }, "ResponseDetails": { "type": "object", "properties": { @@ -16009,79 +13452,6 @@ } } }, - "RoleAssignmentsDTO": { - "type": "object", - "properties": { - "role_uid": { - "type": "string" - }, - "service_accounts": { - "type": "array", - "items": { - "type": "integer", - "format": "int64" - } - }, - "teams": { - "type": "array", - "items": { - "type": "integer", - "format": "int64" - } - }, - "users": { - "type": "array", - "items": { - "type": "integer", - "format": "int64" - } - } - } - }, - "RoleDTO": { - "type": "object", - "properties": { - "created": { - "type": "string", - "format": "date-time" - }, - "delegatable": { - "type": "boolean" - }, - "description": { - "type": "string" - }, - "displayName": { - "type": "string" - }, - "group": { - "type": "string" - }, - "hidden": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "permissions": { - "type": "array", - "items": { - "$ref": "#/definitions/Permission" - } - }, - "uid": { - "type": "string" - }, - "updated": { - "type": "string", - "format": "date-time" - }, - "version": { - "type": "integer", - "format": "int64" - } - } - }, "Route": { "description": "A Route is a node that contains definitions of how to handle alerts. This is modified\nfrom the upstream alertmanager in that it adds the ObjectMatchers property.", "type": "object", @@ -16362,49 +13732,6 @@ } } }, - "ScheduleDTO": { - "type": "object", - "properties": { - "day": { - "type": "string" - }, - "dayOfMonth": { - "type": "string" - }, - "endDate": { - "type": "string", - "format": "date-time" - }, - "frequency": { - "type": "string" - }, - "hour": { - "type": "integer", - "format": "int64" - }, - "intervalAmount": { - "type": "integer", - "format": "int64" - }, - "intervalFrequency": { - "type": "string" - }, - "minute": { - "type": "integer", - "format": "int64" - }, - "startDate": { - "type": "string", - "format": "date-time" - }, - "timeZone": { - "type": "string" - }, - "workdaysOnly": { - "type": "boolean" - } - } - }, "SearchServiceAccountsResult": { "description": "swagger: model", "type": "object", @@ -16597,49 +13924,6 @@ } } }, - "SetRoleAssignmentsCommand": { - "type": "object", - "properties": { - "service_accounts": { - "type": "array", - "items": { - "type": "integer", - "format": "int64" - } - }, - "teams": { - "type": "array", - "items": { - "type": "integer", - "format": "int64" - } - }, - "users": { - "type": "array", - "items": { - "type": "integer", - "format": "int64" - } - } - } - }, - "SetUserRolesCommand": { - "type": "object", - "properties": { - "global": { - "type": "boolean" - }, - "includeHidden": { - "type": "boolean" - }, - "roleUids": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, "SettingsBag": { "type": "object", "additionalProperties": { @@ -16649,26 +13933,6 @@ } } }, - "SettingsDTO": { - "type": "object", - "properties": { - "branding": { - "$ref": "#/definitions/BrandingOptionsDTO" - }, - "id": { - "type": "integer", - "format": "int64" - }, - "orgId": { - "type": "integer", - "format": "int64" - }, - "userId": { - "type": "integer", - "format": "int64" - } - } - }, "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", @@ -16840,17 +14104,6 @@ "SmtpNotEnabled": { "$ref": "#/definitions/ResponseDetails" }, - "State": { - "type": "string" - }, - "Status": { - "type": "object", - "properties": { - "enabled": { - "type": "boolean" - } - } - }, "Success": { "$ref": "#/definitions/ResponseDetails" }, @@ -16862,39 +14115,6 @@ } } }, - "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" - } - } - } - }, "TLSConfig": { "type": "object", "title": "TLSConfig configures the options for TLS connections.", @@ -16969,34 +14189,10 @@ }, "orgId": { "type": "integer", - "format": "int64" - }, - "permission": { - "$ref": "#/definitions/PermissionType" - } - } - }, - "TeamGroupDTO": { - "type": "object", - "properties": { - "groupId": { - "type": "string" - }, - "orgId": { - "type": "integer", - "format": "int64" - }, - "teamId": { - "type": "integer", - "format": "int64" - } - } - }, - "TeamGroupMapping": { - "type": "object", - "properties": { - "groupId": { - "type": "string" + "format": "int64" + }, + "permission": { + "$ref": "#/definitions/PermissionType" } } }, @@ -17314,104 +14510,6 @@ } } }, - "TimeRangeDTO": { - "type": "object", - "properties": { - "from": { - "type": "string" - }, - "to": { - "type": "string" - } - } - }, - "Token": { - "type": "object", - "properties": { - "account": { - "type": "string" - }, - "company": { - "type": "string" - }, - "details_url": { - "type": "string" - }, - "exp": { - "type": "integer", - "format": "int64" - }, - "iat": { - "type": "integer", - "format": "int64" - }, - "included_users": { - "type": "integer", - "format": "int64" - }, - "iss": { - "type": "string" - }, - "jti": { - "type": "string" - }, - "lexp": { - "type": "integer", - "format": "int64" - }, - "lic_exp_warn_days": { - "type": "integer", - "format": "int64" - }, - "lid": { - "type": "string" - }, - "limit_by": { - "type": "string" - }, - "max_concurrent_user_sessions": { - "type": "integer", - "format": "int64" - }, - "nbf": { - "type": "integer", - "format": "int64" - }, - "prod": { - "type": "array", - "items": { - "type": "string" - } - }, - "slug": { - "type": "string" - }, - "status": { - "$ref": "#/definitions/TokenStatus" - }, - "sub": { - "type": "string" - }, - "tok_exp_warn_days": { - "type": "integer", - "format": "int64" - }, - "trial": { - "type": "boolean" - }, - "trial_exp": { - "type": "integer", - "format": "int64" - }, - "update_days": { - "type": "integer", - "format": "int64" - }, - "usage_billing": { - "type": "boolean" - } - } - }, "TokenDTO": { "type": "object", "properties": { @@ -17454,10 +14552,6 @@ } } }, - "TokenStatus": { - "type": "integer", - "format": "int64" - }, "TrimDashboardCommand": { "type": "object", "properties": { @@ -17480,9 +14574,6 @@ } } }, - "Type": { - "type": "string" - }, "URL": { "type": "object", "title": "URL is a custom URL type that allows validation at configuration load time.", @@ -17850,39 +14941,6 @@ } } }, - "UpdateRoleCommand": { - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "displayName": { - "type": "string" - }, - "global": { - "type": "boolean" - }, - "group": { - "type": "string" - }, - "hidden": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "permissions": { - "type": "array", - "items": { - "$ref": "#/definitions/Permission" - } - }, - "version": { - "type": "integer", - "format": "int64" - } - } - }, "UpdateServiceAccountForm": { "type": "object", "properties": { @@ -18866,21 +15924,6 @@ "$ref": "#/definitions/ErrorResponseBody" } }, - "addPermissionResponse": { - "description": "(empty)", - "schema": { - "type": "object", - "properties": { - "message": { - "type": "string" - }, - "permissionId": { - "type": "integer", - "format": "int64" - } - } - } - }, "adminCreateUserResponse": { "description": "(empty)", "schema": { @@ -18930,16 +15973,6 @@ "$ref": "#/definitions/ErrorResponseBody" } }, - "contentResponse": { - "description": "(empty)", - "schema": { - "type": "array", - "items": { - "type": "integer", - "format": "uint8" - } - } - }, "createCorrelationResponse": { "description": "(empty)", "schema": { @@ -19035,27 +16068,6 @@ "$ref": "#/definitions/Playlist" } }, - "createReportResponse": { - "description": "(empty)", - "schema": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "message": { - "type": "string" - } - } - } - }, - "createRoleResponse": { - "description": "(empty)", - "schema": { - "$ref": "#/definitions/RoleDTO" - } - }, "createServiceAccountResponse": { "description": "(empty)", "schema": { @@ -19240,12 +16252,6 @@ } } }, - "getAccessControlStatusResponse": { - "description": "(empty)", - "schema": { - "$ref": "#/definitions/Status" - } - }, "getAlertNotificationChannelResponse": { "description": "(empty)", "schema": { @@ -19285,21 +16291,6 @@ } } }, - "getAllPermissionseResponse": { - "description": "(empty)", - "schema": { - "$ref": "#/definitions/DataSourcePermissionsDTO" - } - }, - "getAllRolesResponse": { - "description": "(empty)", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/RoleDTO" - } - } - }, "getAnnotationByIDResponse": { "description": "(empty)", "schema": { @@ -19351,15 +16342,6 @@ "$ref": "#/definitions/OrgDetailsDTO" } }, - "getCustomPermissionsReportResponse": { - "description": "(empty)", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/CustomPermissionsRecordDTO" - } - } - }, "getDashboardPermissionsListResponse": { "description": "(empty)", "schema": { @@ -19461,12 +16443,6 @@ "$ref": "#/definitions/LibraryElementSearchResponse" } }, - "getLicenseTokenResponse": { - "description": "(empty)", - "schema": { - "$ref": "#/definitions/Token" - } - }, "getOrgByIDResponse": { "description": "(empty)", "schema": { @@ -19575,39 +16551,6 @@ } } }, - "getReportResponse": { - "description": "(empty)", - "schema": { - "$ref": "#/definitions/ConfigDTO" - } - }, - "getReportSettingsResponse": { - "description": "(empty)", - "schema": { - "$ref": "#/definitions/SettingsDTO" - } - }, - "getReportsResponse": { - "description": "(empty)", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/ConfigDTO" - } - } - }, - "getRoleAssignmentsResponse": { - "description": "(empty)", - "schema": { - "$ref": "#/definitions/RoleAssignmentsDTO" - } - }, - "getRoleResponse": { - "description": "(empty)", - "schema": { - "$ref": "#/definitions/RoleDTO" - } - }, "getSharingOptionsResponse": { "description": "(empty)", "schema": { @@ -19643,30 +16586,12 @@ } } }, - "getStatusResponse": { - "description": "(empty)" - }, - "getSyncStatusResponse": { - "description": "(empty)", - "schema": { - "$ref": "#/definitions/ActiveSyncStatusDTO" - } - }, "getTeamByIDResponse": { "description": "(empty)", "schema": { "$ref": "#/definitions/TeamDTO" } }, - "getTeamGroupsApiResponse": { - "description": "(empty)", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/TeamGroupDTO" - } - } - }, "getTeamMembersResponse": { "description": "(empty)", "schema": { @@ -19730,36 +16655,6 @@ "$ref": "#/definitions/ErrorResponseBody" } }, - "listBuiltinRolesResponse": { - "description": "(empty)", - "schema": { - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "$ref": "#/definitions/RoleDTO" - } - } - } - }, - "listRecordingRulesResponse": { - "description": "(empty)", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/RecordingRuleJSON" - } - } - }, - "listRolesResponse": { - "description": "(empty)", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/RoleDTO" - } - } - }, "listSortOptionsResponse": { "description": "(empty)", "schema": { @@ -19920,9 +16815,6 @@ } } }, - "postRenewLicenseTokenResponse": { - "description": "(empty)" - }, "preconditionFailedError": { "description": "PreconditionFailedError", "schema": { @@ -19935,24 +16827,6 @@ "$ref": "#/definitions/QueryDataResponse" } }, - "recordingRuleResponse": { - "description": "(empty)", - "schema": { - "$ref": "#/definitions/RecordingRuleJSON" - } - }, - "recordingRuleWriteTargetResponse": { - "description": "(empty)", - "schema": { - "$ref": "#/definitions/PrometheusRemoteWriteTargetJSON" - } - }, - "refreshLicenseStatsResponse": { - "description": "(empty)", - "schema": { - "$ref": "#/definitions/ActiveUserStats" - } - }, "retrieveServiceAccountResponse": { "description": "(empty)", "schema": { @@ -20007,12 +16881,6 @@ "$ref": "#/definitions/SearchUserQueryResult" } }, - "setRoleAssignmentsResponse": { - "description": "(empty)", - "schema": { - "$ref": "#/definitions/RoleAssignmentsDTO" - } - }, "testAlertResponse": { "description": "(empty)", "schema": { diff --git a/public/api-spec.json b/public/api-spec.json index dc1d00da78fa..57aeea67c527 100644 --- a/public/api-spec.json +++ b/public/api-spec.json @@ -22,58 +22,25 @@ }, "basePath": "/api", "paths": { - "/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:read` and scope `roles:*`.", - "tags": [ - "access_control", - "enterprise" - ], - "summary": "Get all roles.", - "operationId": "listRoles", - "parameters": [ + "/admin/ldap/reload": { + "post": { + "security": [ { - "type": "boolean", - "name": "delegatable", - "in": "query" + "basic": [] } ], - "responses": { - "200": { - "$ref": "#/responses/listRolesResponse" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "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:type:delegate`. `permissions:type: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.", + "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": [ - "access_control", - "enterprise" - ], - "summary": "Create a new custom role.", - "operationId": "createRole", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateRoleForm" - } - } + "admin_ldap" ], + "summary": "Reloads the LDAP configuration.", + "operationId": "reloadLDAPCfg", "responses": { - "201": { - "$ref": "#/responses/createRoleResponse" + "200": { + "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -84,26 +51,25 @@ } } }, - "/access-control/roles/{roleUID}": { + "/admin/ldap/status": { "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", - "parameters": [ + "security": [ { - "type": "string", - "name": "roleUID", - "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 `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/getRoleResponse" + "$ref": "#/responses/okResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -112,71 +78,63 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "You need to have a permission with action `roles:write` and scope `permissions:type:delegate`. `permissions:type:delegate` scope ensures that users can only create custom roles with the same, or a subset of permissions which the user has.", + } + }, + "/admin/ldap/sync/{user_id}": { + "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": [ - "access_control", - "enterprise" + "admin_ldap" ], - "summary": "Update a custom role.", - "operationId": "updateRole", + "summary": "Enables a single Grafana user to be synchronized against LDAP.", + "operationId": "postSyncUserWithLDAP", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateRoleCommand" - } - }, - { - "type": "string", - "name": "roleUID", + "type": "integer", + "format": "int64", + "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" }, - "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:type:delegate`. `permissions:type: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.", + } + }, + "/admin/ldap/{user_name}": { + "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 `ldap.user:read`.", "tags": [ - "access_control", - "enterprise" + "admin_ldap" ], - "summary": "Delete a custom role.", - "operationId": "deleteRole", + "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": "getUserFromLDAP", "parameters": [ - { - "type": "boolean", - "name": "force", - "in": "query" - }, - { - "type": "boolean", - "name": "global", - "in": "query" - }, { "type": "string", - "name": "roleUID", + "name": "user_name", "in": "path", "required": true } @@ -185,8 +143,8 @@ "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -197,127 +155,121 @@ } } }, - "/access-control/roles/{roleUID}/assignments": { - "get": { - "description": "Get role assignments for the role with the given UID.\n\nYou need to have a permission with action `teams.roles:list` and scope `teams:id:*` and `users.roles:list` and scope `users:id:*`.", + "/admin/pause-all-alerts": { + "post": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "access_control", - "enterprise" + "admin" ], - "summary": "Get role assignments.", - "operationId": "getRoleAssignments", + "summary": "Pause/unpause all (legacy) alerts.", + "operationId": "pauseAllAlerts", "parameters": [ { - "type": "string", - "name": "roleUID", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PauseAllAlertsCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/getRoleAssignmentsResponse" + "$ref": "#/responses/pauseAlertsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "Set role assignments for the role with the given UID.\n\nYou need to have a permission with action `teams.roles:add` and `teams.roles:remove` and scope `permissions:type:delegate`, and `users.roles:add` and `users.roles:remove` and scope `permissions:type:delegate`.", - "tags": [ - "access_control", - "enterprise" - ], - "summary": "Set role assignments.", - "operationId": "setRoleAssignments", - "parameters": [ - { - "type": "string", - "name": "roleUID", - "in": "path", - "required": true - }, + } + }, + "/admin/provisioning/dashboards/reload": { + "post": { + "security": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/SetRoleAssignmentsCommand" - } + "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": "adminProvisioningReloadDashboards", "responses": { "200": { - "$ref": "#/responses/setRoleAssignmentsResponse" + "$ref": "#/responses/okResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/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`.", + "/admin/provisioning/datasources/reload": { + "post": { + "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": [ - "access_control", - "enterprise" + "admin_provisioning" ], - "summary": "Get status.", - "operationId": "getAccessControlStatus", + "summary": "Reload datasource provisioning configurations.", + "operationId": "adminProvisioningReloadDatasources", "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:read` and scope `teams:id:\u003cteam ID\u003e`.", - "tags": [ - "access_control", - "enterprise" - ], - "summary": "Get team roles.", - "operationId": "listTeamRoles", - "parameters": [ + "/admin/provisioning/notifications/reload": { + "post": { + "security": [ { - "type": "integer", - "format": "int64", - "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": "adminProvisioningReloadNotifications", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -326,226 +278,150 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "You need to have a permission with action `teams.roles:add` and `teams.roles:remove` and scope `permissions:type:delegate` for each.", - "tags": [ - "access_control", - "enterprise" - ], - "summary": "Update team role.", - "operationId": "setTeamRoles", - "parameters": [ + } + }, + "/admin/provisioning/plugins/reload": { + "post": { + "security": [ { - "type": "integer", - "format": "int64", - "name": "teamId", - "in": "path", - "required": true + "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": "adminProvisioningReloadPlugins", "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" } } - }, - "post": { - "description": "You need to have a permission with action `teams.roles:add` and scope `permissions:type:delegate`.", - "tags": [ - "access_control", - "enterprise" - ], - "summary": "Add team role.", - "operationId": "addTeamRole", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AddTeamRoleCommand" - } - }, + } + }, + "/admin/settings": { + "get": { + "security": [ { - "type": "integer", - "format": "int64", - "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": "adminGetSettings", "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/adminGetSettingsResponse" }, - "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:type:delegate`.", + "/admin/stats": { + "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": [ - "access_control", - "enterprise" - ], - "summary": "Remove team role.", - "operationId": "removeTeamRole", - "parameters": [ - { - "type": "string", - "name": "roleUID", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "teamId", - "in": "path", - "required": true - } + "admin" ], + "summary": "Fetch Grafana Stats.", + "operationId": "adminGetStats", "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/adminGetStatsResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/access-control/users/{userId}/roles": { - "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:read` and scope `users:id:\u003cuser ID\u003e`.", - "tags": [ - "access_control", - "enterprise" - ], - "summary": "List roles assigned to a user.", - "operationId": "listUserRoles", - "parameters": [ + "/admin/users": { + "post": { + "security": [ { - "type": "integer", - "format": "int64", - "name": "userId", - "in": "path", - "required": true + "basic": [] } ], - "responses": { - "200": { - "$ref": "#/responses/getAllRolesResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$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:type:delegate` for each. `permissions:type: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.", + "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": [ - "access_control", - "enterprise" + "admin_users" ], - "summary": "Set user role assignments.", - "operationId": "setUserRoles", + "summary": "Create new user.", + "operationId": "adminCreateUser", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/SetUserRolesCommand" + "$ref": "#/definitions/AdminCreateUserForm" } - }, - { - "type": "integer", - "format": "int64", - "name": "userId", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/adminCreateUserResponse" }, "400": { "$ref": "#/responses/badRequestError" }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "412": { + "$ref": "#/responses/preconditionFailedError" }, "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:type:delegate`. `permissions:type: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.", + } + }, + "/admin/users/{user_id}": { + "delete": { + "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:delete` and scope `global.users:*`.", "tags": [ - "access_control", - "enterprise" + "admin_users" ], - "summary": "Add a user role assignment.", - "operationId": "addUserRole", + "summary": "Delete global User.", + "operationId": "adminDeleteUser", "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AddUserRoleCommand" - } - }, { "type": "integer", "format": "int64", - "name": "userId", + "name": "user_id", "in": "path", "required": true } @@ -554,6 +430,9 @@ "200": { "$ref": "#/responses/okResponse" }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, "403": { "$ref": "#/responses/forbiddenError" }, @@ -566,66 +445,31 @@ } } }, - "/access-control/users/{userId}/roles/{roleUID}": { - "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:type:delegate`. `permissions:type: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.", + "/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": [ - "access_control", - "enterprise" + "admin_users" ], - "summary": "Remove a user role assignment.", - "operationId": "removeUserRole", + "summary": "Return a list of all auth tokens (devices) that the user currently have logged in from.", + "operationId": "adminGetUserAuthTokens", "parameters": [ - { - "type": "boolean", - "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" - }, - { - "type": "string", - "name": "roleUID", - "in": "path", - "required": true - }, { "type": "integer", "format": "int64", - "name": "userId", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/admin/ldap-sync-status": { - "get": { - "description": "You need to have a permission with action `ldap.status:read`.", - "tags": [ - "ldap_debug" - ], - "summary": "Returns the current state of the LDAP background sync integration.", - "operationId": "getSyncStatus", - "responses": { - "200": { - "$ref": "#/responses/getSyncStatusResponse" + "$ref": "#/responses/adminGetUserAuthTokensResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -639,19 +483,28 @@ } } }, - "/admin/ldap/reload": { + "/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.config:reload`.", + "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_ldap" + "admin_users" + ], + "summary": "Disable user.", + "operationId": "adminDisableUser", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true + } ], - "summary": "Reloads the LDAP configuration.", - "operationId": "reloadLDAPCfg", "responses": { "200": { "$ref": "#/responses/okResponse" @@ -662,25 +515,37 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/ldap/status": { - "get": { + "/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.status:read`.", + "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_ldap" + "admin_users" + ], + "summary": "Enable user.", + "operationId": "adminEnableUser", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true + } ], - "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" @@ -691,25 +556,28 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/ldap/sync/{user_id}": { + "/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:sync`.", + "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_ldap" + "admin_users" ], - "summary": "Enables a single Grafana user to be synchronized against LDAP.", - "operationId": "postSyncUserWithLDAP", + "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": "adminLogoutUser", "parameters": [ { "type": "integer", @@ -723,35 +591,50 @@ "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/ldap/{user_name}": { - "get": { + "/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 `ldap.user:read`.", + "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_ldap" + "admin_users" ], - "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": "getUserFromLDAP", + "summary": "Set password for user.", + "operationId": "adminUpdateUserPassword", "parameters": [ { - "type": "string", - "name": "user_name", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AdminUpdateUserPasswordForm" + } + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } @@ -760,6 +643,9 @@ "200": { "$ref": "#/responses/okResponse" }, + "400": { + "$ref": "#/responses/badRequestError" + }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -772,31 +658,37 @@ } } }, - "/admin/pause-all-alerts": { - "post": { - "security": [ - { - "basic": [] - } - ], + "/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" + "admin_users" ], - "summary": "Pause/unpause all (legacy) alerts.", - "operationId": "pauseAllAlerts", + "summary": "Set permissions for user.", + "operationId": "adminUpdateUserPermissions", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PauseAllAlertsCommand" + "$ref": "#/definitions/AdminUpdateUserPermissionsForm" } + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/pauseAlertsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -810,43 +702,31 @@ } } }, - "/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" - }, - "403": { - "$ref": "#/responses/forbiddenError" - } - } - } - }, - "/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`.", + "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_provisioning" + "admin_users" + ], + "summary": "Fetch user quota.", + "operationId": "getUserQuota", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true + } ], - "summary": "Reload dashboard provisioning configurations.", - "operationId": "adminProvisioningReloadDashboards", "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQuotaResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -854,25 +734,51 @@ "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`.", + "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_provisioning" + "admin_users" + ], + "summary": "Update user quota.", + "operationId": "updateUserQuota", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateUserQuotaCmd" + } + }, + { + "type": "string", + "name": "quota_target", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true + } ], - "summary": "Reload datasource provisioning configurations.", - "operationId": "adminProvisioningReloadDatasources", "responses": { "200": { "$ref": "#/responses/okResponse" @@ -883,57 +789,78 @@ "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`.", + "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_provisioning" + "admin_users" + ], + "summary": "Revoke auth token for user.", + "operationId": "adminRevokeUserAuthToken", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RevokeAuthTokenCmd" + } + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true + } ], - "summary": "Reload legacy alert notifier provisioning configurations.", - "operationId": "adminProvisioningReloadNotifications", "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`.", + "/alert-notifications": { + "get": { + "description": "Returns all notification channels that the authenticated user has permission to view.", "tags": [ - "admin_provisioning" + "legacy_alerts_notification_channels" ], - "summary": "Reload plugin provisioning configurations.", - "operationId": "adminProvisioningReloadPlugins", + "summary": "Get all notification channels.", + "operationId": "getAlertNotificationChannels", "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getAlertNotificationChannelsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -945,45 +872,54 @@ "$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": [] + "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": "adminGetSettings", "responses": { "200": { - "$ref": "#/responses/adminGetSettingsResponse" + "$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`.", + "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": [ - "admin" + "legacy_alerts_notification_channels" ], - "summary": "Fetch Grafana Stats.", - "operationId": "adminGetStats", + "summary": "Get all notification channels (lookup).", + "operationId": "getAlertNotificationLookup", "responses": { "200": { - "$ref": "#/responses/adminGetStatsResponse" + "$ref": "#/responses/getAlertNotificationLookupResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -997,32 +933,27 @@ } } }, - "/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`.", + "description": "Sends a test notification to the channel.", "tags": [ - "admin_users" + "legacy_alerts_notification_channels" ], - "summary": "Create new user.", - "operationId": "adminCreateUser", + "summary": "Test notification channel.", + "operationId": "notificationChannelTest", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AdminCreateUserForm" + "$ref": "#/definitions/NotificationTestCommand" } } ], "responses": { "200": { - "$ref": "#/responses/adminCreateUserResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -1034,7 +965,7 @@ "$ref": "#/responses/forbiddenError" }, "412": { - "$ref": "#/responses/preconditionFailedError" + "$ref": "#/responses/SMTPNotEnabledError" }, "500": { "$ref": "#/responses/internalServerError" @@ -1042,31 +973,25 @@ } } }, - "/admin/users/{user_id}": { - "delete": { - "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:delete` and scope `global.users:*`.", + "/alert-notifications/uid/{notification_channel_uid}": { + "get": { + "description": "Returns the notification channel given the notification channel UID.", "tags": [ - "admin_users" + "legacy_alerts_notification_channels" ], - "summary": "Delete global User.", - "operationId": "adminDeleteUser", + "summary": "Get notification channel by UID.", + "operationId": "getAlertNotificationChannelByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "name": "notification_channel_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1081,71 +1006,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:*`.", + }, + "put": { + "description": "Updates an existing notification channel identified by uid.", "tags": [ - "admin_users" + "legacy_alerts_notification_channels" ], - "summary": "Return a list of all auth tokens (devices) that the user currently have logged in from.", - "operationId": "adminGetUserAuthTokens", + "summary": "Update notification channel by UID.", + "operationId": "updateAlertNotificationChannelByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/adminGetUserAuthTokensResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateAlertNotificationWithUidCommand" + } }, - "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": "adminDisableUser", - "parameters": [ { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "name": "notification_channel_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1160,33 +1047,25 @@ "$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).", + }, + "delete": { + "description": "Deletes an existing notification channel identified by UID.", "tags": [ - "admin_users" + "legacy_alerts_notification_channels" ], - "summary": "Enable user.", - "operationId": "adminEnableUser", + "summary": "Delete alert notification by UID.", + "operationId": "deleteAlertNotificationChannelByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "name": "notification_channel_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/deleteAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1203,34 +1082,26 @@ } } }, - "/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:*`.", + "/alert-notifications/{notification_channel_id}": { + "get": { + "description": "Returns the notification channel given the notification channel ID.", "tags": [ - "admin_users" + "legacy_alerts_notification_channels" ], - "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": "adminLogoutUser", + "summary": "Get notification channel by ID.", + "operationId": "getAlertNotificationChannelByID", "parameters": [ { "type": "integer", "format": "int64", - "name": "user_id", + "name": "notification_channel_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1245,44 +1116,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:*`.", + "description": "Updates an existing notification channel identified by ID.", "tags": [ - "admin_users" + "legacy_alerts_notification_channels" ], - "summary": "Set password for user.", - "operationId": "adminUpdateUserPassword", + "summary": "Update notification channel by ID.", + "operationId": "updateAlertNotificationChannel", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AdminUpdateUserPasswordForm" + "$ref": "#/definitions/UpdateAlertNotificationCommand" } }, { "type": "integer", "format": "int64", - "name": "user_id", + "name": "notification_channel_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1290,33 +1151,26 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "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:*`.", + }, + "delete": { + "description": "Deletes an existing notification channel identified by ID.", "tags": [ - "admin_users" + "legacy_alerts_notification_channels" ], - "summary": "Set permissions for user.", - "operationId": "adminUpdateUserPermissions", + "summary": "Delete alert notification by ID.", + "operationId": "deleteAlertNotificationChannel", "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AdminUpdateUserPermissionsForm" - } - }, { "type": "integer", "format": "int64", - "name": "user_id", + "name": "notification_channel_id", "in": "path", "required": true } @@ -1325,1853 +1179,232 @@ "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/users/{user_id}/quotas": { + "/alerts": { "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" + "legacy_alerts" ], - "summary": "Fetch user quota.", - "operationId": "getUserQuota", + "summary": "Get legacy alerts.", + "operationId": "getAlerts", "parameters": [ + { + "type": "array", + "items": { + "type": "string" + }, + "description": "Limit response to alerts in specified dashboard(s). You can specify multiple dashboards.", + "name": "dashboardId", + "in": "query" + }, { "type": "integer", "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getQuotaResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "description": "Limit response to alert for a specified panel on a dashboard.", + "name": "panelId", + "in": "query" }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/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": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateUserQuotaCmd" - } + { + "type": "string", + "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", - "name": "quota_target", - "in": "path", - "required": true + "description": "Return alerts with one or more of the following alert states", + "name": "state", + "in": "query" }, { "type": "integer", "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "description": "Limit response to X number of alerts.", + "name": "limit", + "in": "query" }, - "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": "adminRevokeUserAuthToken", - "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RevokeAuthTokenCmd" - } + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "Limit response to alerts of dashboards in specified folder(s). You can specify multiple folders", + "name": "folderId", + "in": "query" }, { - "type": "integer", - "format": "int64", - "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" + "type": "string", + "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" - } - } - }, - "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": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateAlertNotificationCommand" - } + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "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/getAlertNotificationChannelResponse" + "$ref": "#/responses/getAlertsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "409": { - "$ref": "#/responses/conflictError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alert-notifications/lookup": { + "/alerts/states-for-dashboard": { "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": "getAlertNotificationLookup", - "responses": { - "200": { - "$ref": "#/responses/getAlertNotificationLookupResponse" - }, - "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" + "legacy_alerts" ], - "summary": "Test notification channel.", - "operationId": "notificationChannelTest", + "summary": "Get alert states for a dashboard.", + "operationId": "getDashboardStates", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/NotificationTestCommand" - } + "type": "integer", + "format": "int64", + "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" - }, - "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.", + "/alerts/test": { + "post": { "tags": [ - "legacy_alerts_notification_channels" - ], - "summary": "Get notification channel by UID.", - "operationId": "getAlertNotificationChannelByUID", - "parameters": [ - { - "type": "string", - "name": "notification_channel_uid", - "in": "path", - "required": true - } + "legacy_alerts" ], - "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": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateAlertNotificationWithUidCommand" - } - }, - { - "type": "string", - "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" - } - } - }, - "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", - "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", - "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": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateAlertNotificationCommand" - } - }, - { - "type": "integer", - "format": "int64", - "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" - } - } - }, - "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", - "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" - }, - "description": "Limit response to alerts in specified dashboard(s). You can specify multiple dashboards.", - "name": "dashboardId", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Limit response to alert for a specified panel on a dashboard.", - "name": "panelId", - "in": "query" - }, - { - "type": "string", - "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", - "description": "Return alerts with one or more of the following alert states", - "name": "state", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Limit response to X number of alerts.", - "name": "limit", - "in": "query" - }, - { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "description": "Limit response to alerts of dashboards in specified folder(s). You can specify multiple folders", - "name": "folderId", - "in": "query" - }, - { - "type": "string", - "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", - "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/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", - "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": [ - { - "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", - "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", - "name": "alert_id", - "in": "path", - "required": true - }, - { - "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", - "description": "Find annotations created after specific epoch datetime in milliseconds.", - "name": "from", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations created before specific epoch datetime in milliseconds.", - "name": "to", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Limit response to annotations created by specific user.", - "name": "userId", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations for a specified alert.", - "name": "alertId", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations that are scoped to a specific dashboard", - "name": "dashboardId", - "in": "query" - }, - { - "type": "string", - "description": "Find annotations that are scoped to a specific dashboard", - "name": "dashboardUID", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations that are scoped to a specific panel", - "name": "panelId", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Max limit for results returned.", - "name": "limit", - "in": "query" - }, - { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "description": "Use this to filter organization annotations. Organization 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", - "description": "Return alerts or user created annotations", - "name": "type", - "in": "query" - }, - { - "type": "boolean", - "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 an organization 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": "postAnnotation", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PostAnnotationsCmd" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/postAnnotationResponse" - }, - "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": "postGraphiteAnnotation", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PostGraphiteAnnotationsCmd" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/postAnnotationResponse" - }, - "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": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/MassDeleteAnnotationsCmd" - } - } - ], - "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", - "description": "Tag is a string that you can use to filter tags.", - "name": "tag", - "in": "query" - }, - { - "type": "string", - "default": "100", - "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}": { - "get": { - "tags": [ - "annotations" - ], - "summary": "Get Annotation by ID.", - "operationId": "getAnnotationByID", - "parameters": [ - { - "type": "string", - "name": "annotation_id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAnnotationByIDResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "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", - "name": "annotation_id", - "in": "path", - "required": true - }, - { - "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": "deleteAnnotationByID", - "parameters": [ - { - "type": "string", - "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", - "name": "annotation_id", - "in": "path", - "required": true - }, - { - "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, - "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/AddCommand" - } - } - ], - "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", - "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": "searchDashboardSnapshots", - "parameters": [ - { - "type": "string", - "description": "Search Query", - "name": "query", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 1000, - "description": "Limit the number of returned results", - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "$ref": "#/responses/searchDashboardSnapshotsResponse" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboards/calculate-diff": { - "post": { - "produces": [ - "application/json", - "text/html" - ], - "tags": [ - "dashboards" - ], - "summary": "Perform diff on two dashboards.", - "operationId": "calculateDashboardDiff", - "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" - ] - }, - "new": { - "$ref": "#/definitions/CalculateDiffTarget" - } - } - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/calculateDashboardDiffResponse" - }, - "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": { - "description": "Please refer to [updated API](#/dashboard_permissions/getDashboardPermissionsListByUID) instead", - "tags": [ - "dashboard_permissions" - ], - "summary": "Gets all existing permissions for the given dashboard.", - "operationId": "getDashboardPermissionsListByID", - "deprecated": true, - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "DashboardID", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getDashboardPermissionsListResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "post": { - "description": "Please refer to [updated API](#/dashboard_permissions/updateDashboardPermissionsByUID) instead\n\nThis operation will remove existing permissions if they’re not included in the request.", - "tags": [ - "dashboard_permissions" - ], - "summary": "Updates permissions for a dashboard.", - "operationId": "updateDashboardPermissionsByID", - "deprecated": true, - "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": { - "description": "Please refer to [updated API](#/dashboard_versions/restoreDashboardVersionByUID) instead", - "tags": [ - "dashboard_versions" - ], - "summary": "Restore a dashboard to a given dashboard version.", - "operationId": "restoreDashboardVersionByID", - "deprecated": true, - "parameters": [ - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RestoreDashboardVersionCommand" - } - }, - { - "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": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionsByUID) instead", - "tags": [ - "dashboard_versions" - ], - "summary": "Gets all existing versions for the dashboard.", - "operationId": "getDashboardVersionsByID", - "deprecated": true, - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "DashboardID", - "in": "path", - "required": true - } - ], - "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": { - "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionByUID) instead", - "tags": [ - "dashboard_versions" - ], - "summary": "Get a specific dashboard version.", - "operationId": "getDashboardVersionByID", - "deprecated": true, - "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/getDashboardsTagsResponse" - }, - "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", - "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", - "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" - } - } - } - }, - "/dashboards/uid/{uid}/permissions": { - "get": { - "tags": [ - "dashboard_permissions" - ], - "summary": "Gets all existing permissions for the given dashboard.", - "operationId": "getDashboardPermissionsListByUID", - "parameters": [ - { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "summary": "Test alert.", + "operationId": "testAlert", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/AlertTestCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/getDashboardPermissionsListResponse" + "$ref": "#/responses/testAlertResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "422": { + "$ref": "#/responses/unprocessableEntityError" }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "post": { - "description": "This operation will remove existing permissions if they’re not included in the request.", + } + }, + "/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": [ - "dashboard_permissions" + "legacy_alerts" ], - "summary": "Updates permissions for a dashboard.", - "operationId": "updateDashboardPermissionsByUID", + "summary": "Get alert by ID.", + "operationId": "getAlertByID", "parameters": [ - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateDashboardACLCommand" - } - }, { "type": "string", - "name": "uid", + "name": "alert_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getAlertResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/uid/{uid}/restore": { + "/alerts/{alert_id}/pause": { "post": { "tags": [ - "dashboard_versions" + "legacy_alerts" ], - "summary": "Restore a dashboard to a given dashboard version using UID.", - "operationId": "restoreDashboardVersionByUID", + "summary": "Pause/unpause alert by id.", + "operationId": "pauseAlert", "parameters": [ { - "name": "Body", + "type": "string", + "name": "alert_id", + "in": "path", + "required": true + }, + { + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/RestoreDashboardVersionCommand" + "$ref": "#/definitions/PauseAlertCommand" } - }, - { - "type": "string", - "name": "uid", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/postDashboardResponse" + "$ref": "#/responses/pauseAlertResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3188,40 +1421,132 @@ } } }, - "/dashboards/uid/{uid}/versions": { + "/annotations": { "get": { + "description": "Starting in Grafana v6.4 regions annotations are now returned in one entity that now includes the timeEnd property.", "tags": [ - "dashboard_versions" + "annotations" ], - "summary": "Gets all existing versions for the dashboard using UID.", - "operationId": "getDashboardVersionsByUID", + "summary": "Find Annotations.", + "operationId": "getAnnotations", "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "Find annotations created after specific epoch datetime in milliseconds.", + "name": "from", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations created before specific epoch datetime in milliseconds.", + "name": "to", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Limit response to annotations created by specific user.", + "name": "userId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations for a specified alert.", + "name": "alertId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations that are scoped to a specific dashboard", + "name": "dashboardId", + "in": "query" + }, { "type": "string", - "name": "uid", - "in": "path", - "required": true + "description": "Find annotations that are scoped to a specific dashboard", + "name": "dashboardUID", + "in": "query" }, { "type": "integer", "format": "int64", - "default": 0, - "description": "Maximum number of results to return", - "name": "limit", + "description": "Find annotations that are scoped to a specific panel", + "name": "panelId", "in": "query" }, { "type": "integer", "format": "int64", - "default": 0, - "description": "Version to start from when returning queries", - "name": "start", + "description": "Max limit for results returned.", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "Use this to filter organization annotations. Organization 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", + "description": "Return alerts or user created annotations", + "name": "type", + "in": "query" + }, + { + "type": "boolean", + "description": "Match any or all tags", + "name": "matchAny", "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionsResponse" + "$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 an organization 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": "postAnnotation", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PostAnnotationsCmd" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/postAnnotationResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3229,40 +1554,36 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/uid/{uid}/versions/{DashboardVersionID}": { - "get": { + "/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": [ - "dashboard_versions" + "annotations" ], - "summary": "Get a specific dashboard version using UID.", - "operationId": "getDashboardVersionByUID", + "summary": "Create Annotation in Graphite format.", + "operationId": "postGraphiteAnnotation", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardVersionID", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PostGraphiteAnnotationsCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionResponse" + "$ref": "#/responses/postAnnotationResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3270,116 +1591,134 @@ "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:*`.", + "/annotations/mass-delete": { + "post": { "tags": [ - "datasources" + "annotations" + ], + "summary": "Delete multiple annotations.", + "operationId": "massDeleteAnnotations", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/MassDeleteAnnotationsCmd" + } + } ], - "summary": "Get all data sources.", - "operationId": "getDataSources", "responses": { "200": { - "$ref": "#/responses/getDataSourcesResponse" + "$ref": "#/responses/okResponse" }, "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`", + } + }, + "/annotations/tags": { + "get": { + "description": "Find all the event tags created in the annotations.", "tags": [ - "datasources" + "annotations" ], - "summary": "Create a data source.", - "operationId": "addDataSource", + "summary": "Find Annotations Tags.", + "operationId": "getAnnotationTags", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AddDataSourceCommand" - } + "type": "string", + "description": "Tag is a string that you can use to filter tags.", + "name": "tag", + "in": "query" + }, + { + "type": "string", + "default": "100", + "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/correlations": { + "/annotations/{annotation_id}": { "get": { "tags": [ - "correlations" + "annotations" + ], + "summary": "Get Annotation by ID.", + "operationId": "getAnnotationByID", + "parameters": [ + { + "type": "string", + "name": "annotation_id", + "in": "path", + "required": true + } ], - "summary": "Gets all correlations.", - "operationId": "getCorrelations", "responses": { "200": { - "$ref": "#/responses/getCorrelationsResponse" + "$ref": "#/responses/getAnnotationByIDResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/id/{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).", + }, + "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": [ - "datasources" + "annotations" ], - "summary": "Get data source Id by Name.", - "operationId": "getDataSourceIdByName", + "summary": "Update Annotation.", + "operationId": "updateAnnotation", "parameters": [ { "type": "string", - "name": "name", + "name": "annotation_id", "in": "path", "required": true + }, + { + "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" @@ -3387,34 +1726,29 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/name/{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).", + }, + "delete": { + "description": "Deletes the annotation that matches the specified ID.", "tags": [ - "datasources" + "annotations" ], - "summary": "Get a single data source by Name.", - "operationId": "getDataSourceByName", + "summary": "Delete Annotation By ID.", + "operationId": "deleteAnnotationByID", "parameters": [ { "type": "string", - "name": "name", + "name": "annotation_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDataSourceResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3427,24 +1761,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).", + "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": [ - "datasources" + "annotations" ], - "summary": "Delete an existing data source by name.", - "operationId": "deleteDataSourceByName", + "summary": "Patch Annotation.", + "operationId": "patchAnnotation", "parameters": [ { "type": "string", - "name": "name", + "name": "annotation_id", "in": "path", "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PatchAnnotationsCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/deleteDataSourceByNameResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3461,34 +1803,26 @@ } } }, - "/datasources/proxy/uid/{uid}/{datasource_proxy_route}": { + "/auth/keys": { "get": { - "description": "Proxies all calls to the actual data source.", + "description": "Will return auth keys.", "tags": [ - "datasources" + "api_keys" ], - "summary": "Data source proxy GET calls.", - "operationId": "datasourceProxyGETByUIDcalls", + "summary": "Get auth keys.", + "operationId": "getAPIkeys", "parameters": [ { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "type": "boolean", + "default": false, + "description": "Show expired keys", + "name": "includeExpired", + "in": "query" } ], "responses": { "200": { - "description": "" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getAPIkeyResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3505,38 +1839,25 @@ } }, "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", + "description": "Will return details of the created API key.", "tags": [ - "datasources" + "api_keys" ], - "summary": "Data source proxy POST calls.", - "operationId": "datasourceProxyPOSTByUIDcalls", + "summary": "Creates an API key.", + "operationId": "addAPIkey", "parameters": [ { - "name": "DatasourceProxyParam", + "name": "Body", "in": "body", "required": true, - "schema": {} - }, - { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "schema": { + "$ref": "#/definitions/AddCommand" + } } ], "responses": { - "201": { - "description": "" - }, - "202": { - "description": "" + "200": { + "$ref": "#/responses/postAPIkeyResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3547,41 +1868,34 @@ "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" + "api_keys" ], - "summary": "Data source proxy DELETE calls.", - "operationId": "datasourceProxyDELETEByUIDcalls", + "summary": "Delete API key.", + "operationId": "deleteAPIkey", "parameters": [ { - "type": "string", - "name": "uid", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "datasource_proxy_route", + "type": "integer", + "format": "int64", + "name": "id", "in": "path", "required": true } ], "responses": { - "202": { - "description": "" - }, - "400": { - "$ref": "#/responses/badRequestError" + "200": { + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3598,35 +1912,79 @@ } } }, - "/datasources/proxy/{id}/{datasource_proxy_route}": { - "get": { - "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyGETByUIDcalls) instead", + "/dashboard/snapshots": { + "get": { + "tags": [ + "snapshots" + ], + "summary": "List snapshots.", + "operationId": "searchDashboardSnapshots", + "parameters": [ + { + "type": "string", + "description": "Search Query", + "name": "query", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1000, + "description": "Limit the number of returned results", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/searchDashboardSnapshotsResponse" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/calculate-diff": { + "post": { + "produces": [ + "application/json", + "text/html" + ], "tags": [ - "datasources" + "dashboards" ], - "summary": "Data source proxy GET calls.", - "operationId": "datasourceProxyGETcalls", - "deprecated": true, + "summary": "Perform diff on two dashboards.", + "operationId": "calculateDashboardDiff", "parameters": [ { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", - "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" + ] + }, + "new": { + "$ref": "#/definitions/CalculateDiffTarget" + } + } + } } ], "responses": { "200": { - "description": "" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/calculateDashboardDiffResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3634,48 +1992,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/dashboards/db": { "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\n\nPlease refer to [updated API](#/datasources/datasourceProxyPOSTByUIDcalls) instead", + "description": "Creates a new dashboard or updates an existing dashboard.", "tags": [ - "datasources" + "dashboards" ], - "summary": "Data source proxy POST calls.", - "operationId": "datasourceProxyPOSTcalls", - "deprecated": true, + "summary": "Create / Update dashboard", + "operationId": "postDashboard", "parameters": [ { - "name": "DatasourceProxyParam", + "name": "Body", "in": "body", "required": true, - "schema": {} - }, - { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", - "in": "path", - "required": true + "schema": { + "$ref": "#/definitions/SaveDashboardCommand" + } } ], "responses": { - "201": { - "description": "" - }, - "202": { - "description": "" + "200": { + "$ref": "#/responses/postDashboardResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3689,77 +2032,66 @@ "404": { "$ref": "#/responses/notFoundError" }, + "412": { + "$ref": "#/responses/preconditionFailedError" + }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyDELETEByUIDcalls) instead", + } + }, + "/dashboards/home": { + "get": { "tags": [ - "datasources" - ], - "summary": "Data source proxy DELETE calls.", - "operationId": "datasourceProxyDELETEcalls", - "deprecated": true, - "parameters": [ - { - "type": "string", - "name": "id", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - } + "dashboards" ], + "summary": "Get home dashboard.", + "operationId": "getHomeDashboard", "responses": { - "202": { - "description": "" - }, - "400": { - "$ref": "#/responses/badRequestError" + "200": { + "$ref": "#/responses/getHomeDashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources/uid/{sourceUID}/correlations": { + "/dashboards/id/{DashboardID}/permissions": { "get": { + "description": "Please refer to [updated API](#/dashboard_permissions/getDashboardPermissionsListByUID) instead", "tags": [ - "correlations" + "dashboard_permissions" ], - "summary": "Gets all correlations originating from the given data source.", - "operationId": "getCorrelationsBySourceUID", + "summary": "Gets all existing permissions for the given dashboard.", + "operationId": "getDashboardPermissionsListByID", + "deprecated": true, "parameters": [ { - "type": "string", - "name": "sourceUID", + "type": "integer", + "format": "int64", + "name": "DashboardID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getCorrelationsBySourceUIDResponse" + "$ref": "#/responses/getDashboardPermissionsListResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "404": { "$ref": "#/responses/notFoundError" }, @@ -3769,30 +2101,33 @@ } }, "post": { + "description": "Please refer to [updated API](#/dashboard_permissions/updateDashboardPermissionsByUID) instead\n\nThis operation will remove existing permissions if they’re not included in the request.", "tags": [ - "correlations" + "dashboard_permissions" ], - "summary": "Add correlation.", - "operationId": "createCorrelation", + "summary": "Updates permissions for a dashboard.", + "operationId": "updateDashboardPermissionsByID", + "deprecated": true, "parameters": [ { - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateCorrelationCommand" + "$ref": "#/definitions/UpdateDashboardACLCommand" } }, { - "type": "string", - "name": "sourceUID", + "type": "integer", + "format": "int64", + "name": "DashboardID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/createCorrelationResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3812,34 +2147,42 @@ } } }, - "/datasources/uid/{sourceUID}/correlations/{correlationUID}": { - "get": { + "/dashboards/id/{DashboardID}/restore": { + "post": { + "description": "Please refer to [updated API](#/dashboard_versions/restoreDashboardVersionByUID) instead", "tags": [ - "correlations" + "dashboard_versions" ], - "summary": "Gets a correlation.", - "operationId": "getCorrelation", + "summary": "Restore a dashboard to a given dashboard version.", + "operationId": "restoreDashboardVersionByID", + "deprecated": true, "parameters": [ { - "type": "string", - "name": "sourceUID", - "in": "path", - "required": true + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RestoreDashboardVersionCommand" + } }, { - "type": "string", - "name": "correlationUID", + "type": "integer", + "format": "int64", + "name": "DashboardID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getCorrelationResponse" + "$ref": "#/responses/postDashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "404": { "$ref": "#/responses/notFoundError" }, @@ -3847,40 +2190,29 @@ "$ref": "#/responses/internalServerError" } } - }, - "patch": { + } + }, + "/dashboards/id/{DashboardID}/versions": { + "get": { + "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionsByUID) instead", "tags": [ - "correlations" + "dashboard_versions" ], - "summary": "Updates a correlation.", - "operationId": "updateCorrelation", + "summary": "Gets all existing versions for the dashboard.", + "operationId": "getDashboardVersionsByID", + "deprecated": true, "parameters": [ { - "type": "string", - "name": "sourceUID", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "correlationUID", + "type": "integer", + "format": "int64", + "name": "DashboardID", "in": "path", "required": true - }, - { - "name": "body", - "in": "body", - "schema": { - "$ref": "#/definitions/UpdateCorrelationCommand" - } } ], "responses": { "200": { - "$ref": "#/responses/updateCorrelationResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/dashboardVersionsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3897,28 +2229,34 @@ } } }, - "/datasources/uid/{uid}": { + "/dashboards/id/{DashboardID}/versions/{DashboardVersionID}": { "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).", + "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionByUID) instead", "tags": [ - "datasources" + "dashboard_versions" ], - "summary": "Get a single data source by UID.", - "operationId": "getDataSourceByUID", + "summary": "Get a specific dashboard version.", + "operationId": "getDashboardVersionByID", + "deprecated": true, "parameters": [ { - "type": "string", - "name": "uid", + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "DashboardVersionID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDataSourceResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/dashboardVersionResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3933,126 +2271,105 @@ "$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:uid:*` and `datasources:uid:1` (single data source).", + } + }, + "/dashboards/import": { + "post": { "tags": [ - "datasources" + "dashboards" ], - "summary": "Update an existing data source.", - "operationId": "updateDataSourceByUID", + "summary": "Import dashboard.", + "operationId": "importDashboard", "parameters": [ { "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDataSourceCommand" + "$ref": "#/definitions/ImportDashboardRequest" } - }, - { - "type": "string", - "name": "uid", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" + "$ref": "#/responses/importDashboardResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" + "412": { + "$ref": "#/responses/preconditionFailedError" + }, + "422": { + "$ref": "#/responses/unprocessableEntityError" }, "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).", + } + }, + "/dashboards/tags": { + "get": { "tags": [ - "datasources" - ], - "summary": "Delete an existing data source by UID.", - "operationId": "deleteDataSourceByUID", - "parameters": [ - { - "type": "string", - "name": "uid", - "in": "path", - "required": true - } + "dashboards" ], + "summary": "Get all dashboards tags of an organisation.", + "operationId": "getDashboardTags", "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getDashboardsTagsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources/uid/{uid}/correlations/{correlationUID}": { - "delete": { + "/dashboards/trim": { + "post": { "tags": [ - "correlations" + "dashboards" ], - "summary": "Delete a correlation.", - "operationId": "deleteCorrelation", + "summary": "Trim defaults from dashboard.", + "operationId": "trimDashboard", "parameters": [ { - "type": "string", - "name": "uid", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "correlationUID", - "in": "path", - "required": true + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/TrimDashboardCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/deleteCorrelationResponse" + "$ref": "#/responses/trimDashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources/uid/{uid}/health": { + "/dashboards/uid/{uid}": { "get": { + "description": "Will return the dashboard given the dashboard unique identifier (uid).", "tags": [ - "datasources" + "dashboards" ], - "summary": "Sends a health check request to the plugin datasource identified by the UID.", - "operationId": "checkDatasourceHealthWithUID", + "summary": "Get dashboard by uid.", + "operationId": "getDashboardByUID", "parameters": [ { "type": "string", @@ -4063,10 +2380,7 @@ ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/dashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4074,26 +2388,22 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/uid/{uid}/resources/{datasource_proxy_route}": { - "get": { + }, + "delete": { + "description": "Will delete the dashboard given the specified unique identifier (uid).", "tags": [ - "datasources" + "dashboards" ], - "summary": "Fetch data source resources.", - "operationId": "callDatasourceResourceWithUID", + "summary": "Delete dashboard by uid.", + "operationId": "deleteDashboardByUID", "parameters": [ - { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, { "type": "string", "name": "uid", @@ -4103,10 +2413,7 @@ ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/deleteDashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4123,29 +2430,24 @@ } } }, - "/datasources/{datasourceId}/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).", + "/dashboards/uid/{uid}/permissions": { + "get": { "tags": [ - "datasource_permissions", - "enterprise" + "dashboard_permissions" ], - "summary": "Disable permissions for a data source.", - "operationId": "disablePermissions", + "summary": "Gets all existing permissions for the given dashboard.", + "operationId": "getDashboardPermissionsListByUID", "parameters": [ { "type": "string", - "name": "datasourceId", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getDashboardPermissionsListResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4160,28 +2462,33 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/{datasourceId}/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).", + "description": "This operation will remove existing permissions if they’re not included in the request.", "tags": [ - "datasource_permissions", - "enterprise" + "dashboard_permissions" ], - "summary": "Enable permissions for a data source.", - "operationId": "enablePermissions", + "summary": "Updates permissions for a dashboard.", + "operationId": "updateDashboardPermissionsByUID", "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateDashboardACLCommand" + } + }, { "type": "string", - "name": "datasourceId", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4201,26 +2508,32 @@ } } }, - "/datasources/{datasourceId}/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).", + "/dashboards/uid/{uid}/restore": { + "post": { "tags": [ - "datasource_permissions", - "enterprise" + "dashboard_versions" ], - "summary": "Get permissions for a data source.", - "operationId": "getAllPermissions", + "summary": "Restore a dashboard to a given dashboard version using UID.", + "operationId": "restoreDashboardVersionByUID", "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RestoreDashboardVersionCommand" + } + }, { "type": "string", - "name": "datasourceId", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAllPermissionseResponse" + "$ref": "#/responses/postDashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4235,49 +2548,42 @@ "$ref": "#/responses/internalServerError" } } - }, - "post": { - "description": "You need to have a permission with action `datasources.permissions:read` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", + } + }, + "/dashboards/uid/{uid}/versions": { + "get": { "tags": [ - "datasource_permissions", - "enterprise" + "dashboard_versions" ], - "summary": "Add permissions for a data source.", - "operationId": "addPermission", + "summary": "Gets all existing versions for the dashboard using UID.", + "operationId": "getDashboardVersionsByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "userId", - "in": "query" + "type": "string", + "name": "uid", + "in": "path", + "required": true }, { "type": "integer", "format": "int64", - "name": "teamId", - "in": "query" - }, - { - "type": "string", - "name": "builtinRole", + "default": 0, + "description": "Maximum number of results to return", + "name": "limit", "in": "query" }, { "type": "integer", "format": "int64", - "name": "permission", + "default": 0, + "description": "Version to start from when returning queries", + "name": "start", "in": "query" - }, - { - "type": "string", - "name": "datasourceId", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/addPermissionResponse" + "$ref": "#/responses/dashboardVersionsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4294,32 +2600,31 @@ } } }, - "/datasources/{datasourceId}/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).", + "/dashboards/uid/{uid}/versions/{DashboardVersionID}": { + "get": { "tags": [ - "datasource_permissions", - "enterprise" + "dashboard_versions" ], - "summary": "Remove permission for a data source.", - "operationId": "deletePermissions", + "summary": "Get a specific dashboard version using UID.", + "operationId": "getDashboardVersionByUID", "parameters": [ { - "type": "string", - "name": "datasourceId", + "type": "integer", + "format": "int64", + "name": "DashboardVersionID", "in": "path", "required": true }, { "type": "string", - "name": "permissionId", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/dashboardVersionResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4329,33 +2634,24 @@ }, "404": { "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/datasources/{id}": { + "/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 scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).\n\nPlease refer to [updated API](#/datasources/getDataSourceByUID) instead", + "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 a single data source by Id.", - "operationId": "getDataSourceByID", - "deprecated": true, - "parameters": [ - { - "type": "string", - "name": "id", - "in": "path", - "required": true - } - ], + "summary": "Get all data sources.", + "operationId": "getDataSources", "responses": { "200": { - "$ref": "#/responses/getDataSourceResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getDataSourcesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4363,36 +2659,26 @@ "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).\n\nPlease refer to [updated API](#/datasources/updateDataSourceByUID) instead", + "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": "Update an existing data source by its sequential ID.", - "operationId": "updateDataSourceByID", - "deprecated": true, + "summary": "Create a data source.", + "operationId": "addDataSource", "parameters": [ { "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDataSourceCommand" + "$ref": "#/definitions/AddDataSourceCommand" } - }, - { - "type": "string", - "name": "id", - "in": "path", - "required": true } ], "responses": { @@ -4405,37 +2691,29 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "409": { + "$ref": "#/responses/conflictError" + }, "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).\n\nPlease refer to [updated API](#/datasources/deleteDataSourceByUID) instead", + } + }, + "/datasources/correlations": { + "get": { "tags": [ - "datasources" - ], - "summary": "Delete an existing data source by id.", - "operationId": "deleteDataSourceByID", - "deprecated": true, - "parameters": [ - { - "type": "string", - "name": "id", - "in": "path", - "required": true - } + "correlations" ], + "summary": "Gets all correlations.", + "operationId": "getCorrelations", "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getCorrelationsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "404": { "$ref": "#/responses/notFoundError" }, @@ -4445,29 +2723,25 @@ } } }, - "/datasources/{id}/health": { + "/datasources/id/{name}": { "get": { - "description": "Please refer to [updated API](#/datasources/checkDatasourceHealthWithUID) instead", + "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": "Sends a health check request to the plugin datasource identified by the ID.", - "operationId": "checkDatasourceHealthByID", - "deprecated": true, + "summary": "Get data source Id by Name.", + "operationId": "getDataSourceIdByName", "parameters": [ { "type": "string", - "name": "id", + "name": "name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getDataSourceIDResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4475,41 +2749,34 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources/{id}/resources/{datasource_proxy_route}": { + "/datasources/name/{name}": { "get": { - "description": "Please refer to [updated API](#/datasources/callDatasourceResourceWithUID) instead", + "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": "Fetch data source resources by Id.", - "operationId": "callDatasourceResourceByID", - "deprecated": true, + "summary": "Get a single data source by Name.", + "operationId": "getDataSourceByName", "parameters": [ { "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", + "name": "name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getDataSourceResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4517,42 +2784,29 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/ds/query": { - "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`.", + }, + "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": [ - "ds" + "datasources" ], - "summary": "DataSource query metrics with expressions.", - "operationId": "queryMetricsWithExpressions", + "summary": "Delete an existing data source by name.", + "operationId": "deleteDataSourceByName", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/MetricRequest" - } + "type": "string", + "name": "name", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/queryMetricsWithExpressionsRespons" - }, - "207": { - "$ref": "#/responses/queryMetricsWithExpressionsRespons" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/deleteDataSourceByNameResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4560,41 +2814,43 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/folders": { + "/datasources/proxy/uid/{uid}/{datasource_proxy_route}": { "get": { - "description": "Returns all folders that the authenticated user has permission to view.", + "description": "Proxies all calls to the actual data source.", "tags": [ - "folders" + "datasources" ], - "summary": "Get all folders.", - "operationId": "getFolders", + "summary": "Data source proxy GET calls.", + "operationId": "datasourceProxyGETByUIDcalls", "parameters": [ { - "type": "integer", - "format": "int64", - "default": 1000, - "description": "Limit the maximum number of folders to return", - "name": "limit", - "in": "query" + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true }, { - "type": "integer", - "format": "int64", - "default": 1, - "description": "Page index for starting fetching folders", - "name": "page", - "in": "query" + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getFoldersResponse" + "description": "" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4602,30 +2858,47 @@ "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": [ - "folders" + "datasources" ], - "summary": "Create folder.", - "operationId": "createFolder", + "summary": "Data source proxy POST calls.", + "operationId": "datasourceProxyPOSTByUIDcalls", "parameters": [ { - "name": "body", + "name": "DatasourceProxyParam", "in": "body", "required": true, - "schema": { - "$ref": "#/definitions/CreateFolderCommand" - } + "schema": {} + }, + { + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { - "200": { - "$ref": "#/responses/folderResponse" + "201": { + "description": "" + }, + "202": { + "description": "" }, "400": { "$ref": "#/responses/badRequestError" @@ -4636,35 +2909,41 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/folders/id/{folder_id}": { - "get": { - "description": "Returns the folder identified by id.", + }, + "delete": { + "description": "Proxies all calls to the actual data source.", "tags": [ - "folders" + "datasources" ], - "summary": "Get folder by id.", - "operationId": "getFolderByID", + "summary": "Data source proxy DELETE calls.", + "operationId": "datasourceProxyDELETEByUIDcalls", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "folder_id", + "type": "string", + "name": "uid", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "datasource_proxy_route", "in": "path", "required": true } ], "responses": { - "200": { - "$ref": "#/responses/folderResponse" + "202": { + "description": "" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4681,24 +2960,35 @@ } } }, - "/folders/{folder_uid}": { + "/datasources/proxy/{id}/{datasource_proxy_route}": { "get": { + "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyGETByUIDcalls) instead", "tags": [ - "folders" + "datasources" ], - "summary": "Get folder by uid.", - "operationId": "getFolderByUID", + "summary": "Data source proxy GET calls.", + "operationId": "datasourceProxyGETcalls", + "deprecated": true, "parameters": [ { "type": "string", - "name": "folder_uid", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" + "description": "" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4714,32 +3004,40 @@ } } }, - "put": { + "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\n\nPlease refer to [updated API](#/datasources/datasourceProxyPOSTByUIDcalls) instead", "tags": [ - "folders" + "datasources" ], - "summary": "Update folder.", - "operationId": "updateFolder", + "summary": "Data source proxy POST calls.", + "operationId": "datasourceProxyPOSTcalls", + "deprecated": true, "parameters": [ + { + "name": "DatasourceProxyParam", + "in": "body", + "required": true, + "schema": {} + }, { "type": "string", - "name": "folder_uid", + "name": "datasource_proxy_route", "in": "path", "required": true }, { - "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/UpdateFolderCommand" - } + "type": "string", + "name": "id", + "in": "path", + "required": true } ], "responses": { - "200": { - "$ref": "#/responses/folderResponse" + "201": { + "description": "" + }, + "202": { + "description": "" }, "400": { "$ref": "#/responses/badRequestError" @@ -4753,39 +3051,36 @@ "404": { "$ref": "#/responses/notFoundError" }, - "409": { - "$ref": "#/responses/conflictError" - }, "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.", + "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyDELETEByUIDcalls) instead", "tags": [ - "folders" + "datasources" ], - "summary": "Delete folder.", - "operationId": "deleteFolder", + "summary": "Data source proxy DELETE calls.", + "operationId": "datasourceProxyDELETEcalls", + "deprecated": true, "parameters": [ { "type": "string", - "name": "folder_uid", + "name": "id", "in": "path", "required": true }, { - "type": "boolean", - "default": false, - "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" + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true } ], "responses": { - "200": { - "$ref": "#/responses/deleteFolderResponse" + "202": { + "description": "" }, "400": { "$ref": "#/responses/badRequestError" @@ -4805,31 +3100,28 @@ } } }, - "/folders/{folder_uid}/permissions": { + "/datasources/uid/{sourceUID}/correlations": { "get": { "tags": [ - "folder_permissions" + "correlations" ], - "summary": "Gets all existing permissions for the folder with the given `uid`.", - "operationId": "getFolderPermissionList", + "summary": "Gets all correlations originating from the given data source.", + "operationId": "getCorrelationsBySourceUID", "parameters": [ { "type": "string", - "name": "folder_uid", + "name": "sourceUID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getFolderPermissionListResponse" + "$ref": "#/responses/getCorrelationsBySourceUIDResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "404": { "$ref": "#/responses/notFoundError" }, @@ -4840,29 +3132,32 @@ }, "post": { "tags": [ - "folder_permissions" + "correlations" ], - "summary": "Updates permissions for a folder. This operation will remove existing permissions if they’re not included in the request.", - "operationId": "updateFolderPermissions", + "summary": "Add correlation.", + "operationId": "createCorrelation", "parameters": [ { - "type": "string", - "name": "folder_uid", - "in": "path", - "required": true - }, - { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDashboardACLCommand" + "$ref": "#/definitions/CreateCorrelationCommand" } + }, + { + "type": "string", + "name": "sourceUID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/createCorrelationResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4879,112 +3174,154 @@ } } }, - "/library-elements": { + "/datasources/uid/{sourceUID}/correlations/{correlationUID}": { "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" + "correlations" ], - "summary": "Get all library elements.", - "operationId": "getLibraryElements", + "summary": "Gets a correlation.", + "operationId": "getCorrelation", "parameters": [ { "type": "string", - "description": "Part of the name or description searched for.", - "name": "searchString", - "in": "query" - }, - { - "enum": [ - 1, - 2 - ], - "type": "integer", - "format": "int64", - "description": "Kind of element to search for.", - "name": "kind", - "in": "query" + "name": "sourceUID", + "in": "path", + "required": true }, { - "enum": [ - "alpha-asc", - "alpha-desc" - ], "type": "string", - "description": "Sort order of elements.", - "name": "sortDirection", - "in": "query" + "name": "correlationUID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getCorrelationResponse" }, - { - "type": "string", - "description": "A comma separated list of types to filter the elements by", - "name": "typeFilter", - "in": "query" + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "404": { + "$ref": "#/responses/notFoundError" }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "patch": { + "tags": [ + "correlations" + ], + "summary": "Updates a correlation.", + "operationId": "updateCorrelation", + "parameters": [ { "type": "string", - "description": "Element UID to exclude from search results.", - "name": "excludeUid", - "in": "query" + "name": "sourceUID", + "in": "path", + "required": true }, { "type": "string", - "description": "A comma separated list of folder ID(s) to filter the elements by.", - "name": "folderFilter", - "in": "query" + "name": "correlationUID", + "in": "path", + "required": true }, { - "type": "integer", - "format": "int64", - "default": 100, - "description": "The number of results per page.", - "name": "perPage", - "in": "query" + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/UpdateCorrelationCommand" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/updateCorrelationResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/datasources/uid/{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": "integer", - "format": "int64", - "default": 1, - "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" + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementsResponse" + "$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": "Creates a new library element.", + "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:uid:*` and `datasources:uid:1` (single data source).", "tags": [ - "library_elements" + "datasources" ], - "summary": "Create library element.", - "operationId": "createLibraryElement", + "summary": "Update an existing data source.", + "operationId": "updateDataSourceByUID", "parameters": [ { - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateLibraryElementCommand" + "$ref": "#/definitions/UpdateDataSourceCommand" } + }, + { + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4992,38 +3329,36 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/library-elements/name/{library_element_name}": { - "get": { - "description": "Returns a library element with the given name.", + }, + "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": [ - "library_elements" + "datasources" ], - "summary": "Get library element by name.", - "operationId": "getLibraryElementByName", + "summary": "Delete an existing data source by UID.", + "operationId": "deleteDataSourceByUID", "parameters": [ { "type": "string", - "name": "library_element_name", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "404": { "$ref": "#/responses/notFoundError" }, @@ -5033,29 +3368,37 @@ } } }, - "/library-elements/{library_element_uid}": { - "get": { - "description": "Returns a library element with the given UID.", + "/datasources/uid/{uid}/correlations/{correlationUID}": { + "delete": { "tags": [ - "library_elements" + "correlations" ], - "summary": "Get library element by UID.", - "operationId": "getLibraryElementByUID", + "summary": "Delete a correlation.", + "operationId": "deleteCorrelation", "parameters": [ { "type": "string", - "name": "library_element_uid", + "name": "uid", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "correlationUID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/deleteCorrelationResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "404": { "$ref": "#/responses/notFoundError" }, @@ -5063,18 +3406,19 @@ "$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.", + } + }, + "/datasources/uid/{uid}/health": { + "get": { "tags": [ - "library_elements" + "datasources" ], - "summary": "Delete library element.", - "operationId": "deleteLibraryElementByUID", + "summary": "Sends a health check request to the plugin datasource identified by the UID.", + "operationId": "checkDatasourceHealthWithUID", "parameters": [ { "type": "string", - "name": "library_element_uid", + "name": "uid", "in": "path", "required": true } @@ -5092,40 +3436,36 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "patch": { - "description": "Updates an existing library element identified by uid.", + } + }, + "/datasources/uid/{uid}/resources/{datasource_proxy_route}": { + "get": { "tags": [ - "library_elements" + "datasources" ], - "summary": "Update library element.", - "operationId": "updateLibraryElement", + "summary": "Fetch data source resources.", + "operationId": "callDatasourceResourceWithUID", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PatchLibraryElementCommand" - } + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true }, { "type": "string", - "name": "library_element_uid", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5139,38 +3479,42 @@ "404": { "$ref": "#/responses/notFoundError" }, - "412": { - "$ref": "#/responses/preconditionFailedError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/library-elements/{library_element_uid}/connections/": { + "/datasources/{id}": { "get": { - "description": "Returns a list of connections for a library element based on the UID specified.", + "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).\n\nPlease refer to [updated API](#/datasources/getDataSourceByUID) instead", "tags": [ - "library_elements" + "datasources" ], - "summary": "Get library element connections.", - "operationId": "getLibraryElementConnections", + "summary": "Get a single data source by Id.", + "operationId": "getDataSourceByID", + "deprecated": true, "parameters": [ { "type": "string", - "name": "library_element_uid", + "name": "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" }, @@ -5178,57 +3522,74 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/licensing/check": { - "get": { + }, + "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).\n\nPlease refer to [updated API](#/datasources/updateDataSourceByUID) instead", "tags": [ - "licensing", - "enterprise" + "datasources" ], - "summary": "Check license availability.", - "operationId": "getStatus", - "responses": { - "200": { - "$ref": "#/responses/getStatusResponse" + "summary": "Update an existing data source by its sequential ID.", + "operationId": "updateDataSourceByID", + "deprecated": true, + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateDataSourceCommand" + } + }, + { + "type": "string", + "name": "id", + "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/createOrUpdateDatasourceResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/licensing/custom-permissions-csv": { - "get": { - "description": "You need to have a permission with action `licensing.reports:read`.", - "produces": [ - "text/csv" - ], + }, + "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).\n\nPlease refer to [updated API](#/datasources/deleteDataSourceByUID) instead", "tags": [ - "licensing", - "enterprise" + "datasources" + ], + "summary": "Delete an existing data source by id.", + "operationId": "deleteDataSourceByID", + "deprecated": true, + "parameters": [ + { + "type": "string", + "name": "id", + "in": "path", + "required": true + } ], - "summary": "Get custom permissions report in CSV format.", - "operationId": "getCustomPermissionsCSV", "responses": { "200": { - "$ref": "#/responses/getCustomPermissionsReportResponse" + "$ref": "#/responses/okResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -5236,18 +3597,35 @@ } } }, - "/licensing/refresh-stats": { + "/datasources/{id}/health": { "get": { - "description": "You need to have a permission with action `licensing:read`.", + "description": "Please refer to [updated API](#/datasources/checkDatasourceHealthWithUID) instead", "tags": [ - "licensing", - "enterprise" + "datasources" + ], + "summary": "Sends a health check request to the plugin datasource identified by the ID.", + "operationId": "checkDatasourceHealthByID", + "deprecated": true, + "parameters": [ + { + "type": "string", + "name": "id", + "in": "path", + "required": true + } ], - "summary": "Refresh license stats.", - "operationId": "refreshLicenseStats", "responses": { "200": { - "$ref": "#/responses/refreshLicenseStatsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -5255,72 +3633,120 @@ } } }, - "/licensing/token": { + "/datasources/{id}/resources/{datasource_proxy_route}": { "get": { - "description": "You need to have a permission with action `licensing:read`.", + "description": "Please refer to [updated API](#/datasources/callDatasourceResourceWithUID) instead", "tags": [ - "licensing", - "enterprise" + "datasources" + ], + "summary": "Fetch data source resources by Id.", + "operationId": "callDatasourceResourceByID", + "deprecated": true, + "parameters": [ + { + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "id", + "in": "path", + "required": true + } ], - "summary": "Get license token.", - "operationId": "getLicenseToken", "responses": { "200": { - "$ref": "#/responses/getLicenseTokenResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/ds/query": { "post": { - "description": "You need to have a permission with action `licensing:update`.", + "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": [ - "licensing", - "enterprise" + "ds" ], - "summary": "Create license token.", - "operationId": "postLicenseToken", + "summary": "DataSource query metrics with expressions.", + "operationId": "queryMetricsWithExpressions", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/DeleteTokenCommand" + "$ref": "#/definitions/MetricRequest" } } ], "responses": { "200": { - "$ref": "#/responses/getLicenseTokenResponse" + "$ref": "#/responses/queryMetricsWithExpressionsRespons" + }, + "207": { + "$ref": "#/responses/queryMetricsWithExpressionsRespons" }, "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`.", + } + }, + "/folders": { + "get": { + "description": "Returns all folders that the authenticated user has permission to view.", "tags": [ - "licensing", - "enterprise" + "folders" ], - "summary": "Remove license from database.", - "operationId": "deleteLicenseToken", + "summary": "Get all folders.", + "operationId": "getFolders", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/DeleteTokenCommand" - } + "type": "integer", + "format": "int64", + "default": 1000, + "description": "Limit the maximum number of folders to return", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1, + "description": "Page index for starting fetching folders", + "name": "page", + "in": "query" } ], "responses": { - "202": { - "$ref": "#/responses/acceptedResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "200": { + "$ref": "#/responses/getFoldersResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5328,58 +3754,75 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "422": { - "$ref": "#/responses/unprocessableEntityError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/licensing/token/renew": { + }, "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" + "folders" ], - "summary": "Manually force license refresh.", - "operationId": "postRenewLicenseToken", + "summary": "Create folder.", + "operationId": "createFolder", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "type": "object" + "$ref": "#/definitions/CreateFolderCommand" } } ], "responses": { "200": { - "$ref": "#/responses/postRenewLicenseTokenResponse" + "$ref": "#/responses/folderResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" + "403": { + "$ref": "#/responses/forbiddenError" + }, + "409": { + "$ref": "#/responses/conflictError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/logout/saml": { + "/folders/id/{folder_id}": { "get": { + "description": "Returns the folder identified by id.", "tags": [ - "saml", - "enterprise" + "folders" + ], + "summary": "Get folder by id.", + "operationId": "getFolderByID", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "folder_id", + "in": "path", + "required": true + } ], - "summary": "GetLogout initiates single logout process.", - "operationId": "getSAMLLogout", "responses": { - "302": { - "description": "" + "200": { + "$ref": "#/responses/folderResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, "404": { "$ref": "#/responses/notFoundError" @@ -5390,16 +3833,24 @@ } } }, - "/org": { + "/folders/{folder_uid}": { "get": { "tags": [ - "org" + "folders" + ], + "summary": "Get folder by uid.", + "operationId": "getFolderByUID", + "parameters": [ + { + "type": "string", + "name": "folder_uid", + "in": "path", + "required": true + } ], - "summary": "Get current Organization.", - "operationId": "getCurrentOrg", "responses": { "200": { - "$ref": "#/responses/getCurrentOrgResponse" + "$ref": "#/responses/folderResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5407,6 +3858,9 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } @@ -5414,23 +3868,30 @@ }, "put": { "tags": [ - "org" + "folders" ], - "summary": "Update current Organization.", - "operationId": "updateCurrentOrg", + "summary": "Update folder.", + "operationId": "updateFolder", "parameters": [ { + "type": "string", + "name": "folder_uid", + "in": "path", + "required": true + }, + { + "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/UpdateOrgForm" + "$ref": "#/definitions/UpdateFolderCommand" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/folderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5441,32 +3902,42 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "409": { + "$ref": "#/responses/conflictError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/org/address": { - "put": { + }, + "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": [ - "org" + "folders" ], - "summary": "Update current Organization's address.", - "operationId": "updateCurrentOrgAddress", + "summary": "Delete folder.", + "operationId": "deleteFolder", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgAddressForm" - } + "type": "string", + "name": "folder_uid", + "in": "path", + "required": true + }, + { + "type": "boolean", + "default": false, + "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/okResponse" + "$ref": "#/responses/deleteFolderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5477,56 +3948,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/invites": { + "/folders/{folder_uid}/permissions": { "get": { "tags": [ - "org_invites" - ], - "summary": "Get pending invites.", - "operationId": "getPendingOrgInvites", - "responses": { - "200": { - "$ref": "#/responses/getPendingOrgInvitesResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "post": { - "tags": [ - "org_invites" + "folder_permissions" ], - "summary": "Add invite.", - "operationId": "addOrgInvite", + "summary": "Gets all existing permissions for the folder with the given `uid`.", + "operationId": "getFolderPermissionList", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AddInviteForm" - } + "type": "string", + "name": "folder_uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getFolderPermissionListResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5534,28 +3982,34 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "412": { - "$ref": "#/responses/SMTPNotEnabledError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/org/invites/{invitation_code}/revoke": { - "delete": { + }, + "post": { "tags": [ - "org_invites" + "folder_permissions" ], - "summary": "Revoke invite.", - "operationId": "revokeInvite", + "summary": "Updates permissions for a folder. This operation will remove existing permissions if they’re not included in the request.", + "operationId": "updateFolderPermissions", "parameters": [ { "type": "string", - "name": "invitation_code", + "name": "folder_uid", "in": "path", "required": true + }, + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateDashboardACLCommand" + } } ], "responses": { @@ -5577,81 +4031,109 @@ } } }, - "/org/preferences": { + "/library-elements": { "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": [ - "org_preferences" + "library_elements" ], - "summary": "Get Current Org Prefs.", - "operationId": "getOrgPreferences", - "responses": { - "200": { - "$ref": "#/responses/getPreferencesResponse" + "summary": "Get all library elements.", + "operationId": "getLibraryElements", + "parameters": [ + { + "type": "string", + "description": "Part of the name or description searched for.", + "name": "searchString", + "in": "query" }, - "401": { - "$ref": "#/responses/unauthorisedError" + { + "enum": [ + 1, + 2 + ], + "type": "integer", + "format": "int64", + "description": "Kind of element to search for.", + "name": "kind", + "in": "query" }, - "403": { - "$ref": "#/responses/forbiddenError" + { + "enum": [ + "alpha-asc", + "alpha-desc" + ], + "type": "string", + "description": "Sort order of elements.", + "name": "sortDirection", + "in": "query" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "put": { - "tags": [ - "org_preferences" - ], - "summary": "Update Current Org Prefs.", - "operationId": "updateOrgPreferences", - "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdatePrefsCmd" - } + "type": "string", + "description": "A comma separated list of types to filter the elements by", + "name": "typeFilter", + "in": "query" + }, + { + "type": "string", + "description": "Element UID to exclude from search results.", + "name": "excludeUid", + "in": "query" + }, + { + "type": "string", + "description": "A comma separated list of folder ID(s) to filter the elements by.", + "name": "folderFilter", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 100, + "description": "The number of results per page.", + "name": "perPage", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1, + "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" + "$ref": "#/responses/getLibraryElementsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, - "patch": { + "post": { + "description": "Creates a new library element.", "tags": [ - "org_preferences" + "library_elements" ], - "summary": "Patch Current Org Prefs.", - "operationId": "patchOrgPreferences", + "summary": "Create library element.", + "operationId": "createLibraryElement", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PatchPrefsCmd" + "$ref": "#/definitions/CreateLibraryElementCommand" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getLibraryElementResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5662,61 +4144,40 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/users": { + "/library-elements/name/{library_element_name}": { "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": [ - "org" - ], - "summary": "Get all users within the current organization.", - "operationId": "getOrgUsersForCurrentOrg", - "responses": { - "200": { - "$ref": "#/responses/getOrgUsersForCurrentOrgResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "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:*`.", + "description": "Returns a library element with the given name.", "tags": [ - "org" + "library_elements" ], - "summary": "Add a new user to the current organization.", - "operationId": "addOrgUserToCurrentOrg", + "summary": "Get library element by name.", + "operationId": "getLibraryElementByName", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AddOrgUserCommand" - } + "type": "string", + "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" }, "500": { "$ref": "#/responses/internalServerError" @@ -5724,56 +4185,48 @@ } } }, - "/org/users/lookup": { + "/library-elements/{library_element_uid}": { "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.", + "description": "Returns a library element with the given UID.", "tags": [ - "org" + "library_elements" ], - "summary": "Get all users within the current organization (lookup)", - "operationId": "getOrgUsersForCurrentOrgLookup", + "summary": "Get library element by UID.", + "operationId": "getLibraryElementByUID", "parameters": [ { "type": "string", - "name": "query", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "name": "limit", - "in": "query" + "name": "library_element_uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getOrgUsersForCurrentOrgLookupResponse" + "$ref": "#/responses/getLibraryElementResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" + "404": { + "$ref": "#/responses/notFoundError" }, "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:*`.", + "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": [ - "org" + "library_elements" ], - "summary": "Delete user in current organization.", - "operationId": "removeOrgUserForCurrentOrg", + "summary": "Delete library element.", + "operationId": "deleteLibraryElementByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "name": "library_element_uid", "in": "path", "required": true } @@ -5791,38 +4244,40 @@ "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:*`.", + "description": "Updates an existing library element identified by uid.", "tags": [ - "org" + "library_elements" ], - "summary": "Updates the given user.", - "operationId": "updateOrgUserForCurrentOrg", + "summary": "Update library element.", + "operationId": "updateLibraryElement", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgUserCommand" + "$ref": "#/definitions/PatchLibraryElementCommand" } }, { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "name": "library_element_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getLibraryElementResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5833,55 +4288,60 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "412": { + "$ref": "#/responses/preconditionFailedError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs": { + "/library-elements/{library_element_uid}/connections/": { "get": { - "security": [ - { - "basic": [] - } - ], + "description": "Returns a list of connections for a library element based on the UID specified.", "tags": [ - "orgs" + "library_elements" ], - "summary": "Search all Organizations.", - "operationId": "searchOrgs", + "summary": "Get library element connections.", + "operationId": "getLibraryElementConnections", "parameters": [ { - "type": "integer", - "format": "int64", - "default": 1, - "name": "page", - "in": "query" + "type": "string", + "name": "library_element_uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getLibraryElementConnectionsResponse" }, - { - "type": "integer", - "format": "int64", - "default": 1000, - "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", - "name": "name", - "in": "query" + "404": { + "$ref": "#/responses/notFoundError" }, - { - "type": "string", - "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" + "500": { + "$ref": "#/responses/internalServerError" } + } + } + }, + "/org": { + "get": { + "tags": [ + "org" ], + "summary": "Get current Organization.", + "operationId": "getCurrentOrg", "responses": { "200": { - "$ref": "#/responses/searchOrgsResponse" + "$ref": "#/responses/getCurrentOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5889,34 +4349,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" - }, "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.", + "put": { "tags": [ - "orgs" + "org" ], - "summary": "Create Organization.", - "operationId": "createOrg", + "summary": "Update current Organization.", + "operationId": "updateCurrentOrg", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateOrgCommand" + "$ref": "#/definitions/UpdateOrgForm" } } ], "responses": { "200": { - "$ref": "#/responses/createOrgResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5924,38 +4383,35 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs/name/{org_name}": { - "get": { - "security": [ - { - "basic": [] - } - ], + "/org/address": { + "put": { "tags": [ - "orgs" + "org" ], - "summary": "Get Organization by ID.", - "operationId": "getOrgByName", + "summary": "Update current Organization's address.", + "operationId": "updateCurrentOrgAddress", "parameters": [ { - "type": "string", - "name": "org_name", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgAddressForm" + } } ], "responses": { "200": { - "$ref": "#/responses/getOrgByNameResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5969,30 +4425,16 @@ } } }, - "/orgs/{org_id}": { + "/org/invites": { "get": { - "security": [ - { - "basic": [] - } - ], "tags": [ - "orgs" - ], - "summary": "Get Organization by ID.", - "operationId": "getOrgByID", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - } + "org_invites" ], + "summary": "Get pending invites.", + "operationId": "getPendingOrgInvites", "responses": { "200": { - "$ref": "#/responses/getOrgByIDResponse" + "$ref": "#/responses/getPendingOrgInvitesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6005,32 +4447,20 @@ } } }, - "put": { - "security": [ - { - "basic": [] - } - ], + "post": { "tags": [ - "orgs" + "org_invites" ], - "summary": "Update Organization.", - "operationId": "updateOrg", + "summary": "Add invite.", + "operationId": "addOrgInvite", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgForm" + "$ref": "#/definitions/AddInviteForm" } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { @@ -6046,27 +4476,26 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "412": { + "$ref": "#/responses/SMTPNotEnabledError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/org/invites/{invitation_code}/revoke": { "delete": { - "security": [ - { - "basic": [] - } - ], "tags": [ - "orgs" + "org_invites" ], - "summary": "Delete Organization.", - "operationId": "deleteOrgByID", + "summary": "Revoke invite.", + "operationId": "revokeInvite", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "org_id", + "type": "string", + "name": "invitation_code", "in": "path", "required": true } @@ -6075,9 +4504,6 @@ "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -6093,36 +4519,16 @@ } } }, - "/orgs/{org_id}/address": { - "put": { + "/org/preferences": { + "get": { "tags": [ - "orgs" - ], - "summary": "Update Organization's address.", - "operationId": "updateOrgAddress", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgAddressForm" - } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - } + "org_preferences" ], + "summary": "Get Current Org Prefs.", + "operationId": "getOrgPreferences", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getPreferencesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6134,28 +4540,29 @@ "$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).", + }, + "put": { "tags": [ - "orgs" + "org_preferences" ], - "summary": "Fetch Organization quota.", - "operationId": "getOrgQuota", + "summary": "Update Current Org Prefs.", + "operationId": "updateOrgPreferences", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdatePrefsCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/getQuotaResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6163,95 +4570,57 @@ "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).", + }, + "patch": { "tags": [ - "orgs" + "org_preferences" ], - "summary": "Update user quota.", - "operationId": "updateOrgQuota", + "summary": "Patch Current Org Prefs.", + "operationId": "patchOrgPreferences", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgQuotaCmd" + "$ref": "#/definitions/PatchPrefsCmd" } - }, - { - "type": "string", - "name": "quota_target", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "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": { + "/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:*`.", + "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": [ - "orgs" - ], - "summary": "Get Users in Organization.", - "operationId": "getOrgUsers", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - } + "org" ], + "summary": "Get all users within the current organization.", + "operationId": "getOrgUsersForCurrentOrg", "responses": { "200": { - "$ref": "#/responses/getOrgUsersResponse" + "$ref": "#/responses/getOrgUsersForCurrentOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6267,10 +4636,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" + "org" ], "summary": "Add a new user to the current organization.", - "operationId": "addOrgUser", + "operationId": "addOrgUserToCurrentOrg", "parameters": [ { "name": "body", @@ -6279,18 +4648,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": [ + "org" + ], + "summary": "Get all users within the current organization (lookup)", + "operationId": "getOrgUsersForCurrentOrgLookup", + "parameters": [ + { + "type": "string", + "name": "query", + "in": "query" }, { "type": "integer", "format": "int64", - "name": "org_id", - "in": "path", - "required": true + "name": "limit", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getOrgUsersForCurrentOrgLookupResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6304,22 +4703,15 @@ } } }, - "/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" + "org" ], "summary": "Delete user in current organization.", - "operationId": "removeOrgUser", + "operationId": "removeOrgUserForCurrentOrg", "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - }, { "type": "integer", "format": "int64", @@ -6349,10 +4741,10 @@ "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" + "org" ], - "summary": "Update Users in Organization.", - "operationId": "updateOrgUser", + "summary": "Updates the given user.", + "operationId": "updateOrgUserForCurrentOrg", "parameters": [ { "name": "body", @@ -6362,13 +4754,6 @@ "$ref": "#/definitions/UpdateOrgUserCommand" } }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - }, { "type": "integer", "format": "int64", @@ -6396,129 +4781,49 @@ } } }, - "/playlists": { + "/orgs": { "get": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "playlists" + "orgs" ], - "summary": "Get playlists.", - "operationId": "searchPlaylists", + "summary": "Search all Organizations.", + "operationId": "searchOrgs", "parameters": [ { - "type": "string", - "name": "query", + "type": "integer", + "format": "int64", + "default": 1, + "name": "page", "in": "query" }, { "type": "integer", "format": "int64", - "description": "in:limit", - "name": "limit", + "default": 1000, + "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" - } - ], - "responses": { - "200": { - "$ref": "#/responses/searchPlaylistsResponse" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "post": { - "tags": [ - "playlists" - ], - "summary": "Create playlist.", - "operationId": "createPlaylist", - "parameters": [ - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreatePlaylistCommand" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/createPlaylistResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/playlists/{uid}": { - "get": { - "tags": [ - "playlists" - ], - "summary": "Get playlist.", - "operationId": "getPlaylist", - "parameters": [ { "type": "string", - "name": "uid", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getPlaylistResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "put": { - "tags": [ - "playlists" - ], - "summary": "Update playlist.", - "operationId": "updatePlaylist", - "parameters": [ - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdatePlaylistCommand" - } + "name": "name", + "in": "query" }, { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "type": "string", + "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/updatePlaylistResponse" + "$ref": "#/responses/searchOrgsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6526,31 +4831,34 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" } } }, - "delete": { + "post": { + "description": "Only works if [users.allow_org_create](https://grafana.com/docs/grafana/latest/administration/configuration/#allow_org_create) is set.", "tags": [ - "playlists" + "orgs" ], - "summary": "Delete playlist.", - "operationId": "deletePlaylist", + "summary": "Create Organization.", + "operationId": "createOrg", "parameters": [ { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateOrgCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/createOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6558,8 +4866,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -6567,24 +4875,29 @@ } } }, - "/playlists/{uid}/dashboards": { + "/orgs/name/{org_name}": { "get": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "playlists" + "orgs" ], - "summary": "Get playlist dashboards.", - "operationId": "getPlaylistDashboards", + "summary": "Get Organization by ID.", + "operationId": "getOrgByName", "parameters": [ { "type": "string", - "name": "uid", + "name": "org_name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getPlaylistDashboardsResponse" + "$ref": "#/responses/getOrgByNameResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6592,33 +4905,36 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/playlists/{uid}/items": { + "/orgs/{org_id}": { "get": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "playlists" + "orgs" ], - "summary": "Get playlist items.", - "operationId": "getPlaylistItems", + "summary": "Get Organization by ID.", + "operationId": "getOrgByID", "parameters": [ { - "type": "string", - "name": "uid", + "type": "integer", + "format": "int64", + "name": "org_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getPlaylistItemsResponse" + "$ref": "#/responses/getOrgByIDResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6626,118 +4942,80 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/query-history": { - "get": { - "description": "Returns a list of queries in the query history that matches the search criteria.\nQuery history search supports pagination. Use the `limit` parameter to control the maximum number of queries returned; the default limit is 100.\nYou can also use the `page` query parameter to fetch queries from any page other than the first one.", + }, + "put": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "query_history" + "orgs" ], - "summary": "Query history search.", - "operationId": "searchQueries", + "summary": "Update Organization.", + "operationId": "updateOrg", "parameters": [ { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "description": "List of data source UIDs to search for", - "name": "datasourceUid", - "in": "query" - }, - { - "type": "string", - "description": "Text inside query or comments that is searched for", - "name": "searchString", - "in": "query" - }, - { - "type": "boolean", - "description": "Flag indicating if only starred queries should be returned", - "name": "onlyStarred", - "in": "query" - }, - { - "enum": [ - "time-desc", - "time-asc" - ], - "type": "string", - "default": "time-desc", - "description": "Sort method", - "name": "sort", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Use this parameter to access hits beyond limit. Numbering starts at 1. limit param acts as page size.", - "name": "page", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Limit the number of returned results", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "From range for the query history search", - "name": "from", - "in": "query" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgForm" + } }, { "type": "integer", "format": "int64", - "description": "To range for the query history search", - "name": "to", - "in": "query" + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistorySearchResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { - "description": "Adds new query to query history.", + "delete": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "query_history" + "orgs" ], - "summary": "Add query to query history.", - "operationId": "createQuery", + "summary": "Delete Organization.", + "operationId": "deleteOrgByID", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateQueryInQueryHistoryCommand" - } + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -6745,33 +5023,45 @@ "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/query-history/migrate": { - "post": { - "description": "Adds multiple queries to query history.", + "/orgs/{org_id}/address": { + "put": { "tags": [ - "query_history" + "orgs" ], - "summary": "Migrate queries to query history.", - "operationId": "migrateQueries", + "summary": "Update Organization's address.", + "operationId": "updateOrgAddress", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/MigrateQueriesToQueryHistoryCommand" + "$ref": "#/definitions/UpdateOrgAddressForm" } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryMigrationResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -6779,146 +5069,213 @@ "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/query-history/star/{query_history_uid}": { - "post": { - "description": "Adds star to query in query history as specified by the UID.", + "/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).", "tags": [ - "query_history" + "orgs" ], - "summary": "Add star to query in query history.", - "operationId": "starQuery", + "summary": "Fetch Organization quota.", + "operationId": "getOrgQuota", "parameters": [ { - "type": "string", - "name": "query_history_uid", + "type": "integer", + "format": "int64", + "name": "org_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "$ref": "#/responses/getQuotaResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } - } - }, - "delete": { - "description": "Removes star from query in query history as specified by the UID.", + } + } + }, + "/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": [ - "query_history" + "orgs" ], - "summary": "Remove star to query in query history.", - "operationId": "unstarQuery", + "summary": "Update user quota.", + "operationId": "updateOrgQuota", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgQuotaCmd" + } + }, { "type": "string", - "name": "query_history_uid", + "name": "quota_target", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/query-history/{query_history_uid}": { - "delete": { - "description": "Deletes an existing query in query history as specified by the UID. This operation cannot be reverted.", + "/orgs/{org_id}/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": [ - "query_history" + "orgs" ], - "summary": "Delete query in query history.", - "operationId": "deleteQuery", + "summary": "Get Users in Organization.", + "operationId": "getOrgUsers", "parameters": [ { - "type": "string", - "name": "query_history_uid", + "type": "integer", + "format": "int64", + "name": "org_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryDeleteQueryResponse" + "$ref": "#/responses/getOrgUsersResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, - "patch": { - "description": "Updates comment for query in query history as specified by the UID.", + "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": [ - "query_history" + "orgs" ], - "summary": "Update comment for query in query history.", - "operationId": "patchQueryComment", + "summary": "Add a new user to the current organization.", + "operationId": "addOrgUser", "parameters": [ - { - "type": "string", - "name": "query_history_uid", - "in": "path", - "required": true - }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PatchQueryCommentInQueryHistoryCommand" + "$ref": "#/definitions/AddOrgUserCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/recording-rules": { - "get": { + "/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": [ - "recording_rules", - "enterprise" + "orgs" + ], + "summary": "Delete user in current organization.", + "operationId": "removeOrgUser", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true + } ], - "summary": "Lists all rules in the database: active or deleted.", - "operationId": "listRecordingRules", "responses": { "200": { - "$ref": "#/responses/listRecordingRulesResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6926,34 +5283,48 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, - "put": { + "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": [ - "recording_rules", - "enterprise" + "orgs" ], - "summary": "Update the active status of a rule.", - "operationId": "updateRecordingRule", + "summary": "Update Users in Organization.", + "operationId": "updateOrgUser", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/RecordingRuleJSON" + "$ref": "#/definitions/UpdateOrgUserCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/recordingRuleResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6961,71 +5332,61 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "post": { + } + }, + "/playlists": { + "get": { "tags": [ - "recording_rules", - "enterprise" + "playlists" ], - "summary": "Create a recording rule that is then registered and started.", - "operationId": "createRecordingRule", + "summary": "Get playlists.", + "operationId": "searchPlaylists", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RecordingRuleJSON" - } + "type": "string", + "name": "query", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "in:limit", + "name": "limit", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/recordingRuleResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "$ref": "#/responses/searchPlaylistsResponse" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/recording-rules/test": { + }, "post": { "tags": [ - "recording_rules", - "enterprise" + "playlists" ], - "summary": "Test a recording rule.", - "operationId": "testCreateRecordingRule", + "summary": "Create playlist.", + "operationId": "createPlaylist", "parameters": [ { - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/RecordingRuleJSON" + "$ref": "#/definitions/CreatePlaylistCommand" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/createPlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7036,26 +5397,30 @@ "404": { "$ref": "#/responses/notFoundError" }, - "422": { - "$ref": "#/responses/unprocessableEntityError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/recording-rules/writer": { + "/playlists/{uid}": { "get": { "tags": [ - "recording_rules", - "enterprise" + "playlists" + ], + "summary": "Get playlist.", + "operationId": "getPlaylist", + "parameters": [ + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + } ], - "summary": "Return the prometheus remote write target.", - "operationId": "getRecordingRuleWriteTarget", "responses": { "200": { - "$ref": "#/responses/recordingRuleWriteTargetResponse" + "$ref": "#/responses/getPlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7071,55 +5436,31 @@ } } }, - "post": { - "description": "It returns a 422 if there is not an existing prometheus data source configured.", + "put": { "tags": [ - "recording_rules", - "enterprise" + "playlists" ], - "summary": "Create a remote write target.", - "operationId": "createRecordingRuleWriteTarget", + "summary": "Update playlist.", + "operationId": "updatePlaylist", "parameters": [ { - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PrometheusRemoteWriteTargetJSON" + "$ref": "#/definitions/UpdatePlaylistCommand" } - } - ], - "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" + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + } ], - "summary": "Delete the remote write target.", - "operationId": "deleteRecordingRuleWriteTarget", "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/updatePlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7134,21 +5475,17 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/recording-rules/{recordingRuleID}": { + }, "delete": { "tags": [ - "recording_rules", - "enterprise" + "playlists" ], - "summary": "Delete removes the rule from the registry and stops it.", - "operationId": "deleteRecordingRule", + "summary": "Delete playlist.", + "operationId": "deletePlaylist", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "recordingRuleID", + "type": "string", + "name": "uid", "in": "path", "required": true } @@ -7172,54 +5509,24 @@ } } }, - "/reports": { + "/playlists/{uid}/dashboards": { "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" + "playlists" ], - "summary": "Create a report.", - "operationId": "createReport", + "summary": "Get playlist dashboards.", + "operationId": "getPlaylistDashboards", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateOrUpdateConfigCmd" - } + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/createReportResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getPlaylistDashboardsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7236,31 +5543,24 @@ } } }, - "/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`.", + "/playlists/{uid}/items": { + "get": { "tags": [ - "reports", - "enterprise" + "playlists" ], - "summary": "Send a report.", - "operationId": "sendReport", + "summary": "Get playlist items.", + "operationId": "getPlaylistItems", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/ReportEmailDTO" - } + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getPlaylistItemsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7277,295 +5577,143 @@ } } }, - "/reports/render/pdf/{dashboardID}": { + "/query-history": { "get": { - "description": "Please refer to [reports enterprise](#/reports/renderReportPDFs) instead. This will be removed in Grafana 10.", - "produces": [ - "application/pdf" - ], + "description": "Returns a list of queries in the query history that matches the search criteria.\nQuery history search supports pagination. Use the `limit` parameter to control the maximum number of queries returned; the default limit is 100.\nYou can also use the `page` query parameter to fetch queries from any page other than the first one.", "tags": [ - "reports", - "enterprise" + "query_history" ], - "summary": "Render report for dashboard.", - "operationId": "renderReportPDF", - "deprecated": true, + "summary": "Query history search.", + "operationId": "searchQueries", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardID", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "dashboardID", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "title", - "in": "query" - }, - { - "type": "string", - "name": "variables", + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "List of data source UIDs to search for", + "name": "datasourceUid", "in": "query" }, { "type": "string", - "name": "from", + "description": "Text inside query or comments that is searched for", + "name": "searchString", "in": "query" }, { - "type": "string", - "name": "to", + "type": "boolean", + "description": "Flag indicating if only starred queries should be returned", + "name": "onlyStarred", "in": "query" }, { + "enum": [ + "time-desc", + "time-asc" + ], "type": "string", - "name": "orientation", + "default": "time-desc", + "description": "Sort method", + "name": "sort", "in": "query" }, { - "type": "string", - "name": "layout", + "type": "integer", + "format": "int64", + "description": "Use this parameter to access hits beyond limit. Numbering starts at 1. limit param acts as page size.", + "name": "page", "in": "query" - } - ], - "responses": { - "200": { - "$ref": "#/responses/contentResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/reports/render/pdfs": { - "get": { - "description": "Available to all users and with a valid license.", - "produces": [ - "application/pdf" - ], - "tags": [ - "reports", - "enterprise" - ], - "summary": "Render report for multiple dashboards.", - "operationId": "renderReportPDFs", - "parameters": [ { - "type": "string", - "name": "dashboardID", + "type": "integer", + "format": "int64", + "description": "Limit the number of returned results", + "name": "limit", "in": "query" }, { - "type": "string", - "name": "orientation", + "type": "integer", + "format": "int64", + "description": "From range for the query history search", + "name": "from", "in": "query" }, { - "type": "string", - "name": "layout", + "type": "integer", + "format": "int64", + "description": "To range for the query history search", + "name": "to", "in": "query" } ], "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/getQueryHistorySearchResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "500": { "$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", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/SettingsDTO" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "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`.", + "description": "Adds new query to query history.", "tags": [ - "reports", - "enterprise" + "query_history" ], - "summary": "Send test report via email.", - "operationId": "sendTestEmail", + "summary": "Add query to query history.", + "operationId": "createQuery", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateOrUpdateConfigCmd" + "$ref": "#/definitions/CreateQueryInQueryHistoryCommand" } } ], "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" - } - } - } - }, - "/reports/{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:id:\u003creport ID\u003e`.", - "tags": [ - "reports", - "enterprise" - ], - "summary": "Get a report.", - "operationId": "getReport", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getReportResponse" + "$ref": "#/responses/getQueryHistoryResponse" }, "400": { "$ref": "#/responses/badRequestError" }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "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`.", + } + }, + "/query-history/migrate": { + "post": { + "description": "Adds multiple queries to query history.", "tags": [ - "reports", - "enterprise" + "query_history" ], - "summary": "Update a report.", - "operationId": "updateReport", + "summary": "Migrate queries to query history.", + "operationId": "migrateQueries", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateOrUpdateConfigCmd" + "$ref": "#/definitions/MigrateQueriesToQueryHistoryCommand" } - }, - { - "type": "integer", - "format": "int64", - "name": "id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQueryHistoryMigrationResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -7573,77 +5721,61 @@ "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "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`.", + } + }, + "/query-history/star/{query_history_uid}": { + "post": { + "description": "Adds star to query in query history as specified by the UID.", "tags": [ - "reports", - "enterprise" + "query_history" ], - "summary": "Delete a report.", - "operationId": "deleteReport", + "summary": "Add star to query in query history.", + "operationId": "starQuery", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "id", + "type": "string", + "name": "query_history_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getQueryHistoryResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/saml/acs": { - "post": { + }, + "delete": { + "description": "Removes star from query in query history as specified by the UID.", "tags": [ - "saml", - "enterprise" + "query_history" ], - "summary": "It performs assertion Consumer Service (ACS).", - "operationId": "postACS", + "summary": "Remove star to query in query history.", + "operationId": "unstarQuery", "parameters": [ { "type": "string", - "name": "RelayState", - "in": "query" + "name": "query_history_uid", + "in": "path", + "required": true } ], "responses": { - "302": { - "description": "" + "200": { + "$ref": "#/responses/getQueryHistoryResponse" }, - "403": { - "$ref": "#/responses/forbiddenError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "500": { "$ref": "#/responses/internalServerError" @@ -7651,77 +5783,66 @@ } } }, - "/saml/metadata": { - "get": { - "produces": [ - "application/xml;application/samlmetadata+xml" - ], + "/query-history/{query_history_uid}": { + "delete": { + "description": "Deletes an existing query in query history as specified by the UID. This operation cannot be reverted.", "tags": [ - "saml", - "enterprise" + "query_history" ], - "summary": "It exposes the SP (Grafana's) metadata for the IdP's consumption.", - "operationId": "getMetadata", - "responses": { - "200": { - "$ref": "#/responses/contentResponse" + "summary": "Delete query in query history.", + "operationId": "deleteQuery", + "parameters": [ + { + "type": "string", + "name": "query_history_uid", + "in": "path", + "required": true } - } - } - }, - "/saml/slo": { - "get": { - "description": "There might be two possible requests:\n1. Logout response (callback) when Grafana initiates single logout and IdP returns response to logout request.\n2. Logout request when another SP initiates single logout and IdP sends logout request to the Grafana,\nor in case of IdP-initiated logout.", - "tags": [ - "saml", - "enterprise" ], - "summary": "It performs Single Logout (SLO) callback.", - "operationId": "getSLO", "responses": { - "302": { - "description": "" - }, - "400": { - "$ref": "#/responses/badRequestError" + "200": { + "$ref": "#/responses/getQueryHistoryDeleteQueryResponse" }, - "403": { - "$ref": "#/responses/forbiddenError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { - "description": "There might be two possible requests:\n1. Logout response (callback) when Grafana initiates single logout and IdP returns response to logout request.\n2. Logout request when another SP initiates single logout and IdP sends logout request to the Grafana,\nor in case of IdP-initiated logout.", + "patch": { + "description": "Updates comment for query in query history as specified by the UID.", "tags": [ - "saml", - "enterprise" + "query_history" ], - "summary": "It performs Single Logout (SLO) callback.", - "operationId": "postSLO", + "summary": "Update comment for query in query history.", + "operationId": "patchQueryComment", "parameters": [ { "type": "string", - "name": "SAMLRequest", - "in": "query" + "name": "query_history_uid", + "in": "path", + "required": true }, { - "type": "string", - "name": "SAMLResponse", - "in": "query" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PatchQueryCommentInQueryHistoryCommand" + } } ], "responses": { - "302": { - "description": "" + "200": { + "$ref": "#/responses/getQueryHistoryResponse" }, "400": { "$ref": "#/responses/badRequestError" }, - "403": { - "$ref": "#/responses/forbiddenError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "500": { "$ref": "#/responses/internalServerError" @@ -8379,142 +6500,7 @@ "$ref": "#/responses/forbiddenError" }, "409": { - "$ref": "#/responses/conflictError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/teams/search": { - "get": { - "tags": [ - "teams" - ], - "summary": "Team Search With Paging.", - "operationId": "searchTeams", - "parameters": [ - { - "type": "integer", - "format": "int64", - "default": 1, - "name": "page", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 1000, - "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", - "name": "name", - "in": "query" - }, - { - "type": "string", - "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/searchTeamsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/teams/{teamId}/groups": { - "get": { - "tags": [ - "sync_team_groups", - "enterprise" - ], - "summary": "Get External Groups.", - "operationId": "getTeamGroupsApi", - "parameters": [ - { - "type": "integer", - "format": "int64", - "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": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/TeamGroupMapping" - } - }, - { - "type": "integer", - "format": "int64", - "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" + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -8522,35 +6508,44 @@ } } }, - "/teams/{teamId}/groups/{groupId}": { - "delete": { + "/teams/search": { + "get": { "tags": [ - "sync_team_groups", - "enterprise" + "teams" ], - "summary": "Remove External Group.", - "operationId": "removeTeamGroupApi", + "summary": "Team Search With Paging.", + "operationId": "searchTeams", "parameters": [ { - "type": "string", - "name": "groupId", - "in": "path", - "required": true + "type": "integer", + "format": "int64", + "default": 1, + "name": "page", + "in": "query" }, { "type": "integer", "format": "int64", - "name": "teamId", - "in": "path", - "required": true + "default": 1000, + "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", + "name": "name", + "in": "query" + }, + { + "type": "string", + "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/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/searchTeamsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -8558,9 +6553,6 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } @@ -9710,42 +7702,6 @@ } }, "definitions": { - "ActiveSyncStatusDTO": { - "description": "ActiveSyncStatusDTO holds the information for LDAP background Sync", - "type": "object", - "properties": { - "enabled": { - "type": "boolean" - }, - "nextSync": { - "type": "string", - "format": "date-time" - }, - "prevSync": { - "$ref": "#/definitions/SyncResult" - }, - "schedule": { - "type": "string" - } - } - }, - "ActiveUserStats": { - "type": "object", - "properties": { - "active_admins_and_editors": { - "type": "integer", - "format": "int64" - }, - "active_users": { - "type": "integer", - "format": "int64" - }, - "active_viewers": { - "type": "integer", - "format": "int64" - } - } - }, "AddCommand": { "type": "object", "properties": { @@ -9852,25 +7808,6 @@ } } }, - "AddPermissionDTO": { - "type": "object", - "properties": { - "builtinRole": { - "type": "string" - }, - "permission": { - "$ref": "#/definitions/DsPermissionType" - }, - "teamId": { - "type": "integer", - "format": "int64" - }, - "userId": { - "type": "integer", - "format": "int64" - } - } - }, "AddServiceAccountTokenCommand": { "type": "object", "properties": { @@ -9892,25 +7829,6 @@ } } }, - "AddTeamRoleCommand": { - "type": "object", - "properties": { - "roleUid": { - "type": "string" - } - } - }, - "AddUserRoleCommand": { - "type": "object", - "properties": { - "global": { - "type": "boolean" - }, - "roleUid": { - "type": "string" - } - } - }, "Address": { "type": "object", "properties": { @@ -10314,26 +8232,6 @@ } } }, - "BrandingOptionsDTO": { - "type": "object", - "properties": { - "emailFooterLink": { - "type": "string" - }, - "emailFooterMode": { - "type": "string" - }, - "emailFooterText": { - "type": "string" - }, - "emailLogoUrl": { - "type": "string" - }, - "reportLogoUrl": { - "type": "string" - } - } - }, "CalculateDiffTarget": { "type": "object", "properties": { @@ -10366,84 +8264,6 @@ "type": "number", "format": "double" }, - "ConfigDTO": { - "description": "ConfigDTO is model representation in transfer", - "type": "object", - "properties": { - "created": { - "type": "string", - "format": "date-time" - }, - "dashboardId": { - "type": "integer", - "format": "int64" - }, - "dashboardName": { - "type": "string" - }, - "dashboardUid": { - "type": "string" - }, - "dashboards": { - "type": "array", - "items": { - "$ref": "#/definitions/DashboardDTO" - } - }, - "enableCsv": { - "type": "boolean" - }, - "enableDashboardUrl": { - "type": "boolean" - }, - "formats": { - "type": "array", - "items": { - "$ref": "#/definitions/Type" - } - }, - "id": { - "type": "integer", - "format": "int64" - }, - "message": { - "type": "string" - }, - "name": { - "type": "string" - }, - "options": { - "$ref": "#/definitions/ReportOptionsDTO" - }, - "orgId": { - "type": "integer", - "format": "int64" - }, - "recipients": { - "type": "string" - }, - "replyTo": { - "type": "string" - }, - "schedule": { - "$ref": "#/definitions/ScheduleDTO" - }, - "state": { - "$ref": "#/definitions/State" - }, - "templateVars": { - "type": "object" - }, - "updated": { - "type": "string", - "format": "date-time" - }, - "userId": { - "type": "integer", - "format": "int64" - } - } - }, "Correlation": { "description": "Correlation is the model for correlations definitions", "type": "object", @@ -10683,60 +8503,6 @@ } } }, - "CreateOrUpdateConfigCmd": { - "type": "object", - "properties": { - "dashboardId": { - "type": "integer", - "format": "int64" - }, - "dashboardUid": { - "type": "string" - }, - "dashboards": { - "type": "array", - "items": { - "$ref": "#/definitions/DashboardDTO" - } - }, - "enableCsv": { - "type": "boolean" - }, - "enableDashboardUrl": { - "type": "boolean" - }, - "formats": { - "type": "array", - "items": { - "$ref": "#/definitions/Type" - } - }, - "message": { - "type": "string" - }, - "name": { - "type": "string" - }, - "options": { - "$ref": "#/definitions/ReportOptionsDTO" - }, - "recipients": { - "type": "string" - }, - "replyTo": { - "type": "string" - }, - "schedule": { - "$ref": "#/definitions/ScheduleDTO" - }, - "state": { - "$ref": "#/definitions/State" - }, - "templateVars": { - "type": "object" - } - } - }, "CreateOrgCommand": { "type": "object", "properties": { @@ -10779,42 +8545,6 @@ } } }, - "CreateRoleForm": { - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "displayName": { - "type": "string" - }, - "global": { - "type": "boolean" - }, - "group": { - "type": "string" - }, - "hidden": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "permissions": { - "type": "array", - "items": { - "$ref": "#/definitions/Permission" - } - }, - "uid": { - "type": "string" - }, - "version": { - "type": "integer", - "format": "int64" - } - } - }, "CreateServiceAccountForm": { "type": "object", "properties": { @@ -10830,68 +8560,21 @@ "type": "string", "enum": [ "Viewer", - "Editor", - "Admin" - ], - "example": "Admin" - } - } - }, - "CreateTeamCommand": { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "name": { - "type": "string" + "Editor", + "Admin" + ], + "example": "Admin" } } }, - "CustomPermissionsRecordDTO": { + "CreateTeamCommand": { "type": "object", "properties": { - "customPermissions": { - "type": "string" - }, - "granteeName": { - "type": "string" - }, - "granteeType": { - "type": "string" - }, - "granteeUrl": { - "type": "string" - }, - "id": { - "type": "integer", - "format": "int64" - }, - "isFolder": { - "type": "boolean" - }, - "orgId": { - "type": "integer", - "format": "int64" - }, - "orgRole": { - "type": "string" - }, - "slug": { - "type": "string" - }, - "title": { - "type": "string" - }, - "uid": { + "email": { "type": "string" }, - "url": { + "name": { "type": "string" - }, - "usersCount": { - "type": "integer", - "format": "int64" } } }, @@ -10998,20 +8681,6 @@ } } }, - "DashboardDTO": { - "type": "object", - "properties": { - "dashboard": { - "$ref": "#/definitions/DashboardReportDTO" - }, - "reportVariables": { - "type": "object" - }, - "timeRange": { - "$ref": "#/definitions/TimeRangeDTO" - } - } - }, "DashboardFullWithMeta": { "type": "object", "properties": { @@ -11125,21 +8794,6 @@ } } }, - "DashboardReportDTO": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "uid": { - "type": "string" - } - } - }, "DashboardSnapshot": { "description": "DashboardSnapshot model", "type": "object", @@ -11488,83 +9142,6 @@ } } }, - "DataSourcePermissionRuleDTO": { - "type": "object", - "properties": { - "builtInRole": { - "type": "string" - }, - "created": { - "type": "string", - "format": "date-time" - }, - "datasourceId": { - "type": "integer", - "format": "int64" - }, - "id": { - "type": "integer", - "format": "int64" - }, - "isManaged": { - "type": "boolean" - }, - "permission": { - "$ref": "#/definitions/DsPermissionType" - }, - "permissionName": { - "type": "string" - }, - "team": { - "type": "string" - }, - "teamAvatarUrl": { - "type": "string" - }, - "teamEmail": { - "type": "string" - }, - "teamId": { - "type": "integer", - "format": "int64" - }, - "updated": { - "type": "string", - "format": "date-time" - }, - "userAvatarUrl": { - "type": "string" - }, - "userEmail": { - "type": "string" - }, - "userId": { - "type": "integer", - "format": "int64" - }, - "userLogin": { - "type": "string" - } - } - }, - "DataSourcePermissionsDTO": { - "type": "object", - "properties": { - "datasourceId": { - "type": "integer", - "format": "int64" - }, - "enabled": { - "type": "boolean" - }, - "permissions": { - "type": "array", - "items": { - "$ref": "#/definitions/DataSourcePermissionRuleDTO" - } - } - } - }, "DataTopic": { "type": "string", "title": "DataTopic is used to identify which topic the frame should be assigned to." @@ -11578,14 +9155,6 @@ } } }, - "DeleteTokenCommand": { - "type": "object", - "properties": { - "instance": { - "type": "string" - } - } - }, "DsAccess": { "type": "string" }, @@ -11636,18 +9205,6 @@ } } }, - "FailedUser": { - "description": "FailedUser holds the information of an user that failed", - "type": "object", - "properties": { - "Error": { - "type": "string" - }, - "Login": { - "type": "string" - } - } - }, "Field": { "description": "A Field is essentially a slice of various types with extra properties and methods.\nSee NewField() for supported types.\n\nThe slice data in the Field is a not exported, so methods on the Field are used to to manipulate its data.", "type": "object", @@ -12876,26 +10433,6 @@ } } }, - "Permission": { - "type": "object", - "title": "Permission is the model for access control permissions.", - "properties": { - "action": { - "type": "string" - }, - "created": { - "type": "string", - "format": "date-time" - }, - "scope": { - "type": "string" - }, - "updated": { - "type": "string", - "format": "date-time" - } - } - }, "PermissionType": { "type": "integer", "format": "int64" @@ -13064,20 +10601,6 @@ } } }, - "PrometheusRemoteWriteTargetJSON": { - "type": "object", - "properties": { - "data_source_uid": { - "type": "string" - }, - "id": { - "type": "string" - }, - "remote_write_path": { - "type": "string" - } - } - }, "QueryDataResponse": { "description": "It is the return type of a QueryData call.", "type": "object", @@ -13237,141 +10760,61 @@ "description": "The behavior when clicking on a result", "type": "array", "items": { - "$ref": "#/definitions/DataLink" - } - }, - "mappings": { - "$ref": "#/definitions/ValueMappings" - }, - "max": { - "$ref": "#/definitions/ConfFloat64" - }, - "min": { - "$ref": "#/definitions/ConfFloat64" - }, - "noValue": { - "description": "Alternative to empty string", - "type": "string" - }, - "path": { - "description": "Path is an explicit path to the field in the datasource. When the frame meta includes a path,\nthis will default to `${frame.meta.path}/${field.name}\n\nWhen defined, this value can be used as an identifier within the datasource scope, and\nmay be used as an identifier to update values in a subsequent request", - "type": "string" - }, - "thresholds": { - "$ref": "#/definitions/ThresholdsConfig" - }, - "unit": { - "description": "Numeric Options", - "type": "string" - }, - "value": { - "type": "number", - "format": "double" - }, - "writeable": { - "description": "Writeable indicates that the datasource knows how to update this value", - "type": "boolean" - } - } - }, - "QueryToMigrate": { - "type": "object", - "properties": { - "comment": { - "type": "string" - }, - "createdAt": { - "type": "integer", - "format": "int64" - }, - "datasourceUid": { - "type": "string" - }, - "queries": { - "$ref": "#/definitions/Json" - }, - "starred": { - "type": "boolean" - } - } - }, - "RecordingRuleJSON": { - "description": "RecordingRuleJSON is the external representation of a recording rule", - "type": "object", - "properties": { - "active": { - "type": "boolean" - }, - "count": { - "type": "boolean" - }, - "description": { - "type": "string" - }, - "dest_data_source_uid": { - "type": "string" - }, - "id": { - "type": "string" - }, - "interval": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "prom_name": { - "type": "string" - }, - "queries": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": {} + "$ref": "#/definitions/DataLink" } }, - "range": { - "type": "integer", - "format": "int64" + "mappings": { + "$ref": "#/definitions/ValueMappings" + }, + "max": { + "$ref": "#/definitions/ConfFloat64" }, - "target_ref_id": { + "min": { + "$ref": "#/definitions/ConfFloat64" + }, + "noValue": { + "description": "Alternative to empty string", "type": "string" - } - } - }, - "ReportEmailDTO": { - "type": "object", - "properties": { - "email": { + }, + "path": { + "description": "Path is an explicit path to the field in the datasource. When the frame meta includes a path,\nthis will default to `${frame.meta.path}/${field.name}\n\nWhen defined, this value can be used as an identifier within the datasource scope, and\nmay be used as an identifier to update values in a subsequent request", "type": "string" }, - "emails": { - "description": "Comma-separated list of emails to which to send the report to.", + "thresholds": { + "$ref": "#/definitions/ThresholdsConfig" + }, + "unit": { + "description": "Numeric Options", "type": "string" }, - "id": { - "description": "Send the report to the emails specified in the report. Required if emails is not present.", - "type": "string", - "format": "int64" + "value": { + "type": "number", + "format": "double" }, - "useEmailsFromReport": { - "description": "Send the report to the emails specified in the report. Required if emails is not present.", + "writeable": { + "description": "Writeable indicates that the datasource knows how to update this value", "type": "boolean" } } }, - "ReportOptionsDTO": { + "QueryToMigrate": { "type": "object", "properties": { - "layout": { + "comment": { "type": "string" }, - "orientation": { + "createdAt": { + "type": "integer", + "format": "int64" + }, + "datasourceUid": { "type": "string" }, - "timeRange": { - "$ref": "#/definitions/TimeRangeDTO" + "queries": { + "$ref": "#/definitions/Json" + }, + "starred": { + "type": "boolean" } } }, @@ -13401,79 +10844,6 @@ } } }, - "RoleAssignmentsDTO": { - "type": "object", - "properties": { - "role_uid": { - "type": "string" - }, - "service_accounts": { - "type": "array", - "items": { - "type": "integer", - "format": "int64" - } - }, - "teams": { - "type": "array", - "items": { - "type": "integer", - "format": "int64" - } - }, - "users": { - "type": "array", - "items": { - "type": "integer", - "format": "int64" - } - } - } - }, - "RoleDTO": { - "type": "object", - "properties": { - "created": { - "type": "string", - "format": "date-time" - }, - "delegatable": { - "type": "boolean" - }, - "description": { - "type": "string" - }, - "displayName": { - "type": "string" - }, - "group": { - "type": "string" - }, - "hidden": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "permissions": { - "type": "array", - "items": { - "$ref": "#/definitions/Permission" - } - }, - "uid": { - "type": "string" - }, - "updated": { - "type": "string", - "format": "date-time" - }, - "version": { - "type": "integer", - "format": "int64" - } - } - }, "SaveDashboardCommand": { "type": "object", "properties": { @@ -13506,49 +10876,6 @@ } } }, - "ScheduleDTO": { - "type": "object", - "properties": { - "day": { - "type": "string" - }, - "dayOfMonth": { - "type": "string" - }, - "endDate": { - "type": "string", - "format": "date-time" - }, - "frequency": { - "type": "string" - }, - "hour": { - "type": "integer", - "format": "int64" - }, - "intervalAmount": { - "type": "integer", - "format": "int64" - }, - "intervalFrequency": { - "type": "string" - }, - "minute": { - "type": "integer", - "format": "int64" - }, - "startDate": { - "type": "string", - "format": "date-time" - }, - "timeZone": { - "type": "string" - }, - "workdaysOnly": { - "type": "boolean" - } - } - }, "SearchServiceAccountsResult": { "description": "swagger: model", "type": "object", @@ -13733,49 +11060,6 @@ } } }, - "SetRoleAssignmentsCommand": { - "type": "object", - "properties": { - "service_accounts": { - "type": "array", - "items": { - "type": "integer", - "format": "int64" - } - }, - "teams": { - "type": "array", - "items": { - "type": "integer", - "format": "int64" - } - }, - "users": { - "type": "array", - "items": { - "type": "integer", - "format": "int64" - } - } - } - }, - "SetUserRolesCommand": { - "type": "object", - "properties": { - "global": { - "type": "boolean" - }, - "includeHidden": { - "type": "boolean" - }, - "roleUids": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, "SettingsBag": { "type": "object", "additionalProperties": { @@ -13785,37 +11069,6 @@ } } }, - "SettingsDTO": { - "type": "object", - "properties": { - "branding": { - "$ref": "#/definitions/BrandingOptionsDTO" - }, - "id": { - "type": "integer", - "format": "int64" - }, - "orgId": { - "type": "integer", - "format": "int64" - }, - "userId": { - "type": "integer", - "format": "int64" - } - } - }, - "State": { - "type": "string" - }, - "Status": { - "type": "object", - "properties": { - "enabled": { - "type": "boolean" - } - } - }, "SuccessResponseBody": { "type": "object", "properties": { @@ -13824,39 +11077,6 @@ } } }, - "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" - } - } - } - }, "TagsDTO": { "type": "object", "title": "TagsDTO is the frontend DTO for Tag.", @@ -13896,36 +11116,12 @@ "name": { "type": "string" }, - "orgId": { - "type": "integer", - "format": "int64" - }, - "permission": { - "$ref": "#/definitions/PermissionType" - } - } - }, - "TeamGroupDTO": { - "type": "object", - "properties": { - "groupId": { - "type": "string" - }, - "orgId": { - "type": "integer", - "format": "int64" - }, - "teamId": { - "type": "integer", - "format": "int64" - } - } - }, - "TeamGroupMapping": { - "type": "object", - "properties": { - "groupId": { - "type": "string" + "orgId": { + "type": "integer", + "format": "int64" + }, + "permission": { + "$ref": "#/definitions/PermissionType" } } }, @@ -14064,104 +11260,6 @@ "description": "ThresholdsMode absolute or percentage", "type": "string" }, - "TimeRangeDTO": { - "type": "object", - "properties": { - "from": { - "type": "string" - }, - "to": { - "type": "string" - } - } - }, - "Token": { - "type": "object", - "properties": { - "account": { - "type": "string" - }, - "company": { - "type": "string" - }, - "details_url": { - "type": "string" - }, - "exp": { - "type": "integer", - "format": "int64" - }, - "iat": { - "type": "integer", - "format": "int64" - }, - "included_users": { - "type": "integer", - "format": "int64" - }, - "iss": { - "type": "string" - }, - "jti": { - "type": "string" - }, - "lexp": { - "type": "integer", - "format": "int64" - }, - "lic_exp_warn_days": { - "type": "integer", - "format": "int64" - }, - "lid": { - "type": "string" - }, - "limit_by": { - "type": "string" - }, - "max_concurrent_user_sessions": { - "type": "integer", - "format": "int64" - }, - "nbf": { - "type": "integer", - "format": "int64" - }, - "prod": { - "type": "array", - "items": { - "type": "string" - } - }, - "slug": { - "type": "string" - }, - "status": { - "$ref": "#/definitions/TokenStatus" - }, - "sub": { - "type": "string" - }, - "tok_exp_warn_days": { - "type": "integer", - "format": "int64" - }, - "trial": { - "type": "boolean" - }, - "trial_exp": { - "type": "integer", - "format": "int64" - }, - "update_days": { - "type": "integer", - "format": "int64" - }, - "usage_billing": { - "type": "boolean" - } - } - }, "TokenDTO": { "type": "object", "properties": { @@ -14204,10 +11302,6 @@ } } }, - "TokenStatus": { - "type": "integer", - "format": "int64" - }, "TrimDashboardCommand": { "type": "object", "properties": { @@ -14230,9 +11324,6 @@ } } }, - "Type": { - "type": "string" - }, "UpdateAlertNotificationCommand": { "type": "object", "properties": { @@ -14561,39 +11652,6 @@ } } }, - "UpdateRoleCommand": { - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "displayName": { - "type": "string" - }, - "global": { - "type": "boolean" - }, - "group": { - "type": "string" - }, - "hidden": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "permissions": { - "type": "array", - "items": { - "$ref": "#/definitions/Permission" - } - }, - "version": { - "type": "integer", - "format": "int64" - } - } - }, "UpdateServiceAccountForm": { "type": "object", "properties": { @@ -14906,21 +11964,6 @@ "$ref": "#/definitions/ErrorResponseBody" } }, - "addPermissionResponse": { - "description": "", - "schema": { - "type": "object", - "properties": { - "message": { - "type": "string" - }, - "permissionId": { - "type": "integer", - "format": "int64" - } - } - } - }, "adminCreateUserResponse": { "description": "", "schema": { @@ -14970,16 +12013,6 @@ "$ref": "#/definitions/ErrorResponseBody" } }, - "contentResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "type": "integer", - "format": "uint8" - } - } - }, "createCorrelationResponse": { "description": "", "schema": { @@ -15075,27 +12108,6 @@ "$ref": "#/definitions/Playlist" } }, - "createReportResponse": { - "description": "", - "schema": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "message": { - "type": "string" - } - } - } - }, - "createRoleResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/RoleDTO" - } - }, "createServiceAccountResponse": { "description": "", "schema": { @@ -15280,12 +12292,6 @@ } } }, - "getAccessControlStatusResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/Status" - } - }, "getAlertNotificationChannelResponse": { "description": "", "schema": { @@ -15325,21 +12331,6 @@ } } }, - "getAllPermissionseResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/DataSourcePermissionsDTO" - } - }, - "getAllRolesResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/RoleDTO" - } - } - }, "getAnnotationByIDResponse": { "description": "", "schema": { @@ -15391,15 +12382,6 @@ "$ref": "#/definitions/OrgDetailsDTO" } }, - "getCustomPermissionsReportResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/CustomPermissionsRecordDTO" - } - } - }, "getDashboardPermissionsListResponse": { "description": "", "schema": { @@ -15501,12 +12483,6 @@ "$ref": "#/definitions/LibraryElementSearchResponse" } }, - "getLicenseTokenResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/Token" - } - }, "getOrgByIDResponse": { "description": "", "schema": { @@ -15615,39 +12591,6 @@ } } }, - "getReportResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/ConfigDTO" - } - }, - "getReportSettingsResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/SettingsDTO" - } - }, - "getReportsResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/ConfigDTO" - } - } - }, - "getRoleAssignmentsResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/RoleAssignmentsDTO" - } - }, - "getRoleResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/RoleDTO" - } - }, "getSharingOptionsResponse": { "description": "", "schema": { @@ -15683,30 +12626,12 @@ } } }, - "getStatusResponse": { - "description": "" - }, - "getSyncStatusResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/ActiveSyncStatusDTO" - } - }, "getTeamByIDResponse": { "description": "", "schema": { "$ref": "#/definitions/TeamDTO" } }, - "getTeamGroupsApiResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/TeamGroupDTO" - } - } - }, "getTeamMembersResponse": { "description": "", "schema": { @@ -15770,36 +12695,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" - } - } - }, - "listRolesResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/RoleDTO" - } - } - }, "listSortOptionsResponse": { "description": "", "schema": { @@ -15960,9 +12855,6 @@ } } }, - "postRenewLicenseTokenResponse": { - "description": "" - }, "preconditionFailedError": { "description": "PreconditionFailedError", "schema": { @@ -15975,24 +12867,6 @@ "$ref": "#/definitions/QueryDataResponse" } }, - "recordingRuleResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/RecordingRuleJSON" - } - }, - "recordingRuleWriteTargetResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/PrometheusRemoteWriteTargetJSON" - } - }, - "refreshLicenseStatsResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/ActiveUserStats" - } - }, "retrieveServiceAccountResponse": { "description": "", "schema": { @@ -16047,12 +12921,6 @@ "$ref": "#/definitions/SearchUserQueryResult" } }, - "setRoleAssignmentsResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/RoleAssignmentsDTO" - } - }, "testAlertResponse": { "description": "", "schema": { diff --git a/public/app/plugins/panel/gauge/GaugePanel.tsx b/public/app/plugins/panel/gauge/GaugePanel.tsx index 226fc47f33ef..a0295638a390 100644 --- a/public/app/plugins/panel/gauge/GaugePanel.tsx +++ b/public/app/plugins/panel/gauge/GaugePanel.tsx @@ -28,6 +28,7 @@ export class GaugePanel extends PureComponent> { text={options.text} showThresholdLabels={options.showThresholdLabels} showThresholdMarkers={options.showThresholdMarkers} + neutral={options.neutral} theme={config.theme} onClick={openMenu} className={targetClassName} diff --git a/public/app/plugins/panel/gauge/models.cue b/public/app/plugins/panel/gauge/models.cue index a36918c357cf..e971e26ad397 100644 --- a/public/app/plugins/panel/gauge/models.cue +++ b/public/app/plugins/panel/gauge/models.cue @@ -29,6 +29,7 @@ Panel: thema.#Lineage & { ui.SingleStatBaseOptions showThresholdLabels: bool | *false showThresholdMarkers: bool | *true + neutral: number } @cuetsy(kind="interface") }, ] diff --git a/public/app/plugins/panel/gauge/models.gen.ts b/public/app/plugins/panel/gauge/models.gen.ts index 19bfd5bfd48f..f343823d07a3 100644 --- a/public/app/plugins/panel/gauge/models.gen.ts +++ b/public/app/plugins/panel/gauge/models.gen.ts @@ -13,6 +13,7 @@ import * as ui from '@grafana/schema'; export const PanelModelVersion = Object.freeze([0, 0]); export interface PanelOptions extends ui.SingleStatBaseOptions { + neutral: number; showThresholdLabels: boolean; showThresholdMarkers: boolean; } diff --git a/public/app/plugins/panel/gauge/module.tsx b/public/app/plugins/panel/gauge/module.tsx index 3a36fd460a2b..2754c4b3929f 100644 --- a/public/app/plugins/panel/gauge/module.tsx +++ b/public/app/plugins/panel/gauge/module.tsx @@ -26,6 +26,12 @@ export const plugin = new PanelPlugin(GaugePanel) name: 'Show threshold markers', description: 'Renders the thresholds as an outer bar', defaultValue: defaultPanelOptions.showThresholdMarkers, + }) + .addNumberInput({ + path: 'neutral', + name: 'Neutral', + description: 'Set the neutral point of the gauge', + category: ['Standard options'], }); commonOptionsBuilder.addTextSizeOptions(builder); diff --git a/public/vendor/flot/jquery.flot.gauge.js b/public/vendor/flot/jquery.flot.gauge.js index ae27e9ac4aef..24e7882bba84 100644 --- a/public/vendor/flot/jquery.flot.gauge.js +++ b/public/vendor/flot/jquery.flot.gauge.js @@ -327,8 +327,7 @@ var blur = gaugeOptionsi.gauge.shadow.show ? gaugeOptionsi.gauge.shadow.blur : 0; var color = getColor(gaugeOptionsi, data); - var hasNegative = gaugeOptionsi.gauge.min < 0.0 - var angles = calculateAnglesForGauge(gaugeOptionsi, layout, data, hasNegative); + var angles = calculateAnglesForGauge(gaugeOptionsi, layout, data); // draw gauge frame drawArcWithShadow( @@ -356,7 +355,7 @@ color, // fill color blur); - if(hasNegative) + if(gaugeOptionsi.gauge.neutralValue != null) drawZeroMarker(gaugeOptionsi, layout, cellLayout, color); } @@ -369,16 +368,16 @@ * @param {Number} data the value of the gauge * @returns {Object} */ - function calculateAnglesForGauge(gaugeOptionsi, layout, data, hasNegative) { + function calculateAnglesForGauge(gaugeOptionsi, layout, data) { let angles = {}; - var isNegative = data < 0.0 + var neutral = gaugeOptionsi.gauge.neutralValue - if (hasNegative) { - if (isNegative) { + if (neutral != null) { + if (data < neutral) { angles.a1 = calculateAngle(gaugeOptionsi, layout, data); - angles.a2 = calculateAngle(gaugeOptionsi, layout, 0.0); + angles.a2 = calculateAngle(gaugeOptionsi, layout, neutral); } else { - angles.a1 = calculateAngle(gaugeOptionsi, layout, 0.0); + angles.a1 = calculateAngle(gaugeOptionsi, layout, neutral); angles.a2 = calculateAngle(gaugeOptionsi, layout, data); } } else { @@ -399,15 +398,15 @@ * @param {String} color line color */ function drawZeroMarker(gaugeOptionsi, layout, cellLayout, color) { - var diff = (gaugeOptionsi.gauge.max - gaugeOptionsi.gauge.min) / 800; + var diff = (gaugeOptionsi.gauge.max - gaugeOptionsi.gauge.min) / 600; drawArc(context, cellLayout.cx, cellLayout.cy, layout.radius - 2, layout.width - 4, - toRad(calculateAngle(gaugeOptionsi, layout, -diff)), - toRad(calculateAngle(gaugeOptionsi, layout, diff)), + toRad(calculateAngle(gaugeOptionsi, layout, gaugeOptionsi.gauge.neutralValue-diff)), + toRad(calculateAngle(gaugeOptionsi, layout, gaugeOptionsi.gauge.neutralValue+diff)), color, 2, gaugeOptionsi.gauge.background.color); diff --git a/yarn.lock b/yarn.lock index ee1696994c46..a54b0df0fe07 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16283,38 +16283,10 @@ __metadata: languageName: node linkType: hard -"caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001271, caniuse-lite@npm:^1.0.30001286, caniuse-lite@npm:^1.0.30001317": - version: 1.0.30001332 - resolution: "caniuse-lite@npm:1.0.30001332" - checksum: e54182ea42ab3d2ff1440f9a6480292f7ab23c00c188df7ad65586312e4da567e8bedd5cb5fb8f0ff4193dc027a54e17e0b3c0b6db5d5a3fb61c7726ff9c45b3 - languageName: node - linkType: hard - -"caniuse-lite@npm:^1.0.30001109, caniuse-lite@npm:^1.0.30001349": - version: 1.0.30001349 - resolution: "caniuse-lite@npm:1.0.30001349" - checksum: 0095fcbb7ca4ef76227f5c3788c3cdbad3c52a25825c577371ffa73a44d74ff43fc5a849e5fa37c8b4c6237bb5272777085e1f674f9f86fde9aed85201d26f07 - languageName: node - linkType: hard - -"caniuse-lite@npm:^1.0.30001332": - version: 1.0.30001335 - resolution: "caniuse-lite@npm:1.0.30001335" - checksum: fe08b49ec6cb76cc69958ff001cf89d0a8ef9f35e0c8028b65981585046384f76e007d64dea372a34ca56d91caa83cc614c00779fe2b4d378aa0e68696374f67 - languageName: node - linkType: hard - -"caniuse-lite@npm:^1.0.30001335": - version: 1.0.30001341 - resolution: "caniuse-lite@npm:1.0.30001341" - checksum: 7262b093fb0bf49dbc5328418f5ce4e3dbb0b13e39c015f986ba1807634c123ac214efc94df7d095a336f57f86852b4b63ee61838f18dcc3a4a35f87b390c8f5 - languageName: node - linkType: hard - -"caniuse-lite@npm:^1.0.30001400": - version: 1.0.30001402 - resolution: "caniuse-lite@npm:1.0.30001402" - checksum: 6068ccccd64b357f75388cb2303cf351b686b20800571d0a845bff5c0e0d24f83df0133afbbdd8177a33eb087c93d39ecf359035a52b2feac5f182c946f706ee +"caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001109, caniuse-lite@npm:^1.0.30001271, caniuse-lite@npm:^1.0.30001286, caniuse-lite@npm:^1.0.30001317, caniuse-lite@npm:^1.0.30001332, caniuse-lite@npm:^1.0.30001335, caniuse-lite@npm:^1.0.30001349, caniuse-lite@npm:^1.0.30001400": + version: 1.0.30001420 + resolution: "caniuse-lite@npm:1.0.30001420" + checksum: dfa5027b2aeaba3ab1731735a46aecf62f286cdeec7f8ccb0f8cce0a3d02447e640e944d9bf5d9ea98b53fac6c2b168bb18f4c9ad598d92a2da7b05e2aea06e2 languageName: node linkType: hard From de5e0bdc42aba9e5378597e36b6d04303a485543 Mon Sep 17 00:00:00 2001 From: sfranzis Date: Thu, 10 Nov 2022 10:55:18 +0100 Subject: [PATCH 08/25] Revert "zero option" This reverts commit b31bbdbf83ec18e31802867fd5102feb94f99be6. --- .../grafana-ui/src/components/Gauge/Gauge.tsx | 5 +- public/api-merged.json | 9052 +++++++++++------ public/api-spec.json | 8246 ++++++++++----- public/app/plugins/panel/gauge/GaugePanel.tsx | 1 - public/app/plugins/panel/gauge/models.cue | 1 - public/app/plugins/panel/gauge/models.gen.ts | 1 - public/app/plugins/panel/gauge/module.tsx | 6 - public/vendor/flot/jquery.flot.gauge.js | 23 +- yarn.lock | 36 +- 9 files changed, 11826 insertions(+), 5545 deletions(-) diff --git a/packages/grafana-ui/src/components/Gauge/Gauge.tsx b/packages/grafana-ui/src/components/Gauge/Gauge.tsx index 2bb4220f2159..ebdcf84e6ff6 100644 --- a/packages/grafana-ui/src/components/Gauge/Gauge.tsx +++ b/packages/grafana-ui/src/components/Gauge/Gauge.tsx @@ -21,7 +21,6 @@ export interface Props extends Themeable { field: FieldConfig; showThresholdMarkers: boolean; showThresholdLabels: boolean; - neutral: Number; width: number; value: DisplayValue; text?: VizTextDisplayOptions; @@ -51,7 +50,7 @@ export class Gauge extends PureComponent { } draw() { - const { field, showThresholdLabels, showThresholdMarkers, width, height, theme, value, neutral } = this.props; + const { field, showThresholdLabels, showThresholdMarkers, width, height, theme, value } = this.props; const autoProps = calculateGaugeAutoProps(width, height, value.title); const dimension = Math.min(width, autoProps.gaugeHeight); @@ -59,7 +58,6 @@ export class Gauge extends PureComponent { const gaugeWidthReduceRatio = showThresholdLabels ? 1.5 : 1; const gaugeWidth = Math.min(dimension / 5.5, 40) / gaugeWidthReduceRatio; const thresholdMarkersWidth = gaugeWidth / 5; - const neutralValue = neutral; const text = formattedValueToString(value); // This not 100% accurate as I am unsure of flot's calculations here const valueWidthBase = Math.min(width, dimension * 1.3) * 0.9; @@ -98,7 +96,6 @@ export class Gauge extends PureComponent { gauge: { min, max, - neutralValue, background: { color: backgroundColor }, border: { color: null }, shadow: { show: false }, diff --git a/public/api-merged.json b/public/api-merged.json index 0212b3e19146..eff155dbab49 100644 --- a/public/api-merged.json +++ b/public/api-merged.json @@ -22,25 +22,25 @@ }, "basePath": "/api", "paths": { - "/admin/ldap/reload": { - "post": { - "security": [ + "/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:read` and scope `roles:*`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Get all roles.", + "operationId": "listRoles", + "parameters": [ { - "basic": [] + "type": "boolean", + "name": "delegatable", + "in": "query" } ], - "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": "reloadLDAPCfg", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "$ref": "#/responses/listRolesResponse" }, "403": { "$ref": "#/responses/forbiddenError" @@ -49,27 +49,31 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/ldap/status": { - "get": { - "security": [ + }, + "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:type:delegate`. `permissions:type: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": "createRole", + "parameters": [ { - "basic": [] + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateRoleForm" + } } ], - "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" + "201": { + "$ref": "#/responses/createRoleResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -80,61 +84,99 @@ } } }, - "/admin/ldap/sync/{user_id}": { - "post": { - "security": [ + "/access-control/roles/{roleUID}": { + "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", + "parameters": [ { - "basic": [] + "type": "string", + "name": "roleUID", + "in": "path", + "required": true } ], - "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`.", + "responses": { + "200": { + "$ref": "#/responses/getRoleResponse" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "put": { + "description": "You need to have a permission with action `roles:write` and scope `permissions:type:delegate`. `permissions:type:delegate` scope ensures that users can only create custom roles with the same, or a subset of permissions which the user has.", "tags": [ - "admin_ldap" + "access_control", + "enterprise" ], - "summary": "Enables a single Grafana user to be synchronized against LDAP.", - "operationId": "postSyncUserWithLDAP", + "summary": "Update a custom role.", + "operationId": "updateRole", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "user_id", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateRoleCommand" + } + }, + { + "type": "string", + "name": "roleUID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getRoleResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/ldap/{user_name}": { - "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 `ldap.user:read`.", + }, + "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:type:delegate`. `permissions:type: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": [ - "admin_ldap" + "access_control", + "enterprise" ], - "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": "getUserFromLDAP", + "summary": "Delete a custom role.", + "operationId": "deleteRole", "parameters": [ + { + "type": "boolean", + "name": "force", + "in": "query" + }, + { + "type": "boolean", + "name": "global", + "in": "query" + }, { "type": "string", - "name": "user_name", + "name": "roleUID", "in": "path", "required": true } @@ -143,8 +185,8 @@ "200": { "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -155,121 +197,127 @@ } } }, - "/admin/pause-all-alerts": { - "post": { - "security": [ - { - "basic": [] - } - ], + "/access-control/roles/{roleUID}/assignments": { + "get": { + "description": "Get role assignments for the role with the given UID.\n\nYou need to have a permission with action `teams.roles:list` and scope `teams:id:*` and `users.roles:list` and scope `users:id:*`.", "tags": [ - "admin" + "access_control", + "enterprise" ], - "summary": "Pause/unpause all (legacy) alerts.", - "operationId": "pauseAllAlerts", + "summary": "Get role assignments.", + "operationId": "getRoleAssignments", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PauseAllAlertsCommand" - } + "type": "string", + "name": "roleUID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/pauseAlertsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "$ref": "#/responses/getRoleAssignmentsResponse" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/provisioning/dashboards/reload": { - "post": { - "security": [ + }, + "put": { + "description": "Set role assignments for the role with the given UID.\n\nYou need to have a permission with action `teams.roles:add` and `teams.roles:remove` and scope `permissions:type:delegate`, and `users.roles:add` and `users.roles:remove` and scope `permissions:type:delegate`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Set role assignments.", + "operationId": "setRoleAssignments", + "parameters": [ { - "basic": [] + "type": "string", + "name": "roleUID", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/SetRoleAssignmentsCommand" + } } ], - "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": "adminProvisioningReloadDashboards", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "$ref": "#/responses/setRoleAssignmentsResponse" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/provisioning/datasources/reload": { - "post": { - "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`.", + "/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": [ - "admin_provisioning" + "access_control", + "enterprise" ], - "summary": "Reload datasource provisioning configurations.", - "operationId": "adminProvisioningReloadDatasources", + "summary": "Get status.", + "operationId": "getAccessControlStatus", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "$ref": "#/responses/getAccessControlStatusResponse" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/provisioning/notifications/reload": { - "post": { - "security": [ + "/access-control/teams/{teamId}/roles": { + "get": { + "description": "You need to have a permission with action `teams.roles:read` and scope `teams:id:\u003cteam ID\u003e`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Get team roles.", + "operationId": "listTeamRoles", + "parameters": [ { - "basic": [] + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true } ], - "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": "adminProvisioningReloadNotifications", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -278,150 +326,226 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/provisioning/plugins/reload": { - "post": { - "security": [ + }, + "put": { + "description": "You need to have a permission with action `teams.roles:add` and `teams.roles:remove` and scope `permissions:type:delegate` for each.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Update team role.", + "operationId": "setTeamRoles", + "parameters": [ { - "basic": [] + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true } ], - "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": "adminProvisioningReloadPlugins", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/settings": { - "get": { - "security": [ + }, + "post": { + "description": "You need to have a permission with action `teams.roles:add` and scope `permissions:type:delegate`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Add team role.", + "operationId": "addTeamRole", + "parameters": [ { - "basic": [] + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddTeamRoleCommand" + } + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true } ], - "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": "adminGetSettings", "responses": { "200": { - "$ref": "#/responses/adminGetSettingsResponse" + "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/admin/stats": { - "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`.", + "/access-control/teams/{teamId}/roles/{roleUID}": { + "delete": { + "description": "You need to have a permission with action `teams.roles:remove` and scope `permissions:type:delegate`.", "tags": [ - "admin" + "access_control", + "enterprise" + ], + "summary": "Remove team role.", + "operationId": "removeTeamRole", + "parameters": [ + { + "type": "string", + "name": "roleUID", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true + } ], - "summary": "Fetch Grafana Stats.", - "operationId": "adminGetStats", "responses": { "200": { - "$ref": "#/responses/adminGetStatsResponse" + "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users": { - "post": { - "security": [ + "/access-control/users/{userId}/roles": { + "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:read` and scope `users:id:\u003cuser ID\u003e`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "List roles assigned to a user.", + "operationId": "listUserRoles", + "parameters": [ { - "basic": [] + "type": "integer", + "format": "int64", + "name": "userId", + "in": "path", + "required": true } ], - "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`.", + "responses": { + "200": { + "$ref": "#/responses/getAllRolesResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$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:type:delegate` for each. `permissions:type: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": [ - "admin_users" + "access_control", + "enterprise" ], - "summary": "Create new user.", - "operationId": "adminCreateUser", + "summary": "Set user role assignments.", + "operationId": "setUserRoles", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AdminCreateUserForm" + "$ref": "#/definitions/SetUserRolesCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "userId", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/adminCreateUserResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, "403": { "$ref": "#/responses/forbiddenError" }, - "412": { - "$ref": "#/responses/preconditionFailedError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/users/{user_id}": { - "delete": { - "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:delete` and scope `global.users:*`.", + }, + "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:type:delegate`. `permissions:type: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": [ - "admin_users" + "access_control", + "enterprise" ], - "summary": "Delete global User.", - "operationId": "adminDeleteUser", + "summary": "Add a user role assignment.", + "operationId": "addUserRole", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddUserRoleCommand" + } + }, { "type": "integer", "format": "int64", - "name": "user_id", + "name": "userId", "in": "path", "required": true } @@ -430,9 +554,6 @@ "200": { "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, "403": { "$ref": "#/responses/forbiddenError" }, @@ -445,31 +566,66 @@ } } }, - "/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:*`.", + "/access-control/users/{userId}/roles/{roleUID}": { + "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:type:delegate`. `permissions:type: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": [ - "admin_users" + "access_control", + "enterprise" ], - "summary": "Return a list of all auth tokens (devices) that the user currently have logged in from.", - "operationId": "adminGetUserAuthTokens", + "summary": "Remove a user role assignment.", + "operationId": "removeUserRole", "parameters": [ + { + "type": "boolean", + "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" + }, + { + "type": "string", + "name": "roleUID", + "in": "path", + "required": true + }, { "type": "integer", "format": "int64", - "name": "user_id", + "name": "userId", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/adminGetUserAuthTokensResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/admin/ldap-sync-status": { + "get": { + "description": "You need to have a permission with action `ldap.status:read`.", + "tags": [ + "ldap_debug" + ], + "summary": "Returns the current state of the LDAP background sync integration.", + "operationId": "getSyncStatus", + "responses": { + "200": { + "$ref": "#/responses/getSyncStatusResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -483,28 +639,19 @@ } } }, - "/admin/users/{user_id}/disable": { + "/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 `users:disable` and scope `global.users:1` (userIDScope).", + "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_users" - ], - "summary": "Disable user.", - "operationId": "adminDisableUser", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "admin_ldap" ], + "summary": "Reloads the LDAP configuration.", + "operationId": "reloadLDAPCfg", "responses": { "200": { "$ref": "#/responses/okResponse" @@ -515,37 +662,25 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users/{user_id}/enable": { - "post": { + "/admin/ldap/status": { + "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:enable` and scope `global.users:1` (userIDScope).", + "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_users" - ], - "summary": "Enable user.", - "operationId": "adminEnableUser", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "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" @@ -556,28 +691,25 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users/{user_id}/logout": { + "/admin/ldap/sync/{user_id}": { "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:*`.", + "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_users" + "admin_ldap" ], - "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": "adminLogoutUser", + "summary": "Enables a single Grafana user to be synchronized against LDAP.", + "operationId": "postSyncUserWithLDAP", "parameters": [ { "type": "integer", @@ -591,50 +723,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/users/{user_id}/password": { - "put": { + "/admin/ldap/{user_name}": { + "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.password:update` and scope `global.users:*`.", + "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_users" + "admin_ldap" ], - "summary": "Set password for user.", - "operationId": "adminUpdateUserPassword", + "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": "getUserFromLDAP", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AdminUpdateUserPasswordForm" - } - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "name": "user_name", "in": "path", "required": true } @@ -643,9 +760,6 @@ "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -658,37 +772,31 @@ } } }, - "/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:*`.", + "/admin/pause-all-alerts": { + "post": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "admin_users" + "admin" ], - "summary": "Set permissions for user.", - "operationId": "adminUpdateUserPermissions", + "summary": "Pause/unpause all (legacy) alerts.", + "operationId": "pauseAllAlerts", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AdminUpdateUserPermissionsForm" + "$ref": "#/definitions/PauseAllAlertsCommand" } - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/pauseAlertsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -702,31 +810,43 @@ } } }, - "/admin/users/{user_id}/quotas": { - "get": { + "/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" + }, + "403": { + "$ref": "#/responses/forbiddenError" + } + } + } + }, + "/admin/provisioning/dashboards/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 `users.quotas:list` and scope `global.users:1` (userIDScope).", + "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_users" - ], - "summary": "Fetch user quota.", - "operationId": "getUserQuota", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "admin_provisioning" ], + "summary": "Reload dashboard provisioning configurations.", + "operationId": "adminProvisioningReloadDashboards", "responses": { "200": { - "$ref": "#/responses/getQuotaResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -734,51 +854,25 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users/{user_id}/quotas/{quota_target}": { - "put": { + "/admin/provisioning/datasources/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 `users.quotas:update` and scope `global.users:1` (userIDScope).", + "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_users" - ], - "summary": "Update user quota.", - "operationId": "updateUserQuota", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateUserQuotaCmd" - } - }, - { - "type": "string", - "name": "quota_target", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "admin_provisioning" ], + "summary": "Reload datasource provisioning configurations.", + "operationId": "adminProvisioningReloadDatasources", "responses": { "200": { "$ref": "#/responses/okResponse" @@ -789,78 +883,57 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users/{user_id}/revoke-auth-token": { + "/admin/provisioning/notifications/reload": { "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:*`.", + "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_users" - ], - "summary": "Revoke auth token for user.", - "operationId": "adminRevokeUserAuthToken", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RevokeAuthTokenCmd" - } - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "admin_provisioning" ], + "summary": "Reload legacy alert notifier provisioning configurations.", + "operationId": "adminProvisioningReloadNotifications", "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.", + "/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": [ - "legacy_alerts_notification_channels" + "admin_provisioning" ], - "summary": "Get all notification channels.", - "operationId": "getAlertNotificationChannels", + "summary": "Reload plugin provisioning configurations.", + "operationId": "adminProvisioningReloadPlugins", "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelsResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -872,54 +945,45 @@ "$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": [ + } + }, + "/admin/settings": { + "get": { + "security": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateAlertNotificationCommand" - } + "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": "adminGetSettings", "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/adminGetSettingsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" - }, - "409": { - "$ref": "#/responses/conflictError" - }, - "500": { - "$ref": "#/responses/internalServerError" } } } }, - "/alert-notifications/lookup": { + "/admin/stats": { "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.", + "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": [ - "legacy_alerts_notification_channels" + "admin" ], - "summary": "Get all notification channels (lookup).", - "operationId": "getAlertNotificationLookup", + "summary": "Fetch Grafana Stats.", + "operationId": "adminGetStats", "responses": { "200": { - "$ref": "#/responses/getAlertNotificationLookupResponse" + "$ref": "#/responses/adminGetStatsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -933,27 +997,32 @@ } } }, - "/alert-notifications/test": { + "/admin/users": { "post": { - "description": "Sends a test notification to the channel.", + "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": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Test notification channel.", - "operationId": "notificationChannelTest", + "summary": "Create new user.", + "operationId": "adminCreateUser", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/NotificationTestCommand" + "$ref": "#/definitions/AdminCreateUserForm" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/adminCreateUserResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -965,7 +1034,7 @@ "$ref": "#/responses/forbiddenError" }, "412": { - "$ref": "#/responses/SMTPNotEnabledError" + "$ref": "#/responses/preconditionFailedError" }, "500": { "$ref": "#/responses/internalServerError" @@ -973,25 +1042,31 @@ } } }, - "/alert-notifications/uid/{notification_channel_uid}": { - "get": { - "description": "Returns the notification channel given the notification channel UID.", - "tags": [ - "legacy_alerts_notification_channels" + "/admin/users/{user_id}": { + "delete": { + "security": [ + { + "basic": [] + } ], - "summary": "Get notification channel by UID.", - "operationId": "getAlertNotificationChannelByUID", + "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": "adminDeleteUser", "parameters": [ { - "type": "string", - "name": "notification_channel_uid", + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1006,33 +1081,71 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "Updates an existing notification channel identified by uid.", + } + }, + "/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": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Update notification channel by UID.", - "operationId": "updateAlertNotificationChannelByUID", + "summary": "Return a list of all auth tokens (devices) that the user currently have logged in from.", + "operationId": "adminGetUserAuthTokens", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateAlertNotificationWithUidCommand" - } + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/adminGetUserAuthTokensResponse" }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/admin/users/{user_id}/disable": { + "post": { + "security": [ { - "type": "string", - "name": "notification_channel_uid", + "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": "adminDisableUser", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1047,25 +1160,33 @@ "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Deletes an existing notification channel identified by UID.", + } + }, + "/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": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Delete alert notification by UID.", - "operationId": "deleteAlertNotificationChannelByUID", + "summary": "Enable user.", + "operationId": "adminEnableUser", "parameters": [ { - "type": "string", - "name": "notification_channel_uid", + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/deleteAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1082,26 +1203,34 @@ } } }, - "/alert-notifications/{notification_channel_id}": { - "get": { - "description": "Returns the notification channel given the notification channel ID.", + "/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": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Get notification channel by ID.", - "operationId": "getAlertNotificationChannelByID", + "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": "adminLogoutUser", "parameters": [ { "type": "integer", "format": "int64", - "name": "notification_channel_id", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1116,34 +1245,44 @@ "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/admin/users/{user_id}/password": { "put": { - "description": "Updates an existing notification channel identified by ID.", + "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": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Update notification channel by ID.", - "operationId": "updateAlertNotificationChannel", + "summary": "Set password for user.", + "operationId": "adminUpdateUserPassword", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateAlertNotificationCommand" + "$ref": "#/definitions/AdminUpdateUserPasswordForm" } }, { "type": "integer", "format": "int64", - "name": "notification_channel_id", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1151,26 +1290,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Deletes an existing notification channel identified by ID.", + } + }, + "/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": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Delete alert notification by ID.", - "operationId": "deleteAlertNotificationChannel", + "summary": "Set permissions for user.", + "operationId": "adminUpdateUserPermissions", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AdminUpdateUserPermissionsForm" + } + }, { "type": "integer", "format": "int64", - "name": "notification_channel_id", + "name": "user_id", "in": "path", "required": true } @@ -1179,170 +1325,221 @@ "200": { "$ref": "#/responses/okResponse" }, + "400": { + "$ref": "#/responses/badRequestError" + }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alerts": { + "/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": [ - "legacy_alerts" + "admin_users" ], - "summary": "Get legacy alerts.", - "operationId": "getAlerts", + "summary": "Fetch user quota.", + "operationId": "getUserQuota", "parameters": [ - { - "type": "array", - "items": { - "type": "string" - }, - "description": "Limit response to alerts in specified dashboard(s). You can specify multiple dashboards.", - "name": "dashboardId", - "in": "query" - }, { "type": "integer", "format": "int64", - "description": "Limit response to alert for a specified panel on a dashboard.", - "name": "panelId", - "in": "query" + "name": "user_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getQuotaResponse" }, - { - "type": "string", - "description": "Limit response to alerts having a name like this value.", - "name": "query", - "in": "query" + "401": { + "$ref": "#/responses/unauthorisedError" }, - { - "enum": [ - "all", - "no_data", - "paused", - "alerting", - "ok", - "pending", - "unknown" - ], - "type": "string", - "description": "Return alerts with one or more of the following alert states", - "name": "state", - "in": "query" + "403": { + "$ref": "#/responses/forbiddenError" }, - { - "type": "integer", - "format": "int64", - "description": "Limit response to X number of alerts.", - "name": "limit", - "in": "query" + "404": { + "$ref": "#/responses/notFoundError" }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/admin/users/{user_id}/quotas/{quota_target}": { + "put": { + "security": [ { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "description": "Limit response to alerts of dashboards in specified folder(s). You can specify multiple folders", - "name": "folderId", - "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.quotas:update` and scope `global.users:1` (userIDScope).", + "tags": [ + "admin_users" + ], + "summary": "Update user quota.", + "operationId": "updateUserQuota", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateUserQuotaCmd" + } }, { "type": "string", - "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" + "name": "quota_target", + "in": "path", + "required": true }, { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "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" + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertsResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alerts/states-for-dashboard": { - "get": { + "/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": [ - "legacy_alerts" + "admin_users" ], - "summary": "Get alert states for a dashboard.", - "operationId": "getDashboardStates", + "summary": "Revoke auth token for user.", + "operationId": "adminRevokeUserAuthToken", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RevokeAuthTokenCmd" + } + }, { "type": "integer", "format": "int64", - "name": "dashboardId", - "in": "query", + "name": "user_id", + "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDashboardStatesResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alerts/test": { + "/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" + "legacy_alerts_notification_channels" ], - "summary": "Test alert.", - "operationId": "testAlert", + "summary": "Create notification channel.", + "operationId": "createAlertNotificationChannel", "parameters": [ { "name": "body", "in": "body", + "required": true, "schema": { - "$ref": "#/definitions/AlertTestCommand" + "$ref": "#/definitions/CreateAlertNotificationCommand" } } ], "responses": { "200": { - "$ref": "#/responses/testAlertResponse" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "422": { - "$ref": "#/responses/unprocessableEntityError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -1350,61 +1547,54 @@ } } }, - "/alerts/{alert_id}": { + "/alert-notifications/lookup": { "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.", + "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" - ], - "summary": "Get alert by ID.", - "operationId": "getAlertByID", - "parameters": [ - { - "type": "string", - "name": "alert_id", - "in": "path", - "required": true - } + "legacy_alerts_notification_channels" ], + "summary": "Get all notification channels (lookup).", + "operationId": "getAlertNotificationLookup", "responses": { "200": { - "$ref": "#/responses/getAlertResponse" + "$ref": "#/responses/getAlertNotificationLookupResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alerts/{alert_id}/pause": { + "/alert-notifications/test": { "post": { + "description": "Sends a test notification to the channel.", "tags": [ - "legacy_alerts" + "legacy_alerts_notification_channels" ], - "summary": "Pause/unpause alert by id.", - "operationId": "pauseAlert", + "summary": "Test notification channel.", + "operationId": "notificationChannelTest", "parameters": [ - { - "type": "string", - "name": "alert_id", - "in": "path", - "required": true - }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PauseAlertCommand" + "$ref": "#/definitions/NotificationTestCommand" } } ], "responses": { "200": { - "$ref": "#/responses/pauseAlertResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1412,8 +1602,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "412": { + "$ref": "#/responses/SMTPNotEnabledError" }, "500": { "$ref": "#/responses/internalServerError" @@ -1421,169 +1611,66 @@ } } }, - "/annotations": { + "/alert-notifications/uid/{notification_channel_uid}": { "get": { - "description": "Starting in Grafana v6.4 regions annotations are now returned in one entity that now includes the timeEnd property.", + "description": "Returns the notification channel given the notification channel UID.", "tags": [ - "annotations" + "legacy_alerts_notification_channels" ], - "summary": "Find Annotations.", - "operationId": "getAnnotations", + "summary": "Get notification channel by UID.", + "operationId": "getAlertNotificationChannelByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "description": "Find annotations created after specific epoch datetime in milliseconds.", - "name": "from", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations created before specific epoch datetime in milliseconds.", - "name": "to", - "in": "query" + "type": "string", + "name": "notification_channel_uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAlertNotificationChannelResponse" }, - { - "type": "integer", - "format": "int64", - "description": "Limit response to annotations created by specific user.", - "name": "userId", - "in": "query" + "401": { + "$ref": "#/responses/unauthorisedError" }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations for a specified alert.", - "name": "alertId", - "in": "query" + "403": { + "$ref": "#/responses/forbiddenError" }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations that are scoped to a specific dashboard", - "name": "dashboardId", - "in": "query" - }, - { - "type": "string", - "description": "Find annotations that are scoped to a specific dashboard", - "name": "dashboardUID", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations that are scoped to a specific panel", - "name": "panelId", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Max limit for results returned.", - "name": "limit", - "in": "query" - }, - { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "description": "Use this to filter organization annotations. Organization 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", - "description": "Return alerts or user created annotations", - "name": "type", - "in": "query" - }, - { - "type": "boolean", - "description": "Match any or all tags", - "name": "matchAny", - "in": "query" - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAnnotationsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "404": { + "$ref": "#/responses/notFoundError" }, "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 an organization 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.", + "put": { + "description": "Updates an existing notification channel identified by uid.", "tags": [ - "annotations" + "legacy_alerts_notification_channels" ], - "summary": "Create Annotation.", - "operationId": "postAnnotation", + "summary": "Update notification channel by UID.", + "operationId": "updateAlertNotificationChannelByUID", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PostAnnotationsCmd" + "$ref": "#/definitions/UpdateAlertNotificationWithUidCommand" } - } - ], - "responses": { - "200": { - "$ref": "#/responses/postAnnotationResponse" - }, - "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": "postGraphiteAnnotation", - "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PostGraphiteAnnotationsCmd" - } + "type": "string", + "name": "notification_channel_uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/postAnnotationResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1591,134 +1678,110 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/annotations/mass-delete": { - "post": { - "tags": [ - "annotations" - ], - "summary": "Delete multiple annotations.", - "operationId": "massDeleteAnnotations", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/MassDeleteAnnotationsCmd" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/annotations/tags": { - "get": { - "description": "Find all the event tags created in the annotations.", + }, + "delete": { + "description": "Deletes an existing notification channel identified by UID.", "tags": [ - "annotations" + "legacy_alerts_notification_channels" ], - "summary": "Find Annotations Tags.", - "operationId": "getAnnotationTags", + "summary": "Delete alert notification by UID.", + "operationId": "deleteAlertNotificationChannelByUID", "parameters": [ { "type": "string", - "description": "Tag is a string that you can use to filter tags.", - "name": "tag", - "in": "query" - }, - { - "type": "string", - "default": "100", - "description": "Max limit for results returned.", - "name": "limit", - "in": "query" + "name": "notification_channel_uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAnnotationTagsResponse" + "$ref": "#/responses/deleteAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/annotations/{annotation_id}": { + "/alert-notifications/{notification_channel_id}": { "get": { + "description": "Returns the notification channel given the notification channel ID.", "tags": [ - "annotations" + "legacy_alerts_notification_channels" ], - "summary": "Get Annotation by ID.", - "operationId": "getAnnotationByID", + "summary": "Get notification channel by ID.", + "operationId": "getAlertNotificationChannelByID", "parameters": [ { - "type": "string", - "name": "annotation_id", + "type": "integer", + "format": "int64", + "name": "notification_channel_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAnnotationByIDResponse" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "put": { - "description": "Updates all properties of an annotation that matches the specified id. To only update certain property, consider using the Patch Annotation operation.", + "description": "Updates an existing notification channel identified by ID.", "tags": [ - "annotations" + "legacy_alerts_notification_channels" ], - "summary": "Update Annotation.", - "operationId": "updateAnnotation", + "summary": "Update notification channel by ID.", + "operationId": "updateAlertNotificationChannel", "parameters": [ - { - "type": "string", - "name": "annotation_id", - "in": "path", - "required": true - }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateAnnotationsCmd" + "$ref": "#/definitions/UpdateAlertNotificationCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "notification_channel_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1726,22 +1789,26 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "delete": { - "description": "Deletes the annotation that matches the specified ID.", + "description": "Deletes an existing notification channel identified by ID.", "tags": [ - "annotations" + "legacy_alerts_notification_channels" ], - "summary": "Delete Annotation By ID.", - "operationId": "deleteAnnotationByID", + "summary": "Delete alert notification by ID.", + "operationId": "deleteAlertNotificationChannel", "parameters": [ { - "type": "string", - "name": "annotation_id", + "type": "integer", + "format": "int64", + "name": "notification_channel_id", "in": "path", "required": true } @@ -1756,38 +1823,1600 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "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.", + } + }, + "/alerts": { + "get": { "tags": [ - "annotations" + "legacy_alerts" ], - "summary": "Patch Annotation.", - "operationId": "patchAnnotation", - "parameters": [ + "summary": "Get legacy alerts.", + "operationId": "getAlerts", + "parameters": [ + { + "type": "array", + "items": { + "type": "string" + }, + "description": "Limit response to alerts in specified dashboard(s). You can specify multiple dashboards.", + "name": "dashboardId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Limit response to alert for a specified panel on a dashboard.", + "name": "panelId", + "in": "query" + }, + { + "type": "string", + "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", + "description": "Return alerts with one or more of the following alert states", + "name": "state", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Limit response to X number of alerts.", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "Limit response to alerts of dashboards in specified folder(s). You can specify multiple folders", + "name": "folderId", + "in": "query" + }, + { + "type": "string", + "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", + "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/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", + "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": [ + { + "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", + "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", + "name": "alert_id", + "in": "path", + "required": true + }, + { + "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", + "description": "Find annotations created after specific epoch datetime in milliseconds.", + "name": "from", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations created before specific epoch datetime in milliseconds.", + "name": "to", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Limit response to annotations created by specific user.", + "name": "userId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations for a specified alert.", + "name": "alertId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations that are scoped to a specific dashboard", + "name": "dashboardId", + "in": "query" + }, + { + "type": "string", + "description": "Find annotations that are scoped to a specific dashboard", + "name": "dashboardUID", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations that are scoped to a specific panel", + "name": "panelId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Max limit for results returned.", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "Use this to filter organization annotations. Organization 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", + "description": "Return alerts or user created annotations", + "name": "type", + "in": "query" + }, + { + "type": "boolean", + "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 an organization 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": "postAnnotation", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PostAnnotationsCmd" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/postAnnotationResponse" + }, + "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": "postGraphiteAnnotation", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PostGraphiteAnnotationsCmd" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/postAnnotationResponse" + }, + "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": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/MassDeleteAnnotationsCmd" + } + } + ], + "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", + "description": "Tag is a string that you can use to filter tags.", + "name": "tag", + "in": "query" + }, + { + "type": "string", + "default": "100", + "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}": { + "get": { + "tags": [ + "annotations" + ], + "summary": "Get Annotation by ID.", + "operationId": "getAnnotationByID", + "parameters": [ + { + "type": "string", + "name": "annotation_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAnnotationByIDResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "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", + "name": "annotation_id", + "in": "path", + "required": true + }, + { + "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": "deleteAnnotationByID", + "parameters": [ + { + "type": "string", + "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", + "name": "annotation_id", + "in": "path", + "required": true + }, + { + "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" + } + } + } + }, + "/api/v1/provisioning/alert-rules": { + "post": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Create a new alert rule.", + "operationId": "RoutePostAlertRule", + "parameters": [ + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/ProvisionedAlertRule" + } + } + ], + "responses": { + "201": { + "description": "ProvisionedAlertRule", + "schema": { + "$ref": "#/definitions/ProvisionedAlertRule" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + } + }, + "/api/v1/provisioning/alert-rules/{UID}": { + "get": { + "tags": [ + "provisioning" + ], + "summary": "Get a specific alert rule by UID.", + "operationId": "RouteGetAlertRule", + "parameters": [ + { + "type": "string", + "description": "Alert rule UID", + "name": "UID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ProvisionedAlertRule", + "schema": { + "$ref": "#/definitions/ProvisionedAlertRule" + } + }, + "404": { + "description": " Not found." + } + } + }, + "put": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Update an existing alert rule.", + "operationId": "RoutePutAlertRule", + "parameters": [ + { + "type": "string", + "description": "Alert rule UID", + "name": "UID", + "in": "path", + "required": true + }, + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/ProvisionedAlertRule" + } + } + ], + "responses": { + "200": { + "description": "ProvisionedAlertRule", + "schema": { + "$ref": "#/definitions/ProvisionedAlertRule" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + }, + "delete": { + "tags": [ + "provisioning" + ], + "summary": "Delete a specific alert rule by UID.", + "operationId": "RouteDeleteAlertRule", + "parameters": [ + { + "type": "string", + "description": "Alert rule UID", + "name": "UID", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": " The alert rule was deleted successfully." + } + } + } + }, + "/api/v1/provisioning/contact-points": { + "get": { + "tags": [ + "provisioning" + ], + "summary": "Get all the contact points.", + "operationId": "RouteGetContactpoints", + "parameters": [ + { + "type": "string", + "description": "Filter by name", + "name": "name", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ContactPoints", + "schema": { + "$ref": "#/definitions/ContactPoints" + } + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Create a contact point.", + "operationId": "RoutePostContactpoints", + "parameters": [ + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/EmbeddedContactPoint" + } + } + ], + "responses": { + "202": { + "description": "EmbeddedContactPoint", + "schema": { + "$ref": "#/definitions/EmbeddedContactPoint" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + } + }, + "/api/v1/provisioning/contact-points/{UID}": { + "put": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Update an existing contact point.", + "operationId": "RoutePutContactpoint", + "parameters": [ + { + "type": "string", + "description": "UID is the contact point unique identifier", + "name": "UID", + "in": "path", + "required": true + }, + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/EmbeddedContactPoint" + } + } + ], + "responses": { + "202": { + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + }, + "delete": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Delete a contact point.", + "operationId": "RouteDeleteContactpoints", + "parameters": [ + { + "type": "string", + "description": "UID is the contact point unique identifier", + "name": "UID", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": " The contact point was deleted successfully." + } + } + } + }, + "/api/v1/provisioning/folder/{FolderUID}/rule-groups/{Group}": { + "get": { + "tags": [ + "provisioning" + ], + "summary": "Get a rule group.", + "operationId": "RouteGetAlertRuleGroup", + "parameters": [ + { + "type": "string", + "name": "FolderUID", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "Group", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "AlertRuleGroup", + "schema": { + "$ref": "#/definitions/AlertRuleGroup" + } + }, + "404": { + "description": " Not found." + } + } + }, + "put": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Update the interval of a rule group.", + "operationId": "RoutePutAlertRuleGroup", + "parameters": [ + { + "type": "string", + "name": "FolderUID", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "Group", + "in": "path", + "required": true + }, + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/AlertRuleGroup" + } + } + ], + "responses": { + "200": { + "description": "AlertRuleGroup", + "schema": { + "$ref": "#/definitions/AlertRuleGroup" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + } + }, + "/api/v1/provisioning/mute-timings": { + "get": { + "tags": [ + "provisioning" + ], + "summary": "Get all the mute timings.", + "operationId": "RouteGetMuteTimings", + "responses": { + "200": { + "description": "MuteTimings", + "schema": { + "$ref": "#/definitions/MuteTimings" + } + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Create a new mute timing.", + "operationId": "RoutePostMuteTiming", + "parameters": [ + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/MuteTimeInterval" + } + } + ], + "responses": { + "201": { + "description": "MuteTimeInterval", + "schema": { + "$ref": "#/definitions/MuteTimeInterval" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + } + }, + "/api/v1/provisioning/mute-timings/{name}": { + "get": { + "tags": [ + "provisioning" + ], + "summary": "Get a mute timing.", + "operationId": "RouteGetMuteTiming", + "parameters": [ + { + "type": "string", + "description": "Mute timing name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "MuteTimeInterval", + "schema": { + "$ref": "#/definitions/MuteTimeInterval" + } + }, + "404": { + "description": " Not found." + } + } + }, + "put": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Replace an existing mute timing.", + "operationId": "RoutePutMuteTiming", + "parameters": [ + { + "type": "string", + "description": "Mute timing name", + "name": "name", + "in": "path", + "required": true + }, + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/MuteTimeInterval" + } + } + ], + "responses": { + "200": { + "description": "MuteTimeInterval", + "schema": { + "$ref": "#/definitions/MuteTimeInterval" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + }, + "delete": { + "tags": [ + "provisioning" + ], + "summary": "Delete a mute timing.", + "operationId": "RouteDeleteMuteTiming", + "parameters": [ + { + "type": "string", + "description": "Mute timing name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": " The mute timing was deleted successfully." + } + } + } + }, + "/api/v1/provisioning/policies": { + "get": { + "tags": [ + "provisioning" + ], + "summary": "Get the notification policy tree.", + "operationId": "RouteGetPolicyTree", + "responses": { + "200": { + "description": "Route", + "schema": { + "$ref": "#/definitions/Route" + } + } + } + }, + "put": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Sets the notification policy tree.", + "operationId": "RoutePutPolicyTree", + "parameters": [ + { + "description": "The new notification routing tree to use", + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/Route" + } + } + ], + "responses": { + "202": { + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + }, + "delete": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Clears the notification policy tree.", + "operationId": "RouteResetPolicyTree", + "responses": { + "202": { + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } + } + } + } + }, + "/api/v1/provisioning/templates": { + "get": { + "tags": [ + "provisioning" + ], + "summary": "Get all message templates.", + "operationId": "RouteGetTemplates", + "responses": { + "200": { + "description": "MessageTemplates", + "schema": { + "$ref": "#/definitions/MessageTemplates" + } + }, + "404": { + "description": " Not found." + } + } + } + }, + "/api/v1/provisioning/templates/{name}": { + "get": { + "tags": [ + "provisioning" + ], + "summary": "Get a message template.", + "operationId": "RouteGetTemplate", + "parameters": [ + { + "type": "string", + "description": "Template Name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "MessageTemplate", + "schema": { + "$ref": "#/definitions/MessageTemplate" + } + }, + "404": { + "description": " Not found." + } + } + }, + "put": { + "consumes": [ + "application/json" + ], + "tags": [ + "provisioning" + ], + "summary": "Updates an existing template.", + "operationId": "RoutePutTemplate", + "parameters": [ + { + "type": "string", + "description": "Template Name", + "name": "name", + "in": "path", + "required": true + }, + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/MessageTemplateContent" + } + } + ], + "responses": { + "202": { + "description": "MessageTemplate", + "schema": { + "$ref": "#/definitions/MessageTemplate" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + } + } + }, + "delete": { + "tags": [ + "provisioning" + ], + "summary": "Delete a template.", + "operationId": "RouteDeleteTemplate", + "parameters": [ + { + "type": "string", + "description": "Template Name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": " The template was deleted successfully." + } + } + } + }, + "/auth/keys": { + "get": { + "description": "Will return auth keys.", + "tags": [ + "api_keys" + ], + "summary": "Get auth keys.", + "operationId": "getAPIkeys", + "parameters": [ + { + "type": "boolean", + "default": false, + "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/AddCommand" + } + } + ], + "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", + "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": "searchDashboardSnapshots", + "parameters": [ + { + "type": "string", + "description": "Search Query", + "name": "query", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1000, + "description": "Limit the number of returned results", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/searchDashboardSnapshotsResponse" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/calculate-diff": { + "post": { + "produces": [ + "application/json", + "text/html" + ], + "tags": [ + "dashboards" + ], + "summary": "Perform diff on two dashboards.", + "operationId": "calculateDashboardDiff", + "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" + ] + }, + "new": { + "$ref": "#/definitions/CalculateDiffTarget" + } + } + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/calculateDashboardDiffResponse" + }, + "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": { + "description": "Please refer to [updated API](#/dashboard_permissions/getDashboardPermissionsListByUID) instead", + "tags": [ + "dashboard_permissions" + ], + "summary": "Gets all existing permissions for the given dashboard.", + "operationId": "getDashboardPermissionsListByID", + "deprecated": true, + "parameters": [ { - "type": "string", - "name": "annotation_id", + "type": "integer", + "format": "int64", + "name": "DashboardID", "in": "path", "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getDashboardPermissionsListResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "post": { + "description": "Please refer to [updated API](#/dashboard_permissions/updateDashboardPermissionsByUID) instead\n\nThis operation will remove existing permissions if they’re not included in the request.", + "tags": [ + "dashboard_permissions" + ], + "summary": "Updates permissions for a dashboard.", + "operationId": "updateDashboardPermissionsByID", + "deprecated": true, + "parameters": [ { - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PatchAnnotationsCmd" + "$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" }, @@ -1803,673 +3432,848 @@ } } }, - "/api/v1/provisioning/alert-rules": { + "/dashboards/id/{DashboardID}/restore": { "post": { - "consumes": [ - "application/json" + "description": "Please refer to [updated API](#/dashboard_versions/restoreDashboardVersionByUID) instead", + "tags": [ + "dashboard_versions" + ], + "summary": "Restore a dashboard to a given dashboard version.", + "operationId": "restoreDashboardVersionByID", + "deprecated": true, + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RestoreDashboardVersionCommand" + } + }, + { + "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": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionsByUID) instead", + "tags": [ + "dashboard_versions" + ], + "summary": "Gets all existing versions for the dashboard.", + "operationId": "getDashboardVersionsByID", + "deprecated": true, + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true + } + ], + "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": { + "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionByUID) instead", + "tags": [ + "dashboard_versions" + ], + "summary": "Get a specific dashboard version.", + "operationId": "getDashboardVersionByID", + "deprecated": true, + "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/getDashboardsTagsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/trim": { + "post": { "tags": [ - "provisioning" + "dashboards" ], - "summary": "Create a new alert rule.", - "operationId": "RoutePostAlertRule", + "summary": "Trim defaults from dashboard.", + "operationId": "trimDashboard", "parameters": [ { "name": "Body", "in": "body", + "required": true, "schema": { - "$ref": "#/definitions/ProvisionedAlertRule" + "$ref": "#/definitions/TrimDashboardCommand" } } ], "responses": { - "201": { - "description": "ProvisionedAlertRule", - "schema": { - "$ref": "#/definitions/ProvisionedAlertRule" - } + "200": { + "$ref": "#/responses/trimDashboardResponse" }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/api/v1/provisioning/alert-rules/{UID}": { + "/dashboards/uid/{uid}": { "get": { + "description": "Will return the dashboard given the dashboard unique identifier (uid).", "tags": [ - "provisioning" + "dashboards" ], - "summary": "Get a specific alert rule by UID.", - "operationId": "RouteGetAlertRule", + "summary": "Get dashboard by uid.", + "operationId": "getDashboardByUID", "parameters": [ { "type": "string", - "description": "Alert rule UID", - "name": "UID", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "description": "ProvisionedAlertRule", - "schema": { - "$ref": "#/definitions/ProvisionedAlertRule" - } + "$ref": "#/responses/dashboardResponse" }, - "404": { - "description": " Not found." - } - } - }, - "put": { - "consumes": [ - "application/json" - ], - "tags": [ - "provisioning" - ], - "summary": "Update an existing alert rule.", - "operationId": "RoutePutAlertRule", - "parameters": [ - { - "type": "string", - "description": "Alert rule UID", - "name": "UID", - "in": "path", - "required": true + "401": { + "$ref": "#/responses/unauthorisedError" }, - { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/ProvisionedAlertRule" - } - } - ], - "responses": { - "200": { - "description": "ProvisionedAlertRule", - "schema": { - "$ref": "#/definitions/ProvisionedAlertRule" - } + "403": { + "$ref": "#/responses/forbiddenError" }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } }, "delete": { + "description": "Will delete the dashboard given the specified unique identifier (uid).", "tags": [ - "provisioning" + "dashboards" ], - "summary": "Delete a specific alert rule by UID.", - "operationId": "RouteDeleteAlertRule", + "summary": "Delete dashboard by uid.", + "operationId": "deleteDashboardByUID", "parameters": [ { "type": "string", - "description": "Alert rule UID", - "name": "UID", + "name": "uid", "in": "path", "required": true } ], "responses": { - "204": { - "description": " The alert rule was deleted successfully." + "200": { + "$ref": "#/responses/deleteDashboardResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/api/v1/provisioning/contact-points": { + "/dashboards/uid/{uid}/permissions": { "get": { "tags": [ - "provisioning" + "dashboard_permissions" ], - "summary": "Get all the contact points.", - "operationId": "RouteGetContactpoints", + "summary": "Gets all existing permissions for the given dashboard.", + "operationId": "getDashboardPermissionsListByUID", "parameters": [ { "type": "string", - "description": "Filter by name", - "name": "name", - "in": "query" + "name": "uid", + "in": "path", + "required": true } ], "responses": { "200": { - "description": "ContactPoints", - "schema": { - "$ref": "#/definitions/ContactPoints" - } + "$ref": "#/responses/getDashboardPermissionsListResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } }, "post": { - "consumes": [ - "application/json" - ], + "description": "This operation will remove existing permissions if they’re not included in the request.", "tags": [ - "provisioning" + "dashboard_permissions" ], - "summary": "Create a contact point.", - "operationId": "RoutePostContactpoints", + "summary": "Updates permissions for a dashboard.", + "operationId": "updateDashboardPermissionsByUID", "parameters": [ { "name": "Body", "in": "body", + "required": true, "schema": { - "$ref": "#/definitions/EmbeddedContactPoint" + "$ref": "#/definitions/UpdateDashboardACLCommand" } + }, + { + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { - "202": { - "description": "EmbeddedContactPoint", - "schema": { - "$ref": "#/definitions/EmbeddedContactPoint" - } + "200": { + "$ref": "#/responses/okResponse" }, "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/api/v1/provisioning/contact-points/{UID}": { - "put": { - "consumes": [ - "application/json" - ], + "/dashboards/uid/{uid}/restore": { + "post": { "tags": [ - "provisioning" + "dashboard_versions" ], - "summary": "Update an existing contact point.", - "operationId": "RoutePutContactpoint", + "summary": "Restore a dashboard to a given dashboard version using UID.", + "operationId": "restoreDashboardVersionByUID", "parameters": [ - { - "type": "string", - "description": "UID is the contact point unique identifier", - "name": "UID", - "in": "path", - "required": true - }, { "name": "Body", "in": "body", + "required": true, "schema": { - "$ref": "#/definitions/EmbeddedContactPoint" - } - } - ], - "responses": { - "202": { - "description": "Ack", - "schema": { - "$ref": "#/definitions/Ack" + "$ref": "#/definitions/RestoreDashboardVersionCommand" } }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } - } - } - }, - "delete": { - "consumes": [ - "application/json" - ], - "tags": [ - "provisioning" - ], - "summary": "Delete a contact point.", - "operationId": "RouteDeleteContactpoints", - "parameters": [ { "type": "string", - "description": "UID is the contact point unique identifier", - "name": "UID", + "name": "uid", "in": "path", "required": true } ], "responses": { - "204": { - "description": " The contact point was deleted successfully." + "200": { + "$ref": "#/responses/postDashboardResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/api/v1/provisioning/folder/{FolderUID}/rule-groups/{Group}": { + "/dashboards/uid/{uid}/versions": { "get": { "tags": [ - "provisioning" + "dashboard_versions" ], - "summary": "Get a rule group.", - "operationId": "RouteGetAlertRuleGroup", + "summary": "Gets all existing versions for the dashboard using UID.", + "operationId": "getDashboardVersionsByUID", "parameters": [ { "type": "string", - "name": "FolderUID", + "name": "uid", "in": "path", "required": true }, { - "type": "string", - "name": "Group", - "in": "path", - "required": true + "type": "integer", + "format": "int64", + "default": 0, + "description": "Maximum number of results to return", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 0, + "description": "Version to start from when returning queries", + "name": "start", + "in": "query" } ], "responses": { "200": { - "description": "AlertRuleGroup", - "schema": { - "$ref": "#/definitions/AlertRuleGroup" - } + "$ref": "#/responses/dashboardVersionsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, "404": { - "description": " Not found." + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } - }, - "put": { - "consumes": [ - "application/json" - ], + } + }, + "/dashboards/uid/{uid}/versions/{DashboardVersionID}": { + "get": { "tags": [ - "provisioning" + "dashboard_versions" ], - "summary": "Update the interval of a rule group.", - "operationId": "RoutePutAlertRuleGroup", + "summary": "Get a specific dashboard version using UID.", + "operationId": "getDashboardVersionByUID", "parameters": [ { - "type": "string", - "name": "FolderUID", + "type": "integer", + "format": "int64", + "name": "DashboardVersionID", "in": "path", "required": true }, { "type": "string", - "name": "Group", + "name": "uid", "in": "path", "required": true - }, - { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/AlertRuleGroup" - } } ], "responses": { "200": { - "description": "AlertRuleGroup", - "schema": { - "$ref": "#/definitions/AlertRuleGroup" - } + "$ref": "#/responses/dashboardVersionResponse" }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/api/v1/provisioning/mute-timings": { + "/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": [ - "provisioning" + "datasources" ], - "summary": "Get all the mute timings.", - "operationId": "RouteGetMuteTimings", + "summary": "Get all data sources.", + "operationId": "getDataSources", "responses": { "200": { - "description": "MuteTimings", - "schema": { - "$ref": "#/definitions/MuteTimings" - } + "$ref": "#/responses/getDataSourcesResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } }, "post": { - "consumes": [ - "application/json" - ], + "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": [ - "provisioning" + "datasources" ], - "summary": "Create a new mute timing.", - "operationId": "RoutePostMuteTiming", + "summary": "Create a data source.", + "operationId": "addDataSource", "parameters": [ { "name": "Body", "in": "body", + "required": true, "schema": { - "$ref": "#/definitions/MuteTimeInterval" + "$ref": "#/definitions/AddDataSourceCommand" } } ], "responses": { - "201": { - "description": "MuteTimeInterval", - "schema": { - "$ref": "#/definitions/MuteTimeInterval" - } + "200": { + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "409": { + "$ref": "#/responses/conflictError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/api/v1/provisioning/mute-timings/{name}": { + "/datasources/correlations": { "get": { "tags": [ - "provisioning" - ], - "summary": "Get a mute timing.", - "operationId": "RouteGetMuteTiming", - "parameters": [ - { - "type": "string", - "description": "Mute timing name", - "name": "name", - "in": "path", - "required": true - } + "correlations" ], + "summary": "Gets all correlations.", + "operationId": "getCorrelations", "responses": { "200": { - "description": "MuteTimeInterval", - "schema": { - "$ref": "#/definitions/MuteTimeInterval" - } + "$ref": "#/responses/getCorrelationsResponse" }, - "404": { - "description": " Not found." - } - } - }, - "put": { - "consumes": [ - "application/json" - ], - "tags": [ - "provisioning" - ], - "summary": "Replace an existing mute timing.", - "operationId": "RoutePutMuteTiming", - "parameters": [ - { - "type": "string", - "description": "Mute timing name", - "name": "name", - "in": "path", - "required": true + "401": { + "$ref": "#/responses/unauthorisedError" }, - { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/MuteTimeInterval" - } - } - ], - "responses": { - "200": { - "description": "MuteTimeInterval", - "schema": { - "$ref": "#/definitions/MuteTimeInterval" - } + "404": { + "$ref": "#/responses/notFoundError" }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } + "500": { + "$ref": "#/responses/internalServerError" } } - }, - "delete": { + } + }, + "/datasources/id/{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": [ - "provisioning" + "datasources" ], - "summary": "Delete a mute timing.", - "operationId": "RouteDeleteMuteTiming", + "summary": "Get data source Id by Name.", + "operationId": "getDataSourceIdByName", "parameters": [ { "type": "string", - "description": "Mute timing name", "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": " The mute timing was deleted successfully." - } - } - } - }, - "/api/v1/provisioning/policies": { - "get": { - "tags": [ - "provisioning" + "in": "path", + "required": true + } ], - "summary": "Get the notification policy tree.", - "operationId": "RouteGetPolicyTree", "responses": { "200": { - "description": "Route", - "schema": { - "$ref": "#/definitions/Route" - } + "$ref": "#/responses/getDataSourceIDResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } - }, - "put": { - "consumes": [ - "application/json" - ], + } + }, + "/datasources/name/{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": [ - "provisioning" + "datasources" ], - "summary": "Sets the notification policy tree.", - "operationId": "RoutePutPolicyTree", + "summary": "Get a single data source by Name.", + "operationId": "getDataSourceByName", "parameters": [ { - "description": "The new notification routing tree to use", - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/Route" - } + "type": "string", + "name": "name", + "in": "path", + "required": true } ], "responses": { - "202": { - "description": "Ack", - "schema": { - "$ref": "#/definitions/Ack" - } + "200": { + "$ref": "#/responses/getDataSourceResponse" }, - "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } }, "delete": { - "consumes": [ - "application/json" - ], + "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": [ - "provisioning" + "datasources" ], - "summary": "Clears the notification policy tree.", - "operationId": "RouteResetPolicyTree", - "responses": { - "202": { - "description": "Ack", - "schema": { - "$ref": "#/definitions/Ack" - } + "summary": "Delete an existing data source by name.", + "operationId": "deleteDataSourceByName", + "parameters": [ + { + "type": "string", + "name": "name", + "in": "path", + "required": true } - } - } - }, - "/api/v1/provisioning/templates": { - "get": { - "tags": [ - "provisioning" ], - "summary": "Get all message templates.", - "operationId": "RouteGetTemplates", "responses": { "200": { - "description": "MessageTemplates", - "schema": { - "$ref": "#/definitions/MessageTemplates" - } + "$ref": "#/responses/deleteDataSourceByNameResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, "404": { - "description": " Not found." + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/api/v1/provisioning/templates/{name}": { + "/datasources/proxy/uid/{uid}/{datasource_proxy_route}": { "get": { + "description": "Proxies all calls to the actual data source.", "tags": [ - "provisioning" + "datasources" ], - "summary": "Get a message template.", - "operationId": "RouteGetTemplate", + "summary": "Data source proxy GET calls.", + "operationId": "datasourceProxyGETByUIDcalls", "parameters": [ { "type": "string", - "description": "Template Name", - "name": "name", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "description": "MessageTemplate", - "schema": { - "$ref": "#/definitions/MessageTemplate" - } + "description": "(empty)" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, "404": { - "description": " Not found." + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } }, - "put": { - "consumes": [ - "application/json" - ], + "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": [ - "provisioning" + "datasources" ], - "summary": "Updates an existing template.", - "operationId": "RoutePutTemplate", + "summary": "Data source proxy POST calls.", + "operationId": "datasourceProxyPOSTByUIDcalls", "parameters": [ + { + "name": "DatasourceProxyParam", + "in": "body", + "required": true, + "schema": {} + }, { "type": "string", - "description": "Template Name", - "name": "name", + "name": "datasource_proxy_route", "in": "path", "required": true }, { - "name": "Body", - "in": "body", - "schema": { - "$ref": "#/definitions/MessageTemplateContent" - } + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { + "201": { + "description": "(empty)" + }, "202": { - "description": "MessageTemplate", - "schema": { - "$ref": "#/definitions/MessageTemplate" - } + "description": "(empty)" }, "400": { - "description": "ValidationError", - "schema": { - "$ref": "#/definitions/ValidationError" - } + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } }, "delete": { + "description": "Proxies all calls to the actual data source.", "tags": [ - "provisioning" + "datasources" ], - "summary": "Delete a template.", - "operationId": "RouteDeleteTemplate", + "summary": "Data source proxy DELETE calls.", + "operationId": "datasourceProxyDELETEByUIDcalls", "parameters": [ { "type": "string", - "description": "Template Name", - "name": "name", + "name": "uid", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "datasource_proxy_route", "in": "path", "required": true } ], "responses": { - "204": { - "description": " The template was deleted successfully." + "202": { + "description": "(empty)" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/auth/keys": { + "/datasources/proxy/{id}/{datasource_proxy_route}": { "get": { - "description": "Will return auth keys.", + "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyGETByUIDcalls) instead", "tags": [ - "api_keys" + "datasources" ], - "summary": "Get auth keys.", - "operationId": "getAPIkeys", + "summary": "Data source proxy GET calls.", + "operationId": "datasourceProxyGETcalls", + "deprecated": true, "parameters": [ { - "type": "boolean", - "default": false, - "description": "Show expired keys", - "name": "includeExpired", - "in": "query" + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAPIkeyResponse" + "description": "(empty)" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2486,25 +4290,39 @@ } }, "post": { - "description": "Will return details of the created API key.", + "description": "Proxies all calls to the actual data source. The data source should support POST methods for the specific path and role as defined\n\nPlease refer to [updated API](#/datasources/datasourceProxyPOSTByUIDcalls) instead", "tags": [ - "api_keys" + "datasources" ], - "summary": "Creates an API key.", - "operationId": "addAPIkey", + "summary": "Data source proxy POST calls.", + "operationId": "datasourceProxyPOSTcalls", + "deprecated": true, "parameters": [ { - "name": "Body", + "name": "DatasourceProxyParam", "in": "body", "required": true, - "schema": { - "$ref": "#/definitions/AddCommand" - } + "schema": {} + }, + { + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "id", + "in": "path", + "required": true } ], "responses": { - "200": { - "$ref": "#/responses/postAPIkeyResponse" + "201": { + "description": "(empty)" + }, + "202": { + "description": "(empty)" }, "400": { "$ref": "#/responses/badRequestError" @@ -2515,34 +4333,42 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/auth/keys/{id}": { + }, "delete": { + "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyDELETEByUIDcalls) instead", "tags": [ - "api_keys" + "datasources" ], - "summary": "Delete API key.", - "operationId": "deleteAPIkey", + "summary": "Data source proxy DELETE calls.", + "operationId": "datasourceProxyDELETEcalls", + "deprecated": true, "parameters": [ { - "type": "integer", - "format": "int64", + "type": "string", "name": "id", "in": "path", "required": true + }, + { + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true } ], "responses": { - "200": { - "$ref": "#/responses/okResponse" + "202": { + "description": "(empty)" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2559,79 +4385,64 @@ } } }, - "/dashboard/snapshots": { + "/datasources/uid/{sourceUID}/correlations": { "get": { "tags": [ - "snapshots" + "correlations" ], - "summary": "List snapshots.", - "operationId": "searchDashboardSnapshots", + "summary": "Gets all correlations originating from the given data source.", + "operationId": "getCorrelationsBySourceUID", "parameters": [ { "type": "string", - "description": "Search Query", - "name": "query", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 1000, - "description": "Limit the number of returned results", - "name": "limit", - "in": "query" + "name": "sourceUID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/searchDashboardSnapshotsResponse" + "$ref": "#/responses/getCorrelationsBySourceUIDResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/dashboards/calculate-diff": { + }, "post": { - "produces": [ - "application/json", - "text/html" - ], "tags": [ - "dashboards" + "correlations" ], - "summary": "Perform diff on two dashboards.", - "operationId": "calculateDashboardDiff", + "summary": "Add correlation.", + "operationId": "createCorrelation", "parameters": [ { - "name": "Body", + "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" - ] - }, - "new": { - "$ref": "#/definitions/CalculateDiffTarget" - } - } + "$ref": "#/definitions/CreateCorrelationCommand" } + }, + { + "type": "string", + "name": "sourceUID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/calculateDashboardDiffResponse" + "$ref": "#/responses/createCorrelationResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2639,99 +4450,122 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/db": { - "post": { - "description": "Creates a new dashboard or updates an existing dashboard.", + "/datasources/uid/{sourceUID}/correlations/{correlationUID}": { + "get": { "tags": [ - "dashboards" + "correlations" ], - "summary": "Create / Update dashboard", - "operationId": "postDashboard", + "summary": "Gets a correlation.", + "operationId": "getCorrelation", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/SaveDashboardCommand" - } + "type": "string", + "name": "sourceUID", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "correlationUID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/postDashboardResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getCorrelationResponse" }, "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": { + }, + "patch": { "tags": [ - "dashboards" + "correlations" + ], + "summary": "Updates a correlation.", + "operationId": "updateCorrelation", + "parameters": [ + { + "type": "string", + "name": "sourceUID", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "correlationUID", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/UpdateCorrelationCommand" + } + } ], - "summary": "Get home dashboard.", - "operationId": "getHomeDashboard", "responses": { "200": { - "$ref": "#/responses/getHomeDashboardResponse" + "$ref": "#/responses/updateCorrelationResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/id/{DashboardID}/permissions": { + "/datasources/uid/{uid}": { "get": { - "description": "Please refer to [updated API](#/dashboard_permissions/getDashboardPermissionsListByUID) instead", + "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": [ - "dashboard_permissions" - ], - "summary": "Gets all existing permissions for the given dashboard.", - "operationId": "getDashboardPermissionsListByID", - "deprecated": true, + "datasources" + ], + "summary": "Get a single data source by UID.", + "operationId": "getDataSourceByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDashboardPermissionsListResponse" + "$ref": "#/responses/getDataSourceResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2747,37 +4581,62 @@ } } }, - "post": { - "description": "Please refer to [updated API](#/dashboard_permissions/updateDashboardPermissionsByUID) instead\n\nThis operation will remove existing permissions if they’re not included in the request.", + "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:uid:*` and `datasources:uid:1` (single data source).", "tags": [ - "dashboard_permissions" + "datasources" ], - "summary": "Updates permissions for a dashboard.", - "operationId": "updateDashboardPermissionsByID", - "deprecated": true, + "summary": "Update an existing data source.", + "operationId": "updateDataSourceByUID", "parameters": [ { "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDashboardACLCommand" + "$ref": "#/definitions/UpdateDataSourceCommand" } }, { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "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:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", + "tags": [ + "datasources" + ], + "summary": "Delete an existing data source by UID.", + "operationId": "deleteDataSourceByUID", + "parameters": [ + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2794,35 +4653,30 @@ } } }, - "/dashboards/id/{DashboardID}/restore": { - "post": { - "description": "Please refer to [updated API](#/dashboard_versions/restoreDashboardVersionByUID) instead", + "/datasources/uid/{uid}/correlations/{correlationUID}": { + "delete": { "tags": [ - "dashboard_versions" + "correlations" ], - "summary": "Restore a dashboard to a given dashboard version.", - "operationId": "restoreDashboardVersionByID", - "deprecated": true, + "summary": "Delete a correlation.", + "operationId": "deleteCorrelation", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RestoreDashboardVersionCommand" - } + "type": "string", + "name": "uid", + "in": "path", + "required": true }, { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "name": "correlationUID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/postDashboardResponse" + "$ref": "#/responses/deleteCorrelationResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2839,27 +4693,27 @@ } } }, - "/dashboards/id/{DashboardID}/versions": { + "/datasources/uid/{uid}/health": { "get": { - "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionsByUID) instead", "tags": [ - "dashboard_versions" + "datasources" ], - "summary": "Gets all existing versions for the dashboard.", - "operationId": "getDashboardVersionsByID", - "deprecated": true, + "summary": "Sends a health check request to the plugin datasource identified by the UID.", + "operationId": "checkDatasourceHealthWithUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2867,43 +4721,39 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/id/{DashboardID}/versions/{DashboardVersionID}": { + "/datasources/uid/{uid}/resources/{datasource_proxy_route}": { "get": { - "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionByUID) instead", "tags": [ - "dashboard_versions" + "datasources" ], - "summary": "Get a specific dashboard version.", - "operationId": "getDashboardVersionByID", - "deprecated": true, + "summary": "Fetch data source resources.", + "operationId": "callDatasourceResourceWithUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "name": "datasource_proxy_route", "in": "path", "required": true }, { - "type": "integer", - "format": "int64", - "name": "DashboardVersionID", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2920,26 +4770,26 @@ } } }, - "/dashboards/import": { + "/datasources/{datasourceId}/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": [ - "dashboards" + "datasource_permissions", + "enterprise" ], - "summary": "Import dashboard.", - "operationId": "importDashboard", + "summary": "Disable permissions for a data source.", + "operationId": "disablePermissions", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/ImportDashboardRequest" - } + "type": "string", + "name": "datasourceId", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/importDashboardResponse" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -2947,11 +4797,11 @@ "401": { "$ref": "#/responses/unauthorisedError" }, - "412": { - "$ref": "#/responses/preconditionFailedError" + "403": { + "$ref": "#/responses/forbiddenError" }, - "422": { - "$ref": "#/responses/unprocessableEntityError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -2959,75 +4809,122 @@ } } }, - "/dashboards/tags": { - "get": { + "/datasources/{datasourceId}/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": [ - "dashboards" + "datasource_permissions", + "enterprise" + ], + "summary": "Enable permissions for a data source.", + "operationId": "enablePermissions", + "parameters": [ + { + "type": "string", + "name": "datasourceId", + "in": "path", + "required": true + } ], - "summary": "Get all dashboards tags of an organisation.", - "operationId": "getDashboardTags", "responses": { "200": { - "$ref": "#/responses/getDashboardsTagsResponse" + "$ref": "#/responses/createOrUpdateDatasourceResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/trim": { - "post": { + "/datasources/{datasourceId}/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": [ - "dashboards" + "datasource_permissions", + "enterprise" ], - "summary": "Trim defaults from dashboard.", - "operationId": "trimDashboard", + "summary": "Get permissions for a data source.", + "operationId": "getAllPermissions", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/TrimDashboardCommand" - } + "type": "string", + "name": "datasourceId", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/trimDashboardResponse" + "$ref": "#/responses/getAllPermissionseResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/dashboards/uid/{uid}": { - "get": { - "description": "Will return the dashboard given the dashboard unique identifier (uid).", + }, + "post": { + "description": "You need to have a permission with action `datasources.permissions:read` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", "tags": [ - "dashboards" + "datasource_permissions", + "enterprise" ], - "summary": "Get dashboard by uid.", - "operationId": "getDashboardByUID", + "summary": "Add permissions for a data source.", + "operationId": "addPermission", "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "userId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "query" + }, { "type": "string", - "name": "uid", + "name": "builtinRole", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "name": "permission", + "in": "query" + }, + { + "type": "string", + "name": "datasourceId", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/dashboardResponse" + "$ref": "#/responses/addPermissionResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3042,25 +4939,34 @@ "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/datasources/{datasourceId}/permissions/{permissionId}": { "delete": { - "description": "Will delete the dashboard given the specified unique identifier (uid).", + "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": [ - "dashboards" + "datasource_permissions", + "enterprise" ], - "summary": "Delete dashboard by uid.", - "operationId": "deleteDashboardByUID", + "summary": "Remove permission for a data source.", + "operationId": "deletePermissions", "parameters": [ { "type": "string", - "name": "uid", + "name": "datasourceId", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "permissionId", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/deleteDashboardResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3070,31 +4976,33 @@ }, "404": { "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/uid/{uid}/permissions": { + "/datasources/{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).\n\nPlease refer to [updated API](#/datasources/getDataSourceByUID) instead", "tags": [ - "dashboard_permissions" + "datasources" ], - "summary": "Gets all existing permissions for the given dashboard.", - "operationId": "getDashboardPermissionsListByUID", + "summary": "Get a single data source by Id.", + "operationId": "getDataSourceByID", + "deprecated": true, "parameters": [ { "type": "string", - "name": "uid", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDashboardPermissionsListResponse" + "$ref": "#/responses/getDataSourceResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3110,35 +5018,33 @@ } } }, - "post": { - "description": "This operation will remove existing permissions if they’re not included in the request.", + "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).\n\nPlease refer to [updated API](#/datasources/updateDataSourceByUID) instead", "tags": [ - "dashboard_permissions" + "datasources" ], - "summary": "Updates permissions for a dashboard.", - "operationId": "updateDashboardPermissionsByUID", + "summary": "Update an existing data source by its sequential ID.", + "operationId": "updateDataSourceByID", + "deprecated": true, "parameters": [ { "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDashboardACLCommand" + "$ref": "#/definitions/UpdateDataSourceCommand" } }, { "type": "string", - "name": "uid", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3146,41 +5052,30 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/dashboards/uid/{uid}/restore": { - "post": { + }, + "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).\n\nPlease refer to [updated API](#/datasources/deleteDataSourceByUID) instead", "tags": [ - "dashboard_versions" + "datasources" ], - "summary": "Restore a dashboard to a given dashboard version using UID.", - "operationId": "restoreDashboardVersionByUID", + "summary": "Delete an existing data source by id.", + "operationId": "deleteDataSourceByID", + "deprecated": true, "parameters": [ - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RestoreDashboardVersionCommand" - } - }, { "type": "string", - "name": "uid", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/postDashboardResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3197,40 +5092,29 @@ } } }, - "/dashboards/uid/{uid}/versions": { + "/datasources/{id}/health": { "get": { + "description": "Please refer to [updated API](#/datasources/checkDatasourceHealthWithUID) instead", "tags": [ - "dashboard_versions" + "datasources" ], - "summary": "Gets all existing versions for the dashboard using UID.", - "operationId": "getDashboardVersionsByUID", + "summary": "Sends a health check request to the plugin datasource identified by the ID.", + "operationId": "checkDatasourceHealthByID", + "deprecated": true, "parameters": [ { "type": "string", - "name": "uid", + "name": "id", "in": "path", "required": true - }, - { - "type": "integer", - "format": "int64", - "default": 0, - "description": "Maximum number of results to return", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 0, - "description": "Version to start from when returning queries", - "name": "start", - "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3238,40 +5122,41 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/uid/{uid}/versions/{DashboardVersionID}": { + "/datasources/{id}/resources/{datasource_proxy_route}": { "get": { + "description": "Please refer to [updated API](#/datasources/callDatasourceResourceWithUID) instead", "tags": [ - "dashboard_versions" + "datasources" ], - "summary": "Get a specific dashboard version using UID.", - "operationId": "getDashboardVersionByUID", + "summary": "Fetch data source resources by Id.", + "operationId": "callDatasourceResourceByID", + "deprecated": true, "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardVersionID", + "type": "string", + "name": "datasource_proxy_route", "in": "path", "required": true }, { "type": "string", - "name": "uid", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3288,81 +5173,39 @@ } } }, - "/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" - } - } - }, + "/ds/query": { "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`", + "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": [ - "datasources" + "ds" ], - "summary": "Create a data source.", - "operationId": "addDataSource", + "summary": "DataSource query metrics with expressions.", + "operationId": "queryMetricsWithExpressions", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddDataSourceCommand" + "$ref": "#/definitions/MetricRequest" } } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "$ref": "#/responses/queryMetricsWithExpressionsRespons" }, - "409": { - "$ref": "#/responses/conflictError" + "207": { + "$ref": "#/responses/queryMetricsWithExpressionsRespons" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/datasources/correlations": { - "get": { - "tags": [ - "correlations" - ], - "summary": "Gets all correlations.", - "operationId": "getCorrelations", - "responses": { - "200": { - "$ref": "#/responses/getCorrelationsResponse" + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -3370,25 +5213,35 @@ } } }, - "/datasources/id/{name}": { + "/folders": { "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).", + "description": "Returns all folders that the authenticated user has permission to view.", "tags": [ - "datasources" + "folders" ], - "summary": "Get data source Id by Name.", - "operationId": "getDataSourceIdByName", + "summary": "Get all folders.", + "operationId": "getFolders", "parameters": [ { - "type": "string", - "name": "name", - "in": "path", - "required": true + "type": "integer", + "format": "int64", + "default": 1000, + "description": "Limit the maximum number of folders to return", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1, + "description": "Page index for starting fetching folders", + "name": "page", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/getDataSourceIDResponse" + "$ref": "#/responses/getFoldersResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3396,34 +5249,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/name/{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).", + }, + "post": { "tags": [ - "datasources" + "folders" ], - "summary": "Get a single data source by Name.", - "operationId": "getDataSourceByName", + "summary": "Create folder.", + "operationId": "createFolder", "parameters": [ { - "type": "string", - "name": "name", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateFolderCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/getDataSourceResponse" + "$ref": "#/responses/folderResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3431,29 +5283,35 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "409": { + "$ref": "#/responses/conflictError" + }, "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).", + } + }, + "/folders/id/{folder_id}": { + "get": { + "description": "Returns the folder identified by id.", "tags": [ - "datasources" + "folders" ], - "summary": "Delete an existing data source by name.", - "operationId": "deleteDataSourceByName", + "summary": "Get folder by id.", + "operationId": "getFolderByID", "parameters": [ { - "type": "string", - "name": "name", + "type": "integer", + "format": "int64", + "name": "folder_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/deleteDataSourceByNameResponse" + "$ref": "#/responses/folderResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3470,34 +5328,24 @@ } } }, - "/datasources/proxy/uid/{uid}/{datasource_proxy_route}": { + "/folders/{folder_uid}": { "get": { - "description": "Proxies all calls to the actual data source.", "tags": [ - "datasources" + "folders" ], - "summary": "Data source proxy GET calls.", - "operationId": "datasourceProxyGETByUIDcalls", + "summary": "Get folder by uid.", + "operationId": "getFolderByUID", "parameters": [ { "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "uid", + "name": "folder_uid", "in": "path", "required": true } ], "responses": { "200": { - "description": "(empty)" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/folderResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3513,39 +5361,32 @@ } } }, - "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", + "put": { "tags": [ - "datasources" + "folders" ], - "summary": "Data source proxy POST calls.", - "operationId": "datasourceProxyPOSTByUIDcalls", + "summary": "Update folder.", + "operationId": "updateFolder", "parameters": [ - { - "name": "DatasourceProxyParam", - "in": "body", - "required": true, - "schema": {} - }, { "type": "string", - "name": "datasource_proxy_route", + "name": "folder_uid", "in": "path", "required": true }, { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "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/UpdateFolderCommand" + } } ], "responses": { - "201": { - "description": "(empty)" - }, - "202": { - "description": "(empty)" + "200": { + "$ref": "#/responses/folderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3559,35 +5400,39 @@ "404": { "$ref": "#/responses/notFoundError" }, + "409": { + "$ref": "#/responses/conflictError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "delete": { - "description": "Proxies all calls to the actual data source.", + "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": [ - "datasources" + "folders" ], - "summary": "Data source proxy DELETE calls.", - "operationId": "datasourceProxyDELETEByUIDcalls", + "summary": "Delete folder.", + "operationId": "deleteFolder", "parameters": [ { "type": "string", - "name": "uid", + "name": "folder_uid", "in": "path", "required": true }, { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true + "type": "boolean", + "default": false, + "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": { - "202": { - "description": "(empty)" + "200": { + "$ref": "#/responses/deleteFolderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3607,35 +5452,24 @@ } } }, - "/datasources/proxy/{id}/{datasource_proxy_route}": { + "/folders/{folder_uid}/permissions": { "get": { - "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyGETByUIDcalls) instead", "tags": [ - "datasources" + "folder_permissions" ], - "summary": "Data source proxy GET calls.", - "operationId": "datasourceProxyGETcalls", - "deprecated": true, + "summary": "Gets all existing permissions for the folder with the given `uid`.", + "operationId": "getFolderPermissionList", "parameters": [ { "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", + "name": "folder_uid", "in": "path", "required": true } ], "responses": { "200": { - "description": "(empty)" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getFolderPermissionListResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3652,42 +5486,30 @@ } }, "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\n\nPlease refer to [updated API](#/datasources/datasourceProxyPOSTByUIDcalls) instead", "tags": [ - "datasources" + "folder_permissions" ], - "summary": "Data source proxy POST calls.", - "operationId": "datasourceProxyPOSTcalls", - "deprecated": true, + "summary": "Updates permissions for a folder. This operation will remove existing permissions if they’re not included in the request.", + "operationId": "updateFolderPermissions", "parameters": [ - { - "name": "DatasourceProxyParam", - "in": "body", - "required": true, - "schema": {} - }, { "type": "string", - "name": "datasource_proxy_route", + "name": "folder_uid", "in": "path", "required": true }, { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateDashboardACLCommand" + } } ], "responses": { - "201": { - "description": "(empty)" - }, - "202": { - "description": "(empty)" - }, - "400": { - "$ref": "#/responses/badRequestError" + "200": { + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3702,106 +5524,111 @@ "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyDELETEByUIDcalls) instead", + } + }, + "/library-elements": { + "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": [ - "datasources" + "library_elements" ], - "summary": "Data source proxy DELETE calls.", - "operationId": "datasourceProxyDELETEcalls", - "deprecated": true, + "summary": "Get all library elements.", + "operationId": "getLibraryElements", "parameters": [ { "type": "string", - "name": "id", - "in": "path", - "required": true + "description": "Part of the name or description searched for.", + "name": "searchString", + "in": "query" }, { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - } - ], - "responses": { - "202": { - "description": "(empty)" + "enum": [ + 1, + 2 + ], + "type": "integer", + "format": "int64", + "description": "Kind of element to search for.", + "name": "kind", + "in": "query" }, - "400": { - "$ref": "#/responses/badRequestError" + { + "enum": [ + "alpha-asc", + "alpha-desc" + ], + "type": "string", + "description": "Sort order of elements.", + "name": "sortDirection", + "in": "query" }, - "401": { - "$ref": "#/responses/unauthorisedError" + { + "type": "string", + "description": "A comma separated list of types to filter the elements by", + "name": "typeFilter", + "in": "query" }, - "403": { - "$ref": "#/responses/forbiddenError" + { + "type": "string", + "description": "Element UID to exclude from search results.", + "name": "excludeUid", + "in": "query" }, - "404": { - "$ref": "#/responses/notFoundError" + { + "type": "string", + "description": "A comma separated list of folder ID(s) to filter the elements by.", + "name": "folderFilter", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 100, + "description": "The number of results per page.", + "name": "perPage", + "in": "query" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/datasources/uid/{sourceUID}/correlations": { - "get": { - "tags": [ - "correlations" - ], - "summary": "Gets all correlations originating from the given data source.", - "operationId": "getCorrelationsBySourceUID", - "parameters": [ { - "type": "string", - "name": "sourceUID", - "in": "path", - "required": true + "type": "integer", + "format": "int64", + "default": 1, + "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/getCorrelationsBySourceUIDResponse" + "$ref": "#/responses/getLibraryElementsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, "post": { + "description": "Creates a new library element.", "tags": [ - "correlations" + "library_elements" ], - "summary": "Add correlation.", - "operationId": "createCorrelation", + "summary": "Create library element.", + "operationId": "createLibraryElement", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateCorrelationCommand" + "$ref": "#/definitions/CreateLibraryElementCommand" } - }, - { - "type": "string", - "name": "sourceUID", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/createCorrelationResponse" + "$ref": "#/responses/getLibraryElementResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3821,30 +5648,25 @@ } } }, - "/datasources/uid/{sourceUID}/correlations/{correlationUID}": { + "/library-elements/name/{library_element_name}": { "get": { + "description": "Returns a library element with the given name.", "tags": [ - "correlations" + "library_elements" ], - "summary": "Gets a correlation.", - "operationId": "getCorrelation", + "summary": "Get library element by name.", + "operationId": "getLibraryElementByName", "parameters": [ { "type": "string", - "name": "sourceUID", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "correlationUID", + "name": "library_element_name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getCorrelationResponse" + "$ref": "#/responses/getLibraryElementResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3856,47 +5678,31 @@ "$ref": "#/responses/internalServerError" } } - }, - "patch": { + } + }, + "/library-elements/{library_element_uid}": { + "get": { + "description": "Returns a library element with the given UID.", "tags": [ - "correlations" + "library_elements" ], - "summary": "Updates a correlation.", - "operationId": "updateCorrelation", + "summary": "Get library element by UID.", + "operationId": "getLibraryElementByUID", "parameters": [ { "type": "string", - "name": "sourceUID", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "correlationUID", + "name": "library_element_uid", "in": "path", "required": true - }, - { - "name": "body", - "in": "body", - "schema": { - "$ref": "#/definitions/UpdateCorrelationCommand" - } } ], "responses": { "200": { - "$ref": "#/responses/updateCorrelationResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getLibraryElementResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "404": { "$ref": "#/responses/notFoundError" }, @@ -3904,27 +5710,25 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/uid/{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).", + }, + "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": [ - "datasources" + "library_elements" ], - "summary": "Get a single data source by UID.", - "operationId": "getDataSourceByUID", + "summary": "Delete library element.", + "operationId": "deleteLibraryElementByUID", "parameters": [ { "type": "string", - "name": "uid", + "name": "library_element_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDataSourceResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3943,32 +5747,35 @@ } } }, - "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:uid:*` and `datasources:uid:1` (single data source).", + "patch": { + "description": "Updates an existing library element identified by uid.", "tags": [ - "datasources" + "library_elements" ], - "summary": "Update an existing data source.", - "operationId": "updateDataSourceByUID", + "summary": "Update library element.", + "operationId": "updateLibraryElement", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDataSourceCommand" + "$ref": "#/definitions/PatchLibraryElementCommand" } }, { "type": "string", - "name": "uid", + "name": "library_element_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" + "$ref": "#/responses/getLibraryElementResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3976,36 +5783,41 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "412": { + "$ref": "#/responses/preconditionFailedError" + }, "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).", + } + }, + "/library-elements/{library_element_uid}/connections/": { + "get": { + "description": "Returns a list of connections for a library element based on the UID specified.", "tags": [ - "datasources" + "library_elements" ], - "summary": "Delete an existing data source by UID.", - "operationId": "deleteDataSourceByUID", + "summary": "Get library element connections.", + "operationId": "getLibraryElementConnections", "parameters": [ { "type": "string", - "name": "uid", + "name": "library_element_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getLibraryElementConnectionsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "404": { "$ref": "#/responses/notFoundError" }, @@ -4015,39 +5827,33 @@ } } }, - "/datasources/uid/{uid}/correlations/{correlationUID}": { - "delete": { + "/licensing/check": { + "get": { "tags": [ - "correlations" + "licensing", + "enterprise" ], - "summary": "Delete a correlation.", - "operationId": "deleteCorrelation", - "parameters": [ - { - "type": "string", - "name": "uid", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "correlationUID", - "in": "path", - "required": true + "summary": "Check license availability.", + "operationId": "getStatus", + "responses": { + "200": { + "$ref": "#/responses/getStatusResponse" } + } + } + }, + "/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/deleteCorrelationResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "$ref": "#/responses/getCustomPermissionsReportResponse" }, "500": { "$ref": "#/responses/internalServerError" @@ -4055,33 +5861,21 @@ } } }, - "/datasources/uid/{uid}/health": { + "/licensing/custom-permissions-csv": { "get": { - "tags": [ - "datasources" + "description": "You need to have a permission with action `licensing.reports:read`.", + "produces": [ + "text/csv" ], - "summary": "Sends a health check request to the plugin datasource identified by the UID.", - "operationId": "checkDatasourceHealthWithUID", - "parameters": [ - { - "type": "string", - "name": "uid", - "in": "path", - "required": true - } + "tags": [ + "licensing", + "enterprise" ], + "summary": "Get custom permissions report in CSV format.", + "operationId": "getCustomPermissionsCSV", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "$ref": "#/responses/getCustomPermissionsReportResponse" }, "500": { "$ref": "#/responses/internalServerError" @@ -4089,42 +5883,18 @@ } } }, - "/datasources/uid/{uid}/resources/{datasource_proxy_route}": { + "/licensing/refresh-stats": { "get": { + "description": "You need to have a permission with action `licensing:read`.", "tags": [ - "datasources" - ], - "summary": "Fetch data source resources.", - "operationId": "callDatasourceResourceWithUID", - "parameters": [ - { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "uid", - "in": "path", - "required": true - } + "licensing", + "enterprise" ], + "summary": "Refresh license stats.", + "operationId": "refreshLicenseStats", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "$ref": "#/responses/refreshLicenseStatsResponse" }, "500": { "$ref": "#/responses/internalServerError" @@ -4132,71 +5902,72 @@ } } }, - "/datasources/{id}": { + "/licensing/token": { "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).\n\nPlease refer to [updated API](#/datasources/getDataSourceByUID) instead", + "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": [ - "datasources" + "licensing", + "enterprise" ], - "summary": "Get a single data source by Id.", - "operationId": "getDataSourceByID", - "deprecated": true, + "summary": "Create license token.", + "operationId": "postLicenseToken", "parameters": [ { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/DeleteTokenCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/getDataSourceResponse" + "$ref": "#/responses/getLicenseTokenResponse" }, "400": { "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "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).\n\nPlease refer to [updated API](#/datasources/updateDataSourceByUID) instead", + "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": [ - "datasources" + "licensing", + "enterprise" ], - "summary": "Update an existing data source by its sequential ID.", - "operationId": "updateDataSourceByID", - "deprecated": true, + "summary": "Remove license from database.", + "operationId": "deleteLicenseToken", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDataSourceCommand" + "$ref": "#/definitions/DeleteTokenCommand" } - }, - { - "type": "string", - "name": "id", - "in": "path", - "required": true } ], "responses": { - "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" + "202": { + "$ref": "#/responses/acceptedResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4204,36 +5975,58 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, "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).\n\nPlease refer to [updated API](#/datasources/deleteDataSourceByUID) instead", + } + }, + "/licensing/token/renew": { + "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": [ - "datasources" + "licensing", + "enterprise" ], - "summary": "Delete an existing data source by id.", - "operationId": "deleteDataSourceByID", - "deprecated": true, + "summary": "Manually force license refresh.", + "operationId": "postRenewLicenseToken", "parameters": [ { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object" + } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/postRenewLicenseTokenResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" + "404": { + "$ref": "#/responses/notFoundError" + } + } + } + }, + "/logout/saml": { + "get": { + "tags": [ + "saml", + "enterprise" + ], + "summary": "GetLogout initiates single logout process.", + "operationId": "getSAMLLogout", + "responses": { + "302": { + "description": "(empty)" }, "404": { "$ref": "#/responses/notFoundError" @@ -4244,29 +6037,16 @@ } } }, - "/datasources/{id}/health": { + "/org": { "get": { - "description": "Please refer to [updated API](#/datasources/checkDatasourceHealthWithUID) instead", "tags": [ - "datasources" - ], - "summary": "Sends a health check request to the plugin datasource identified by the ID.", - "operationId": "checkDatasourceHealthByID", - "deprecated": true, - "parameters": [ - { - "type": "string", - "name": "id", - "in": "path", - "required": true - } + "org" ], + "summary": "Get current Organization.", + "operationId": "getCurrentOrg", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getCurrentOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4278,29 +6058,21 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/{id}/resources/{datasource_proxy_route}": { - "get": { - "description": "Please refer to [updated API](#/datasources/callDatasourceResourceWithUID) instead", + }, + "put": { "tags": [ - "datasources" + "org" ], - "summary": "Fetch data source resources by Id.", - "operationId": "callDatasourceResourceByID", - "deprecated": true, + "summary": "Update current Organization.", + "operationId": "updateCurrentOrg", "parameters": [ { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgForm" + } } ], "responses": { @@ -4316,39 +6088,32 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/ds/query": { - "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`.", + "/org/address": { + "put": { "tags": [ - "ds" + "org" ], - "summary": "DataSource query metrics with expressions.", - "operationId": "queryMetricsWithExpressions", + "summary": "Update current Organization's address.", + "operationId": "updateCurrentOrgAddress", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/MetricRequest" + "$ref": "#/definitions/UpdateOrgAddressForm" } } ], "responses": { "200": { - "$ref": "#/responses/queryMetricsWithExpressionsRespons" - }, - "207": { - "$ref": "#/responses/queryMetricsWithExpressionsRespons" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4365,35 +6130,16 @@ } } }, - "/folders": { + "/org/invites": { "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, - "description": "Limit the maximum number of folders to return", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 1, - "description": "Page index for starting fetching folders", - "name": "page", - "in": "query" - } + "org_invites" ], + "summary": "Get pending invites.", + "operationId": "getPendingOrgInvites", "responses": { "200": { - "$ref": "#/responses/getFoldersResponse" + "$ref": "#/responses/getPendingOrgInvitesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4408,23 +6154,23 @@ }, "post": { "tags": [ - "folders" + "org_invites" ], - "summary": "Create folder.", - "operationId": "createFolder", + "summary": "Add invite.", + "operationId": "addOrgInvite", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateFolderCommand" + "$ref": "#/definitions/AddInviteForm" } } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4435,8 +6181,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" + "412": { + "$ref": "#/responses/SMTPNotEnabledError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4444,26 +6190,24 @@ } } }, - "/folders/id/{folder_id}": { - "get": { - "description": "Returns the folder identified by id.", + "/org/invites/{invitation_code}/revoke": { + "delete": { "tags": [ - "folders" + "org_invites" ], - "summary": "Get folder by id.", - "operationId": "getFolderByID", + "summary": "Revoke invite.", + "operationId": "revokeInvite", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "folder_id", + "type": "string", + "name": "invitation_code", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4480,24 +6224,16 @@ } } }, - "/folders/{folder_uid}": { + "/org/preferences": { "get": { "tags": [ - "folders" - ], - "summary": "Get folder by uid.", - "operationId": "getFolderByUID", - "parameters": [ - { - "type": "string", - "name": "folder_uid", - "in": "path", - "required": true - } + "org_preferences" ], + "summary": "Get Current Org Prefs.", + "operationId": "getOrgPreferences", "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/getPreferencesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4505,9 +6241,6 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } @@ -4515,30 +6248,23 @@ }, "put": { "tags": [ - "folders" - ], - "summary": "Update folder.", - "operationId": "updateFolder", - "parameters": [ - { - "type": "string", - "name": "folder_uid", - "in": "path", - "required": true - }, + "org_preferences" + ], + "summary": "Update Current Org Prefs.", + "operationId": "updateOrgPreferences", + "parameters": [ { - "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/UpdateFolderCommand" + "$ref": "#/definitions/UpdatePrefsCmd" } } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4549,42 +6275,30 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "409": { - "$ref": "#/responses/conflictError" - }, "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.", + "patch": { "tags": [ - "folders" + "org_preferences" ], - "summary": "Delete folder.", - "operationId": "deleteFolder", + "summary": "Patch Current Org Prefs.", + "operationId": "patchOrgPreferences", "parameters": [ { - "type": "string", - "name": "folder_uid", - "in": "path", - "required": true - }, - { - "type": "boolean", - "default": false, - "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/PatchPrefsCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/deleteFolderResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4595,33 +6309,23 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/folders/{folder_uid}/permissions": { + "/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": [ - "folder_permissions" - ], - "summary": "Gets all existing permissions for the folder with the given `uid`.", - "operationId": "getFolderPermissionList", - "parameters": [ - { - "type": "string", - "name": "folder_uid", - "in": "path", - "required": true - } + "org" ], + "summary": "Get all users within the current organization.", + "operationId": "getOrgUsersForCurrentOrg", "responses": { "200": { - "$ref": "#/responses/getFolderPermissionListResponse" + "$ref": "#/responses/getOrgUsersForCurrentOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4629,33 +6333,25 @@ "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": [ - "folder_permissions" + "org" ], - "summary": "Updates permissions for a folder. This operation will remove existing permissions if they’re not included in the request.", - "operationId": "updateFolderPermissions", + "summary": "Add a new user to the current organization.", + "operationId": "addOrgUserToCurrentOrg", "parameters": [ { - "type": "string", - "name": "folder_uid", - "in": "path", - "required": true - }, - { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDashboardACLCommand" + "$ref": "#/definitions/AddOrgUserCommand" } } ], @@ -4669,118 +6365,69 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/library-elements": { + "/org/users/lookup": { "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.", + "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": [ - "library_elements" + "org" ], - "summary": "Get all library elements.", - "operationId": "getLibraryElements", + "summary": "Get all users within the current organization (lookup)", + "operationId": "getOrgUsersForCurrentOrgLookup", "parameters": [ { "type": "string", - "description": "Part of the name or description searched for.", - "name": "searchString", - "in": "query" - }, - { - "enum": [ - 1, - 2 - ], - "type": "integer", - "format": "int64", - "description": "Kind of element to search for.", - "name": "kind", - "in": "query" - }, - { - "enum": [ - "alpha-asc", - "alpha-desc" - ], - "type": "string", - "description": "Sort order of elements.", - "name": "sortDirection", - "in": "query" - }, - { - "type": "string", - "description": "A comma separated list of types to filter the elements by", - "name": "typeFilter", - "in": "query" - }, - { - "type": "string", - "description": "Element UID to exclude from search results.", - "name": "excludeUid", - "in": "query" - }, - { - "type": "string", - "description": "A comma separated list of folder ID(s) to filter the elements by.", - "name": "folderFilter", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 100, - "description": "The number of results per page.", - "name": "perPage", + "name": "query", "in": "query" }, { "type": "integer", "format": "int64", - "default": 1, - "description": "The page for a set of records, given that only perPage records are returned at a time. Numbering starts at 1.", - "name": "page", + "name": "limit", "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementsResponse" + "$ref": "#/responses/getOrgUsersForCurrentOrgLookupResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "post": { - "description": "Creates a new library element.", + } + }, + "/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": [ - "library_elements" + "org" ], - "summary": "Create library element.", - "operationId": "createLibraryElement", + "summary": "Delete user in current organization.", + "operationId": "removeOrgUserForCurrentOrg", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateLibraryElementCommand" - } + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4791,40 +6438,47 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/library-elements/name/{library_element_name}": { - "get": { - "description": "Returns a library element with the given name.", + }, + "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": [ - "library_elements" + "org" ], - "summary": "Get library element by name.", - "operationId": "getLibraryElementByName", + "summary": "Updates the given user.", + "operationId": "updateOrgUserForCurrentOrg", "parameters": [ { - "type": "string", - "name": "library_element_name", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgUserCommand" + } + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4832,58 +6486,49 @@ } } }, - "/library-elements/{library_element_uid}": { + "/orgs": { "get": { - "description": "Returns a library element with the given UID.", - "tags": [ - "library_elements" - ], - "summary": "Get library element by UID.", - "operationId": "getLibraryElementByUID", - "parameters": [ + "security": [ { - "type": "string", - "name": "library_element_uid", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getLibraryElementResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "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.", + "basic": [] + } + ], "tags": [ - "library_elements" + "orgs" ], - "summary": "Delete library element.", - "operationId": "deleteLibraryElementByUID", + "summary": "Search all Organizations.", + "operationId": "searchOrgs", "parameters": [ + { + "type": "integer", + "format": "int64", + "default": 1, + "name": "page", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1000, + "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", - "name": "library_element_uid", - "in": "path", - "required": true + "name": "name", + "in": "query" + }, + { + "type": "string", + "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/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/searchOrgsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4891,43 +6536,34 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" } } }, - "patch": { - "description": "Updates an existing library element identified by uid.", + "post": { + "description": "Only works if [users.allow_org_create](https://grafana.com/docs/grafana/latest/administration/configuration/#allow_org_create) is set.", "tags": [ - "library_elements" + "orgs" ], - "summary": "Update library element.", - "operationId": "updateLibraryElement", + "summary": "Create Organization.", + "operationId": "createOrg", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PatchLibraryElementCommand" + "$ref": "#/definitions/CreateOrgCommand" } - }, - { - "type": "string", - "name": "library_element_uid", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/createOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4935,11 +6571,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "412": { - "$ref": "#/responses/preconditionFailedError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4947,31 +6580,35 @@ } } }, - "/library-elements/{library_element_uid}/connections/": { + "/orgs/name/{org_name}": { "get": { - "description": "Returns a list of connections for a library element based on the UID specified.", + "security": [ + { + "basic": [] + } + ], "tags": [ - "library_elements" + "orgs" ], - "summary": "Get library element connections.", - "operationId": "getLibraryElementConnections", + "summary": "Get Organization by ID.", + "operationId": "getOrgByName", "parameters": [ { "type": "string", - "name": "library_element_uid", + "name": "org_name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementConnectionsResponse" + "$ref": "#/responses/getOrgByNameResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4979,16 +6616,30 @@ } } }, - "/org": { + "/orgs/{org_id}": { "get": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "org" + "orgs" + ], + "summary": "Get Organization by ID.", + "operationId": "getOrgByID", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + } ], - "summary": "Get current Organization.", - "operationId": "getCurrentOrg", "responses": { "200": { - "$ref": "#/responses/getCurrentOrgResponse" + "$ref": "#/responses/getOrgByIDResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5002,11 +6653,16 @@ } }, "put": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "org" + "orgs" ], - "summary": "Update current Organization.", - "operationId": "updateCurrentOrg", + "summary": "Update Organization.", + "operationId": "updateOrg", "parameters": [ { "name": "body", @@ -5015,6 +6671,13 @@ "schema": { "$ref": "#/definitions/UpdateOrgForm" } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { @@ -5034,23 +6697,25 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/org/address": { - "put": { + }, + "delete": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "org" + "orgs" ], - "summary": "Update current Organization's address.", - "operationId": "updateCurrentOrgAddress", + "summary": "Delete Organization.", + "operationId": "deleteOrgByID", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgAddressForm" - } + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { @@ -5066,22 +6731,45 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/invites": { - "get": { + "/orgs/{org_id}/address": { + "put": { "tags": [ - "org_invites" + "orgs" + ], + "summary": "Update Organization's address.", + "operationId": "updateOrgAddress", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgAddressForm" + } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + } ], - "summary": "Get pending invites.", - "operationId": "getPendingOrgInvites", "responses": { "200": { - "$ref": "#/responses/getPendingOrgInvitesResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5093,29 +6781,28 @@ "$ref": "#/responses/internalServerError" } } - }, - "post": { + } + }, + "/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).", "tags": [ - "org_invites" + "orgs" ], - "summary": "Add invite.", - "operationId": "addOrgInvite", + "summary": "Fetch Organization quota.", + "operationId": "getOrgQuota", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AddInviteForm" - } + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getQuotaResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5123,8 +6810,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "412": { - "$ref": "#/responses/SMTPNotEnabledError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -5132,17 +6819,38 @@ } } }, - "/org/invites/{invitation_code}/revoke": { - "delete": { + "/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": [ - "org_invites" + "orgs" ], - "summary": "Revoke invite.", - "operationId": "revokeInvite", + "summary": "Update user quota.", + "operationId": "updateOrgQuota", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgQuotaCmd" + } + }, { "type": "string", - "name": "invitation_code", + "name": "quota_target", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", "in": "path", "required": true } @@ -5166,16 +6874,31 @@ } } }, - "/org/preferences": { + "/orgs/{org_id}/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": [ - "org_preferences" + "orgs" + ], + "summary": "Get Users in Organization.", + "operationId": "getOrgUsers", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + } ], - "summary": "Get Current Org Prefs.", - "operationId": "getOrgPreferences", "responses": { "200": { - "$ref": "#/responses/getPreferencesResponse" + "$ref": "#/responses/getOrgUsersResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5188,29 +6911,34 @@ } } }, - "put": { + "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": [ - "org_preferences" + "orgs" ], - "summary": "Update Current Org Prefs.", - "operationId": "updateOrgPreferences", + "summary": "Add a new user to the current organization.", + "operationId": "addOrgUser", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdatePrefsCmd" + "$ref": "#/definitions/AddOrgUserCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -5221,21 +6949,30 @@ "$ref": "#/responses/internalServerError" } } - }, - "patch": { + } + }, + "/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": [ - "org_preferences" + "orgs" ], - "summary": "Patch Current Org Prefs.", - "operationId": "patchOrgPreferences", + "summary": "Delete user in current organization.", + "operationId": "removeOrgUser", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PatchPrefsCmd" - } + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { @@ -5255,52 +6992,45 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/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": [ - "org" - ], - "summary": "Get all users within the current organization.", - "operationId": "getOrgUsersForCurrentOrg", - "responses": { - "200": { - "$ref": "#/responses/getOrgUsersForCurrentOrgResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "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:*`.", + "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": [ - "org" + "orgs" ], - "summary": "Add a new user to the current organization.", - "operationId": "addOrgUserToCurrentOrg", + "summary": "Update Users in Organization.", + "operationId": "updateOrgUser", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddOrgUserCommand" + "$ref": "#/definitions/UpdateOrgUserCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { "200": { "$ref": "#/responses/okResponse" }, + "400": { + "$ref": "#/responses/badRequestError" + }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -5313,14 +7043,13 @@ } } }, - "/org/users/lookup": { + "/playlists": { "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": [ - "org" + "playlists" ], - "summary": "Get all users within the current organization (lookup)", - "operationId": "getOrgUsersForCurrentOrgLookup", + "summary": "Get playlists.", + "operationId": "searchPlaylists", "parameters": [ { "type": "string", @@ -5330,49 +7059,39 @@ { "type": "integer", "format": "int64", + "description": "in:limit", "name": "limit", "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/getOrgUsersForCurrentOrgLookupResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "$ref": "#/responses/searchPlaylistsResponse" }, "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:*`.", + }, + "post": { "tags": [ - "org" + "playlists" ], - "summary": "Delete user in current organization.", - "operationId": "removeOrgUserForCurrentOrg", + "summary": "Create playlist.", + "operationId": "createPlaylist", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreatePlaylistCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/createPlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5380,41 +7099,33 @@ "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:*`.", + } + }, + "/playlists/{uid}": { + "get": { "tags": [ - "org" + "playlists" ], - "summary": "Updates the given user.", - "operationId": "updateOrgUserForCurrentOrg", + "summary": "Get playlist.", + "operationId": "getPlaylist", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgUserCommand" - } - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getPlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5422,55 +7133,39 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/orgs": { - "get": { - "security": [ - { - "basic": [] - } - ], + }, + "put": { "tags": [ - "orgs" + "playlists" ], - "summary": "Search all Organizations.", - "operationId": "searchOrgs", - "parameters": [ - { - "type": "integer", - "format": "int64", - "default": 1, - "name": "page", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 1000, - "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" - }, + "summary": "Update playlist.", + "operationId": "updatePlaylist", + "parameters": [ { - "type": "string", - "name": "name", - "in": "query" + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdatePlaylistCommand" + } }, { "type": "string", - "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" + "name": "uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/searchOrgsResponse" + "$ref": "#/responses/updatePlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5478,34 +7173,31 @@ "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.", + "delete": { "tags": [ - "orgs" + "playlists" ], - "summary": "Create Organization.", - "operationId": "createOrg", + "summary": "Delete playlist.", + "operationId": "deletePlaylist", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateOrgCommand" - } + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/createOrgResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5513,8 +7205,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -5522,29 +7214,24 @@ } } }, - "/orgs/name/{org_name}": { + "/playlists/{uid}/dashboards": { "get": { - "security": [ - { - "basic": [] - } - ], "tags": [ - "orgs" + "playlists" ], - "summary": "Get Organization by ID.", - "operationId": "getOrgByName", + "summary": "Get playlist dashboards.", + "operationId": "getPlaylistDashboards", "parameters": [ { "type": "string", - "name": "org_name", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getOrgByNameResponse" + "$ref": "#/responses/getPlaylistDashboardsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5552,36 +7239,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs/{org_id}": { + "/playlists/{uid}/items": { "get": { - "security": [ - { - "basic": [] - } - ], "tags": [ - "orgs" + "playlists" ], - "summary": "Get Organization by ID.", - "operationId": "getOrgByID", + "summary": "Get playlist items.", + "operationId": "getPlaylistItems", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "org_id", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getOrgByIDResponse" + "$ref": "#/responses/getPlaylistItemsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5589,80 +7273,118 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "put": { - "security": [ - { - "basic": [] - } - ], + } + }, + "/query-history": { + "get": { + "description": "Returns a list of queries in the query history that matches the search criteria.\nQuery history search supports pagination. Use the `limit` parameter to control the maximum number of queries returned; the default limit is 100.\nYou can also use the `page` query parameter to fetch queries from any page other than the first one.", "tags": [ - "orgs" + "query_history" ], - "summary": "Update Organization.", - "operationId": "updateOrg", + "summary": "Query history search.", + "operationId": "searchQueries", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgForm" - } + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "List of data source UIDs to search for", + "name": "datasourceUid", + "in": "query" + }, + { + "type": "string", + "description": "Text inside query or comments that is searched for", + "name": "searchString", + "in": "query" + }, + { + "type": "boolean", + "description": "Flag indicating if only starred queries should be returned", + "name": "onlyStarred", + "in": "query" + }, + { + "enum": [ + "time-desc", + "time-asc" + ], + "type": "string", + "default": "time-desc", + "description": "Sort method", + "name": "sort", + "in": "query" }, { "type": "integer", "format": "int64", - "name": "org_id", - "in": "path", - "required": true + "description": "Use this parameter to access hits beyond limit. Numbering starts at 1. limit param acts as page size.", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Limit the number of returned results", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "From range for the query history search", + "name": "from", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "To range for the query history search", + "name": "to", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getQueryHistorySearchResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, - "delete": { - "security": [ - { - "basic": [] - } - ], + "post": { + "description": "Adds new query to query history.", "tags": [ - "orgs" + "query_history" ], - "summary": "Delete Organization.", - "operationId": "deleteOrgByID", + "summary": "Add query to query history.", + "operationId": "createQuery", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateQueryInQueryHistoryCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQueryHistoryResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5670,45 +7392,33 @@ "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs/{org_id}/address": { - "put": { + "/query-history/migrate": { + "post": { + "description": "Adds multiple queries to query history.", "tags": [ - "orgs" + "query_history" ], - "summary": "Update Organization's address.", - "operationId": "updateOrgAddress", + "summary": "Migrate queries to query history.", + "operationId": "migrateQueries", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgAddressForm" + "$ref": "#/definitions/MigrateQueriesToQueryHistoryCommand" } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQueryHistoryMigrationResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5716,213 +7426,146 @@ "401": { "$ref": "#/responses/unauthorisedError" }, - "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).", + "/query-history/star/{query_history_uid}": { + "post": { + "description": "Adds star to query in query history as specified by the UID.", "tags": [ - "orgs" + "query_history" ], - "summary": "Fetch Organization quota.", - "operationId": "getOrgQuota", + "summary": "Add star to query in query history.", + "operationId": "starQuery", "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "org_id", + { + "type": "string", + "name": "query_history_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQuotaResponse" + "$ref": "#/responses/getQueryHistoryResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "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).", + }, + "delete": { + "description": "Removes star from query in query history as specified by the UID.", "tags": [ - "orgs" + "query_history" ], - "summary": "Update user quota.", - "operationId": "updateOrgQuota", + "summary": "Remove star to query in query history.", + "operationId": "unstarQuery", "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgQuotaCmd" - } - }, { "type": "string", - "name": "quota_target", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", + "name": "query_history_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQueryHistoryResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs/{org_id}/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:*`.", + "/query-history/{query_history_uid}": { + "delete": { + "description": "Deletes an existing query in query history as specified by the UID. This operation cannot be reverted.", "tags": [ - "orgs" + "query_history" ], - "summary": "Get Users in Organization.", - "operationId": "getOrgUsers", + "summary": "Delete query in query history.", + "operationId": "deleteQuery", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "org_id", + "type": "string", + "name": "query_history_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getOrgUsersResponse" + "$ref": "#/responses/getQueryHistoryDeleteQueryResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "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:*`.", + "patch": { + "description": "Updates comment for query in query history as specified by the UID.", "tags": [ - "orgs" + "query_history" ], - "summary": "Add a new user to the current organization.", - "operationId": "addOrgUser", + "summary": "Update comment for query in query history.", + "operationId": "patchQueryComment", "parameters": [ + { + "type": "string", + "name": "query_history_uid", + "in": "path", + "required": true + }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddOrgUserCommand" + "$ref": "#/definitions/PatchQueryCommentInQueryHistoryCommand" } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQueryHistoryResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/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:*`.", + "/recording-rules": { + "get": { "tags": [ - "orgs" - ], - "summary": "Delete user in current organization.", - "operationId": "removeOrgUser", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "recording_rules", + "enterprise" ], + "summary": "Lists all rules in the database: active or deleted.", + "operationId": "listRecordingRules", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/listRecordingRulesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5930,48 +7573,34 @@ "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:*`.", + "put": { "tags": [ - "orgs" + "recording_rules", + "enterprise" ], - "summary": "Update Users in Organization.", - "operationId": "updateOrgUser", + "summary": "Update the active status of a rule.", + "operationId": "updateRecordingRule", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgUserCommand" + "$ref": "#/definitions/RecordingRuleJSON" } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/recordingRuleResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5979,61 +7608,71 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/playlists": { - "get": { + }, + "post": { "tags": [ - "playlists" + "recording_rules", + "enterprise" ], - "summary": "Get playlists.", - "operationId": "searchPlaylists", + "summary": "Create a recording rule that is then registered and started.", + "operationId": "createRecordingRule", "parameters": [ { - "type": "string", - "name": "query", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "in:limit", - "name": "limit", - "in": "query" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RecordingRuleJSON" + } } ], "responses": { "200": { - "$ref": "#/responses/searchPlaylistsResponse" + "$ref": "#/responses/recordingRuleResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/recording-rules/test": { "post": { "tags": [ - "playlists" + "recording_rules", + "enterprise" ], - "summary": "Create playlist.", - "operationId": "createPlaylist", + "summary": "Test a recording rule.", + "operationId": "testCreateRecordingRule", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreatePlaylistCommand" + "$ref": "#/definitions/RecordingRuleJSON" } } ], "responses": { "200": { - "$ref": "#/responses/createPlaylistResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6044,30 +7683,26 @@ "404": { "$ref": "#/responses/notFoundError" }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/playlists/{uid}": { + "/recording-rules/writer": { "get": { "tags": [ - "playlists" - ], - "summary": "Get playlist.", - "operationId": "getPlaylist", - "parameters": [ - { - "type": "string", - "name": "uid", - "in": "path", - "required": true - } + "recording_rules", + "enterprise" ], + "summary": "Return the prometheus remote write target.", + "operationId": "getRecordingRuleWriteTarget", "responses": { "200": { - "$ref": "#/responses/getPlaylistResponse" + "$ref": "#/responses/recordingRuleWriteTargetResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6083,31 +7718,55 @@ } } }, - "put": { + "post": { + "description": "It returns a 422 if there is not an existing prometheus data source configured.", "tags": [ - "playlists" + "recording_rules", + "enterprise" ], - "summary": "Update playlist.", - "operationId": "updatePlaylist", + "summary": "Create a remote write target.", + "operationId": "createRecordingRuleWriteTarget", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdatePlaylistCommand" + "$ref": "#/definitions/PrometheusRemoteWriteTargetJSON" } + } + ], + "responses": { + "200": { + "$ref": "#/responses/recordingRuleWriteTargetResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "422": { + "$ref": "#/responses/unprocessableEntityError" }, - { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "500": { + "$ref": "#/responses/internalServerError" } + } + }, + "delete": { + "tags": [ + "recording_rules", + "enterprise" ], + "summary": "Delete the remote write target.", + "operationId": "deleteRecordingRuleWriteTarget", "responses": { "200": { - "$ref": "#/responses/updatePlaylistResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6122,17 +7781,21 @@ "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/recording-rules/{recordingRuleID}": { "delete": { "tags": [ - "playlists" + "recording_rules", + "enterprise" ], - "summary": "Delete playlist.", - "operationId": "deletePlaylist", + "summary": "Delete removes the rule from the registry and stops it.", + "operationId": "deleteRecordingRule", "parameters": [ { - "type": "string", - "name": "uid", + "type": "integer", + "format": "int64", + "name": "recordingRuleID", "in": "path", "required": true } @@ -6156,24 +7819,54 @@ } } }, - "/playlists/{uid}/dashboards": { + "/reports": { "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": [ - "playlists" + "reports", + "enterprise" ], - "summary": "Get playlist dashboards.", - "operationId": "getPlaylistDashboards", + "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", "parameters": [ { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateOrUpdateConfigCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/getPlaylistDashboardsResponse" + "$ref": "#/responses/createReportResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6190,24 +7883,31 @@ } } }, - "/playlists/{uid}/items": { - "get": { + "/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": [ - "playlists" + "reports", + "enterprise" ], - "summary": "Get playlist items.", - "operationId": "getPlaylistItems", + "summary": "Send a report.", + "operationId": "sendReport", "parameters": [ { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ReportEmailDTO" + } } ], "responses": { "200": { - "$ref": "#/responses/getPlaylistItemsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6224,109 +7924,249 @@ } } }, - "/query-history": { + "/reports/render/pdf/{dashboardID}": { "get": { - "description": "Returns a list of queries in the query history that matches the search criteria.\nQuery history search supports pagination. Use the `limit` parameter to control the maximum number of queries returned; the default limit is 100.\nYou can also use the `page` query parameter to fetch queries from any page other than the first one.", + "description": "Please refer to [reports enterprise](#/reports/renderReportPDFs) instead. This will be removed in Grafana 10.", + "produces": [ + "application/pdf" + ], "tags": [ - "query_history" + "reports", + "enterprise" ], - "summary": "Query history search.", - "operationId": "searchQueries", + "summary": "Render report for dashboard.", + "operationId": "renderReportPDF", + "deprecated": true, "parameters": [ { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "description": "List of data source UIDs to search for", - "name": "datasourceUid", + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "dashboardID", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "title", "in": "query" }, { "type": "string", - "description": "Text inside query or comments that is searched for", - "name": "searchString", + "name": "variables", "in": "query" }, { - "type": "boolean", - "description": "Flag indicating if only starred queries should be returned", - "name": "onlyStarred", + "type": "string", + "name": "from", "in": "query" }, { - "enum": [ - "time-desc", - "time-asc" - ], "type": "string", - "default": "time-desc", - "description": "Sort method", - "name": "sort", + "name": "to", "in": "query" }, { - "type": "integer", - "format": "int64", - "description": "Use this parameter to access hits beyond limit. Numbering starts at 1. limit param acts as page size.", - "name": "page", + "type": "string", + "name": "orientation", "in": "query" }, { - "type": "integer", - "format": "int64", - "description": "Limit the number of returned results", - "name": "limit", + "type": "string", + "name": "layout", "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/contentResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/reports/render/pdfs": { + "get": { + "description": "Available to all users and with a valid license.", + "produces": [ + "application/pdf" + ], + "tags": [ + "reports", + "enterprise" + ], + "summary": "Render report for multiple dashboards.", + "operationId": "renderReportPDFs", + "parameters": [ { - "type": "integer", - "format": "int64", - "description": "From range for the query history search", - "name": "from", + "type": "string", + "name": "dashboardID", "in": "query" }, { - "type": "integer", - "format": "int64", - "description": "To range for the query history search", - "name": "to", + "type": "string", + "name": "orientation", + "in": "query" + }, + { + "type": "string", + "name": "layout", "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistorySearchResponse" + "$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" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "post": { - "description": "Adds new query to query history.", + "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": [ - "query_history" + "reports", + "enterprise" ], - "summary": "Add query to query history.", - "operationId": "createQuery", + "summary": "Save settings.", + "operationId": "saveReportSettings", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateQueryInQueryHistoryCommand" + "$ref": "#/definitions/SettingsDTO" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "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", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateOrUpdateConfigCmd" } } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/reports/{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:id:\u003creport ID\u003e`.", + "tags": [ + "reports", + "enterprise" + ], + "summary": "Get a report.", + "operationId": "getReport", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getReportResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -6334,33 +8174,45 @@ "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/query-history/migrate": { - "post": { - "description": "Adds multiple queries to query history.", + }, + "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": [ - "query_history" + "reports", + "enterprise" ], - "summary": "Migrate queries to query history.", - "operationId": "migrateQueries", + "summary": "Update a report.", + "operationId": "updateReport", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/MigrateQueriesToQueryHistoryCommand" + "$ref": "#/definitions/CreateOrUpdateConfigCmd" } + }, + { + "type": "integer", + "format": "int64", + "name": "id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryMigrationResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -6368,61 +8220,77 @@ "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/query-history/star/{query_history_uid}": { - "post": { - "description": "Adds star to query in query history as specified by the UID.", + }, + "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": [ - "query_history" + "reports", + "enterprise" ], - "summary": "Add star to query in query history.", - "operationId": "starQuery", + "summary": "Delete a report.", + "operationId": "deleteReport", "parameters": [ { - "type": "string", - "name": "query_history_uid", + "type": "integer", + "format": "int64", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Removes star from query in query history as specified by the UID.", + } + }, + "/saml/acs": { + "post": { "tags": [ - "query_history" + "saml", + "enterprise" ], - "summary": "Remove star to query in query history.", - "operationId": "unstarQuery", + "summary": "It performs assertion Consumer Service (ACS).", + "operationId": "postACS", "parameters": [ { "type": "string", - "name": "query_history_uid", - "in": "path", - "required": true + "name": "RelayState", + "in": "query" } ], "responses": { - "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "302": { + "description": "(empty)" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -6430,66 +8298,77 @@ } } }, - "/query-history/{query_history_uid}": { - "delete": { - "description": "Deletes an existing query in query history as specified by the UID. This operation cannot be reverted.", + "/saml/metadata": { + "get": { + "produces": [ + "application/xml;application/samlmetadata+xml" + ], "tags": [ - "query_history" + "saml", + "enterprise" ], - "summary": "Delete query in query history.", - "operationId": "deleteQuery", - "parameters": [ - { - "type": "string", - "name": "query_history_uid", - "in": "path", - "required": true + "summary": "It exposes the SP (Grafana's) metadata for the IdP's consumption.", + "operationId": "getMetadata", + "responses": { + "200": { + "$ref": "#/responses/contentResponse" } + } + } + }, + "/saml/slo": { + "get": { + "description": "There might be two possible requests:\n1. Logout response (callback) when Grafana initiates single logout and IdP returns response to logout request.\n2. Logout request when another SP initiates single logout and IdP sends logout request to the Grafana,\nor in case of IdP-initiated logout.", + "tags": [ + "saml", + "enterprise" ], + "summary": "It performs Single Logout (SLO) callback.", + "operationId": "getSLO", "responses": { - "200": { - "$ref": "#/responses/getQueryHistoryDeleteQueryResponse" + "302": { + "description": "(empty)" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" } } }, - "patch": { - "description": "Updates comment for query in query history as specified by the UID.", + "post": { + "description": "There might be two possible requests:\n1. Logout response (callback) when Grafana initiates single logout and IdP returns response to logout request.\n2. Logout request when another SP initiates single logout and IdP sends logout request to the Grafana,\nor in case of IdP-initiated logout.", "tags": [ - "query_history" + "saml", + "enterprise" ], - "summary": "Update comment for query in query history.", - "operationId": "patchQueryComment", + "summary": "It performs Single Logout (SLO) callback.", + "operationId": "postSLO", "parameters": [ { "type": "string", - "name": "query_history_uid", - "in": "path", - "required": true + "name": "SAMLRequest", + "in": "query" }, { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PatchQueryCommentInQueryHistoryCommand" - } + "type": "string", + "name": "SAMLResponse", + "in": "query" } ], "responses": { - "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "302": { + "description": "(empty)" }, "400": { "$ref": "#/responses/badRequestError" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -7081,31 +8960,157 @@ "400": { "$ref": "#/responses/badRequestError" }, - "404": { - "$ref": "#/responses/notFoundError" + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "delete": { + "tags": [ + "snapshots" + ], + "summary": "Delete Snapshot by Key.", + "operationId": "deleteDashboardSnapshot", + "parameters": [ + { + "type": "string", + "name": "key", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/teams": { + "post": { + "tags": [ + "teams" + ], + "summary": "Add Team.", + "operationId": "createTeam", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateTeamCommand" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/createTeamResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "409": { + "$ref": "#/responses/conflictError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/teams/search": { + "get": { + "tags": [ + "teams" + ], + "summary": "Team Search With Paging.", + "operationId": "searchTeams", + "parameters": [ + { + "type": "integer", + "format": "int64", + "default": 1, + "name": "page", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1000, + "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", + "name": "name", + "in": "query" + }, + { + "type": "string", + "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/searchTeamsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { + } + }, + "/teams/{teamId}/groups": { + "get": { "tags": [ - "snapshots" + "sync_team_groups", + "enterprise" ], - "summary": "Delete Snapshot by Key.", - "operationId": "deleteDashboardSnapshot", + "summary": "Get External Groups.", + "operationId": "getTeamGroupsApi", "parameters": [ { - "type": "string", - "name": "key", + "type": "integer", + "format": "int64", + "name": "teamId", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getTeamGroupsApiResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -7117,28 +9122,37 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/teams": { + }, "post": { "tags": [ - "teams" + "sync_team_groups", + "enterprise" ], - "summary": "Add Team.", - "operationId": "createTeam", + "summary": "Add External Group.", + "operationId": "addTeamGroupApi", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateTeamCommand" + "$ref": "#/definitions/TeamGroupMapping" } + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/createTeamResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7146,8 +9160,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -7155,44 +9169,35 @@ } } }, - "/teams/search": { - "get": { + "/teams/{teamId}/groups/{groupId}": { + "delete": { "tags": [ - "teams" + "sync_team_groups", + "enterprise" ], - "summary": "Team Search With Paging.", - "operationId": "searchTeams", + "summary": "Remove External Group.", + "operationId": "removeTeamGroupApi", "parameters": [ { - "type": "integer", - "format": "int64", - "default": 1, - "name": "page", - "in": "query" + "type": "string", + "name": "groupId", + "in": "path", + "required": true }, { "type": "integer", "format": "int64", - "default": 1000, - "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", - "name": "name", - "in": "query" - }, - { - "type": "string", - "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" + "name": "teamId", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/searchTeamsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7200,6 +9205,9 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } @@ -8352,6 +10360,42 @@ "Ack": { "type": "object" }, + "ActiveSyncStatusDTO": { + "description": "ActiveSyncStatusDTO holds the information for LDAP background Sync", + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "nextSync": { + "type": "string", + "format": "date-time" + }, + "prevSync": { + "$ref": "#/definitions/SyncResult" + }, + "schedule": { + "type": "string" + } + } + }, + "ActiveUserStats": { + "type": "object", + "properties": { + "active_admins_and_editors": { + "type": "integer", + "format": "int64" + }, + "active_users": { + "type": "integer", + "format": "int64" + }, + "active_viewers": { + "type": "integer", + "format": "int64" + } + } + }, "AddCommand": { "type": "object", "properties": { @@ -8458,6 +10502,25 @@ } } }, + "AddPermissionDTO": { + "type": "object", + "properties": { + "builtinRole": { + "type": "string" + }, + "permission": { + "$ref": "#/definitions/DsPermissionType" + }, + "teamId": { + "type": "integer", + "format": "int64" + }, + "userId": { + "type": "integer", + "format": "int64" + } + } + }, "AddServiceAccountTokenCommand": { "type": "object", "properties": { @@ -8479,6 +10542,25 @@ } } }, + "AddTeamRoleCommand": { + "type": "object", + "properties": { + "roleUid": { + "type": "string" + } + } + }, + "AddUserRoleCommand": { + "type": "object", + "properties": { + "global": { + "type": "boolean" + }, + "roleUid": { + "type": "string" + } + } + }, "Address": { "type": "object", "properties": { @@ -9176,6 +11258,26 @@ } } }, + "BrandingOptionsDTO": { + "type": "object", + "properties": { + "emailFooterLink": { + "type": "string" + }, + "emailFooterMode": { + "type": "string" + }, + "emailFooterText": { + "type": "string" + }, + "emailLogoUrl": { + "type": "string" + }, + "reportLogoUrl": { + "type": "string" + } + } + }, "CalculateDiffTarget": { "type": "object", "properties": { @@ -9238,6 +11340,84 @@ } } }, + "ConfigDTO": { + "description": "ConfigDTO is model representation in transfer", + "type": "object", + "properties": { + "created": { + "type": "string", + "format": "date-time" + }, + "dashboardId": { + "type": "integer", + "format": "int64" + }, + "dashboardName": { + "type": "string" + }, + "dashboardUid": { + "type": "string" + }, + "dashboards": { + "type": "array", + "items": { + "$ref": "#/definitions/DashboardDTO" + } + }, + "enableCsv": { + "type": "boolean" + }, + "enableDashboardUrl": { + "type": "boolean" + }, + "formats": { + "type": "array", + "items": { + "$ref": "#/definitions/Type" + } + }, + "id": { + "type": "integer", + "format": "int64" + }, + "message": { + "type": "string" + }, + "name": { + "type": "string" + }, + "options": { + "$ref": "#/definitions/ReportOptionsDTO" + }, + "orgId": { + "type": "integer", + "format": "int64" + }, + "recipients": { + "type": "string" + }, + "replyTo": { + "type": "string" + }, + "schedule": { + "$ref": "#/definitions/ScheduleDTO" + }, + "state": { + "$ref": "#/definitions/State" + }, + "templateVars": { + "type": "object" + }, + "updated": { + "type": "string", + "format": "date-time" + }, + "userId": { + "type": "integer", + "format": "int64" + } + } + }, "ContactPoints": { "type": "array", "items": { @@ -9483,6 +11663,60 @@ } } }, + "CreateOrUpdateConfigCmd": { + "type": "object", + "properties": { + "dashboardId": { + "type": "integer", + "format": "int64" + }, + "dashboardUid": { + "type": "string" + }, + "dashboards": { + "type": "array", + "items": { + "$ref": "#/definitions/DashboardDTO" + } + }, + "enableCsv": { + "type": "boolean" + }, + "enableDashboardUrl": { + "type": "boolean" + }, + "formats": { + "type": "array", + "items": { + "$ref": "#/definitions/Type" + } + }, + "message": { + "type": "string" + }, + "name": { + "type": "string" + }, + "options": { + "$ref": "#/definitions/ReportOptionsDTO" + }, + "recipients": { + "type": "string" + }, + "replyTo": { + "type": "string" + }, + "schedule": { + "$ref": "#/definitions/ScheduleDTO" + }, + "state": { + "$ref": "#/definitions/State" + }, + "templateVars": { + "type": "object" + } + } + }, "CreateOrgCommand": { "type": "object", "properties": { @@ -9525,6 +11759,42 @@ } } }, + "CreateRoleForm": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "global": { + "type": "boolean" + }, + "group": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/definitions/Permission" + } + }, + "uid": { + "type": "string" + }, + "version": { + "type": "integer", + "format": "int64" + } + } + }, "CreateServiceAccountForm": { "type": "object", "properties": { @@ -9558,6 +11828,53 @@ } } }, + "CustomPermissionsRecordDTO": { + "type": "object", + "properties": { + "customPermissions": { + "type": "string" + }, + "granteeName": { + "type": "string" + }, + "granteeType": { + "type": "string" + }, + "granteeUrl": { + "type": "string" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "isFolder": { + "type": "boolean" + }, + "orgId": { + "type": "integer", + "format": "int64" + }, + "orgRole": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "title": { + "type": "string" + }, + "uid": { + "type": "string" + }, + "url": { + "type": "string" + }, + "usersCount": { + "type": "integer", + "format": "int64" + } + } + }, "DashboardACLInfoDTO": { "type": "object", "properties": { @@ -9661,6 +11978,20 @@ } } }, + "DashboardDTO": { + "type": "object", + "properties": { + "dashboard": { + "$ref": "#/definitions/DashboardReportDTO" + }, + "reportVariables": { + "type": "object" + }, + "timeRange": { + "$ref": "#/definitions/TimeRangeDTO" + } + } + }, "DashboardFullWithMeta": { "type": "object", "properties": { @@ -9774,6 +12105,21 @@ } } }, + "DashboardReportDTO": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, "DashboardSnapshot": { "description": "DashboardSnapshot model", "type": "object", @@ -10122,6 +12468,83 @@ } } }, + "DataSourcePermissionRuleDTO": { + "type": "object", + "properties": { + "builtInRole": { + "type": "string" + }, + "created": { + "type": "string", + "format": "date-time" + }, + "datasourceId": { + "type": "integer", + "format": "int64" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "isManaged": { + "type": "boolean" + }, + "permission": { + "$ref": "#/definitions/DsPermissionType" + }, + "permissionName": { + "type": "string" + }, + "team": { + "type": "string" + }, + "teamAvatarUrl": { + "type": "string" + }, + "teamEmail": { + "type": "string" + }, + "teamId": { + "type": "integer", + "format": "int64" + }, + "updated": { + "type": "string", + "format": "date-time" + }, + "userAvatarUrl": { + "type": "string" + }, + "userEmail": { + "type": "string" + }, + "userId": { + "type": "integer", + "format": "int64" + }, + "userLogin": { + "type": "string" + } + } + }, + "DataSourcePermissionsDTO": { + "type": "object", + "properties": { + "datasourceId": { + "type": "integer", + "format": "int64" + }, + "enabled": { + "type": "boolean" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/definitions/DataSourcePermissionRuleDTO" + } + } + } + }, "DataTopic": { "type": "string", "title": "DataTopic is used to identify which topic the frame should be assigned to." @@ -10135,6 +12558,14 @@ } } }, + "DeleteTokenCommand": { + "type": "object", + "properties": { + "instance": { + "type": "string" + } + } + }, "DiscoveryBase": { "type": "object", "required": [ @@ -10380,6 +12811,18 @@ } } }, + "FailedUser": { + "description": "FailedUser holds the information of an user that failed", + "type": "object", + "properties": { + "Error": { + "type": "string" + }, + "Login": { + "type": "string" + } + } + }, "Failure": { "$ref": "#/definitions/ResponseDetails" }, @@ -12473,6 +14916,26 @@ } } }, + "Permission": { + "type": "object", + "title": "Permission is the model for access control permissions.", + "properties": { + "action": { + "type": "string" + }, + "created": { + "type": "string", + "format": "date-time" + }, + "scope": { + "type": "string" + }, + "updated": { + "type": "string", + "format": "date-time" + } + } + }, "PermissionDenied": { "type": "object" }, @@ -12924,6 +15387,20 @@ } } }, + "PrometheusRemoteWriteTargetJSON": { + "type": "object", + "properties": { + "data_source_uid": { + "type": "string" + }, + "id": { + "type": "string" + }, + "remote_write_path": { + "type": "string" + } + } + }, "Provenance": { "type": "string" }, @@ -13369,35 +15846,80 @@ "$ref": "#/definitions/SlackConfig" } }, - "sns_configs": { - "type": "array", - "items": { - "$ref": "#/definitions/SNSConfig" - } + "sns_configs": { + "type": "array", + "items": { + "$ref": "#/definitions/SNSConfig" + } + }, + "telegram_configs": { + "type": "array", + "items": { + "$ref": "#/definitions/TelegramConfig" + } + }, + "victorops_configs": { + "type": "array", + "items": { + "$ref": "#/definitions/VictorOpsConfig" + } + }, + "webhook_configs": { + "type": "array", + "items": { + "$ref": "#/definitions/WebhookConfig" + } + }, + "wechat_configs": { + "type": "array", + "items": { + "$ref": "#/definitions/WechatConfig" + } + } + } + }, + "RecordingRuleJSON": { + "description": "RecordingRuleJSON is the external representation of a recording rule", + "type": "object", + "properties": { + "active": { + "type": "boolean" + }, + "count": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "dest_data_source_uid": { + "type": "string" + }, + "id": { + "type": "string" + }, + "interval": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" }, - "telegram_configs": { - "type": "array", - "items": { - "$ref": "#/definitions/TelegramConfig" - } + "prom_name": { + "type": "string" }, - "victorops_configs": { + "queries": { "type": "array", "items": { - "$ref": "#/definitions/VictorOpsConfig" + "type": "object", + "additionalProperties": false } }, - "webhook_configs": { - "type": "array", - "items": { - "$ref": "#/definitions/WebhookConfig" - } + "range": { + "type": "integer", + "format": "int64" }, - "wechat_configs": { - "type": "array", - "items": { - "$ref": "#/definitions/WechatConfig" - } + "target_ref_id": { + "type": "string" } } }, @@ -13418,6 +15940,41 @@ } } }, + "ReportEmailDTO": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "emails": { + "description": "Comma-separated list of emails to which to send the report to.", + "type": "string" + }, + "id": { + "description": "Send the report to the emails specified in the report. Required if emails is not present.", + "type": "string", + "format": "int64" + }, + "useEmailsFromReport": { + "description": "Send the report to the emails specified in the report. Required if emails is not present.", + "type": "boolean" + } + } + }, + "ReportOptionsDTO": { + "type": "object", + "properties": { + "layout": { + "type": "string" + }, + "orientation": { + "type": "string" + }, + "timeRange": { + "$ref": "#/definitions/TimeRangeDTO" + } + } + }, "ResponseDetails": { "type": "object", "properties": { @@ -13452,6 +16009,79 @@ } } }, + "RoleAssignmentsDTO": { + "type": "object", + "properties": { + "role_uid": { + "type": "string" + }, + "service_accounts": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "teams": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "users": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + } + } + }, + "RoleDTO": { + "type": "object", + "properties": { + "created": { + "type": "string", + "format": "date-time" + }, + "delegatable": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "group": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/definitions/Permission" + } + }, + "uid": { + "type": "string" + }, + "updated": { + "type": "string", + "format": "date-time" + }, + "version": { + "type": "integer", + "format": "int64" + } + } + }, "Route": { "description": "A Route is a node that contains definitions of how to handle alerts. This is modified\nfrom the upstream alertmanager in that it adds the ObjectMatchers property.", "type": "object", @@ -13732,6 +16362,49 @@ } } }, + "ScheduleDTO": { + "type": "object", + "properties": { + "day": { + "type": "string" + }, + "dayOfMonth": { + "type": "string" + }, + "endDate": { + "type": "string", + "format": "date-time" + }, + "frequency": { + "type": "string" + }, + "hour": { + "type": "integer", + "format": "int64" + }, + "intervalAmount": { + "type": "integer", + "format": "int64" + }, + "intervalFrequency": { + "type": "string" + }, + "minute": { + "type": "integer", + "format": "int64" + }, + "startDate": { + "type": "string", + "format": "date-time" + }, + "timeZone": { + "type": "string" + }, + "workdaysOnly": { + "type": "boolean" + } + } + }, "SearchServiceAccountsResult": { "description": "swagger: model", "type": "object", @@ -13924,6 +16597,49 @@ } } }, + "SetRoleAssignmentsCommand": { + "type": "object", + "properties": { + "service_accounts": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "teams": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "users": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + } + } + }, + "SetUserRolesCommand": { + "type": "object", + "properties": { + "global": { + "type": "boolean" + }, + "includeHidden": { + "type": "boolean" + }, + "roleUids": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "SettingsBag": { "type": "object", "additionalProperties": { @@ -13933,6 +16649,26 @@ } } }, + "SettingsDTO": { + "type": "object", + "properties": { + "branding": { + "$ref": "#/definitions/BrandingOptionsDTO" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "orgId": { + "type": "integer", + "format": "int64" + }, + "userId": { + "type": "integer", + "format": "int64" + } + } + }, "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", @@ -14104,6 +16840,17 @@ "SmtpNotEnabled": { "$ref": "#/definitions/ResponseDetails" }, + "State": { + "type": "string" + }, + "Status": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + } + } + }, "Success": { "$ref": "#/definitions/ResponseDetails" }, @@ -14115,6 +16862,39 @@ } } }, + "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" + } + } + } + }, "TLSConfig": { "type": "object", "title": "TLSConfig configures the options for TLS connections.", @@ -14196,6 +16976,30 @@ } } }, + "TeamGroupDTO": { + "type": "object", + "properties": { + "groupId": { + "type": "string" + }, + "orgId": { + "type": "integer", + "format": "int64" + }, + "teamId": { + "type": "integer", + "format": "int64" + } + } + }, + "TeamGroupMapping": { + "type": "object", + "properties": { + "groupId": { + "type": "string" + } + } + }, "TeamMemberDTO": { "type": "object", "properties": { @@ -14510,6 +17314,104 @@ } } }, + "TimeRangeDTO": { + "type": "object", + "properties": { + "from": { + "type": "string" + }, + "to": { + "type": "string" + } + } + }, + "Token": { + "type": "object", + "properties": { + "account": { + "type": "string" + }, + "company": { + "type": "string" + }, + "details_url": { + "type": "string" + }, + "exp": { + "type": "integer", + "format": "int64" + }, + "iat": { + "type": "integer", + "format": "int64" + }, + "included_users": { + "type": "integer", + "format": "int64" + }, + "iss": { + "type": "string" + }, + "jti": { + "type": "string" + }, + "lexp": { + "type": "integer", + "format": "int64" + }, + "lic_exp_warn_days": { + "type": "integer", + "format": "int64" + }, + "lid": { + "type": "string" + }, + "limit_by": { + "type": "string" + }, + "max_concurrent_user_sessions": { + "type": "integer", + "format": "int64" + }, + "nbf": { + "type": "integer", + "format": "int64" + }, + "prod": { + "type": "array", + "items": { + "type": "string" + } + }, + "slug": { + "type": "string" + }, + "status": { + "$ref": "#/definitions/TokenStatus" + }, + "sub": { + "type": "string" + }, + "tok_exp_warn_days": { + "type": "integer", + "format": "int64" + }, + "trial": { + "type": "boolean" + }, + "trial_exp": { + "type": "integer", + "format": "int64" + }, + "update_days": { + "type": "integer", + "format": "int64" + }, + "usage_billing": { + "type": "boolean" + } + } + }, "TokenDTO": { "type": "object", "properties": { @@ -14552,6 +17454,10 @@ } } }, + "TokenStatus": { + "type": "integer", + "format": "int64" + }, "TrimDashboardCommand": { "type": "object", "properties": { @@ -14574,6 +17480,9 @@ } } }, + "Type": { + "type": "string" + }, "URL": { "type": "object", "title": "URL is a custom URL type that allows validation at configuration load time.", @@ -14941,6 +17850,39 @@ } } }, + "UpdateRoleCommand": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "global": { + "type": "boolean" + }, + "group": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/definitions/Permission" + } + }, + "version": { + "type": "integer", + "format": "int64" + } + } + }, "UpdateServiceAccountForm": { "type": "object", "properties": { @@ -15924,6 +18866,21 @@ "$ref": "#/definitions/ErrorResponseBody" } }, + "addPermissionResponse": { + "description": "(empty)", + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "permissionId": { + "type": "integer", + "format": "int64" + } + } + } + }, "adminCreateUserResponse": { "description": "(empty)", "schema": { @@ -15973,6 +18930,16 @@ "$ref": "#/definitions/ErrorResponseBody" } }, + "contentResponse": { + "description": "(empty)", + "schema": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8" + } + } + }, "createCorrelationResponse": { "description": "(empty)", "schema": { @@ -16068,6 +19035,27 @@ "$ref": "#/definitions/Playlist" } }, + "createReportResponse": { + "description": "(empty)", + "schema": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "message": { + "type": "string" + } + } + } + }, + "createRoleResponse": { + "description": "(empty)", + "schema": { + "$ref": "#/definitions/RoleDTO" + } + }, "createServiceAccountResponse": { "description": "(empty)", "schema": { @@ -16252,6 +19240,12 @@ } } }, + "getAccessControlStatusResponse": { + "description": "(empty)", + "schema": { + "$ref": "#/definitions/Status" + } + }, "getAlertNotificationChannelResponse": { "description": "(empty)", "schema": { @@ -16291,6 +19285,21 @@ } } }, + "getAllPermissionseResponse": { + "description": "(empty)", + "schema": { + "$ref": "#/definitions/DataSourcePermissionsDTO" + } + }, + "getAllRolesResponse": { + "description": "(empty)", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/RoleDTO" + } + } + }, "getAnnotationByIDResponse": { "description": "(empty)", "schema": { @@ -16342,6 +19351,15 @@ "$ref": "#/definitions/OrgDetailsDTO" } }, + "getCustomPermissionsReportResponse": { + "description": "(empty)", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/CustomPermissionsRecordDTO" + } + } + }, "getDashboardPermissionsListResponse": { "description": "(empty)", "schema": { @@ -16443,6 +19461,12 @@ "$ref": "#/definitions/LibraryElementSearchResponse" } }, + "getLicenseTokenResponse": { + "description": "(empty)", + "schema": { + "$ref": "#/definitions/Token" + } + }, "getOrgByIDResponse": { "description": "(empty)", "schema": { @@ -16551,6 +19575,39 @@ } } }, + "getReportResponse": { + "description": "(empty)", + "schema": { + "$ref": "#/definitions/ConfigDTO" + } + }, + "getReportSettingsResponse": { + "description": "(empty)", + "schema": { + "$ref": "#/definitions/SettingsDTO" + } + }, + "getReportsResponse": { + "description": "(empty)", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/ConfigDTO" + } + } + }, + "getRoleAssignmentsResponse": { + "description": "(empty)", + "schema": { + "$ref": "#/definitions/RoleAssignmentsDTO" + } + }, + "getRoleResponse": { + "description": "(empty)", + "schema": { + "$ref": "#/definitions/RoleDTO" + } + }, "getSharingOptionsResponse": { "description": "(empty)", "schema": { @@ -16586,12 +19643,30 @@ } } }, + "getStatusResponse": { + "description": "(empty)" + }, + "getSyncStatusResponse": { + "description": "(empty)", + "schema": { + "$ref": "#/definitions/ActiveSyncStatusDTO" + } + }, "getTeamByIDResponse": { "description": "(empty)", "schema": { "$ref": "#/definitions/TeamDTO" } }, + "getTeamGroupsApiResponse": { + "description": "(empty)", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/TeamGroupDTO" + } + } + }, "getTeamMembersResponse": { "description": "(empty)", "schema": { @@ -16655,6 +19730,36 @@ "$ref": "#/definitions/ErrorResponseBody" } }, + "listBuiltinRolesResponse": { + "description": "(empty)", + "schema": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "$ref": "#/definitions/RoleDTO" + } + } + } + }, + "listRecordingRulesResponse": { + "description": "(empty)", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/RecordingRuleJSON" + } + } + }, + "listRolesResponse": { + "description": "(empty)", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/RoleDTO" + } + } + }, "listSortOptionsResponse": { "description": "(empty)", "schema": { @@ -16815,6 +19920,9 @@ } } }, + "postRenewLicenseTokenResponse": { + "description": "(empty)" + }, "preconditionFailedError": { "description": "PreconditionFailedError", "schema": { @@ -16827,6 +19935,24 @@ "$ref": "#/definitions/QueryDataResponse" } }, + "recordingRuleResponse": { + "description": "(empty)", + "schema": { + "$ref": "#/definitions/RecordingRuleJSON" + } + }, + "recordingRuleWriteTargetResponse": { + "description": "(empty)", + "schema": { + "$ref": "#/definitions/PrometheusRemoteWriteTargetJSON" + } + }, + "refreshLicenseStatsResponse": { + "description": "(empty)", + "schema": { + "$ref": "#/definitions/ActiveUserStats" + } + }, "retrieveServiceAccountResponse": { "description": "(empty)", "schema": { @@ -16881,6 +20007,12 @@ "$ref": "#/definitions/SearchUserQueryResult" } }, + "setRoleAssignmentsResponse": { + "description": "(empty)", + "schema": { + "$ref": "#/definitions/RoleAssignmentsDTO" + } + }, "testAlertResponse": { "description": "(empty)", "schema": { diff --git a/public/api-spec.json b/public/api-spec.json index 57aeea67c527..dc1d00da78fa 100644 --- a/public/api-spec.json +++ b/public/api-spec.json @@ -22,25 +22,25 @@ }, "basePath": "/api", "paths": { - "/admin/ldap/reload": { - "post": { - "security": [ + "/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:read` and scope `roles:*`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Get all roles.", + "operationId": "listRoles", + "parameters": [ { - "basic": [] + "type": "boolean", + "name": "delegatable", + "in": "query" } ], - "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": "reloadLDAPCfg", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "$ref": "#/responses/listRolesResponse" }, "403": { "$ref": "#/responses/forbiddenError" @@ -49,27 +49,31 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/ldap/status": { - "get": { - "security": [ + }, + "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:type:delegate`. `permissions:type: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": "createRole", + "parameters": [ { - "basic": [] + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateRoleForm" + } } ], - "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" + "201": { + "$ref": "#/responses/createRoleResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -80,61 +84,99 @@ } } }, - "/admin/ldap/sync/{user_id}": { - "post": { - "security": [ + "/access-control/roles/{roleUID}": { + "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", + "parameters": [ { - "basic": [] + "type": "string", + "name": "roleUID", + "in": "path", + "required": true } ], - "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`.", + "responses": { + "200": { + "$ref": "#/responses/getRoleResponse" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "put": { + "description": "You need to have a permission with action `roles:write` and scope `permissions:type:delegate`. `permissions:type:delegate` scope ensures that users can only create custom roles with the same, or a subset of permissions which the user has.", "tags": [ - "admin_ldap" + "access_control", + "enterprise" ], - "summary": "Enables a single Grafana user to be synchronized against LDAP.", - "operationId": "postSyncUserWithLDAP", + "summary": "Update a custom role.", + "operationId": "updateRole", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "user_id", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateRoleCommand" + } + }, + { + "type": "string", + "name": "roleUID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getRoleResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/ldap/{user_name}": { - "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 `ldap.user:read`.", + }, + "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:type:delegate`. `permissions:type: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": [ - "admin_ldap" + "access_control", + "enterprise" ], - "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": "getUserFromLDAP", + "summary": "Delete a custom role.", + "operationId": "deleteRole", "parameters": [ + { + "type": "boolean", + "name": "force", + "in": "query" + }, + { + "type": "boolean", + "name": "global", + "in": "query" + }, { "type": "string", - "name": "user_name", + "name": "roleUID", "in": "path", "required": true } @@ -143,8 +185,8 @@ "200": { "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -155,121 +197,127 @@ } } }, - "/admin/pause-all-alerts": { - "post": { - "security": [ - { - "basic": [] - } - ], + "/access-control/roles/{roleUID}/assignments": { + "get": { + "description": "Get role assignments for the role with the given UID.\n\nYou need to have a permission with action `teams.roles:list` and scope `teams:id:*` and `users.roles:list` and scope `users:id:*`.", "tags": [ - "admin" + "access_control", + "enterprise" ], - "summary": "Pause/unpause all (legacy) alerts.", - "operationId": "pauseAllAlerts", + "summary": "Get role assignments.", + "operationId": "getRoleAssignments", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PauseAllAlertsCommand" - } + "type": "string", + "name": "roleUID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/pauseAlertsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "$ref": "#/responses/getRoleAssignmentsResponse" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/provisioning/dashboards/reload": { - "post": { - "security": [ + }, + "put": { + "description": "Set role assignments for the role with the given UID.\n\nYou need to have a permission with action `teams.roles:add` and `teams.roles:remove` and scope `permissions:type:delegate`, and `users.roles:add` and `users.roles:remove` and scope `permissions:type:delegate`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Set role assignments.", + "operationId": "setRoleAssignments", + "parameters": [ { - "basic": [] + "type": "string", + "name": "roleUID", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/SetRoleAssignmentsCommand" + } } ], - "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": "adminProvisioningReloadDashboards", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "$ref": "#/responses/setRoleAssignmentsResponse" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/provisioning/datasources/reload": { - "post": { - "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`.", + "/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": [ - "admin_provisioning" + "access_control", + "enterprise" ], - "summary": "Reload datasource provisioning configurations.", - "operationId": "adminProvisioningReloadDatasources", + "summary": "Get status.", + "operationId": "getAccessControlStatus", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "$ref": "#/responses/getAccessControlStatusResponse" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/provisioning/notifications/reload": { - "post": { - "security": [ + "/access-control/teams/{teamId}/roles": { + "get": { + "description": "You need to have a permission with action `teams.roles:read` and scope `teams:id:\u003cteam ID\u003e`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Get team roles.", + "operationId": "listTeamRoles", + "parameters": [ { - "basic": [] + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true } ], - "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": "adminProvisioningReloadNotifications", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" @@ -278,150 +326,226 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/provisioning/plugins/reload": { - "post": { - "security": [ + }, + "put": { + "description": "You need to have a permission with action `teams.roles:add` and `teams.roles:remove` and scope `permissions:type:delegate` for each.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Update team role.", + "operationId": "setTeamRoles", + "parameters": [ { - "basic": [] + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true } ], - "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": "adminProvisioningReloadPlugins", "responses": { "200": { "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/settings": { - "get": { - "security": [ + }, + "post": { + "description": "You need to have a permission with action `teams.roles:add` and scope `permissions:type:delegate`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "Add team role.", + "operationId": "addTeamRole", + "parameters": [ { - "basic": [] + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddTeamRoleCommand" + } + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true } ], - "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": "adminGetSettings", "responses": { "200": { - "$ref": "#/responses/adminGetSettingsResponse" + "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/admin/stats": { - "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`.", + "/access-control/teams/{teamId}/roles/{roleUID}": { + "delete": { + "description": "You need to have a permission with action `teams.roles:remove` and scope `permissions:type:delegate`.", "tags": [ - "admin" + "access_control", + "enterprise" + ], + "summary": "Remove team role.", + "operationId": "removeTeamRole", + "parameters": [ + { + "type": "string", + "name": "roleUID", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true + } ], - "summary": "Fetch Grafana Stats.", - "operationId": "adminGetStats", "responses": { "200": { - "$ref": "#/responses/adminGetStatsResponse" + "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users": { - "post": { - "security": [ + "/access-control/users/{userId}/roles": { + "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:read` and scope `users:id:\u003cuser ID\u003e`.", + "tags": [ + "access_control", + "enterprise" + ], + "summary": "List roles assigned to a user.", + "operationId": "listUserRoles", + "parameters": [ { - "basic": [] + "type": "integer", + "format": "int64", + "name": "userId", + "in": "path", + "required": true } ], - "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`.", + "responses": { + "200": { + "$ref": "#/responses/getAllRolesResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$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:type:delegate` for each. `permissions:type: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": [ - "admin_users" + "access_control", + "enterprise" ], - "summary": "Create new user.", - "operationId": "adminCreateUser", + "summary": "Set user role assignments.", + "operationId": "setUserRoles", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AdminCreateUserForm" + "$ref": "#/definitions/SetUserRolesCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "userId", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/adminCreateUserResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, "403": { "$ref": "#/responses/forbiddenError" }, - "412": { - "$ref": "#/responses/preconditionFailedError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/admin/users/{user_id}": { - "delete": { - "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:delete` and scope `global.users:*`.", + }, + "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:type:delegate`. `permissions:type: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": [ - "admin_users" + "access_control", + "enterprise" ], - "summary": "Delete global User.", - "operationId": "adminDeleteUser", + "summary": "Add a user role assignment.", + "operationId": "addUserRole", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddUserRoleCommand" + } + }, { "type": "integer", "format": "int64", - "name": "user_id", + "name": "userId", "in": "path", "required": true } @@ -430,9 +554,6 @@ "200": { "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, "403": { "$ref": "#/responses/forbiddenError" }, @@ -445,31 +566,66 @@ } } }, - "/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:*`.", + "/access-control/users/{userId}/roles/{roleUID}": { + "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:type:delegate`. `permissions:type: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": [ - "admin_users" + "access_control", + "enterprise" ], - "summary": "Return a list of all auth tokens (devices) that the user currently have logged in from.", - "operationId": "adminGetUserAuthTokens", + "summary": "Remove a user role assignment.", + "operationId": "removeUserRole", "parameters": [ + { + "type": "boolean", + "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" + }, + { + "type": "string", + "name": "roleUID", + "in": "path", + "required": true + }, { "type": "integer", "format": "int64", - "name": "user_id", + "name": "userId", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/adminGetUserAuthTokensResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/admin/ldap-sync-status": { + "get": { + "description": "You need to have a permission with action `ldap.status:read`.", + "tags": [ + "ldap_debug" + ], + "summary": "Returns the current state of the LDAP background sync integration.", + "operationId": "getSyncStatus", + "responses": { + "200": { + "$ref": "#/responses/getSyncStatusResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -483,28 +639,19 @@ } } }, - "/admin/users/{user_id}/disable": { + "/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 `users:disable` and scope `global.users:1` (userIDScope).", + "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_users" - ], - "summary": "Disable user.", - "operationId": "adminDisableUser", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "admin_ldap" ], + "summary": "Reloads the LDAP configuration.", + "operationId": "reloadLDAPCfg", "responses": { "200": { "$ref": "#/responses/okResponse" @@ -515,37 +662,25 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users/{user_id}/enable": { - "post": { + "/admin/ldap/status": { + "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:enable` and scope `global.users:1` (userIDScope).", + "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_users" - ], - "summary": "Enable user.", - "operationId": "adminEnableUser", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "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" @@ -556,28 +691,25 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users/{user_id}/logout": { + "/admin/ldap/sync/{user_id}": { "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:*`.", + "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_users" + "admin_ldap" ], - "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": "adminLogoutUser", + "summary": "Enables a single Grafana user to be synchronized against LDAP.", + "operationId": "postSyncUserWithLDAP", "parameters": [ { "type": "integer", @@ -591,50 +723,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/users/{user_id}/password": { - "put": { + "/admin/ldap/{user_name}": { + "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.password:update` and scope `global.users:*`.", + "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_users" + "admin_ldap" ], - "summary": "Set password for user.", - "operationId": "adminUpdateUserPassword", + "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": "getUserFromLDAP", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AdminUpdateUserPasswordForm" - } - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "name": "user_name", "in": "path", "required": true } @@ -643,9 +760,6 @@ "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -658,37 +772,31 @@ } } }, - "/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:*`.", + "/admin/pause-all-alerts": { + "post": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "admin_users" + "admin" ], - "summary": "Set permissions for user.", - "operationId": "adminUpdateUserPermissions", + "summary": "Pause/unpause all (legacy) alerts.", + "operationId": "pauseAllAlerts", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AdminUpdateUserPermissionsForm" + "$ref": "#/definitions/PauseAllAlertsCommand" } - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/pauseAlertsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -702,31 +810,43 @@ } } }, - "/admin/users/{user_id}/quotas": { - "get": { + "/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" + }, + "403": { + "$ref": "#/responses/forbiddenError" + } + } + } + }, + "/admin/provisioning/dashboards/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 `users.quotas:list` and scope `global.users:1` (userIDScope).", + "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_users" - ], - "summary": "Fetch user quota.", - "operationId": "getUserQuota", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "admin_provisioning" ], + "summary": "Reload dashboard provisioning configurations.", + "operationId": "adminProvisioningReloadDashboards", "responses": { "200": { - "$ref": "#/responses/getQuotaResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -734,51 +854,25 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users/{user_id}/quotas/{quota_target}": { - "put": { + "/admin/provisioning/datasources/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 `users.quotas:update` and scope `global.users:1` (userIDScope).", + "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_users" - ], - "summary": "Update user quota.", - "operationId": "updateUserQuota", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateUserQuotaCmd" - } - }, - { - "type": "string", - "name": "quota_target", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "admin_provisioning" ], + "summary": "Reload datasource provisioning configurations.", + "operationId": "adminProvisioningReloadDatasources", "responses": { "200": { "$ref": "#/responses/okResponse" @@ -789,78 +883,57 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/admin/users/{user_id}/revoke-auth-token": { + "/admin/provisioning/notifications/reload": { "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:*`.", + "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_users" - ], - "summary": "Revoke auth token for user.", - "operationId": "adminRevokeUserAuthToken", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RevokeAuthTokenCmd" - } - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "admin_provisioning" ], + "summary": "Reload legacy alert notifier provisioning configurations.", + "operationId": "adminProvisioningReloadNotifications", "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.", + "/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": [ - "legacy_alerts_notification_channels" + "admin_provisioning" ], - "summary": "Get all notification channels.", - "operationId": "getAlertNotificationChannels", + "summary": "Reload plugin provisioning configurations.", + "operationId": "adminProvisioningReloadPlugins", "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelsResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -872,54 +945,45 @@ "$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": [ + } + }, + "/admin/settings": { + "get": { + "security": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateAlertNotificationCommand" - } + "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": "adminGetSettings", "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/adminGetSettingsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" - }, - "409": { - "$ref": "#/responses/conflictError" - }, - "500": { - "$ref": "#/responses/internalServerError" } } } }, - "/alert-notifications/lookup": { + "/admin/stats": { "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.", + "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": [ - "legacy_alerts_notification_channels" + "admin" ], - "summary": "Get all notification channels (lookup).", - "operationId": "getAlertNotificationLookup", + "summary": "Fetch Grafana Stats.", + "operationId": "adminGetStats", "responses": { "200": { - "$ref": "#/responses/getAlertNotificationLookupResponse" + "$ref": "#/responses/adminGetStatsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -933,27 +997,32 @@ } } }, - "/alert-notifications/test": { + "/admin/users": { "post": { - "description": "Sends a test notification to the channel.", + "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": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Test notification channel.", - "operationId": "notificationChannelTest", + "summary": "Create new user.", + "operationId": "adminCreateUser", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/NotificationTestCommand" + "$ref": "#/definitions/AdminCreateUserForm" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/adminCreateUserResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -965,7 +1034,7 @@ "$ref": "#/responses/forbiddenError" }, "412": { - "$ref": "#/responses/SMTPNotEnabledError" + "$ref": "#/responses/preconditionFailedError" }, "500": { "$ref": "#/responses/internalServerError" @@ -973,25 +1042,31 @@ } } }, - "/alert-notifications/uid/{notification_channel_uid}": { - "get": { - "description": "Returns the notification channel given the notification channel UID.", - "tags": [ - "legacy_alerts_notification_channels" + "/admin/users/{user_id}": { + "delete": { + "security": [ + { + "basic": [] + } ], - "summary": "Get notification channel by UID.", - "operationId": "getAlertNotificationChannelByUID", + "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": "adminDeleteUser", "parameters": [ { - "type": "string", - "name": "notification_channel_uid", + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1006,33 +1081,71 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "Updates an existing notification channel identified by uid.", + } + }, + "/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": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Update notification channel by UID.", - "operationId": "updateAlertNotificationChannelByUID", + "summary": "Return a list of all auth tokens (devices) that the user currently have logged in from.", + "operationId": "adminGetUserAuthTokens", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateAlertNotificationWithUidCommand" - } + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/adminGetUserAuthTokensResponse" }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/admin/users/{user_id}/disable": { + "post": { + "security": [ { - "type": "string", - "name": "notification_channel_uid", + "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": "adminDisableUser", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1047,25 +1160,33 @@ "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Deletes an existing notification channel identified by UID.", + } + }, + "/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": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Delete alert notification by UID.", - "operationId": "deleteAlertNotificationChannelByUID", + "summary": "Enable user.", + "operationId": "adminEnableUser", "parameters": [ { - "type": "string", - "name": "notification_channel_uid", + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/deleteAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1082,26 +1203,34 @@ } } }, - "/alert-notifications/{notification_channel_id}": { - "get": { - "description": "Returns the notification channel given the notification channel ID.", + "/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": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Get notification channel by ID.", - "operationId": "getAlertNotificationChannelByID", + "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": "adminLogoutUser", "parameters": [ { "type": "integer", "format": "int64", - "name": "notification_channel_id", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1116,34 +1245,44 @@ "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/admin/users/{user_id}/password": { "put": { - "description": "Updates an existing notification channel identified by ID.", + "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": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Update notification channel by ID.", - "operationId": "updateAlertNotificationChannel", + "summary": "Set password for user.", + "operationId": "adminUpdateUserPassword", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateAlertNotificationCommand" + "$ref": "#/definitions/AdminUpdateUserPasswordForm" } }, { "type": "integer", "format": "int64", - "name": "notification_channel_id", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1151,26 +1290,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Deletes an existing notification channel identified by ID.", + } + }, + "/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": [ - "legacy_alerts_notification_channels" + "admin_users" ], - "summary": "Delete alert notification by ID.", - "operationId": "deleteAlertNotificationChannel", + "summary": "Set permissions for user.", + "operationId": "adminUpdateUserPermissions", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AdminUpdateUserPermissionsForm" + } + }, { "type": "integer", "format": "int64", - "name": "notification_channel_id", + "name": "user_id", "in": "path", "required": true } @@ -1179,170 +1325,221 @@ "200": { "$ref": "#/responses/okResponse" }, + "400": { + "$ref": "#/responses/badRequestError" + }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alerts": { + "/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": [ - "legacy_alerts" + "admin_users" ], - "summary": "Get legacy alerts.", - "operationId": "getAlerts", + "summary": "Fetch user quota.", + "operationId": "getUserQuota", "parameters": [ - { - "type": "array", - "items": { - "type": "string" - }, - "description": "Limit response to alerts in specified dashboard(s). You can specify multiple dashboards.", - "name": "dashboardId", - "in": "query" - }, { "type": "integer", "format": "int64", - "description": "Limit response to alert for a specified panel on a dashboard.", - "name": "panelId", - "in": "query" + "name": "user_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getQuotaResponse" }, - { - "type": "string", - "description": "Limit response to alerts having a name like this value.", - "name": "query", - "in": "query" + "401": { + "$ref": "#/responses/unauthorisedError" }, - { - "enum": [ - "all", - "no_data", - "paused", - "alerting", - "ok", - "pending", - "unknown" - ], - "type": "string", - "description": "Return alerts with one or more of the following alert states", - "name": "state", - "in": "query" + "403": { + "$ref": "#/responses/forbiddenError" }, - { - "type": "integer", - "format": "int64", - "description": "Limit response to X number of alerts.", - "name": "limit", - "in": "query" + "404": { + "$ref": "#/responses/notFoundError" }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/admin/users/{user_id}/quotas/{quota_target}": { + "put": { + "security": [ { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "description": "Limit response to alerts of dashboards in specified folder(s). You can specify multiple folders", - "name": "folderId", - "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.quotas:update` and scope `global.users:1` (userIDScope).", + "tags": [ + "admin_users" + ], + "summary": "Update user quota.", + "operationId": "updateUserQuota", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateUserQuotaCmd" + } }, { "type": "string", - "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" + "name": "quota_target", + "in": "path", + "required": true }, { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "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" + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAlertsResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alerts/states-for-dashboard": { - "get": { + "/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": [ - "legacy_alerts" + "admin_users" ], - "summary": "Get alert states for a dashboard.", - "operationId": "getDashboardStates", + "summary": "Revoke auth token for user.", + "operationId": "adminRevokeUserAuthToken", "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RevokeAuthTokenCmd" + } + }, { "type": "integer", "format": "int64", - "name": "dashboardId", - "in": "query", + "name": "user_id", + "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDashboardStatesResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alerts/test": { + "/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" + "legacy_alerts_notification_channels" ], - "summary": "Test alert.", - "operationId": "testAlert", + "summary": "Create notification channel.", + "operationId": "createAlertNotificationChannel", "parameters": [ { "name": "body", "in": "body", + "required": true, "schema": { - "$ref": "#/definitions/AlertTestCommand" + "$ref": "#/definitions/CreateAlertNotificationCommand" } } ], "responses": { "200": { - "$ref": "#/responses/testAlertResponse" + "$ref": "#/responses/getAlertNotificationChannelResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "401": { + "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "422": { - "$ref": "#/responses/unprocessableEntityError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -1350,61 +1547,54 @@ } } }, - "/alerts/{alert_id}": { + "/alert-notifications/lookup": { "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.", + "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" - ], - "summary": "Get alert by ID.", - "operationId": "getAlertByID", - "parameters": [ - { - "type": "string", - "name": "alert_id", - "in": "path", - "required": true - } + "legacy_alerts_notification_channels" ], + "summary": "Get all notification channels (lookup).", + "operationId": "getAlertNotificationLookup", "responses": { "200": { - "$ref": "#/responses/getAlertResponse" + "$ref": "#/responses/getAlertNotificationLookupResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/alerts/{alert_id}/pause": { + "/alert-notifications/test": { "post": { + "description": "Sends a test notification to the channel.", "tags": [ - "legacy_alerts" + "legacy_alerts_notification_channels" ], - "summary": "Pause/unpause alert by id.", - "operationId": "pauseAlert", + "summary": "Test notification channel.", + "operationId": "notificationChannelTest", "parameters": [ - { - "type": "string", - "name": "alert_id", - "in": "path", - "required": true - }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PauseAlertCommand" + "$ref": "#/definitions/NotificationTestCommand" } } ], "responses": { "200": { - "$ref": "#/responses/pauseAlertResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1412,8 +1602,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "412": { + "$ref": "#/responses/SMTPNotEnabledError" }, "500": { "$ref": "#/responses/internalServerError" @@ -1421,67 +1611,276 @@ } } }, - "/annotations": { + "/alert-notifications/uid/{notification_channel_uid}": { "get": { - "description": "Starting in Grafana v6.4 regions annotations are now returned in one entity that now includes the timeEnd property.", + "description": "Returns the notification channel given the notification channel UID.", "tags": [ - "annotations" + "legacy_alerts_notification_channels" ], - "summary": "Find Annotations.", - "operationId": "getAnnotations", + "summary": "Get notification channel by UID.", + "operationId": "getAlertNotificationChannelByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "description": "Find annotations created after specific epoch datetime in milliseconds.", - "name": "from", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations created before specific epoch datetime in milliseconds.", - "name": "to", - "in": "query" + "type": "string", + "name": "notification_channel_uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAlertNotificationChannelResponse" }, - { - "type": "integer", - "format": "int64", - "description": "Limit response to annotations created by specific user.", - "name": "userId", - "in": "query" + "401": { + "$ref": "#/responses/unauthorisedError" }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations for a specified alert.", - "name": "alertId", - "in": "query" + "403": { + "$ref": "#/responses/forbiddenError" }, - { - "type": "integer", - "format": "int64", - "description": "Find annotations that are scoped to a specific dashboard", - "name": "dashboardId", - "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": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateAlertNotificationWithUidCommand" + } + }, + { "type": "string", - "description": "Find annotations that are scoped to a specific dashboard", - "name": "dashboardUID", + "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" + } + } + }, + "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", + "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", + "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": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateAlertNotificationCommand" + } + }, + { + "type": "integer", + "format": "int64", + "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" + } + } + }, + "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", + "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" + }, + "description": "Limit response to alerts in specified dashboard(s). You can specify multiple dashboards.", + "name": "dashboardId", "in": "query" }, { "type": "integer", "format": "int64", - "description": "Find annotations that are scoped to a specific panel", + "description": "Limit response to alert for a specified panel on a dashboard.", "name": "panelId", "in": "query" }, + { + "type": "string", + "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", + "description": "Return alerts with one or more of the following alert states", + "name": "state", + "in": "query" + }, { "type": "integer", "format": "int64", - "description": "Max limit for results returned.", + "description": "Limit response to X number of alerts.", "name": "limit", "in": "query" }, @@ -1491,62 +1890,1531 @@ "type": "string" }, "collectionFormat": "multi", - "description": "Use this to filter organization annotations. Organization 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", + "description": "Limit response to alerts of dashboards in specified folder(s). You can specify multiple folders", + "name": "folderId", "in": "query" }, { - "enum": [ - "alert", - "annotation" - ], "type": "string", - "description": "Return alerts or user created annotations", - "name": "type", + "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": "boolean", - "description": "Match any or all tags", - "name": "matchAny", - "in": "query" + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "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/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", + "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": [ + { + "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", + "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", + "name": "alert_id", + "in": "path", + "required": true + }, + { + "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", + "description": "Find annotations created after specific epoch datetime in milliseconds.", + "name": "from", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations created before specific epoch datetime in milliseconds.", + "name": "to", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Limit response to annotations created by specific user.", + "name": "userId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations for a specified alert.", + "name": "alertId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations that are scoped to a specific dashboard", + "name": "dashboardId", + "in": "query" + }, + { + "type": "string", + "description": "Find annotations that are scoped to a specific dashboard", + "name": "dashboardUID", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Find annotations that are scoped to a specific panel", + "name": "panelId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "Max limit for results returned.", + "name": "limit", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "Use this to filter organization annotations. Organization 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", + "description": "Return alerts or user created annotations", + "name": "type", + "in": "query" + }, + { + "type": "boolean", + "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 an organization 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": "postAnnotation", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PostAnnotationsCmd" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/postAnnotationResponse" + }, + "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": "postGraphiteAnnotation", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PostGraphiteAnnotationsCmd" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/postAnnotationResponse" + }, + "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": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/MassDeleteAnnotationsCmd" + } + } + ], + "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", + "description": "Tag is a string that you can use to filter tags.", + "name": "tag", + "in": "query" + }, + { + "type": "string", + "default": "100", + "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}": { + "get": { + "tags": [ + "annotations" + ], + "summary": "Get Annotation by ID.", + "operationId": "getAnnotationByID", + "parameters": [ + { + "type": "string", + "name": "annotation_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getAnnotationByIDResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "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", + "name": "annotation_id", + "in": "path", + "required": true + }, + { + "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": "deleteAnnotationByID", + "parameters": [ + { + "type": "string", + "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", + "name": "annotation_id", + "in": "path", + "required": true + }, + { + "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, + "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/AddCommand" + } + } + ], + "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", + "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": "searchDashboardSnapshots", + "parameters": [ + { + "type": "string", + "description": "Search Query", + "name": "query", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1000, + "description": "Limit the number of returned results", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/searchDashboardSnapshotsResponse" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/dashboards/calculate-diff": { + "post": { + "produces": [ + "application/json", + "text/html" + ], + "tags": [ + "dashboards" + ], + "summary": "Perform diff on two dashboards.", + "operationId": "calculateDashboardDiff", + "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" + ] + }, + "new": { + "$ref": "#/definitions/CalculateDiffTarget" + } + } + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/calculateDashboardDiffResponse" + }, + "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": { + "description": "Please refer to [updated API](#/dashboard_permissions/getDashboardPermissionsListByUID) instead", + "tags": [ + "dashboard_permissions" + ], + "summary": "Gets all existing permissions for the given dashboard.", + "operationId": "getDashboardPermissionsListByID", + "deprecated": true, + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getDashboardPermissionsListResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "post": { + "description": "Please refer to [updated API](#/dashboard_permissions/updateDashboardPermissionsByUID) instead\n\nThis operation will remove existing permissions if they’re not included in the request.", + "tags": [ + "dashboard_permissions" + ], + "summary": "Updates permissions for a dashboard.", + "operationId": "updateDashboardPermissionsByID", + "deprecated": true, + "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": { + "description": "Please refer to [updated API](#/dashboard_versions/restoreDashboardVersionByUID) instead", + "tags": [ + "dashboard_versions" + ], + "summary": "Restore a dashboard to a given dashboard version.", + "operationId": "restoreDashboardVersionByID", + "deprecated": true, + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RestoreDashboardVersionCommand" + } + }, + { + "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": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionsByUID) instead", + "tags": [ + "dashboard_versions" + ], + "summary": "Gets all existing versions for the dashboard.", + "operationId": "getDashboardVersionsByID", + "deprecated": true, + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true + } + ], + "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": { + "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionByUID) instead", + "tags": [ + "dashboard_versions" + ], + "summary": "Get a specific dashboard version.", + "operationId": "getDashboardVersionByID", + "deprecated": true, + "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/getDashboardsTagsResponse" + }, + "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", + "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", + "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" + } + } + } + }, + "/dashboards/uid/{uid}/permissions": { + "get": { + "tags": [ + "dashboard_permissions" + ], + "summary": "Gets all existing permissions for the given dashboard.", + "operationId": "getDashboardPermissionsListByUID", + "parameters": [ + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getDashboardPermissionsListResponse" + }, + "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": "updateDashboardPermissionsByUID", + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateDashboardACLCommand" + } + }, + { + "type": "string", + "name": "uid", + "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/uid/{uid}/restore": { + "post": { + "tags": [ + "dashboard_versions" + ], + "summary": "Restore a dashboard to a given dashboard version using UID.", + "operationId": "restoreDashboardVersionByUID", + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RestoreDashboardVersionCommand" + } + }, + { + "type": "string", + "name": "uid", + "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/uid/{uid}/versions": { + "get": { + "tags": [ + "dashboard_versions" + ], + "summary": "Gets all existing versions for the dashboard using UID.", + "operationId": "getDashboardVersionsByUID", + "parameters": [ + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "default": 0, + "description": "Maximum number of results to return", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 0, + "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/uid/{uid}/versions/{DashboardVersionID}": { + "get": { + "tags": [ + "dashboard_versions" + ], + "summary": "Get a specific dashboard version using UID.", + "operationId": "getDashboardVersionByUID", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "DashboardVersionID", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "uid", + "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" + } + } + } + }, + "/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/correlations": { + "get": { + "tags": [ + "correlations" + ], + "summary": "Gets all correlations.", + "operationId": "getCorrelations", + "responses": { + "200": { + "$ref": "#/responses/getCorrelationsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/datasources/id/{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", + "name": "name", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAnnotationsResponse" + "$ref": "#/responses/getDataSourceIDResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "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 an organization 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.", + } + }, + "/datasources/name/{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": [ - "annotations" + "datasources" ], - "summary": "Create Annotation.", - "operationId": "postAnnotation", + "summary": "Get a single data source by Name.", + "operationId": "getDataSourceByName", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PostAnnotationsCmd" - } + "type": "string", + "name": "name", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/postAnnotationResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getDataSourceResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1558,32 +3426,25 @@ "$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).", + }, + "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": [ - "annotations" + "datasources" ], - "summary": "Create Annotation in Graphite format.", - "operationId": "postGraphiteAnnotation", + "summary": "Delete an existing data source by name.", + "operationId": "deleteDataSourceByName", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PostGraphiteAnnotationsCmd" - } + "type": "string", + "name": "name", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/postAnnotationResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/deleteDataSourceByNameResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1591,131 +3452,178 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/annotations/mass-delete": { - "post": { + "/datasources/proxy/uid/{uid}/{datasource_proxy_route}": { + "get": { + "description": "Proxies all calls to the actual data source.", "tags": [ - "annotations" + "datasources" ], - "summary": "Delete multiple annotations.", - "operationId": "massDeleteAnnotations", + "summary": "Data source proxy GET calls.", + "operationId": "datasourceProxyGETByUIDcalls", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/MassDeleteAnnotationsCmd" - } + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "description": "" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/annotations/tags": { - "get": { - "description": "Find all the event tags created in the annotations.", + }, + "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": [ - "annotations" + "datasources" ], - "summary": "Find Annotations Tags.", - "operationId": "getAnnotationTags", + "summary": "Data source proxy POST calls.", + "operationId": "datasourceProxyPOSTByUIDcalls", "parameters": [ + { + "name": "DatasourceProxyParam", + "in": "body", + "required": true, + "schema": {} + }, { "type": "string", - "description": "Tag is a string that you can use to filter tags.", - "name": "tag", - "in": "query" + "name": "datasource_proxy_route", + "in": "path", + "required": true }, { "type": "string", - "default": "100", - "description": "Max limit for results returned.", - "name": "limit", - "in": "query" + "name": "uid", + "in": "path", + "required": true } ], "responses": { - "200": { - "$ref": "#/responses/getAnnotationTagsResponse" + "201": { + "description": "" + }, + "202": { + "description": "" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/annotations/{annotation_id}": { - "get": { + }, + "delete": { + "description": "Proxies all calls to the actual data source.", "tags": [ - "annotations" + "datasources" ], - "summary": "Get Annotation by ID.", - "operationId": "getAnnotationByID", + "summary": "Data source proxy DELETE calls.", + "operationId": "datasourceProxyDELETEByUIDcalls", "parameters": [ { "type": "string", - "name": "annotation_id", + "name": "uid", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "datasource_proxy_route", "in": "path", "required": true } ], "responses": { - "200": { - "$ref": "#/responses/getAnnotationByIDResponse" + "202": { + "description": "" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "put": { - "description": "Updates all properties of an annotation that matches the specified id. To only update certain property, consider using the Patch Annotation operation.", + } + }, + "/datasources/proxy/{id}/{datasource_proxy_route}": { + "get": { + "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyGETByUIDcalls) instead", "tags": [ - "annotations" + "datasources" ], - "summary": "Update Annotation.", - "operationId": "updateAnnotation", + "summary": "Data source proxy GET calls.", + "operationId": "datasourceProxyGETcalls", + "deprecated": true, "parameters": [ { "type": "string", - "name": "annotation_id", + "name": "datasource_proxy_route", "in": "path", "required": true }, { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateAnnotationsCmd" - } + "type": "string", + "name": "id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "description": "" }, "400": { "$ref": "#/responses/badRequestError" @@ -1726,29 +3634,51 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, - "delete": { - "description": "Deletes the annotation that matches the specified ID.", + "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\n\nPlease refer to [updated API](#/datasources/datasourceProxyPOSTByUIDcalls) instead", "tags": [ - "annotations" + "datasources" ], - "summary": "Delete Annotation By ID.", - "operationId": "deleteAnnotationByID", + "summary": "Data source proxy POST calls.", + "operationId": "datasourceProxyPOSTcalls", + "deprecated": true, "parameters": [ + { + "name": "DatasourceProxyParam", + "in": "body", + "required": true, + "schema": {} + }, + { + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, { "type": "string", - "name": "annotation_id", + "name": "id", "in": "path", "required": true } ], "responses": { - "200": { - "$ref": "#/responses/okResponse" + "201": { + "description": "" + }, + "202": { + "description": "" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1756,37 +3686,42 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "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.", + "delete": { + "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyDELETEByUIDcalls) instead", "tags": [ - "annotations" + "datasources" ], - "summary": "Patch Annotation.", - "operationId": "patchAnnotation", + "summary": "Data source proxy DELETE calls.", + "operationId": "datasourceProxyDELETEcalls", + "deprecated": true, "parameters": [ { "type": "string", - "name": "annotation_id", + "name": "id", "in": "path", "required": true }, { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PatchAnnotationsCmd" - } + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true } ], "responses": { - "200": { - "$ref": "#/responses/okResponse" + "202": { + "description": "" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -1803,33 +3738,28 @@ } } }, - "/auth/keys": { + "/datasources/uid/{sourceUID}/correlations": { "get": { - "description": "Will return auth keys.", "tags": [ - "api_keys" + "correlations" ], - "summary": "Get auth keys.", - "operationId": "getAPIkeys", + "summary": "Gets all correlations originating from the given data source.", + "operationId": "getCorrelationsBySourceUID", "parameters": [ { - "type": "boolean", - "default": false, - "description": "Show expired keys", - "name": "includeExpired", - "in": "query" + "type": "string", + "name": "sourceUID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAPIkeyResponse" + "$ref": "#/responses/getCorrelationsBySourceUIDResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "404": { "$ref": "#/responses/notFoundError" }, @@ -1839,25 +3769,30 @@ } }, "post": { - "description": "Will return details of the created API key.", "tags": [ - "api_keys" + "correlations" ], - "summary": "Creates an API key.", - "operationId": "addAPIkey", + "summary": "Add correlation.", + "operationId": "createCorrelation", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddCommand" + "$ref": "#/definitions/CreateCorrelationCommand" } + }, + { + "type": "string", + "name": "sourceUID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/postAPIkeyResponse" + "$ref": "#/responses/createCorrelationResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -1868,8 +3803,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -1877,32 +3812,34 @@ } } }, - "/auth/keys/{id}": { - "delete": { + "/datasources/uid/{sourceUID}/correlations/{correlationUID}": { + "get": { "tags": [ - "api_keys" + "correlations" ], - "summary": "Delete API key.", - "operationId": "deleteAPIkey", + "summary": "Gets a correlation.", + "operationId": "getCorrelation", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "id", + "type": "string", + "name": "sourceUID", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "correlationUID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getCorrelationResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "404": { "$ref": "#/responses/notFoundError" }, @@ -1910,115 +3847,37 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/dashboard/snapshots": { - "get": { + }, + "patch": { "tags": [ - "snapshots" + "correlations" ], - "summary": "List snapshots.", - "operationId": "searchDashboardSnapshots", + "summary": "Updates a correlation.", + "operationId": "updateCorrelation", "parameters": [ { "type": "string", - "description": "Search Query", - "name": "query", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 1000, - "description": "Limit the number of returned results", - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "$ref": "#/responses/searchDashboardSnapshotsResponse" + "name": "sourceUID", + "in": "path", + "required": true }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/dashboards/calculate-diff": { - "post": { - "produces": [ - "application/json", - "text/html" - ], - "tags": [ - "dashboards" - ], - "summary": "Perform diff on two dashboards.", - "operationId": "calculateDashboardDiff", - "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" - ] - }, - "new": { - "$ref": "#/definitions/CalculateDiffTarget" - } - } - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/calculateDashboardDiffResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "type": "string", + "name": "correlationUID", + "in": "path", + "required": true }, - "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", + "name": "body", "in": "body", - "required": true, "schema": { - "$ref": "#/definitions/SaveDashboardCommand" + "$ref": "#/definitions/UpdateCorrelationCommand" } } ], "responses": { "200": { - "$ref": "#/responses/postDashboardResponse" + "$ref": "#/responses/updateCorrelationResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -2032,59 +3891,34 @@ "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": { + "/datasources/uid/{uid}": { "get": { - "description": "Please refer to [updated API](#/dashboard_permissions/getDashboardPermissionsListByUID) instead", + "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": [ - "dashboard_permissions" + "datasources" ], - "summary": "Gets all existing permissions for the given dashboard.", - "operationId": "getDashboardPermissionsListByID", - "deprecated": true, + "summary": "Get a single data source by UID.", + "operationId": "getDataSourceByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDashboardPermissionsListResponse" + "$ref": "#/responses/getDataSourceResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2100,37 +3934,62 @@ } } }, - "post": { - "description": "Please refer to [updated API](#/dashboard_permissions/updateDashboardPermissionsByUID) instead\n\nThis operation will remove existing permissions if they’re not included in the request.", + "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:uid:*` and `datasources:uid:1` (single data source).", "tags": [ - "dashboard_permissions" + "datasources" ], - "summary": "Updates permissions for a dashboard.", - "operationId": "updateDashboardPermissionsByID", - "deprecated": true, + "summary": "Update an existing data source.", + "operationId": "updateDataSourceByUID", "parameters": [ { "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDashboardACLCommand" + "$ref": "#/definitions/UpdateDataSourceCommand" } }, { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + "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:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", + "tags": [ + "datasources" + ], + "summary": "Delete an existing data source by UID.", + "operationId": "deleteDataSourceByUID", + "parameters": [ + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2147,35 +4006,30 @@ } } }, - "/dashboards/id/{DashboardID}/restore": { - "post": { - "description": "Please refer to [updated API](#/dashboard_versions/restoreDashboardVersionByUID) instead", + "/datasources/uid/{uid}/correlations/{correlationUID}": { + "delete": { "tags": [ - "dashboard_versions" + "correlations" ], - "summary": "Restore a dashboard to a given dashboard version.", - "operationId": "restoreDashboardVersionByID", - "deprecated": true, + "summary": "Delete a correlation.", + "operationId": "deleteCorrelation", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RestoreDashboardVersionCommand" - } + "type": "string", + "name": "uid", + "in": "path", + "required": true }, { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "name": "correlationUID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/postDashboardResponse" + "$ref": "#/responses/deleteCorrelationResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2192,27 +4046,27 @@ } } }, - "/dashboards/id/{DashboardID}/versions": { + "/datasources/uid/{uid}/health": { "get": { - "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionsByUID) instead", "tags": [ - "dashboard_versions" + "datasources" ], - "summary": "Gets all existing versions for the dashboard.", - "operationId": "getDashboardVersionsByID", - "deprecated": true, + "summary": "Sends a health check request to the plugin datasource identified by the UID.", + "operationId": "checkDatasourceHealthWithUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2220,43 +4074,39 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/id/{DashboardID}/versions/{DashboardVersionID}": { + "/datasources/uid/{uid}/resources/{datasource_proxy_route}": { "get": { - "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionByUID) instead", "tags": [ - "dashboard_versions" + "datasources" ], - "summary": "Get a specific dashboard version.", - "operationId": "getDashboardVersionByID", - "deprecated": true, + "summary": "Fetch data source resources.", + "operationId": "callDatasourceResourceWithUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardID", + "type": "string", + "name": "datasource_proxy_route", "in": "path", "required": true }, { - "type": "integer", - "format": "int64", - "name": "DashboardVersionID", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2273,26 +4123,26 @@ } } }, - "/dashboards/import": { + "/datasources/{datasourceId}/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": [ - "dashboards" + "datasource_permissions", + "enterprise" ], - "summary": "Import dashboard.", - "operationId": "importDashboard", + "summary": "Disable permissions for a data source.", + "operationId": "disablePermissions", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/ImportDashboardRequest" - } + "type": "string", + "name": "datasourceId", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/importDashboardResponse" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -2300,11 +4150,11 @@ "401": { "$ref": "#/responses/unauthorisedError" }, - "412": { - "$ref": "#/responses/preconditionFailedError" + "403": { + "$ref": "#/responses/forbiddenError" }, - "422": { - "$ref": "#/responses/unprocessableEntityError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -2312,75 +4162,122 @@ } } }, - "/dashboards/tags": { - "get": { + "/datasources/{datasourceId}/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": [ - "dashboards" + "datasource_permissions", + "enterprise" + ], + "summary": "Enable permissions for a data source.", + "operationId": "enablePermissions", + "parameters": [ + { + "type": "string", + "name": "datasourceId", + "in": "path", + "required": true + } ], - "summary": "Get all dashboards tags of an organisation.", - "operationId": "getDashboardTags", "responses": { "200": { - "$ref": "#/responses/getDashboardsTagsResponse" + "$ref": "#/responses/createOrUpdateDatasourceResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/trim": { - "post": { + "/datasources/{datasourceId}/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": [ - "dashboards" + "datasource_permissions", + "enterprise" ], - "summary": "Trim defaults from dashboard.", - "operationId": "trimDashboard", + "summary": "Get permissions for a data source.", + "operationId": "getAllPermissions", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/TrimDashboardCommand" - } + "type": "string", + "name": "datasourceId", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/trimDashboardResponse" + "$ref": "#/responses/getAllPermissionseResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/dashboards/uid/{uid}": { - "get": { - "description": "Will return the dashboard given the dashboard unique identifier (uid).", + }, + "post": { + "description": "You need to have a permission with action `datasources.permissions:read` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).", "tags": [ - "dashboards" + "datasource_permissions", + "enterprise" ], - "summary": "Get dashboard by uid.", - "operationId": "getDashboardByUID", + "summary": "Add permissions for a data source.", + "operationId": "addPermission", "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "userId", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "query" + }, { "type": "string", - "name": "uid", + "name": "builtinRole", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "name": "permission", + "in": "query" + }, + { + "type": "string", + "name": "datasourceId", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/dashboardResponse" + "$ref": "#/responses/addPermissionResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2395,25 +4292,34 @@ "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/datasources/{datasourceId}/permissions/{permissionId}": { "delete": { - "description": "Will delete the dashboard given the specified unique identifier (uid).", + "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": [ - "dashboards" + "datasource_permissions", + "enterprise" ], - "summary": "Delete dashboard by uid.", - "operationId": "deleteDashboardByUID", + "summary": "Remove permission for a data source.", + "operationId": "deletePermissions", "parameters": [ { "type": "string", - "name": "uid", + "name": "datasourceId", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "permissionId", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/deleteDashboardResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2423,31 +4329,33 @@ }, "404": { "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/uid/{uid}/permissions": { + "/datasources/{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).\n\nPlease refer to [updated API](#/datasources/getDataSourceByUID) instead", "tags": [ - "dashboard_permissions" + "datasources" ], - "summary": "Gets all existing permissions for the given dashboard.", - "operationId": "getDashboardPermissionsListByUID", + "summary": "Get a single data source by Id.", + "operationId": "getDataSourceByID", + "deprecated": true, "parameters": [ { "type": "string", - "name": "uid", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDashboardPermissionsListResponse" + "$ref": "#/responses/getDataSourceResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2463,35 +4371,33 @@ } } }, - "post": { - "description": "This operation will remove existing permissions if they’re not included in the request.", + "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).\n\nPlease refer to [updated API](#/datasources/updateDataSourceByUID) instead", "tags": [ - "dashboard_permissions" + "datasources" ], - "summary": "Updates permissions for a dashboard.", - "operationId": "updateDashboardPermissionsByUID", + "summary": "Update an existing data source by its sequential ID.", + "operationId": "updateDataSourceByID", + "deprecated": true, "parameters": [ { "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDashboardACLCommand" + "$ref": "#/definitions/UpdateDataSourceCommand" } }, { "type": "string", - "name": "uid", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2499,41 +4405,30 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/dashboards/uid/{uid}/restore": { - "post": { + }, + "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).\n\nPlease refer to [updated API](#/datasources/deleteDataSourceByUID) instead", "tags": [ - "dashboard_versions" + "datasources" ], - "summary": "Restore a dashboard to a given dashboard version using UID.", - "operationId": "restoreDashboardVersionByUID", + "summary": "Delete an existing data source by id.", + "operationId": "deleteDataSourceByID", + "deprecated": true, "parameters": [ - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RestoreDashboardVersionCommand" - } - }, { "type": "string", - "name": "uid", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/postDashboardResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2550,40 +4445,29 @@ } } }, - "/dashboards/uid/{uid}/versions": { + "/datasources/{id}/health": { "get": { + "description": "Please refer to [updated API](#/datasources/checkDatasourceHealthWithUID) instead", "tags": [ - "dashboard_versions" + "datasources" ], - "summary": "Gets all existing versions for the dashboard using UID.", - "operationId": "getDashboardVersionsByUID", + "summary": "Sends a health check request to the plugin datasource identified by the ID.", + "operationId": "checkDatasourceHealthByID", + "deprecated": true, "parameters": [ { "type": "string", - "name": "uid", + "name": "id", "in": "path", "required": true - }, - { - "type": "integer", - "format": "int64", - "default": 0, - "description": "Maximum number of results to return", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 0, - "description": "Version to start from when returning queries", - "name": "start", - "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2591,40 +4475,41 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/dashboards/uid/{uid}/versions/{DashboardVersionID}": { + "/datasources/{id}/resources/{datasource_proxy_route}": { "get": { + "description": "Please refer to [updated API](#/datasources/callDatasourceResourceWithUID) instead", "tags": [ - "dashboard_versions" + "datasources" ], - "summary": "Get a specific dashboard version using UID.", - "operationId": "getDashboardVersionByUID", + "summary": "Fetch data source resources by Id.", + "operationId": "callDatasourceResourceByID", + "deprecated": true, "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardVersionID", + "type": "string", + "name": "datasource_proxy_route", "in": "path", "required": true }, { "type": "string", - "name": "uid", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2641,81 +4526,39 @@ } } }, - "/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" - } - } - }, + "/ds/query": { "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`", + "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": [ - "datasources" + "ds" ], - "summary": "Create a data source.", - "operationId": "addDataSource", + "summary": "DataSource query metrics with expressions.", + "operationId": "queryMetricsWithExpressions", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddDataSourceCommand" + "$ref": "#/definitions/MetricRequest" } } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "$ref": "#/responses/queryMetricsWithExpressionsRespons" }, - "409": { - "$ref": "#/responses/conflictError" + "207": { + "$ref": "#/responses/queryMetricsWithExpressionsRespons" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/datasources/correlations": { - "get": { - "tags": [ - "correlations" - ], - "summary": "Gets all correlations.", - "operationId": "getCorrelations", - "responses": { - "200": { - "$ref": "#/responses/getCorrelationsResponse" + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -2723,25 +4566,35 @@ } } }, - "/datasources/id/{name}": { + "/folders": { "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).", + "description": "Returns all folders that the authenticated user has permission to view.", "tags": [ - "datasources" + "folders" ], - "summary": "Get data source Id by Name.", - "operationId": "getDataSourceIdByName", + "summary": "Get all folders.", + "operationId": "getFolders", "parameters": [ { - "type": "string", - "name": "name", - "in": "path", - "required": true + "type": "integer", + "format": "int64", + "default": 1000, + "description": "Limit the maximum number of folders to return", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1, + "description": "Page index for starting fetching folders", + "name": "page", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/getDataSourceIDResponse" + "$ref": "#/responses/getFoldersResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2749,34 +4602,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/name/{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).", + }, + "post": { "tags": [ - "datasources" + "folders" ], - "summary": "Get a single data source by Name.", - "operationId": "getDataSourceByName", + "summary": "Create folder.", + "operationId": "createFolder", "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateFolderCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/getDataSourceResponse" + "$ref": "#/responses/folderResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2784,29 +4636,35 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "409": { + "$ref": "#/responses/conflictError" + }, "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).", + } + }, + "/folders/id/{folder_id}": { + "get": { + "description": "Returns the folder identified by id.", "tags": [ - "datasources" + "folders" ], - "summary": "Delete an existing data source by name.", - "operationId": "deleteDataSourceByName", + "summary": "Get folder by id.", + "operationId": "getFolderByID", "parameters": [ { - "type": "string", - "name": "name", + "type": "integer", + "format": "int64", + "name": "folder_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/deleteDataSourceByNameResponse" + "$ref": "#/responses/folderResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2823,34 +4681,24 @@ } } }, - "/datasources/proxy/uid/{uid}/{datasource_proxy_route}": { + "/folders/{folder_uid}": { "get": { - "description": "Proxies all calls to the actual data source.", "tags": [ - "datasources" + "folders" ], - "summary": "Data source proxy GET calls.", - "operationId": "datasourceProxyGETByUIDcalls", + "summary": "Get folder by uid.", + "operationId": "getFolderByUID", "parameters": [ { "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "uid", + "name": "folder_uid", "in": "path", "required": true } ], "responses": { "200": { - "description": "" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/folderResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -2866,39 +4714,32 @@ } } }, - "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", + "put": { "tags": [ - "datasources" + "folders" ], - "summary": "Data source proxy POST calls.", - "operationId": "datasourceProxyPOSTByUIDcalls", + "summary": "Update folder.", + "operationId": "updateFolder", "parameters": [ - { - "name": "DatasourceProxyParam", - "in": "body", - "required": true, - "schema": {} - }, { "type": "string", - "name": "datasource_proxy_route", + "name": "folder_uid", "in": "path", "required": true }, { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "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/UpdateFolderCommand" + } } ], "responses": { - "201": { - "description": "" - }, - "202": { - "description": "" + "200": { + "$ref": "#/responses/folderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -2912,35 +4753,39 @@ "404": { "$ref": "#/responses/notFoundError" }, + "409": { + "$ref": "#/responses/conflictError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "delete": { - "description": "Proxies all calls to the actual data source.", + "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": [ - "datasources" + "folders" ], - "summary": "Data source proxy DELETE calls.", - "operationId": "datasourceProxyDELETEByUIDcalls", + "summary": "Delete folder.", + "operationId": "deleteFolder", "parameters": [ { "type": "string", - "name": "uid", + "name": "folder_uid", "in": "path", "required": true }, { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true + "type": "boolean", + "default": false, + "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": { - "202": { - "description": "" + "200": { + "$ref": "#/responses/deleteFolderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -2960,35 +4805,24 @@ } } }, - "/datasources/proxy/{id}/{datasource_proxy_route}": { + "/folders/{folder_uid}/permissions": { "get": { - "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyGETByUIDcalls) instead", "tags": [ - "datasources" + "folder_permissions" ], - "summary": "Data source proxy GET calls.", - "operationId": "datasourceProxyGETcalls", - "deprecated": true, + "summary": "Gets all existing permissions for the folder with the given `uid`.", + "operationId": "getFolderPermissionList", "parameters": [ { "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", + "name": "folder_uid", "in": "path", "required": true } ], "responses": { "200": { - "description": "" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getFolderPermissionListResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3005,42 +4839,30 @@ } }, "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\n\nPlease refer to [updated API](#/datasources/datasourceProxyPOSTByUIDcalls) instead", "tags": [ - "datasources" + "folder_permissions" ], - "summary": "Data source proxy POST calls.", - "operationId": "datasourceProxyPOSTcalls", - "deprecated": true, + "summary": "Updates permissions for a folder. This operation will remove existing permissions if they’re not included in the request.", + "operationId": "updateFolderPermissions", "parameters": [ - { - "name": "DatasourceProxyParam", - "in": "body", - "required": true, - "schema": {} - }, { "type": "string", - "name": "datasource_proxy_route", + "name": "folder_uid", "in": "path", "required": true }, { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateDashboardACLCommand" + } } ], "responses": { - "201": { - "description": "" - }, - "202": { - "description": "" - }, - "400": { - "$ref": "#/responses/badRequestError" + "200": { + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3055,106 +4877,111 @@ "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyDELETEByUIDcalls) instead", + } + }, + "/library-elements": { + "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": [ - "datasources" + "library_elements" ], - "summary": "Data source proxy DELETE calls.", - "operationId": "datasourceProxyDELETEcalls", - "deprecated": true, + "summary": "Get all library elements.", + "operationId": "getLibraryElements", "parameters": [ { "type": "string", - "name": "id", - "in": "path", - "required": true + "description": "Part of the name or description searched for.", + "name": "searchString", + "in": "query" }, { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - } - ], - "responses": { - "202": { - "description": "" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "enum": [ + 1, + 2 + ], + "type": "integer", + "format": "int64", + "description": "Kind of element to search for.", + "name": "kind", + "in": "query" }, - "403": { - "$ref": "#/responses/forbiddenError" + { + "enum": [ + "alpha-asc", + "alpha-desc" + ], + "type": "string", + "description": "Sort order of elements.", + "name": "sortDirection", + "in": "query" }, - "404": { - "$ref": "#/responses/notFoundError" + { + "type": "string", + "description": "A comma separated list of types to filter the elements by", + "name": "typeFilter", + "in": "query" + }, + { + "type": "string", + "description": "Element UID to exclude from search results.", + "name": "excludeUid", + "in": "query" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/datasources/uid/{sourceUID}/correlations": { - "get": { - "tags": [ - "correlations" - ], - "summary": "Gets all correlations originating from the given data source.", - "operationId": "getCorrelationsBySourceUID", - "parameters": [ { "type": "string", - "name": "sourceUID", - "in": "path", - "required": true + "description": "A comma separated list of folder ID(s) to filter the elements by.", + "name": "folderFilter", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 100, + "description": "The number of results per page.", + "name": "perPage", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "default": 1, + "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/getCorrelationsBySourceUIDResponse" + "$ref": "#/responses/getLibraryElementsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, "post": { + "description": "Creates a new library element.", "tags": [ - "correlations" + "library_elements" ], - "summary": "Add correlation.", - "operationId": "createCorrelation", + "summary": "Create library element.", + "operationId": "createLibraryElement", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateCorrelationCommand" + "$ref": "#/definitions/CreateLibraryElementCommand" } - }, - { - "type": "string", - "name": "sourceUID", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/createCorrelationResponse" + "$ref": "#/responses/getLibraryElementResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3174,30 +5001,25 @@ } } }, - "/datasources/uid/{sourceUID}/correlations/{correlationUID}": { + "/library-elements/name/{library_element_name}": { "get": { + "description": "Returns a library element with the given name.", "tags": [ - "correlations" + "library_elements" ], - "summary": "Gets a correlation.", - "operationId": "getCorrelation", + "summary": "Get library element by name.", + "operationId": "getLibraryElementByName", "parameters": [ { "type": "string", - "name": "sourceUID", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "correlationUID", + "name": "library_element_name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getCorrelationResponse" + "$ref": "#/responses/getLibraryElementResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3209,47 +5031,31 @@ "$ref": "#/responses/internalServerError" } } - }, - "patch": { + } + }, + "/library-elements/{library_element_uid}": { + "get": { + "description": "Returns a library element with the given UID.", "tags": [ - "correlations" + "library_elements" ], - "summary": "Updates a correlation.", - "operationId": "updateCorrelation", + "summary": "Get library element by UID.", + "operationId": "getLibraryElementByUID", "parameters": [ { "type": "string", - "name": "sourceUID", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "correlationUID", + "name": "library_element_uid", "in": "path", "required": true - }, - { - "name": "body", - "in": "body", - "schema": { - "$ref": "#/definitions/UpdateCorrelationCommand" - } } ], "responses": { "200": { - "$ref": "#/responses/updateCorrelationResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getLibraryElementResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "404": { "$ref": "#/responses/notFoundError" }, @@ -3257,27 +5063,25 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/uid/{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).", + }, + "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": [ - "datasources" + "library_elements" ], - "summary": "Get a single data source by UID.", - "operationId": "getDataSourceByUID", + "summary": "Delete library element.", + "operationId": "deleteLibraryElementByUID", "parameters": [ { "type": "string", - "name": "uid", + "name": "library_element_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDataSourceResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3296,32 +5100,35 @@ } } }, - "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:uid:*` and `datasources:uid:1` (single data source).", + "patch": { + "description": "Updates an existing library element identified by uid.", "tags": [ - "datasources" + "library_elements" ], - "summary": "Update an existing data source.", - "operationId": "updateDataSourceByUID", + "summary": "Update library element.", + "operationId": "updateLibraryElement", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDataSourceCommand" + "$ref": "#/definitions/PatchLibraryElementCommand" } }, { "type": "string", - "name": "uid", + "name": "library_element_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" + "$ref": "#/responses/getLibraryElementResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3329,36 +5136,41 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "412": { + "$ref": "#/responses/preconditionFailedError" + }, "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).", + } + }, + "/library-elements/{library_element_uid}/connections/": { + "get": { + "description": "Returns a list of connections for a library element based on the UID specified.", "tags": [ - "datasources" + "library_elements" ], - "summary": "Delete an existing data source by UID.", - "operationId": "deleteDataSourceByUID", + "summary": "Get library element connections.", + "operationId": "getLibraryElementConnections", "parameters": [ { "type": "string", - "name": "uid", + "name": "library_element_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getLibraryElementConnectionsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "404": { "$ref": "#/responses/notFoundError" }, @@ -3368,64 +5180,144 @@ } } }, - "/datasources/uid/{uid}/correlations/{correlationUID}": { - "delete": { + "/licensing/check": { + "get": { "tags": [ - "correlations" + "licensing", + "enterprise" ], - "summary": "Delete a correlation.", - "operationId": "deleteCorrelation", - "parameters": [ - { - "type": "string", - "name": "uid", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "correlationUID", - "in": "path", - "required": true + "summary": "Check license availability.", + "operationId": "getStatus", + "responses": { + "200": { + "$ref": "#/responses/getStatusResponse" } + } + } + }, + "/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/deleteCorrelationResponse" + "$ref": "#/responses/getCustomPermissionsReportResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "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" }, - "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", + "responses": { + "200": { + "$ref": "#/responses/refreshLicenseStatsResponse" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/uid/{uid}/health": { - "get": { + } + }, + "/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", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/DeleteTokenCommand" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/getLicenseTokenResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" + } + } + }, + "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": [ - "datasources" + "licensing", + "enterprise" ], - "summary": "Sends a health check request to the plugin datasource identified by the UID.", - "operationId": "checkDatasourceHealthWithUID", + "summary": "Remove license from database.", + "operationId": "deleteLicenseToken", "parameters": [ { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/DeleteTokenCommand" + } } ], "responses": { - "200": { - "$ref": "#/responses/okResponse" + "202": { + "$ref": "#/responses/acceptedResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3436,45 +5328,58 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources/uid/{uid}/resources/{datasource_proxy_route}": { - "get": { + "/licensing/token/renew": { + "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": [ - "datasources" + "licensing", + "enterprise" ], - "summary": "Fetch data source resources.", - "operationId": "callDatasourceResourceWithUID", + "summary": "Manually force license refresh.", + "operationId": "postRenewLicenseToken", "parameters": [ { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object" + } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/postRenewLicenseTokenResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" + "404": { + "$ref": "#/responses/notFoundError" + } + } + } + }, + "/logout/saml": { + "get": { + "tags": [ + "saml", + "enterprise" + ], + "summary": "GetLogout initiates single logout process.", + "operationId": "getSAMLLogout", + "responses": { + "302": { + "description": "" }, "404": { "$ref": "#/responses/notFoundError" @@ -3485,29 +5390,16 @@ } } }, - "/datasources/{id}": { + "/org": { "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).\n\nPlease refer to [updated API](#/datasources/getDataSourceByUID) instead", "tags": [ - "datasources" - ], - "summary": "Get a single data source by Id.", - "operationId": "getDataSourceByID", - "deprecated": true, - "parameters": [ - { - "type": "string", - "name": "id", - "in": "path", - "required": true - } + "org" ], + "summary": "Get current Organization.", + "operationId": "getCurrentOrg", "responses": { "200": { - "$ref": "#/responses/getDataSourceResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getCurrentOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3515,41 +5407,33 @@ "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).\n\nPlease refer to [updated API](#/datasources/updateDataSourceByUID) instead", "tags": [ - "datasources" + "org" ], - "summary": "Update an existing data source by its sequential ID.", - "operationId": "updateDataSourceByID", - "deprecated": true, + "summary": "Update current Organization.", + "operationId": "updateCurrentOrg", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDataSourceCommand" + "$ref": "#/definitions/UpdateOrgForm" } - }, - { - "type": "string", - "name": "id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3561,65 +5445,54 @@ "$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).\n\nPlease refer to [updated API](#/datasources/deleteDataSourceByUID) instead", + } + }, + "/org/address": { + "put": { "tags": [ - "datasources" + "org" ], - "summary": "Delete an existing data source by id.", - "operationId": "deleteDataSourceByID", - "deprecated": true, + "summary": "Update current Organization's address.", + "operationId": "updateCurrentOrgAddress", "parameters": [ { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgAddressForm" + } } ], "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" } } } }, - "/datasources/{id}/health": { + "/org/invites": { "get": { - "description": "Please refer to [updated API](#/datasources/checkDatasourceHealthWithUID) instead", "tags": [ - "datasources" - ], - "summary": "Sends a health check request to the plugin datasource identified by the ID.", - "operationId": "checkDatasourceHealthByID", - "deprecated": true, - "parameters": [ - { - "type": "string", - "name": "id", - "in": "path", - "required": true - } + "org_invites" ], + "summary": "Get pending invites.", + "operationId": "getPendingOrgInvites", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getPendingOrgInvitesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3631,29 +5504,21 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/{id}/resources/{datasource_proxy_route}": { - "get": { - "description": "Please refer to [updated API](#/datasources/callDatasourceResourceWithUID) instead", + }, + "post": { "tags": [ - "datasources" + "org_invites" ], - "summary": "Fetch data source resources by Id.", - "operationId": "callDatasourceResourceByID", - "deprecated": true, + "summary": "Add invite.", + "operationId": "addOrgInvite", "parameters": [ { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddInviteForm" + } } ], "responses": { @@ -3669,8 +5534,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "412": { + "$ref": "#/responses/SMTPNotEnabledError" }, "500": { "$ref": "#/responses/internalServerError" @@ -3678,33 +5543,24 @@ } } }, - "/ds/query": { - "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`.", + "/org/invites/{invitation_code}/revoke": { + "delete": { "tags": [ - "ds" + "org_invites" ], - "summary": "DataSource query metrics with expressions.", - "operationId": "queryMetricsWithExpressions", + "summary": "Revoke invite.", + "operationId": "revokeInvite", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/MetricRequest" - } + "type": "string", + "name": "invitation_code", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/queryMetricsWithExpressionsRespons" - }, - "207": { - "$ref": "#/responses/queryMetricsWithExpressionsRespons" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3712,41 +5568,25 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/folders": { - "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, - "description": "Limit the maximum number of folders to return", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "default": 1, - "description": "Page index for starting fetching folders", - "name": "page", - "in": "query" - } + "/org/preferences": { + "get": { + "tags": [ + "org_preferences" ], + "summary": "Get Current Org Prefs.", + "operationId": "getOrgPreferences", "responses": { "200": { - "$ref": "#/responses/getFoldersResponse" + "$ref": "#/responses/getPreferencesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3759,25 +5599,25 @@ } } }, - "post": { + "put": { "tags": [ - "folders" + "org_preferences" ], - "summary": "Create folder.", - "operationId": "createFolder", + "summary": "Update Current Org Prefs.", + "operationId": "updateOrgPreferences", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateFolderCommand" + "$ref": "#/definitions/UpdatePrefsCmd" } } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3788,35 +5628,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/folders/id/{folder_id}": { - "get": { - "description": "Returns the folder identified by id.", + }, + "patch": { "tags": [ - "folders" + "org_preferences" ], - "summary": "Get folder by id.", - "operationId": "getFolderByID", + "summary": "Patch Current Org Prefs.", + "operationId": "patchOrgPreferences", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "folder_id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PatchPrefsCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3824,33 +5662,23 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/folders/{folder_uid}": { + "/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": [ - "folders" - ], - "summary": "Get folder by uid.", - "operationId": "getFolderByUID", - "parameters": [ - { - "type": "string", - "name": "folder_uid", - "in": "path", - "required": true - } + "org" ], + "summary": "Get all users within the current organization.", + "operationId": "getOrgUsersForCurrentOrg", "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/getOrgUsersForCurrentOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3858,43 +5686,31 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, - "put": { + "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": [ - "folders" + "org" ], - "summary": "Update folder.", - "operationId": "updateFolder", + "summary": "Add a new user to the current organization.", + "operationId": "addOrgUserToCurrentOrg", "parameters": [ { - "type": "string", - "name": "folder_uid", - "in": "path", - "required": true - }, - { - "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/UpdateFolderCommand" + "$ref": "#/definitions/AddOrgUserCommand" } } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3902,45 +5718,36 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "409": { - "$ref": "#/responses/conflictError" - }, "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.", + } + }, + "/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": [ - "folders" + "org" ], - "summary": "Delete folder.", - "operationId": "deleteFolder", + "summary": "Get all users within the current organization (lookup)", + "operationId": "getOrgUsersForCurrentOrgLookup", "parameters": [ { "type": "string", - "name": "folder_uid", - "in": "path", - "required": true + "name": "query", + "in": "query" }, { - "type": "boolean", - "default": false, - "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", + "type": "integer", + "format": "int64", + "name": "limit", "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/deleteFolderResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getOrgUsersForCurrentOrgLookupResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3948,33 +5755,35 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/folders/{folder_uid}/permissions": { - "get": { + "/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": [ - "folder_permissions" + "org" ], - "summary": "Gets all existing permissions for the folder with the given `uid`.", - "operationId": "getFolderPermissionList", + "summary": "Delete user in current organization.", + "operationId": "removeOrgUserForCurrentOrg", "parameters": [ { - "type": "string", - "name": "folder_uid", + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getFolderPermissionListResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3982,161 +5791,132 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { + "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": [ - "folder_permissions" + "org" ], - "summary": "Updates permissions for a folder. This operation will remove existing permissions if they’re not included in the request.", - "operationId": "updateFolderPermissions", + "summary": "Updates the given user.", + "operationId": "updateOrgUserForCurrentOrg", "parameters": [ { - "type": "string", - "name": "folder_uid", - "in": "path", - "required": true - }, - { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDashboardACLCommand" + "$ref": "#/definitions/UpdateOrgUserCommand" } + }, + { + "type": "integer", + "format": "int64", + "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" } } } }, - "/library-elements": { + "/orgs": { "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.", + "security": [ + { + "basic": [] + } + ], "tags": [ - "library_elements" + "orgs" ], - "summary": "Get all library elements.", - "operationId": "getLibraryElements", + "summary": "Search all Organizations.", + "operationId": "searchOrgs", "parameters": [ { - "type": "string", - "description": "Part of the name or description searched for.", - "name": "searchString", - "in": "query" - }, - { - "enum": [ - 1, - 2 - ], "type": "integer", "format": "int64", - "description": "Kind of element to search for.", - "name": "kind", - "in": "query" - }, - { - "enum": [ - "alpha-asc", - "alpha-desc" - ], - "type": "string", - "description": "Sort order of elements.", - "name": "sortDirection", - "in": "query" - }, - { - "type": "string", - "description": "A comma separated list of types to filter the elements by", - "name": "typeFilter", - "in": "query" - }, - { - "type": "string", - "description": "Element UID to exclude from search results.", - "name": "excludeUid", - "in": "query" - }, - { - "type": "string", - "description": "A comma separated list of folder ID(s) to filter the elements by.", - "name": "folderFilter", + "default": 1, + "name": "page", "in": "query" }, { "type": "integer", "format": "int64", - "default": 100, - "description": "The number of results per page.", - "name": "perPage", + "default": 1000, + "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": "integer", - "format": "int64", - "default": 1, - "description": "The page for a set of records, given that only perPage records are returned at a time. Numbering starts at 1.", - "name": "page", + "type": "string", + "name": "name", + "in": "query" + }, + { + "type": "string", + "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/getLibraryElementsResponse" + "$ref": "#/responses/searchOrgsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "409": { + "$ref": "#/responses/conflictError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "post": { - "description": "Creates a new library element.", + "description": "Only works if [users.allow_org_create](https://grafana.com/docs/grafana/latest/administration/configuration/#allow_org_create) is set.", "tags": [ - "library_elements" + "orgs" ], - "summary": "Create library element.", - "operationId": "createLibraryElement", + "summary": "Create Organization.", + "operationId": "createOrg", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateLibraryElementCommand" + "$ref": "#/definitions/CreateOrgCommand" } } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/createOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4144,8 +5924,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4153,31 +5933,35 @@ } } }, - "/library-elements/name/{library_element_name}": { + "/orgs/name/{org_name}": { "get": { - "description": "Returns a library element with the given name.", + "security": [ + { + "basic": [] + } + ], "tags": [ - "library_elements" + "orgs" ], - "summary": "Get library element by name.", - "operationId": "getLibraryElementByName", + "summary": "Get Organization by ID.", + "operationId": "getOrgByName", "parameters": [ { "type": "string", - "name": "library_element_name", + "name": "org_name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/getOrgByNameResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4185,48 +5969,66 @@ } } }, - "/library-elements/{library_element_uid}": { + "/orgs/{org_id}": { "get": { - "description": "Returns a library element with the given UID.", + "security": [ + { + "basic": [] + } + ], "tags": [ - "library_elements" + "orgs" ], - "summary": "Get library element by UID.", - "operationId": "getLibraryElementByUID", + "summary": "Get Organization by ID.", + "operationId": "getOrgByID", "parameters": [ { - "type": "string", - "name": "library_element_uid", + "type": "integer", + "format": "int64", + "name": "org_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/getOrgByIDResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" + "403": { + "$ref": "#/responses/forbiddenError" }, "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.", + "put": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "library_elements" + "orgs" ], - "summary": "Delete library element.", - "operationId": "deleteLibraryElementByUID", + "summary": "Update Organization.", + "operationId": "updateOrg", "parameters": [ { - "type": "string", - "name": "library_element_uid", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgForm" + } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", "in": "path", "required": true } @@ -4244,40 +6046,34 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, - "patch": { - "description": "Updates an existing library element identified by uid.", + "delete": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "library_elements" + "orgs" ], - "summary": "Update library element.", - "operationId": "updateLibraryElement", + "summary": "Delete Organization.", + "operationId": "deleteOrgByID", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PatchLibraryElementCommand" - } - }, - { - "type": "string", - "name": "library_element_uid", + "type": "integer", + "format": "int64", + "name": "org_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4291,57 +6087,42 @@ "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.", + "/orgs/{org_id}/address": { + "put": { "tags": [ - "library_elements" + "orgs" ], - "summary": "Get library element connections.", - "operationId": "getLibraryElementConnections", + "summary": "Update Organization's address.", + "operationId": "updateOrgAddress", "parameters": [ { - "type": "string", - "name": "library_element_uid", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateOrgAddressForm" + } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementConnectionsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "$ref": "#/responses/okResponse" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/org": { - "get": { - "tags": [ - "org" - ], - "summary": "Get current Organization.", - "operationId": "getCurrentOrg", - "responses": { - "200": { - "$ref": "#/responses/getCurrentOrgResponse" + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4353,29 +6134,28 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { + } + }, + "/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).", "tags": [ - "org" + "orgs" ], - "summary": "Update current Organization.", - "operationId": "updateCurrentOrg", + "summary": "Fetch Organization quota.", + "operationId": "getOrgQuota", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgForm" - } + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getQuotaResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4383,58 +6163,95 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/address": { + "/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": [ - "org" + "orgs" ], - "summary": "Update current Organization's address.", - "operationId": "updateCurrentOrgAddress", + "summary": "Update user quota.", + "operationId": "updateOrgQuota", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgAddressForm" + "$ref": "#/definitions/UpdateOrgQuotaCmd" } + }, + { + "type": "string", + "name": "quota_target", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "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" } } } }, - "/org/invites": { + "/orgs/{org_id}/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": [ - "org_invites" + "orgs" + ], + "summary": "Get Users in Organization.", + "operationId": "getOrgUsers", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + } ], - "summary": "Get pending invites.", - "operationId": "getPendingOrgInvites", "responses": { "200": { - "$ref": "#/responses/getPendingOrgInvitesResponse" + "$ref": "#/responses/getOrgUsersResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4448,54 +6265,65 @@ } }, "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": [ - "org_invites" + "orgs" ], - "summary": "Add invite.", - "operationId": "addOrgInvite", + "summary": "Add a new user to the current organization.", + "operationId": "addOrgUser", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddInviteForm" + "$ref": "#/definitions/AddOrgUserCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "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" } } } }, - "/org/invites/{invitation_code}/revoke": { + "/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": [ - "org_invites" + "orgs" ], - "summary": "Revoke invite.", - "operationId": "revokeInvite", + "summary": "Delete user in current organization.", + "operationId": "removeOrgUser", "parameters": [ { - "type": "string", - "name": "invitation_code", + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } @@ -4504,31 +6332,8 @@ "200": { "$ref": "#/responses/okResponse" }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/org/preferences": { - "get": { - "tags": [ - "org_preferences" - ], - "summary": "Get Current Org Prefs.", - "operationId": "getOrgPreferences", - "responses": { - "200": { - "$ref": "#/responses/getPreferencesResponse" + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4541,20 +6346,35 @@ } } }, - "put": { + "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": [ - "org_preferences" + "orgs" ], - "summary": "Update Current Org Prefs.", - "operationId": "updateOrgPreferences", + "summary": "Update Users in Organization.", + "operationId": "updateOrgUser", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdatePrefsCmd" + "$ref": "#/definitions/UpdateOrgUserCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "user_id", + "in": "path", + "required": true } ], "responses": { @@ -4574,29 +6394,57 @@ "$ref": "#/responses/internalServerError" } } + } + }, + "/playlists": { + "get": { + "tags": [ + "playlists" + ], + "summary": "Get playlists.", + "operationId": "searchPlaylists", + "parameters": [ + { + "type": "string", + "name": "query", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "in:limit", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/searchPlaylistsResponse" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } }, - "patch": { + "post": { "tags": [ - "org_preferences" + "playlists" ], - "summary": "Patch Current Org Prefs.", - "operationId": "patchOrgPreferences", + "summary": "Create playlist.", + "operationId": "createPlaylist", "parameters": [ { - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PatchPrefsCmd" + "$ref": "#/definitions/CreatePlaylistCommand" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/createPlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4604,23 +6452,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/users": { + "/playlists/{uid}": { "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": [ - "org" + "playlists" + ], + "summary": "Get playlist.", + "operationId": "getPlaylist", + "parameters": [ + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + } ], - "summary": "Get all users within the current organization.", - "operationId": "getOrgUsersForCurrentOrg", "responses": { "200": { - "$ref": "#/responses/getOrgUsersForCurrentOrgResponse" + "$ref": "#/responses/getPlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4628,31 +6486,39 @@ "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:*`.", + "put": { "tags": [ - "org" + "playlists" ], - "summary": "Add a new user to the current organization.", - "operationId": "addOrgUserToCurrentOrg", + "summary": "Update playlist.", + "operationId": "updatePlaylist", "parameters": [ { - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddOrgUserCommand" + "$ref": "#/definitions/UpdatePlaylistCommand" } + }, + { + "type": "string", + "name": "uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/updatePlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4660,36 +6526,31 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "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.", + }, + "delete": { "tags": [ - "org" + "playlists" ], - "summary": "Get all users within the current organization (lookup)", - "operationId": "getOrgUsersForCurrentOrgLookup", + "summary": "Delete playlist.", + "operationId": "deletePlaylist", "parameters": [ { "type": "string", - "name": "query", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "name": "limit", - "in": "query" + "name": "uid", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getOrgUsersForCurrentOrgLookupResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4697,35 +6558,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "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:*`.", + "/playlists/{uid}/dashboards": { + "get": { "tags": [ - "org" + "playlists" ], - "summary": "Delete user in current organization.", - "operationId": "removeOrgUserForCurrentOrg", + "summary": "Get playlist dashboards.", + "operationId": "getPlaylistDashboards", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getPlaylistDashboardsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4733,41 +6592,33 @@ "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:*`.", + } + }, + "/playlists/{uid}/items": { + "get": { "tags": [ - "org" + "playlists" ], - "summary": "Updates the given user.", - "operationId": "updateOrgUserForCurrentOrg", + "summary": "Get playlist items.", + "operationId": "getPlaylistItems", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgUserCommand" - } - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getPlaylistItemsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4775,99 +6626,158 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs": { + "/query-history": { "get": { - "security": [ - { - "basic": [] - } - ], + "description": "Returns a list of queries in the query history that matches the search criteria.\nQuery history search supports pagination. Use the `limit` parameter to control the maximum number of queries returned; the default limit is 100.\nYou can also use the `page` query parameter to fetch queries from any page other than the first one.", "tags": [ - "orgs" + "query_history" ], - "summary": "Search all Organizations.", - "operationId": "searchOrgs", + "summary": "Query history search.", + "operationId": "searchQueries", "parameters": [ + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "List of data source UIDs to search for", + "name": "datasourceUid", + "in": "query" + }, + { + "type": "string", + "description": "Text inside query or comments that is searched for", + "name": "searchString", + "in": "query" + }, + { + "type": "boolean", + "description": "Flag indicating if only starred queries should be returned", + "name": "onlyStarred", + "in": "query" + }, + { + "enum": [ + "time-desc", + "time-asc" + ], + "type": "string", + "default": "time-desc", + "description": "Sort method", + "name": "sort", + "in": "query" + }, { "type": "integer", "format": "int64", - "default": 1, + "description": "Use this parameter to access hits beyond limit. Numbering starts at 1. limit param acts as page size.", "name": "page", "in": "query" }, { "type": "integer", "format": "int64", - "default": 1000, - "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", + "description": "Limit the number of returned results", + "name": "limit", "in": "query" }, { - "type": "string", - "name": "name", + "type": "integer", + "format": "int64", + "description": "From range for the query history search", + "name": "from", "in": "query" }, { - "type": "string", - "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", + "type": "integer", + "format": "int64", + "description": "To range for the query history search", + "name": "to", "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/searchOrgsResponse" + "$ref": "#/responses/getQueryHistorySearchResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "409": { - "$ref": "#/responses/conflictError" - }, "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.", + "description": "Adds new query to query history.", "tags": [ - "orgs" + "query_history" ], - "summary": "Create Organization.", - "operationId": "createOrg", + "summary": "Add query to query history.", + "operationId": "createQuery", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateOrgCommand" + "$ref": "#/definitions/CreateQueryInQueryHistoryCommand" } } ], "responses": { "200": { - "$ref": "#/responses/createOrgResponse" + "$ref": "#/responses/getQueryHistoryResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/query-history/migrate": { + "post": { + "description": "Adds multiple queries to query history.", + "tags": [ + "query_history" + ], + "summary": "Migrate queries to query history.", + "operationId": "migrateQueries", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/MigrateQueriesToQueryHistoryCommand" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/getQueryHistoryMigrationResponse" }, - "409": { - "$ref": "#/responses/conflictError" + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4875,109 +6785,116 @@ } } }, - "/orgs/name/{org_name}": { - "get": { - "security": [ + "/query-history/star/{query_history_uid}": { + "post": { + "description": "Adds star to query in query history as specified by the UID.", + "tags": [ + "query_history" + ], + "summary": "Add star to query in query history.", + "operationId": "starQuery", + "parameters": [ { - "basic": [] + "type": "string", + "name": "query_history_uid", + "in": "path", + "required": true } ], + "responses": { + "200": { + "$ref": "#/responses/getQueryHistoryResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, + "delete": { + "description": "Removes star from query in query history as specified by the UID.", "tags": [ - "orgs" + "query_history" ], - "summary": "Get Organization by ID.", - "operationId": "getOrgByName", + "summary": "Remove star to query in query history.", + "operationId": "unstarQuery", "parameters": [ { "type": "string", - "name": "org_name", + "name": "query_history_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getOrgByNameResponse" + "$ref": "#/responses/getQueryHistoryResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs/{org_id}": { - "get": { - "security": [ - { - "basic": [] - } - ], + "/query-history/{query_history_uid}": { + "delete": { + "description": "Deletes an existing query in query history as specified by the UID. This operation cannot be reverted.", "tags": [ - "orgs" + "query_history" ], - "summary": "Get Organization by ID.", - "operationId": "getOrgByID", + "summary": "Delete query in query history.", + "operationId": "deleteQuery", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "org_id", + "type": "string", + "name": "query_history_uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getOrgByIDResponse" + "$ref": "#/responses/getQueryHistoryDeleteQueryResponse" }, "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "$ref": "#/responses/unauthorisedError" }, "500": { "$ref": "#/responses/internalServerError" } } }, - "put": { - "security": [ - { - "basic": [] - } - ], + "patch": { + "description": "Updates comment for query in query history as specified by the UID.", "tags": [ - "orgs" + "query_history" ], - "summary": "Update Organization.", - "operationId": "updateOrg", + "summary": "Update comment for query in query history.", + "operationId": "patchQueryComment", "parameters": [ + { + "type": "string", + "name": "query_history_uid", + "in": "path", + "required": true + }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgForm" + "$ref": "#/definitions/PatchQueryCommentInQueryHistoryCommand" } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQueryHistoryResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4985,40 +6902,23 @@ "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "security": [ - { - "basic": [] - } - ], + } + }, + "/recording-rules": { + "get": { "tags": [ - "orgs" - ], - "summary": "Delete Organization.", - "operationId": "deleteOrgByID", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - } + "recording_rules", + "enterprise" ], + "summary": "Lists all rules in the database: active or deleted.", + "operationId": "listRecordingRules", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/listRecordingRulesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5033,38 +6933,27 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/orgs/{org_id}/address": { + }, "put": { "tags": [ - "orgs" + "recording_rules", + "enterprise" ], - "summary": "Update Organization's address.", - "operationId": "updateOrgAddress", + "summary": "Update the active status of a rule.", + "operationId": "updateRecordingRule", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgAddressForm" + "$ref": "#/definitions/RecordingRuleJSON" } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/recordingRuleResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5072,32 +6961,34 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "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).", + }, + "post": { "tags": [ - "orgs" + "recording_rules", + "enterprise" ], - "summary": "Fetch Organization quota.", - "operationId": "getOrgQuota", + "summary": "Create a recording rule that is then registered and started.", + "operationId": "createRecordingRule", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RecordingRuleJSON" + } } ], "responses": { "200": { - "$ref": "#/responses/getQuotaResponse" + "$ref": "#/responses/recordingRuleResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5114,40 +7005,22 @@ } } }, - "/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).", + "/recording-rules/test": { + "post": { "tags": [ - "orgs" + "recording_rules", + "enterprise" ], - "summary": "Update user quota.", - "operationId": "updateOrgQuota", + "summary": "Test a recording rule.", + "operationId": "testCreateRecordingRule", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgQuotaCmd" + "$ref": "#/definitions/RecordingRuleJSON" } - }, - { - "type": "string", - "name": "quota_target", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { @@ -5163,37 +7036,26 @@ "404": { "$ref": "#/responses/notFoundError" }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs/{org_id}/users": { + "/recording-rules/writer": { "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": "getOrgUsers", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - } + "recording_rules", + "enterprise" ], + "summary": "Return the prometheus remote write target.", + "operationId": "getRecordingRuleWriteTarget", "responses": { "200": { - "$ref": "#/responses/getOrgUsersResponse" + "$ref": "#/responses/recordingRuleWriteTargetResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5201,38 +7063,35 @@ "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:*`.", + "description": "It returns a 422 if there is not an existing prometheus data source configured.", "tags": [ - "orgs" + "recording_rules", + "enterprise" ], - "summary": "Add a new user to the current organization.", - "operationId": "addOrgUser", + "summary": "Create a remote write target.", + "operationId": "createRecordingRuleWriteTarget", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddOrgUserCommand" + "$ref": "#/definitions/PrometheusRemoteWriteTargetJSON" } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/recordingRuleWriteTargetResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5240,81 +7099,56 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/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": "removeOrgUser", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", - "in": "path", - "required": true - } + "recording_rules", + "enterprise" ], + "summary": "Delete the remote write target.", + "operationId": "deleteRecordingRuleWriteTarget", "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" } } - }, - "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:*`.", + } + }, + "/recording-rules/{recordingRuleID}": { + "delete": { "tags": [ - "orgs" + "recording_rules", + "enterprise" ], - "summary": "Update Users in Organization.", - "operationId": "updateOrgUser", + "summary": "Delete removes the rule from the registry and stops it.", + "operationId": "deleteRecordingRule", "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgUserCommand" - } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - }, { "type": "integer", "format": "int64", - "name": "user_id", + "name": "recordingRuleID", "in": "path", "required": true } @@ -5323,45 +7157,39 @@ "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/playlists": { - "get": { - "tags": [ - "playlists" - ], - "summary": "Get playlists.", - "operationId": "searchPlaylists", - "parameters": [ - { - "type": "string", - "name": "query", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "in:limit", - "name": "limit", - "in": "query" - } + "/reports": { + "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/searchPlaylistsResponse" + "$ref": "#/responses/getReportsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -5369,24 +7197,29 @@ } }, "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": [ - "playlists" + "reports", + "enterprise" ], - "summary": "Create playlist.", - "operationId": "createPlaylist", + "summary": "Create a report.", + "operationId": "createReport", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreatePlaylistCommand" + "$ref": "#/definitions/CreateOrUpdateConfigCmd" } } ], "responses": { "200": { - "$ref": "#/responses/createPlaylistResponse" + "$ref": "#/responses/createReportResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5403,24 +7236,31 @@ } } }, - "/playlists/{uid}": { - "get": { + "/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": [ - "playlists" + "reports", + "enterprise" ], - "summary": "Get playlist.", - "operationId": "getPlaylist", + "summary": "Send a report.", + "operationId": "sendReport", "parameters": [ { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ReportEmailDTO" + } } ], "responses": { "200": { - "$ref": "#/responses/getPlaylistResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5435,98 +7275,176 @@ "$ref": "#/responses/internalServerError" } } - }, - "put": { + } + }, + "/reports/render/pdf/{dashboardID}": { + "get": { + "description": "Please refer to [reports enterprise](#/reports/renderReportPDFs) instead. This will be removed in Grafana 10.", + "produces": [ + "application/pdf" + ], "tags": [ - "playlists" + "reports", + "enterprise" ], - "summary": "Update playlist.", - "operationId": "updatePlaylist", + "summary": "Render report for dashboard.", + "operationId": "renderReportPDF", + "deprecated": true, "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdatePlaylistCommand" - } + "type": "integer", + "format": "int64", + "name": "DashboardID", + "in": "path", + "required": true }, { - "type": "string", - "name": "uid", + "type": "integer", + "format": "int64", + "name": "dashboardID", "in": "path", "required": true + }, + { + "type": "string", + "name": "title", + "in": "query" + }, + { + "type": "string", + "name": "variables", + "in": "query" + }, + { + "type": "string", + "name": "from", + "in": "query" + }, + { + "type": "string", + "name": "to", + "in": "query" + }, + { + "type": "string", + "name": "orientation", + "in": "query" + }, + { + "type": "string", + "name": "layout", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/updatePlaylistResponse" + "$ref": "#/responses/contentResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { + } + }, + "/reports/render/pdfs": { + "get": { + "description": "Available to all users and with a valid license.", + "produces": [ + "application/pdf" + ], "tags": [ - "playlists" + "reports", + "enterprise" ], - "summary": "Delete playlist.", - "operationId": "deletePlaylist", + "summary": "Render report for multiple dashboards.", + "operationId": "renderReportPDFs", "parameters": [ { "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "dashboardID", + "in": "query" + }, + { + "type": "string", + "name": "orientation", + "in": "query" + }, + { + "type": "string", + "name": "layout", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/contentResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/playlists/{uid}/dashboards": { + "/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": [ - "playlists" + "reports", + "enterprise" ], - "summary": "Get playlist dashboards.", - "operationId": "getPlaylistDashboards", + "summary": "Get settings.", + "operationId": "getReportSettings", + "responses": { + "200": { + "$ref": "#/responses/getReportSettingsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$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", "parameters": [ { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/SettingsDTO" + } } ], "responses": { "200": { - "$ref": "#/responses/getPlaylistDashboardsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5534,33 +7452,37 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/playlists/{uid}/items": { - "get": { + "/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": [ - "playlists" + "reports", + "enterprise" ], - "summary": "Get playlist items.", - "operationId": "getPlaylistItems", + "summary": "Send test report via email.", + "operationId": "sendTestEmail", "parameters": [ { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateOrUpdateConfigCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/getPlaylistItemsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5577,109 +7499,73 @@ } } }, - "/query-history": { + "/reports/{id}": { "get": { - "description": "Returns a list of queries in the query history that matches the search criteria.\nQuery history search supports pagination. Use the `limit` parameter to control the maximum number of queries returned; the default limit is 100.\nYou can also use the `page` query parameter to fetch queries from any page other than the first one.", + "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": [ - "query_history" + "reports", + "enterprise" ], - "summary": "Query history search.", - "operationId": "searchQueries", + "summary": "Get a report.", + "operationId": "getReport", "parameters": [ - { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "description": "List of data source UIDs to search for", - "name": "datasourceUid", - "in": "query" - }, - { - "type": "string", - "description": "Text inside query or comments that is searched for", - "name": "searchString", - "in": "query" - }, - { - "type": "boolean", - "description": "Flag indicating if only starred queries should be returned", - "name": "onlyStarred", - "in": "query" - }, - { - "enum": [ - "time-desc", - "time-asc" - ], - "type": "string", - "default": "time-desc", - "description": "Sort method", - "name": "sort", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Use this parameter to access hits beyond limit. Numbering starts at 1. limit param acts as page size.", - "name": "page", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "Limit the number of returned results", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "description": "From range for the query history search", - "name": "from", - "in": "query" - }, { "type": "integer", "format": "int64", - "description": "To range for the query history search", - "name": "to", - "in": "query" + "name": "id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistorySearchResponse" + "$ref": "#/responses/getReportResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { - "description": "Adds new query to query history.", + "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": [ - "query_history" + "reports", + "enterprise" ], - "summary": "Add query to query history.", - "operationId": "createQuery", + "summary": "Update a report.", + "operationId": "updateReport", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateQueryInQueryHistoryCommand" + "$ref": "#/definitions/CreateOrUpdateConfigCmd" } + }, + { + "type": "integer", + "format": "int64", + "name": "id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5687,33 +7573,37 @@ "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/query-history/migrate": { - "post": { - "description": "Adds multiple queries to query history.", + }, + "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": [ - "query_history" + "reports", + "enterprise" ], - "summary": "Migrate queries to query history.", - "operationId": "migrateQueries", + "summary": "Delete a report.", + "operationId": "deleteReport", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/MigrateQueriesToQueryHistoryCommand" - } + "type": "integer", + "format": "int64", + "name": "id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryMigrationResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5721,128 +7611,117 @@ "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/query-history/star/{query_history_uid}": { + "/saml/acs": { "post": { - "description": "Adds star to query in query history as specified by the UID.", "tags": [ - "query_history" + "saml", + "enterprise" ], - "summary": "Add star to query in query history.", - "operationId": "starQuery", + "summary": "It performs assertion Consumer Service (ACS).", + "operationId": "postACS", "parameters": [ { "type": "string", - "name": "query_history_uid", - "in": "path", - "required": true + "name": "RelayState", + "in": "query" } ], "responses": { - "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "302": { + "description": "" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Removes star from query in query history as specified by the UID.", - "tags": [ - "query_history" + } + }, + "/saml/metadata": { + "get": { + "produces": [ + "application/xml;application/samlmetadata+xml" ], - "summary": "Remove star to query in query history.", - "operationId": "unstarQuery", - "parameters": [ - { - "type": "string", - "name": "query_history_uid", - "in": "path", - "required": true - } + "tags": [ + "saml", + "enterprise" ], + "summary": "It exposes the SP (Grafana's) metadata for the IdP's consumption.", + "operationId": "getMetadata", "responses": { "200": { - "$ref": "#/responses/getQueryHistoryResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "$ref": "#/responses/contentResponse" } } } }, - "/query-history/{query_history_uid}": { - "delete": { - "description": "Deletes an existing query in query history as specified by the UID. This operation cannot be reverted.", + "/saml/slo": { + "get": { + "description": "There might be two possible requests:\n1. Logout response (callback) when Grafana initiates single logout and IdP returns response to logout request.\n2. Logout request when another SP initiates single logout and IdP sends logout request to the Grafana,\nor in case of IdP-initiated logout.", "tags": [ - "query_history" - ], - "summary": "Delete query in query history.", - "operationId": "deleteQuery", - "parameters": [ - { - "type": "string", - "name": "query_history_uid", - "in": "path", - "required": true - } + "saml", + "enterprise" ], + "summary": "It performs Single Logout (SLO) callback.", + "operationId": "getSLO", "responses": { - "200": { - "$ref": "#/responses/getQueryHistoryDeleteQueryResponse" + "302": { + "description": "" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "400": { + "$ref": "#/responses/badRequestError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" } } }, - "patch": { - "description": "Updates comment for query in query history as specified by the UID.", + "post": { + "description": "There might be two possible requests:\n1. Logout response (callback) when Grafana initiates single logout and IdP returns response to logout request.\n2. Logout request when another SP initiates single logout and IdP sends logout request to the Grafana,\nor in case of IdP-initiated logout.", "tags": [ - "query_history" + "saml", + "enterprise" ], - "summary": "Update comment for query in query history.", - "operationId": "patchQueryComment", + "summary": "It performs Single Logout (SLO) callback.", + "operationId": "postSLO", "parameters": [ { "type": "string", - "name": "query_history_uid", - "in": "path", - "required": true + "name": "SAMLRequest", + "in": "query" }, { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PatchQueryCommentInQueryHistoryCommand" - } + "type": "string", + "name": "SAMLResponse", + "in": "query" } ], "responses": { - "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "302": { + "description": "" }, "400": { "$ref": "#/responses/badRequestError" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -6545,7 +8424,133 @@ ], "responses": { "200": { - "$ref": "#/responses/searchTeamsResponse" + "$ref": "#/responses/searchTeamsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/teams/{teamId}/groups": { + "get": { + "tags": [ + "sync_team_groups", + "enterprise" + ], + "summary": "Get External Groups.", + "operationId": "getTeamGroupsApi", + "parameters": [ + { + "type": "integer", + "format": "int64", + "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": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/TeamGroupMapping" + } + }, + { + "type": "integer", + "format": "int64", + "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": "string", + "name": "groupId", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "teamId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6553,6 +8558,9 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } @@ -7702,6 +9710,42 @@ } }, "definitions": { + "ActiveSyncStatusDTO": { + "description": "ActiveSyncStatusDTO holds the information for LDAP background Sync", + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "nextSync": { + "type": "string", + "format": "date-time" + }, + "prevSync": { + "$ref": "#/definitions/SyncResult" + }, + "schedule": { + "type": "string" + } + } + }, + "ActiveUserStats": { + "type": "object", + "properties": { + "active_admins_and_editors": { + "type": "integer", + "format": "int64" + }, + "active_users": { + "type": "integer", + "format": "int64" + }, + "active_viewers": { + "type": "integer", + "format": "int64" + } + } + }, "AddCommand": { "type": "object", "properties": { @@ -7808,6 +9852,25 @@ } } }, + "AddPermissionDTO": { + "type": "object", + "properties": { + "builtinRole": { + "type": "string" + }, + "permission": { + "$ref": "#/definitions/DsPermissionType" + }, + "teamId": { + "type": "integer", + "format": "int64" + }, + "userId": { + "type": "integer", + "format": "int64" + } + } + }, "AddServiceAccountTokenCommand": { "type": "object", "properties": { @@ -7829,6 +9892,25 @@ } } }, + "AddTeamRoleCommand": { + "type": "object", + "properties": { + "roleUid": { + "type": "string" + } + } + }, + "AddUserRoleCommand": { + "type": "object", + "properties": { + "global": { + "type": "boolean" + }, + "roleUid": { + "type": "string" + } + } + }, "Address": { "type": "object", "properties": { @@ -8232,6 +10314,26 @@ } } }, + "BrandingOptionsDTO": { + "type": "object", + "properties": { + "emailFooterLink": { + "type": "string" + }, + "emailFooterMode": { + "type": "string" + }, + "emailFooterText": { + "type": "string" + }, + "emailLogoUrl": { + "type": "string" + }, + "reportLogoUrl": { + "type": "string" + } + } + }, "CalculateDiffTarget": { "type": "object", "properties": { @@ -8264,6 +10366,84 @@ "type": "number", "format": "double" }, + "ConfigDTO": { + "description": "ConfigDTO is model representation in transfer", + "type": "object", + "properties": { + "created": { + "type": "string", + "format": "date-time" + }, + "dashboardId": { + "type": "integer", + "format": "int64" + }, + "dashboardName": { + "type": "string" + }, + "dashboardUid": { + "type": "string" + }, + "dashboards": { + "type": "array", + "items": { + "$ref": "#/definitions/DashboardDTO" + } + }, + "enableCsv": { + "type": "boolean" + }, + "enableDashboardUrl": { + "type": "boolean" + }, + "formats": { + "type": "array", + "items": { + "$ref": "#/definitions/Type" + } + }, + "id": { + "type": "integer", + "format": "int64" + }, + "message": { + "type": "string" + }, + "name": { + "type": "string" + }, + "options": { + "$ref": "#/definitions/ReportOptionsDTO" + }, + "orgId": { + "type": "integer", + "format": "int64" + }, + "recipients": { + "type": "string" + }, + "replyTo": { + "type": "string" + }, + "schedule": { + "$ref": "#/definitions/ScheduleDTO" + }, + "state": { + "$ref": "#/definitions/State" + }, + "templateVars": { + "type": "object" + }, + "updated": { + "type": "string", + "format": "date-time" + }, + "userId": { + "type": "integer", + "format": "int64" + } + } + }, "Correlation": { "description": "Correlation is the model for correlations definitions", "type": "object", @@ -8503,6 +10683,60 @@ } } }, + "CreateOrUpdateConfigCmd": { + "type": "object", + "properties": { + "dashboardId": { + "type": "integer", + "format": "int64" + }, + "dashboardUid": { + "type": "string" + }, + "dashboards": { + "type": "array", + "items": { + "$ref": "#/definitions/DashboardDTO" + } + }, + "enableCsv": { + "type": "boolean" + }, + "enableDashboardUrl": { + "type": "boolean" + }, + "formats": { + "type": "array", + "items": { + "$ref": "#/definitions/Type" + } + }, + "message": { + "type": "string" + }, + "name": { + "type": "string" + }, + "options": { + "$ref": "#/definitions/ReportOptionsDTO" + }, + "recipients": { + "type": "string" + }, + "replyTo": { + "type": "string" + }, + "schedule": { + "$ref": "#/definitions/ScheduleDTO" + }, + "state": { + "$ref": "#/definitions/State" + }, + "templateVars": { + "type": "object" + } + } + }, "CreateOrgCommand": { "type": "object", "properties": { @@ -8545,6 +10779,42 @@ } } }, + "CreateRoleForm": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "global": { + "type": "boolean" + }, + "group": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/definitions/Permission" + } + }, + "uid": { + "type": "string" + }, + "version": { + "type": "integer", + "format": "int64" + } + } + }, "CreateServiceAccountForm": { "type": "object", "properties": { @@ -8552,29 +10822,76 @@ "type": "boolean", "example": false }, - "name": { - "type": "string", - "example": "grafana" + "name": { + "type": "string", + "example": "grafana" + }, + "role": { + "type": "string", + "enum": [ + "Viewer", + "Editor", + "Admin" + ], + "example": "Admin" + } + } + }, + "CreateTeamCommand": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "CustomPermissionsRecordDTO": { + "type": "object", + "properties": { + "customPermissions": { + "type": "string" + }, + "granteeName": { + "type": "string" + }, + "granteeType": { + "type": "string" + }, + "granteeUrl": { + "type": "string" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "isFolder": { + "type": "boolean" + }, + "orgId": { + "type": "integer", + "format": "int64" + }, + "orgRole": { + "type": "string" }, - "role": { - "type": "string", - "enum": [ - "Viewer", - "Editor", - "Admin" - ], - "example": "Admin" - } - } - }, - "CreateTeamCommand": { - "type": "object", - "properties": { - "email": { + "slug": { "type": "string" }, - "name": { + "title": { + "type": "string" + }, + "uid": { + "type": "string" + }, + "url": { "type": "string" + }, + "usersCount": { + "type": "integer", + "format": "int64" } } }, @@ -8681,6 +10998,20 @@ } } }, + "DashboardDTO": { + "type": "object", + "properties": { + "dashboard": { + "$ref": "#/definitions/DashboardReportDTO" + }, + "reportVariables": { + "type": "object" + }, + "timeRange": { + "$ref": "#/definitions/TimeRangeDTO" + } + } + }, "DashboardFullWithMeta": { "type": "object", "properties": { @@ -8794,6 +11125,21 @@ } } }, + "DashboardReportDTO": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "uid": { + "type": "string" + } + } + }, "DashboardSnapshot": { "description": "DashboardSnapshot model", "type": "object", @@ -9142,6 +11488,83 @@ } } }, + "DataSourcePermissionRuleDTO": { + "type": "object", + "properties": { + "builtInRole": { + "type": "string" + }, + "created": { + "type": "string", + "format": "date-time" + }, + "datasourceId": { + "type": "integer", + "format": "int64" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "isManaged": { + "type": "boolean" + }, + "permission": { + "$ref": "#/definitions/DsPermissionType" + }, + "permissionName": { + "type": "string" + }, + "team": { + "type": "string" + }, + "teamAvatarUrl": { + "type": "string" + }, + "teamEmail": { + "type": "string" + }, + "teamId": { + "type": "integer", + "format": "int64" + }, + "updated": { + "type": "string", + "format": "date-time" + }, + "userAvatarUrl": { + "type": "string" + }, + "userEmail": { + "type": "string" + }, + "userId": { + "type": "integer", + "format": "int64" + }, + "userLogin": { + "type": "string" + } + } + }, + "DataSourcePermissionsDTO": { + "type": "object", + "properties": { + "datasourceId": { + "type": "integer", + "format": "int64" + }, + "enabled": { + "type": "boolean" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/definitions/DataSourcePermissionRuleDTO" + } + } + } + }, "DataTopic": { "type": "string", "title": "DataTopic is used to identify which topic the frame should be assigned to." @@ -9155,6 +11578,14 @@ } } }, + "DeleteTokenCommand": { + "type": "object", + "properties": { + "instance": { + "type": "string" + } + } + }, "DsAccess": { "type": "string" }, @@ -9205,6 +11636,18 @@ } } }, + "FailedUser": { + "description": "FailedUser holds the information of an user that failed", + "type": "object", + "properties": { + "Error": { + "type": "string" + }, + "Login": { + "type": "string" + } + } + }, "Field": { "description": "A Field is essentially a slice of various types with extra properties and methods.\nSee NewField() for supported types.\n\nThe slice data in the Field is a not exported, so methods on the Field are used to to manipulate its data.", "type": "object", @@ -10433,6 +12876,26 @@ } } }, + "Permission": { + "type": "object", + "title": "Permission is the model for access control permissions.", + "properties": { + "action": { + "type": "string" + }, + "created": { + "type": "string", + "format": "date-time" + }, + "scope": { + "type": "string" + }, + "updated": { + "type": "string", + "format": "date-time" + } + } + }, "PermissionType": { "type": "integer", "format": "int64" @@ -10601,6 +13064,20 @@ } } }, + "PrometheusRemoteWriteTargetJSON": { + "type": "object", + "properties": { + "data_source_uid": { + "type": "string" + }, + "id": { + "type": "string" + }, + "remote_write_path": { + "type": "string" + } + } + }, "QueryDataResponse": { "description": "It is the return type of a QueryData call.", "type": "object", @@ -10747,74 +13224,154 @@ "description": "DisplayNameFromDS overrides Grafana default naming in a better way that allows users to override it easily.", "type": "string" }, - "filterable": { - "description": "Filterable indicates if the Field's data can be filtered by additional calls.", - "type": "boolean" - }, - "interval": { - "description": "Interval indicates the expected regular step between values in the series.\nWhen an interval exists, consumers can identify \"missing\" values when the expected value is not present.\nThe grafana timeseries visualization will render disconnected values when missing values are found it the time field.\nThe interval uses the same units as the values. For time.Time, this is defined in milliseconds.", - "type": "number", - "format": "double" + "filterable": { + "description": "Filterable indicates if the Field's data can be filtered by additional calls.", + "type": "boolean" + }, + "interval": { + "description": "Interval indicates the expected regular step between values in the series.\nWhen an interval exists, consumers can identify \"missing\" values when the expected value is not present.\nThe grafana timeseries visualization will render disconnected values when missing values are found it the time field.\nThe interval uses the same units as the values. For time.Time, this is defined in milliseconds.", + "type": "number", + "format": "double" + }, + "links": { + "description": "The behavior when clicking on a result", + "type": "array", + "items": { + "$ref": "#/definitions/DataLink" + } + }, + "mappings": { + "$ref": "#/definitions/ValueMappings" + }, + "max": { + "$ref": "#/definitions/ConfFloat64" + }, + "min": { + "$ref": "#/definitions/ConfFloat64" + }, + "noValue": { + "description": "Alternative to empty string", + "type": "string" + }, + "path": { + "description": "Path is an explicit path to the field in the datasource. When the frame meta includes a path,\nthis will default to `${frame.meta.path}/${field.name}\n\nWhen defined, this value can be used as an identifier within the datasource scope, and\nmay be used as an identifier to update values in a subsequent request", + "type": "string" + }, + "thresholds": { + "$ref": "#/definitions/ThresholdsConfig" + }, + "unit": { + "description": "Numeric Options", + "type": "string" + }, + "value": { + "type": "number", + "format": "double" + }, + "writeable": { + "description": "Writeable indicates that the datasource knows how to update this value", + "type": "boolean" + } + } + }, + "QueryToMigrate": { + "type": "object", + "properties": { + "comment": { + "type": "string" + }, + "createdAt": { + "type": "integer", + "format": "int64" + }, + "datasourceUid": { + "type": "string" + }, + "queries": { + "$ref": "#/definitions/Json" + }, + "starred": { + "type": "boolean" + } + } + }, + "RecordingRuleJSON": { + "description": "RecordingRuleJSON is the external representation of a recording rule", + "type": "object", + "properties": { + "active": { + "type": "boolean" + }, + "count": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "dest_data_source_uid": { + "type": "string" + }, + "id": { + "type": "string" + }, + "interval": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "prom_name": { + "type": "string" }, - "links": { - "description": "The behavior when clicking on a result", + "queries": { "type": "array", "items": { - "$ref": "#/definitions/DataLink" + "type": "object", + "additionalProperties": {} } }, - "mappings": { - "$ref": "#/definitions/ValueMappings" - }, - "max": { - "$ref": "#/definitions/ConfFloat64" - }, - "min": { - "$ref": "#/definitions/ConfFloat64" + "range": { + "type": "integer", + "format": "int64" }, - "noValue": { - "description": "Alternative to empty string", + "target_ref_id": { "type": "string" - }, - "path": { - "description": "Path is an explicit path to the field in the datasource. When the frame meta includes a path,\nthis will default to `${frame.meta.path}/${field.name}\n\nWhen defined, this value can be used as an identifier within the datasource scope, and\nmay be used as an identifier to update values in a subsequent request", + } + } + }, + "ReportEmailDTO": { + "type": "object", + "properties": { + "email": { "type": "string" }, - "thresholds": { - "$ref": "#/definitions/ThresholdsConfig" - }, - "unit": { - "description": "Numeric Options", + "emails": { + "description": "Comma-separated list of emails to which to send the report to.", "type": "string" }, - "value": { - "type": "number", - "format": "double" + "id": { + "description": "Send the report to the emails specified in the report. Required if emails is not present.", + "type": "string", + "format": "int64" }, - "writeable": { - "description": "Writeable indicates that the datasource knows how to update this value", + "useEmailsFromReport": { + "description": "Send the report to the emails specified in the report. Required if emails is not present.", "type": "boolean" } } }, - "QueryToMigrate": { + "ReportOptionsDTO": { "type": "object", "properties": { - "comment": { + "layout": { "type": "string" }, - "createdAt": { - "type": "integer", - "format": "int64" - }, - "datasourceUid": { + "orientation": { "type": "string" }, - "queries": { - "$ref": "#/definitions/Json" - }, - "starred": { - "type": "boolean" + "timeRange": { + "$ref": "#/definitions/TimeRangeDTO" } } }, @@ -10844,6 +13401,79 @@ } } }, + "RoleAssignmentsDTO": { + "type": "object", + "properties": { + "role_uid": { + "type": "string" + }, + "service_accounts": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "teams": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "users": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + } + } + }, + "RoleDTO": { + "type": "object", + "properties": { + "created": { + "type": "string", + "format": "date-time" + }, + "delegatable": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "group": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/definitions/Permission" + } + }, + "uid": { + "type": "string" + }, + "updated": { + "type": "string", + "format": "date-time" + }, + "version": { + "type": "integer", + "format": "int64" + } + } + }, "SaveDashboardCommand": { "type": "object", "properties": { @@ -10876,6 +13506,49 @@ } } }, + "ScheduleDTO": { + "type": "object", + "properties": { + "day": { + "type": "string" + }, + "dayOfMonth": { + "type": "string" + }, + "endDate": { + "type": "string", + "format": "date-time" + }, + "frequency": { + "type": "string" + }, + "hour": { + "type": "integer", + "format": "int64" + }, + "intervalAmount": { + "type": "integer", + "format": "int64" + }, + "intervalFrequency": { + "type": "string" + }, + "minute": { + "type": "integer", + "format": "int64" + }, + "startDate": { + "type": "string", + "format": "date-time" + }, + "timeZone": { + "type": "string" + }, + "workdaysOnly": { + "type": "boolean" + } + } + }, "SearchServiceAccountsResult": { "description": "swagger: model", "type": "object", @@ -11060,6 +13733,49 @@ } } }, + "SetRoleAssignmentsCommand": { + "type": "object", + "properties": { + "service_accounts": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "teams": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "users": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + } + } + }, + "SetUserRolesCommand": { + "type": "object", + "properties": { + "global": { + "type": "boolean" + }, + "includeHidden": { + "type": "boolean" + }, + "roleUids": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "SettingsBag": { "type": "object", "additionalProperties": { @@ -11069,6 +13785,37 @@ } } }, + "SettingsDTO": { + "type": "object", + "properties": { + "branding": { + "$ref": "#/definitions/BrandingOptionsDTO" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "orgId": { + "type": "integer", + "format": "int64" + }, + "userId": { + "type": "integer", + "format": "int64" + } + } + }, + "State": { + "type": "string" + }, + "Status": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + } + } + }, "SuccessResponseBody": { "type": "object", "properties": { @@ -11077,6 +13824,39 @@ } } }, + "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" + } + } + } + }, "TagsDTO": { "type": "object", "title": "TagsDTO is the frontend DTO for Tag.", @@ -11125,6 +13905,30 @@ } } }, + "TeamGroupDTO": { + "type": "object", + "properties": { + "groupId": { + "type": "string" + }, + "orgId": { + "type": "integer", + "format": "int64" + }, + "teamId": { + "type": "integer", + "format": "int64" + } + } + }, + "TeamGroupMapping": { + "type": "object", + "properties": { + "groupId": { + "type": "string" + } + } + }, "TeamMemberDTO": { "type": "object", "properties": { @@ -11260,6 +14064,104 @@ "description": "ThresholdsMode absolute or percentage", "type": "string" }, + "TimeRangeDTO": { + "type": "object", + "properties": { + "from": { + "type": "string" + }, + "to": { + "type": "string" + } + } + }, + "Token": { + "type": "object", + "properties": { + "account": { + "type": "string" + }, + "company": { + "type": "string" + }, + "details_url": { + "type": "string" + }, + "exp": { + "type": "integer", + "format": "int64" + }, + "iat": { + "type": "integer", + "format": "int64" + }, + "included_users": { + "type": "integer", + "format": "int64" + }, + "iss": { + "type": "string" + }, + "jti": { + "type": "string" + }, + "lexp": { + "type": "integer", + "format": "int64" + }, + "lic_exp_warn_days": { + "type": "integer", + "format": "int64" + }, + "lid": { + "type": "string" + }, + "limit_by": { + "type": "string" + }, + "max_concurrent_user_sessions": { + "type": "integer", + "format": "int64" + }, + "nbf": { + "type": "integer", + "format": "int64" + }, + "prod": { + "type": "array", + "items": { + "type": "string" + } + }, + "slug": { + "type": "string" + }, + "status": { + "$ref": "#/definitions/TokenStatus" + }, + "sub": { + "type": "string" + }, + "tok_exp_warn_days": { + "type": "integer", + "format": "int64" + }, + "trial": { + "type": "boolean" + }, + "trial_exp": { + "type": "integer", + "format": "int64" + }, + "update_days": { + "type": "integer", + "format": "int64" + }, + "usage_billing": { + "type": "boolean" + } + } + }, "TokenDTO": { "type": "object", "properties": { @@ -11302,6 +14204,10 @@ } } }, + "TokenStatus": { + "type": "integer", + "format": "int64" + }, "TrimDashboardCommand": { "type": "object", "properties": { @@ -11324,6 +14230,9 @@ } } }, + "Type": { + "type": "string" + }, "UpdateAlertNotificationCommand": { "type": "object", "properties": { @@ -11652,6 +14561,39 @@ } } }, + "UpdateRoleCommand": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "global": { + "type": "boolean" + }, + "group": { + "type": "string" + }, + "hidden": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/definitions/Permission" + } + }, + "version": { + "type": "integer", + "format": "int64" + } + } + }, "UpdateServiceAccountForm": { "type": "object", "properties": { @@ -11964,6 +14906,21 @@ "$ref": "#/definitions/ErrorResponseBody" } }, + "addPermissionResponse": { + "description": "", + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "permissionId": { + "type": "integer", + "format": "int64" + } + } + } + }, "adminCreateUserResponse": { "description": "", "schema": { @@ -12013,6 +14970,16 @@ "$ref": "#/definitions/ErrorResponseBody" } }, + "contentResponse": { + "description": "", + "schema": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8" + } + } + }, "createCorrelationResponse": { "description": "", "schema": { @@ -12108,6 +15075,27 @@ "$ref": "#/definitions/Playlist" } }, + "createReportResponse": { + "description": "", + "schema": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "message": { + "type": "string" + } + } + } + }, + "createRoleResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/RoleDTO" + } + }, "createServiceAccountResponse": { "description": "", "schema": { @@ -12292,6 +15280,12 @@ } } }, + "getAccessControlStatusResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/Status" + } + }, "getAlertNotificationChannelResponse": { "description": "", "schema": { @@ -12331,6 +15325,21 @@ } } }, + "getAllPermissionseResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/DataSourcePermissionsDTO" + } + }, + "getAllRolesResponse": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/RoleDTO" + } + } + }, "getAnnotationByIDResponse": { "description": "", "schema": { @@ -12382,6 +15391,15 @@ "$ref": "#/definitions/OrgDetailsDTO" } }, + "getCustomPermissionsReportResponse": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/CustomPermissionsRecordDTO" + } + } + }, "getDashboardPermissionsListResponse": { "description": "", "schema": { @@ -12483,6 +15501,12 @@ "$ref": "#/definitions/LibraryElementSearchResponse" } }, + "getLicenseTokenResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/Token" + } + }, "getOrgByIDResponse": { "description": "", "schema": { @@ -12591,6 +15615,39 @@ } } }, + "getReportResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/ConfigDTO" + } + }, + "getReportSettingsResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/SettingsDTO" + } + }, + "getReportsResponse": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/ConfigDTO" + } + } + }, + "getRoleAssignmentsResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/RoleAssignmentsDTO" + } + }, + "getRoleResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/RoleDTO" + } + }, "getSharingOptionsResponse": { "description": "", "schema": { @@ -12626,12 +15683,30 @@ } } }, + "getStatusResponse": { + "description": "" + }, + "getSyncStatusResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/ActiveSyncStatusDTO" + } + }, "getTeamByIDResponse": { "description": "", "schema": { "$ref": "#/definitions/TeamDTO" } }, + "getTeamGroupsApiResponse": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/TeamGroupDTO" + } + } + }, "getTeamMembersResponse": { "description": "", "schema": { @@ -12695,6 +15770,36 @@ "$ref": "#/definitions/ErrorResponseBody" } }, + "listBuiltinRolesResponse": { + "description": "", + "schema": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "$ref": "#/definitions/RoleDTO" + } + } + } + }, + "listRecordingRulesResponse": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/RecordingRuleJSON" + } + } + }, + "listRolesResponse": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/RoleDTO" + } + } + }, "listSortOptionsResponse": { "description": "", "schema": { @@ -12855,6 +15960,9 @@ } } }, + "postRenewLicenseTokenResponse": { + "description": "" + }, "preconditionFailedError": { "description": "PreconditionFailedError", "schema": { @@ -12867,6 +15975,24 @@ "$ref": "#/definitions/QueryDataResponse" } }, + "recordingRuleResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/RecordingRuleJSON" + } + }, + "recordingRuleWriteTargetResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/PrometheusRemoteWriteTargetJSON" + } + }, + "refreshLicenseStatsResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/ActiveUserStats" + } + }, "retrieveServiceAccountResponse": { "description": "", "schema": { @@ -12921,6 +16047,12 @@ "$ref": "#/definitions/SearchUserQueryResult" } }, + "setRoleAssignmentsResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/RoleAssignmentsDTO" + } + }, "testAlertResponse": { "description": "", "schema": { diff --git a/public/app/plugins/panel/gauge/GaugePanel.tsx b/public/app/plugins/panel/gauge/GaugePanel.tsx index a0295638a390..226fc47f33ef 100644 --- a/public/app/plugins/panel/gauge/GaugePanel.tsx +++ b/public/app/plugins/panel/gauge/GaugePanel.tsx @@ -28,7 +28,6 @@ export class GaugePanel extends PureComponent> { text={options.text} showThresholdLabels={options.showThresholdLabels} showThresholdMarkers={options.showThresholdMarkers} - neutral={options.neutral} theme={config.theme} onClick={openMenu} className={targetClassName} diff --git a/public/app/plugins/panel/gauge/models.cue b/public/app/plugins/panel/gauge/models.cue index e971e26ad397..a36918c357cf 100644 --- a/public/app/plugins/panel/gauge/models.cue +++ b/public/app/plugins/panel/gauge/models.cue @@ -29,7 +29,6 @@ Panel: thema.#Lineage & { ui.SingleStatBaseOptions showThresholdLabels: bool | *false showThresholdMarkers: bool | *true - neutral: number } @cuetsy(kind="interface") }, ] diff --git a/public/app/plugins/panel/gauge/models.gen.ts b/public/app/plugins/panel/gauge/models.gen.ts index f343823d07a3..19bfd5bfd48f 100644 --- a/public/app/plugins/panel/gauge/models.gen.ts +++ b/public/app/plugins/panel/gauge/models.gen.ts @@ -13,7 +13,6 @@ import * as ui from '@grafana/schema'; export const PanelModelVersion = Object.freeze([0, 0]); export interface PanelOptions extends ui.SingleStatBaseOptions { - neutral: number; showThresholdLabels: boolean; showThresholdMarkers: boolean; } diff --git a/public/app/plugins/panel/gauge/module.tsx b/public/app/plugins/panel/gauge/module.tsx index 2754c4b3929f..3a36fd460a2b 100644 --- a/public/app/plugins/panel/gauge/module.tsx +++ b/public/app/plugins/panel/gauge/module.tsx @@ -26,12 +26,6 @@ export const plugin = new PanelPlugin(GaugePanel) name: 'Show threshold markers', description: 'Renders the thresholds as an outer bar', defaultValue: defaultPanelOptions.showThresholdMarkers, - }) - .addNumberInput({ - path: 'neutral', - name: 'Neutral', - description: 'Set the neutral point of the gauge', - category: ['Standard options'], }); commonOptionsBuilder.addTextSizeOptions(builder); diff --git a/public/vendor/flot/jquery.flot.gauge.js b/public/vendor/flot/jquery.flot.gauge.js index 24e7882bba84..ae27e9ac4aef 100644 --- a/public/vendor/flot/jquery.flot.gauge.js +++ b/public/vendor/flot/jquery.flot.gauge.js @@ -327,7 +327,8 @@ var blur = gaugeOptionsi.gauge.shadow.show ? gaugeOptionsi.gauge.shadow.blur : 0; var color = getColor(gaugeOptionsi, data); - var angles = calculateAnglesForGauge(gaugeOptionsi, layout, data); + var hasNegative = gaugeOptionsi.gauge.min < 0.0 + var angles = calculateAnglesForGauge(gaugeOptionsi, layout, data, hasNegative); // draw gauge frame drawArcWithShadow( @@ -355,7 +356,7 @@ color, // fill color blur); - if(gaugeOptionsi.gauge.neutralValue != null) + if(hasNegative) drawZeroMarker(gaugeOptionsi, layout, cellLayout, color); } @@ -368,16 +369,16 @@ * @param {Number} data the value of the gauge * @returns {Object} */ - function calculateAnglesForGauge(gaugeOptionsi, layout, data) { + function calculateAnglesForGauge(gaugeOptionsi, layout, data, hasNegative) { let angles = {}; - var neutral = gaugeOptionsi.gauge.neutralValue + var isNegative = data < 0.0 - if (neutral != null) { - if (data < neutral) { + if (hasNegative) { + if (isNegative) { angles.a1 = calculateAngle(gaugeOptionsi, layout, data); - angles.a2 = calculateAngle(gaugeOptionsi, layout, neutral); + angles.a2 = calculateAngle(gaugeOptionsi, layout, 0.0); } else { - angles.a1 = calculateAngle(gaugeOptionsi, layout, neutral); + angles.a1 = calculateAngle(gaugeOptionsi, layout, 0.0); angles.a2 = calculateAngle(gaugeOptionsi, layout, data); } } else { @@ -398,15 +399,15 @@ * @param {String} color line color */ function drawZeroMarker(gaugeOptionsi, layout, cellLayout, color) { - var diff = (gaugeOptionsi.gauge.max - gaugeOptionsi.gauge.min) / 600; + var diff = (gaugeOptionsi.gauge.max - gaugeOptionsi.gauge.min) / 800; drawArc(context, cellLayout.cx, cellLayout.cy, layout.radius - 2, layout.width - 4, - toRad(calculateAngle(gaugeOptionsi, layout, gaugeOptionsi.gauge.neutralValue-diff)), - toRad(calculateAngle(gaugeOptionsi, layout, gaugeOptionsi.gauge.neutralValue+diff)), + toRad(calculateAngle(gaugeOptionsi, layout, -diff)), + toRad(calculateAngle(gaugeOptionsi, layout, diff)), color, 2, gaugeOptionsi.gauge.background.color); diff --git a/yarn.lock b/yarn.lock index a54b0df0fe07..ee1696994c46 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16283,10 +16283,38 @@ __metadata: languageName: node linkType: hard -"caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001109, caniuse-lite@npm:^1.0.30001271, caniuse-lite@npm:^1.0.30001286, caniuse-lite@npm:^1.0.30001317, caniuse-lite@npm:^1.0.30001332, caniuse-lite@npm:^1.0.30001335, caniuse-lite@npm:^1.0.30001349, caniuse-lite@npm:^1.0.30001400": - version: 1.0.30001420 - resolution: "caniuse-lite@npm:1.0.30001420" - checksum: dfa5027b2aeaba3ab1731735a46aecf62f286cdeec7f8ccb0f8cce0a3d02447e640e944d9bf5d9ea98b53fac6c2b168bb18f4c9ad598d92a2da7b05e2aea06e2 +"caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001271, caniuse-lite@npm:^1.0.30001286, caniuse-lite@npm:^1.0.30001317": + version: 1.0.30001332 + resolution: "caniuse-lite@npm:1.0.30001332" + checksum: e54182ea42ab3d2ff1440f9a6480292f7ab23c00c188df7ad65586312e4da567e8bedd5cb5fb8f0ff4193dc027a54e17e0b3c0b6db5d5a3fb61c7726ff9c45b3 + languageName: node + linkType: hard + +"caniuse-lite@npm:^1.0.30001109, caniuse-lite@npm:^1.0.30001349": + version: 1.0.30001349 + resolution: "caniuse-lite@npm:1.0.30001349" + checksum: 0095fcbb7ca4ef76227f5c3788c3cdbad3c52a25825c577371ffa73a44d74ff43fc5a849e5fa37c8b4c6237bb5272777085e1f674f9f86fde9aed85201d26f07 + languageName: node + linkType: hard + +"caniuse-lite@npm:^1.0.30001332": + version: 1.0.30001335 + resolution: "caniuse-lite@npm:1.0.30001335" + checksum: fe08b49ec6cb76cc69958ff001cf89d0a8ef9f35e0c8028b65981585046384f76e007d64dea372a34ca56d91caa83cc614c00779fe2b4d378aa0e68696374f67 + languageName: node + linkType: hard + +"caniuse-lite@npm:^1.0.30001335": + version: 1.0.30001341 + resolution: "caniuse-lite@npm:1.0.30001341" + checksum: 7262b093fb0bf49dbc5328418f5ce4e3dbb0b13e39c015f986ba1807634c123ac214efc94df7d095a336f57f86852b4b63ee61838f18dcc3a4a35f87b390c8f5 + languageName: node + linkType: hard + +"caniuse-lite@npm:^1.0.30001400": + version: 1.0.30001402 + resolution: "caniuse-lite@npm:1.0.30001402" + checksum: 6068ccccd64b357f75388cb2303cf351b686b20800571d0a845bff5c0e0d24f83df0133afbbdd8177a33eb087c93d39ecf359035a52b2feac5f182c946f706ee languageName: node linkType: hard From bb23215e0977b1864861270b8bb5f43a2f2285b7 Mon Sep 17 00:00:00 2001 From: sfranzis Date: Thu, 10 Nov 2022 11:07:23 +0100 Subject: [PATCH 09/25] zero option --- public/app/plugins/panel/gauge/module.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/app/plugins/panel/gauge/module.tsx b/public/app/plugins/panel/gauge/module.tsx index 3a36fd460a2b..2754c4b3929f 100644 --- a/public/app/plugins/panel/gauge/module.tsx +++ b/public/app/plugins/panel/gauge/module.tsx @@ -26,6 +26,12 @@ export const plugin = new PanelPlugin(GaugePanel) name: 'Show threshold markers', description: 'Renders the thresholds as an outer bar', defaultValue: defaultPanelOptions.showThresholdMarkers, + }) + .addNumberInput({ + path: 'neutral', + name: 'Neutral', + description: 'Set the neutral point of the gauge', + category: ['Standard options'], }); commonOptionsBuilder.addTextSizeOptions(builder); From 49318921bca4c9a0c936e45d9e3f19c37636fbd0 Mon Sep 17 00:00:00 2001 From: sfranzis Date: Thu, 10 Nov 2022 11:54:52 +0100 Subject: [PATCH 10/25] threshold value for zero --- public/vendor/flot/jquery.flot.gauge.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/public/vendor/flot/jquery.flot.gauge.js b/public/vendor/flot/jquery.flot.gauge.js index ae27e9ac4aef..8f8d9e5396c8 100644 --- a/public/vendor/flot/jquery.flot.gauge.js +++ b/public/vendor/flot/jquery.flot.gauge.js @@ -327,7 +327,8 @@ var blur = gaugeOptionsi.gauge.shadow.show ? gaugeOptionsi.gauge.shadow.blur : 0; var color = getColor(gaugeOptionsi, data); - var hasNegative = gaugeOptionsi.gauge.min < 0.0 + var hasPositive = gaugeOptionsi.gauge.max > 0.0; + var hasNegative = gaugeOptionsi.gauge.min < 0.0; var angles = calculateAnglesForGauge(gaugeOptionsi, layout, data, hasNegative); // draw gauge frame @@ -356,8 +357,9 @@ color, // fill color blur); - if(hasNegative) + if(hasPositive && hasNegative) { drawZeroMarker(gaugeOptionsi, layout, cellLayout, color); + } } /** @@ -584,6 +586,12 @@ drawThresholdValue(gaugeOptionsi, layout, cellLayout, i + "_" + j, threshold.value, a); } } + + var hasPositive = gaugeOptionsi.gauge.max > 0.0; + var hasNegative = gaugeOptionsi.gauge.min < 0.0; + if(hasPositive && hasNegative) { + drawThresholdValue(gaugeOptionsi, layout, cellLayout, "Zero" + i, 0, calculateAngle(gaugeOptionsi, layout, 0)); + } } /** @@ -637,7 +645,7 @@ * @param {Object} textOptions the option of the text * @param {Number} [a] the angle of the value drawn */ - function drawText(x, y, id, text, textOptions, a) { + function drawText(x, y, id, text, textOptions, a) { var span = $(placeholder).find("#" + id); var exists = span.length; if (!exists) { From 236a8543b4a78c4df22fe8a4fb7562408866d352 Mon Sep 17 00:00:00 2001 From: sfranzis Date: Thu, 10 Nov 2022 17:08:38 +0100 Subject: [PATCH 11/25] fix merge --- .../grafana-ui/src/components/Gauge/Gauge.tsx | 5 +++- public/app/plugins/panel/gauge/GaugePanel.tsx | 1 + public/app/plugins/panel/gauge/models.cue | 1 + public/app/plugins/panel/gauge/models.gen.ts | 1 + public/vendor/flot/jquery.flot.gauge.js | 26 +++++++++---------- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/packages/grafana-ui/src/components/Gauge/Gauge.tsx b/packages/grafana-ui/src/components/Gauge/Gauge.tsx index 39e7a80808e0..3795b578fa51 100644 --- a/packages/grafana-ui/src/components/Gauge/Gauge.tsx +++ b/packages/grafana-ui/src/components/Gauge/Gauge.tsx @@ -22,6 +22,7 @@ export interface Props { field: FieldConfig; showThresholdMarkers: boolean; showThresholdLabels: boolean; + neutral: Number; width: number; value: DisplayValue; text?: VizTextDisplayOptions; @@ -52,7 +53,7 @@ export class Gauge extends PureComponent { } draw() { - const { field, showThresholdLabels, showThresholdMarkers, width, height, theme, value } = this.props; + const { field, showThresholdLabels, showThresholdMarkers, width, height, theme, value, neutral } = this.props; const autoProps = calculateGaugeAutoProps(width, height, value.title); const dimension = Math.min(width, autoProps.gaugeHeight); @@ -60,6 +61,7 @@ export class Gauge extends PureComponent { const gaugeWidthReduceRatio = showThresholdLabels ? 1.5 : 1; const gaugeWidth = Math.min(dimension / 5.5, 40) / gaugeWidthReduceRatio; const thresholdMarkersWidth = gaugeWidth / 5; + const neutralValue = neutral; const text = formattedValueToString(value); // This not 100% accurate as I am unsure of flot's calculations here const valueWidthBase = Math.min(width, dimension * 1.3) * 0.9; @@ -98,6 +100,7 @@ export class Gauge extends PureComponent { gauge: { min, max, + neutralValue, background: { color: backgroundColor }, border: { color: null }, shadow: { show: false }, diff --git a/public/app/plugins/panel/gauge/GaugePanel.tsx b/public/app/plugins/panel/gauge/GaugePanel.tsx index e5766087ef29..a1efd911a906 100644 --- a/public/app/plugins/panel/gauge/GaugePanel.tsx +++ b/public/app/plugins/panel/gauge/GaugePanel.tsx @@ -28,6 +28,7 @@ export class GaugePanel extends PureComponent> { text={options.text} showThresholdLabels={options.showThresholdLabels} showThresholdMarkers={options.showThresholdMarkers} + neutral={options.neutral} theme={config.theme2} onClick={openMenu} className={targetClassName} diff --git a/public/app/plugins/panel/gauge/models.cue b/public/app/plugins/panel/gauge/models.cue index a36918c357cf..e971e26ad397 100644 --- a/public/app/plugins/panel/gauge/models.cue +++ b/public/app/plugins/panel/gauge/models.cue @@ -29,6 +29,7 @@ Panel: thema.#Lineage & { ui.SingleStatBaseOptions showThresholdLabels: bool | *false showThresholdMarkers: bool | *true + neutral: number } @cuetsy(kind="interface") }, ] diff --git a/public/app/plugins/panel/gauge/models.gen.ts b/public/app/plugins/panel/gauge/models.gen.ts index 19bfd5bfd48f..f343823d07a3 100644 --- a/public/app/plugins/panel/gauge/models.gen.ts +++ b/public/app/plugins/panel/gauge/models.gen.ts @@ -13,6 +13,7 @@ import * as ui from '@grafana/schema'; export const PanelModelVersion = Object.freeze([0, 0]); export interface PanelOptions extends ui.SingleStatBaseOptions { + neutral: number; showThresholdLabels: boolean; showThresholdMarkers: boolean; } diff --git a/public/vendor/flot/jquery.flot.gauge.js b/public/vendor/flot/jquery.flot.gauge.js index ae27e9ac4aef..4f08dd062aaf 100644 --- a/public/vendor/flot/jquery.flot.gauge.js +++ b/public/vendor/flot/jquery.flot.gauge.js @@ -10,7 +10,7 @@ /** * @module flot.gauge */ -(function($) { + (function($) { /** @@ -327,8 +327,7 @@ var blur = gaugeOptionsi.gauge.shadow.show ? gaugeOptionsi.gauge.shadow.blur : 0; var color = getColor(gaugeOptionsi, data); - var hasNegative = gaugeOptionsi.gauge.min < 0.0 - var angles = calculateAnglesForGauge(gaugeOptionsi, layout, data, hasNegative); + var angles = calculateAnglesForGauge(gaugeOptionsi, layout, data); // draw gauge frame drawArcWithShadow( @@ -356,7 +355,7 @@ color, // fill color blur); - if(hasNegative) + if(gaugeOptionsi.gauge.neutralValue != null) drawZeroMarker(gaugeOptionsi, layout, cellLayout, color); } @@ -369,16 +368,16 @@ * @param {Number} data the value of the gauge * @returns {Object} */ - function calculateAnglesForGauge(gaugeOptionsi, layout, data, hasNegative) { + function calculateAnglesForGauge(gaugeOptionsi, layout, data) { let angles = {}; - var isNegative = data < 0.0 + var neutral = gaugeOptionsi.gauge.neutralValue - if (hasNegative) { - if (isNegative) { + if (neutral != null) { + if (data < neutral) { angles.a1 = calculateAngle(gaugeOptionsi, layout, data); - angles.a2 = calculateAngle(gaugeOptionsi, layout, 0.0); + angles.a2 = calculateAngle(gaugeOptionsi, layout, neutral); } else { - angles.a1 = calculateAngle(gaugeOptionsi, layout, 0.0); + angles.a1 = calculateAngle(gaugeOptionsi, layout, neutral); angles.a2 = calculateAngle(gaugeOptionsi, layout, data); } } else { @@ -399,15 +398,15 @@ * @param {String} color line color */ function drawZeroMarker(gaugeOptionsi, layout, cellLayout, color) { - var diff = (gaugeOptionsi.gauge.max - gaugeOptionsi.gauge.min) / 800; + var diff = (gaugeOptionsi.gauge.max - gaugeOptionsi.gauge.min) / 600; drawArc(context, cellLayout.cx, cellLayout.cy, layout.radius - 2, layout.width - 4, - toRad(calculateAngle(gaugeOptionsi, layout, -diff)), - toRad(calculateAngle(gaugeOptionsi, layout, diff)), + toRad(calculateAngle(gaugeOptionsi, layout, gaugeOptionsi.gauge.neutralValue-diff)), + toRad(calculateAngle(gaugeOptionsi, layout, gaugeOptionsi.gauge.neutralValue+diff)), color, 2, gaugeOptionsi.gauge.background.color); @@ -1008,4 +1007,3 @@ }); })(jQuery); - From 59f4c0cccfafe712e828d007f5d04a8f979d26e3 Mon Sep 17 00:00:00 2001 From: sfranzis Date: Thu, 10 Nov 2022 17:14:16 +0100 Subject: [PATCH 12/25] remove space --- public/vendor/flot/jquery.flot.gauge.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/vendor/flot/jquery.flot.gauge.js b/public/vendor/flot/jquery.flot.gauge.js index 4f08dd062aaf..7a1d75efb9d5 100644 --- a/public/vendor/flot/jquery.flot.gauge.js +++ b/public/vendor/flot/jquery.flot.gauge.js @@ -636,7 +636,7 @@ * @param {Object} textOptions the option of the text * @param {Number} [a] the angle of the value drawn */ - function drawText(x, y, id, text, textOptions, a) { + function drawText(x, y, id, text, textOptions, a) { var span = $(placeholder).find("#" + id); var exists = span.length; if (!exists) { @@ -1006,4 +1006,4 @@ version: "1.1.0" }); -})(jQuery); +})(jQuery); \ No newline at end of file From 4d0b73622a48b8670ca021350399533a54ea33a6 Mon Sep 17 00:00:00 2001 From: sfranzis Date: Thu, 10 Nov 2022 17:16:42 +0100 Subject: [PATCH 13/25] add newline at eof --- public/vendor/flot/jquery.flot.gauge.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/vendor/flot/jquery.flot.gauge.js b/public/vendor/flot/jquery.flot.gauge.js index 7a1d75efb9d5..15fbe5ef7f41 100644 --- a/public/vendor/flot/jquery.flot.gauge.js +++ b/public/vendor/flot/jquery.flot.gauge.js @@ -1006,4 +1006,4 @@ version: "1.1.0" }); -})(jQuery); \ No newline at end of file +})(jQuery); From 24d295a78d87ffde50c2be0e6380bda6dae186aa Mon Sep 17 00:00:00 2001 From: sfranzis Date: Thu, 10 Nov 2022 17:26:44 +0100 Subject: [PATCH 14/25] remove category --- public/app/plugins/panel/gauge/module.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/public/app/plugins/panel/gauge/module.tsx b/public/app/plugins/panel/gauge/module.tsx index 2754c4b3929f..56ebd9236573 100644 --- a/public/app/plugins/panel/gauge/module.tsx +++ b/public/app/plugins/panel/gauge/module.tsx @@ -31,7 +31,6 @@ export const plugin = new PanelPlugin(GaugePanel) path: 'neutral', name: 'Neutral', description: 'Set the neutral point of the gauge', - category: ['Standard options'], }); commonOptionsBuilder.addTextSizeOptions(builder); From 2b0525cae769f2600dae7b7cd5f6fcf16de7a377 Mon Sep 17 00:00:00 2001 From: sfranzis Date: Thu, 10 Nov 2022 17:39:59 +0100 Subject: [PATCH 15/25] remove space --- public/vendor/flot/jquery.flot.gauge.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/vendor/flot/jquery.flot.gauge.js b/public/vendor/flot/jquery.flot.gauge.js index 15fbe5ef7f41..f16b76d3fb22 100644 --- a/public/vendor/flot/jquery.flot.gauge.js +++ b/public/vendor/flot/jquery.flot.gauge.js @@ -10,7 +10,7 @@ /** * @module flot.gauge */ - (function($) { +(function($) { /** From 2a9e5eae0dc17282d6591320a0f620c4418a4442 Mon Sep 17 00:00:00 2001 From: sfranzis Date: Thu, 10 Nov 2022 17:47:06 +0100 Subject: [PATCH 16/25] remove newline --- public/vendor/flot/jquery.flot.gauge.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/vendor/flot/jquery.flot.gauge.js b/public/vendor/flot/jquery.flot.gauge.js index f16b76d3fb22..259fe72c7eb7 100644 --- a/public/vendor/flot/jquery.flot.gauge.js +++ b/public/vendor/flot/jquery.flot.gauge.js @@ -1006,4 +1006,4 @@ version: "1.1.0" }); -})(jQuery); +})(jQuery); \ No newline at end of file From 441c898c4d974e7e378f6287112daff88d7535d7 Mon Sep 17 00:00:00 2001 From: sfranzis Date: Thu, 10 Nov 2022 17:48:39 +0100 Subject: [PATCH 17/25] add newline --- public/vendor/flot/jquery.flot.gauge.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/vendor/flot/jquery.flot.gauge.js b/public/vendor/flot/jquery.flot.gauge.js index 259fe72c7eb7..bed126314301 100644 --- a/public/vendor/flot/jquery.flot.gauge.js +++ b/public/vendor/flot/jquery.flot.gauge.js @@ -1006,4 +1006,5 @@ version: "1.1.0" }); -})(jQuery); \ No newline at end of file +})(jQuery); + From c85d7cab6ee2243a0d52569ec070b8159947f627 Mon Sep 17 00:00:00 2001 From: sfranzis Date: Thu, 10 Nov 2022 18:05:28 +0100 Subject: [PATCH 18/25] draw neutral threshold value --- public/vendor/flot/jquery.flot.gauge.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/vendor/flot/jquery.flot.gauge.js b/public/vendor/flot/jquery.flot.gauge.js index bed126314301..1ac49e815026 100644 --- a/public/vendor/flot/jquery.flot.gauge.js +++ b/public/vendor/flot/jquery.flot.gauge.js @@ -370,7 +370,7 @@ */ function calculateAnglesForGauge(gaugeOptionsi, layout, data) { let angles = {}; - var neutral = gaugeOptionsi.gauge.neutralValue + var neutral = gaugeOptionsi.gauge.neutralValue; if (neutral != null) { if (data < neutral) { @@ -583,6 +583,11 @@ drawThresholdValue(gaugeOptionsi, layout, cellLayout, i + "_" + j, threshold.value, a); } } + + var neutral = gaugeOptionsi.gauge.neutralValue; + if (neutral != null) { + drawThresholdValue(gaugeOptionsi, layout, cellLayout, "Neutral" + i, neutral, calculateAngle(gaugeOptionsi, layout, neutral)); + } } /** From 264b4fea918a0a93871a5aa19ed52a9c0aed1200 Mon Sep 17 00:00:00 2001 From: sfranzis Date: Fri, 11 Nov 2022 07:35:01 +0100 Subject: [PATCH 19/25] draw neutral threshold value --- public/app/plugins/panel/gauge/module.tsx | 1 - public/vendor/flot/jquery.flot.gauge.js | 12 +++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/public/app/plugins/panel/gauge/module.tsx b/public/app/plugins/panel/gauge/module.tsx index 2754c4b3929f..56ebd9236573 100644 --- a/public/app/plugins/panel/gauge/module.tsx +++ b/public/app/plugins/panel/gauge/module.tsx @@ -31,7 +31,6 @@ export const plugin = new PanelPlugin(GaugePanel) path: 'neutral', name: 'Neutral', description: 'Set the neutral point of the gauge', - category: ['Standard options'], }); commonOptionsBuilder.addTextSizeOptions(builder); diff --git a/public/vendor/flot/jquery.flot.gauge.js b/public/vendor/flot/jquery.flot.gauge.js index 4f08dd062aaf..1ac49e815026 100644 --- a/public/vendor/flot/jquery.flot.gauge.js +++ b/public/vendor/flot/jquery.flot.gauge.js @@ -10,7 +10,7 @@ /** * @module flot.gauge */ - (function($) { +(function($) { /** @@ -370,7 +370,7 @@ */ function calculateAnglesForGauge(gaugeOptionsi, layout, data) { let angles = {}; - var neutral = gaugeOptionsi.gauge.neutralValue + var neutral = gaugeOptionsi.gauge.neutralValue; if (neutral != null) { if (data < neutral) { @@ -583,6 +583,11 @@ drawThresholdValue(gaugeOptionsi, layout, cellLayout, i + "_" + j, threshold.value, a); } } + + var neutral = gaugeOptionsi.gauge.neutralValue; + if (neutral != null) { + drawThresholdValue(gaugeOptionsi, layout, cellLayout, "Neutral" + i, neutral, calculateAngle(gaugeOptionsi, layout, neutral)); + } } /** @@ -636,7 +641,7 @@ * @param {Object} textOptions the option of the text * @param {Number} [a] the angle of the value drawn */ - function drawText(x, y, id, text, textOptions, a) { + function drawText(x, y, id, text, textOptions, a) { var span = $(placeholder).find("#" + id); var exists = span.length; if (!exists) { @@ -1007,3 +1012,4 @@ }); })(jQuery); + From 586f7d81c931903e40a48b2db4b747acf484402f Mon Sep 17 00:00:00 2001 From: sfranzis Date: Tue, 15 Nov 2022 15:13:22 +0100 Subject: [PATCH 20/25] fixing merge glitch --- public/vendor/flot/jquery.flot.gauge.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/vendor/flot/jquery.flot.gauge.js b/public/vendor/flot/jquery.flot.gauge.js index d037f55501f9..fdd4bb5cfd03 100644 --- a/public/vendor/flot/jquery.flot.gauge.js +++ b/public/vendor/flot/jquery.flot.gauge.js @@ -355,7 +355,7 @@ color, // fill color blur); - if(gaugeOptionsi.gauge.neutralValue != null) + if(gaugeOptionsi.gauge.neutralValue != null) { drawZeroMarker(gaugeOptionsi, layout, cellLayout, color); } } From 80038be3435aa9cf57ccd8c3234f9846e9ce3713 Mon Sep 17 00:00:00 2001 From: sfranzis Date: Tue, 15 Nov 2022 17:34:53 +0100 Subject: [PATCH 21/25] fixed type check --- packages/grafana-ui/src/components/Gauge/Gauge.test.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/grafana-ui/src/components/Gauge/Gauge.test.tsx b/packages/grafana-ui/src/components/Gauge/Gauge.test.tsx index 0a337707c365..efc3bdd3755f 100644 --- a/packages/grafana-ui/src/components/Gauge/Gauge.test.tsx +++ b/packages/grafana-ui/src/components/Gauge/Gauge.test.tsx @@ -25,6 +25,7 @@ const props: Props = { showThresholdMarkers: true, showThresholdLabels: false, field, + neutral: 0, width: 300, height: 300, value: { From 13876b0d2584f0171559dc5bcc2d909304941739 Mon Sep 17 00:00:00 2001 From: sfranzis Date: Wed, 16 Nov 2022 19:37:49 +0100 Subject: [PATCH 22/25] implement suggestions from review --- packages/grafana-ui/src/components/Gauge/Gauge.tsx | 5 ++--- public/app/plugins/panel/gauge/models.cue | 2 +- public/app/plugins/panel/gauge/module.tsx | 3 +++ public/vendor/flot/jquery.flot.gauge.js | 4 +++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/grafana-ui/src/components/Gauge/Gauge.tsx b/packages/grafana-ui/src/components/Gauge/Gauge.tsx index 3795b578fa51..e20caed7aa10 100644 --- a/packages/grafana-ui/src/components/Gauge/Gauge.tsx +++ b/packages/grafana-ui/src/components/Gauge/Gauge.tsx @@ -22,7 +22,7 @@ export interface Props { field: FieldConfig; showThresholdMarkers: boolean; showThresholdLabels: boolean; - neutral: Number; + neutral?: number; width: number; value: DisplayValue; text?: VizTextDisplayOptions; @@ -61,7 +61,6 @@ export class Gauge extends PureComponent { const gaugeWidthReduceRatio = showThresholdLabels ? 1.5 : 1; const gaugeWidth = Math.min(dimension / 5.5, 40) / gaugeWidthReduceRatio; const thresholdMarkersWidth = gaugeWidth / 5; - const neutralValue = neutral; const text = formattedValueToString(value); // This not 100% accurate as I am unsure of flot's calculations here const valueWidthBase = Math.min(width, dimension * 1.3) * 0.9; @@ -100,7 +99,7 @@ export class Gauge extends PureComponent { gauge: { min, max, - neutralValue, + neutralValue: neutral, background: { color: backgroundColor }, border: { color: null }, shadow: { show: false }, diff --git a/public/app/plugins/panel/gauge/models.cue b/public/app/plugins/panel/gauge/models.cue index e971e26ad397..12c412e51939 100644 --- a/public/app/plugins/panel/gauge/models.cue +++ b/public/app/plugins/panel/gauge/models.cue @@ -29,7 +29,7 @@ Panel: thema.#Lineage & { ui.SingleStatBaseOptions showThresholdLabels: bool | *false showThresholdMarkers: bool | *true - neutral: number + neutral?: number } @cuetsy(kind="interface") }, ] diff --git a/public/app/plugins/panel/gauge/module.tsx b/public/app/plugins/panel/gauge/module.tsx index 56ebd9236573..94f1dcc42435 100644 --- a/public/app/plugins/panel/gauge/module.tsx +++ b/public/app/plugins/panel/gauge/module.tsx @@ -31,6 +31,9 @@ export const plugin = new PanelPlugin(GaugePanel) path: 'neutral', name: 'Neutral', description: 'Set the neutral point of the gauge', + settings: { + placeholder: 'auto', + }, }); commonOptionsBuilder.addTextSizeOptions(builder); diff --git a/public/vendor/flot/jquery.flot.gauge.js b/public/vendor/flot/jquery.flot.gauge.js index fdd4bb5cfd03..8c5c43a9213a 100644 --- a/public/vendor/flot/jquery.flot.gauge.js +++ b/public/vendor/flot/jquery.flot.gauge.js @@ -586,7 +586,9 @@ } var neutral = gaugeOptionsi.gauge.neutralValue; - if (neutral != null) { + if (neutral != null && + neutral>gaugeOptionsi.gauge.min && + neutral Date: Wed, 16 Nov 2022 19:40:18 +0100 Subject: [PATCH 23/25] implement suggestions from review --- public/app/plugins/panel/gauge/module.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/panel/gauge/module.tsx b/public/app/plugins/panel/gauge/module.tsx index 94f1dcc42435..89976663ca1b 100644 --- a/public/app/plugins/panel/gauge/module.tsx +++ b/public/app/plugins/panel/gauge/module.tsx @@ -30,7 +30,7 @@ export const plugin = new PanelPlugin(GaugePanel) .addNumberInput({ path: 'neutral', name: 'Neutral', - description: 'Set the neutral point of the gauge', + description: 'Leave empty to use Min as neutral point', settings: { placeholder: 'auto', }, From eac63f2ceae69026131a15cdb0aa47d957bd4d00 Mon Sep 17 00:00:00 2001 From: sfranzis Date: Wed, 16 Nov 2022 19:54:04 +0100 Subject: [PATCH 24/25] run make gen-cue --- public/app/plugins/panel/gauge/models.gen.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/panel/gauge/models.gen.ts b/public/app/plugins/panel/gauge/models.gen.ts index f343823d07a3..ff5eff0a9643 100644 --- a/public/app/plugins/panel/gauge/models.gen.ts +++ b/public/app/plugins/panel/gauge/models.gen.ts @@ -13,7 +13,7 @@ import * as ui from '@grafana/schema'; export const PanelModelVersion = Object.freeze([0, 0]); export interface PanelOptions extends ui.SingleStatBaseOptions { - neutral: number; + neutral?: number; showThresholdLabels: boolean; showThresholdMarkers: boolean; } From 145bba3f80954b76ddb011a52ef063fd6898b2df Mon Sep 17 00:00:00 2001 From: sfranzis Date: Fri, 18 Nov 2022 07:31:19 +0100 Subject: [PATCH 25/25] move neutral to custom field config --- .../src/components/Gauge/Gauge.test.tsx | 4 +++- .../grafana-ui/src/components/Gauge/Gauge.tsx | 5 ++-- public/app/plugins/panel/gauge/GaugePanel.tsx | 1 - public/app/plugins/panel/gauge/models.cue | 1 - public/app/plugins/panel/gauge/models.gen.ts | 1 - public/app/plugins/panel/gauge/module.tsx | 23 +++++++++++-------- 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/packages/grafana-ui/src/components/Gauge/Gauge.test.tsx b/packages/grafana-ui/src/components/Gauge/Gauge.test.tsx index efc3bdd3755f..00037a9872c6 100644 --- a/packages/grafana-ui/src/components/Gauge/Gauge.test.tsx +++ b/packages/grafana-ui/src/components/Gauge/Gauge.test.tsx @@ -19,13 +19,15 @@ const field: FieldConfig = { mode: ThresholdsMode.Absolute, steps: [{ value: -Infinity, color: '#7EB26D' }], }, + custom: { + neeutral: 0, + }, }; const props: Props = { showThresholdMarkers: true, showThresholdLabels: false, field, - neutral: 0, width: 300, height: 300, value: { diff --git a/packages/grafana-ui/src/components/Gauge/Gauge.tsx b/packages/grafana-ui/src/components/Gauge/Gauge.tsx index e20caed7aa10..1f54b72aff4b 100644 --- a/packages/grafana-ui/src/components/Gauge/Gauge.tsx +++ b/packages/grafana-ui/src/components/Gauge/Gauge.tsx @@ -22,7 +22,6 @@ export interface Props { field: FieldConfig; showThresholdMarkers: boolean; showThresholdLabels: boolean; - neutral?: number; width: number; value: DisplayValue; text?: VizTextDisplayOptions; @@ -53,7 +52,7 @@ export class Gauge extends PureComponent { } draw() { - const { field, showThresholdLabels, showThresholdMarkers, width, height, theme, value, neutral } = this.props; + const { field, showThresholdLabels, showThresholdMarkers, width, height, theme, value } = this.props; const autoProps = calculateGaugeAutoProps(width, height, value.title); const dimension = Math.min(width, autoProps.gaugeHeight); @@ -99,7 +98,7 @@ export class Gauge extends PureComponent { gauge: { min, max, - neutralValue: neutral, + neutralValue: field.custom?.neutral, background: { color: backgroundColor }, border: { color: null }, shadow: { show: false }, diff --git a/public/app/plugins/panel/gauge/GaugePanel.tsx b/public/app/plugins/panel/gauge/GaugePanel.tsx index a1efd911a906..e5766087ef29 100644 --- a/public/app/plugins/panel/gauge/GaugePanel.tsx +++ b/public/app/plugins/panel/gauge/GaugePanel.tsx @@ -28,7 +28,6 @@ export class GaugePanel extends PureComponent> { text={options.text} showThresholdLabels={options.showThresholdLabels} showThresholdMarkers={options.showThresholdMarkers} - neutral={options.neutral} theme={config.theme2} onClick={openMenu} className={targetClassName} diff --git a/public/app/plugins/panel/gauge/models.cue b/public/app/plugins/panel/gauge/models.cue index 12c412e51939..a36918c357cf 100644 --- a/public/app/plugins/panel/gauge/models.cue +++ b/public/app/plugins/panel/gauge/models.cue @@ -29,7 +29,6 @@ Panel: thema.#Lineage & { ui.SingleStatBaseOptions showThresholdLabels: bool | *false showThresholdMarkers: bool | *true - neutral?: number } @cuetsy(kind="interface") }, ] diff --git a/public/app/plugins/panel/gauge/models.gen.ts b/public/app/plugins/panel/gauge/models.gen.ts index ff5eff0a9643..19bfd5bfd48f 100644 --- a/public/app/plugins/panel/gauge/models.gen.ts +++ b/public/app/plugins/panel/gauge/models.gen.ts @@ -13,7 +13,6 @@ import * as ui from '@grafana/schema'; export const PanelModelVersion = Object.freeze([0, 0]); export interface PanelOptions extends ui.SingleStatBaseOptions { - neutral?: number; showThresholdLabels: boolean; showThresholdMarkers: boolean; } diff --git a/public/app/plugins/panel/gauge/module.tsx b/public/app/plugins/panel/gauge/module.tsx index 89976663ca1b..0910083e2310 100644 --- a/public/app/plugins/panel/gauge/module.tsx +++ b/public/app/plugins/panel/gauge/module.tsx @@ -9,11 +9,22 @@ import { PanelOptions, defaultPanelOptions } from './models.gen'; import { GaugeSuggestionsSupplier } from './suggestions'; export const plugin = new PanelPlugin(GaugePanel) - .useFieldConfig() + .useFieldConfig({ + useCustomConfig: (builder) => { + builder.addNumberInput({ + path: 'neutral', + name: 'Neutral', + description: 'Leave empty to use Min as neutral point', + category: ['Gauge'], + settings: { + placeholder: 'auto', + }, + }); + }, + }) .setPanelOptions((builder) => { addStandardDataReduceOptions(builder); addOrientationOption(builder); - builder .addBooleanSwitch({ path: 'showThresholdLabels', @@ -26,14 +37,6 @@ export const plugin = new PanelPlugin(GaugePanel) name: 'Show threshold markers', description: 'Renders the thresholds as an outer bar', defaultValue: defaultPanelOptions.showThresholdMarkers, - }) - .addNumberInput({ - path: 'neutral', - name: 'Neutral', - description: 'Leave empty to use Min as neutral point', - settings: { - placeholder: 'auto', - }, }); commonOptionsBuilder.addTextSizeOptions(builder);