From 3f1908464d9ca10c461d00d13bdf5b5e4f2cd085 Mon Sep 17 00:00:00 2001 From: Polina Boneva <13227501+polibb@users.noreply.github.com> Date: Thu, 5 Jan 2023 11:48:11 +0200 Subject: [PATCH] PanelChrome: Implement Panel header with error, loading, and streaming data status (#60147) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * dashboards squad mob! :trident: lastFile:packages/grafana-ui/src/components/LoadingBar/LoadingBar.tsx * dashboards squad mob! :trident: * dashboards squad mob! :trident: lastFile:packages/grafana-ui/src/components/LoadingBar/LoadingBar.tsx * user essentials mob! :trident: * create grafana/ui LoadingBar and set it up in Storybook * Remove test changes on PanelChrome * Fix mdx page reference * dashboards squad mob! :trident: lastFile:public/api-merged.json * dashboards squad mob! :trident: * dashboards squad mob! :trident: * dashboards squad mob! :trident: * dashboards squad mob! :trident: lastFile:public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderState.tsx * Implemented basic draft of panel header states. Using ToolbarButton instead of IconButton. * use 'warning' styled Button in ToolbarButton * make LoadingBar a simple JSX Element; do not use containerWidth; have a wrapper around the loading bar itself; * fix wrapper around LoadingBar: willChange css prop makes performance of rerendering better * States: Render general panel query error states and render notices next to the title * add streaming to PanelChrome if data is streaming instead of loading * PanelHeaderState with its own state 'mode' * clean up useEffect * notices have their own square space in the size of the panel header * clean up * minor fixes * moving the LoadingBar to core * LoadingBar is not in grafana/ui * always have a place for the loading bar in the PanelChrome, otherwise it moves everything when appearing; remove titleItemsNodes for now - in later development make no changes to Notice component, not part of this PR * Revert "moving the LoadingBar to core" This reverts commit 11f0f4ff2fe81d6755b6587c368284f0ea8f7b68. * do not use internal comment as it doesn't do anything * integrate LoadingBar in PanelChrome from grafana/ui directly * fix deprecated leftItems comment * Modify annimation to 1 second * remove comments * remove streaming stopped UI because we cannot know when the streaming has stopped * skip unnecessary test for now * no point in removing hoverHeader now, even though it's not yet implemented * small fixes * error state of the data in a panel is positioned in PanelChrome itself, not in PanelHeaderState * Fixed loading state jitter * remove warning state as we have none of it * streaming cannot be stopped from the icon * explicit content container width and height * explicit content container width and height * edit deprecated comment * fix LoadingBar to be relative to width of panel; remove explicit width and height on content strict * no warning state of the data * status of the panel data given directly to PanelChrome, not a node * clean up * clean up console log Co-authored-by: kay delaney <45561153+kaydelaney@users.noreply.github.com> * panel title design fits typography h6 styles; render error status only if error or error message are passed to PanelChrome * add storybook examples; prepare PanelChrome for hoverHeader because this will be a breaking change and it will affect how the storybook example shows up * show storybook example for streaming panel with title because that's the condition for having a header * override margin-bottom: 0.45em of h6 Co-authored-by: Alexandra Vargas Co-authored-by: Torkel Ödegaard Co-authored-by: kay delaney <45561153+kaydelaney@users.noreply.github.com> --- .../src/components/IconButton/IconButton.tsx | 2 +- .../src/components/LoadingBar/LoadingBar.tsx | 2 +- .../PanelChrome/PanelChrome.story.tsx | 54 +- .../PanelChrome/PanelChrome.test.tsx | 13 +- .../components/PanelChrome/PanelChrome.tsx | 200 +- .../components/PanelChrome/PanelStatus.tsx | 43 + public/api-merged.json | 7374 ++++++--------- public/api-spec.json | 8166 +++++------------ .../dashboard/dashgrid/PanelStateWrapper.tsx | 26 +- 9 files changed, 5631 insertions(+), 10249 deletions(-) create mode 100644 packages/grafana-ui/src/components/PanelChrome/PanelStatus.tsx diff --git a/packages/grafana-ui/src/components/IconButton/IconButton.tsx b/packages/grafana-ui/src/components/IconButton/IconButton.tsx index 53d727d6963..2eeb1e604d3 100644 --- a/packages/grafana-ui/src/components/IconButton/IconButton.tsx +++ b/packages/grafana-ui/src/components/IconButton/IconButton.tsx @@ -18,7 +18,7 @@ export interface Props extends React.ButtonHTMLAttributes { name: IconName; /** Icon size */ size?: IconSize; - /** Type od the icon - mono or default */ + /** Type of the icon - mono or default */ iconType?: IconType; /** Tooltip content to display on hover */ tooltip?: PopoverContent; diff --git a/packages/grafana-ui/src/components/LoadingBar/LoadingBar.tsx b/packages/grafana-ui/src/components/LoadingBar/LoadingBar.tsx index dd3fbcd272c..b576d22d728 100644 --- a/packages/grafana-ui/src/components/LoadingBar/LoadingBar.tsx +++ b/packages/grafana-ui/src/components/LoadingBar/LoadingBar.tsx @@ -30,7 +30,7 @@ const getStyles = (width?: string, height?: string) => (_: GrafanaTheme2) => { transform: 'translateX(0)', }, '100%': { - transform: `translateX(calc(100% - ${barWidth}))`, + transform: `translateX(100%)`, }, }); diff --git a/packages/grafana-ui/src/components/PanelChrome/PanelChrome.story.tsx b/packages/grafana-ui/src/components/PanelChrome/PanelChrome.story.tsx index 7e5247cb66d..ac658843e90 100644 --- a/packages/grafana-ui/src/components/PanelChrome/PanelChrome.story.tsx +++ b/packages/grafana-ui/src/components/PanelChrome/PanelChrome.story.tsx @@ -4,6 +4,7 @@ import { merge } from 'lodash'; import React, { CSSProperties, useState, ReactNode } from 'react'; import { useInterval } from 'react-use'; +import { LoadingState } from '@grafana/data'; import { PanelChrome, PanelChromeProps } from '@grafana/ui'; import { DashboardStoryCanvas } from '../../utils/storybook/DashboardStoryCanvas'; @@ -64,26 +65,21 @@ export const Examples = () => { - {renderPanel('Default panel with error state indicator', { + {renderPanel('Default panel with error status', { title: 'Default title', - leftItems: [ - , - ], + status: { + message: 'Error text', + onClick: action('ErrorIndicator: onClick fired'), + }, })} - {renderPanel('No padding with error state indicator', { + {renderPanel('No padding with error state', { padding: 'none', title: 'Default title', - leftItems: [ - , - ], + loadingState: LoadingState.Error, + })} + {renderPanel('Default panel with streaming state', { + title: 'Default title', + loadingState: LoadingState.Streaming, })} @@ -93,22 +89,21 @@ export const Examples = () => { })} - + - {renderPanel('No title and loading indicator', { - title: '', + {renderPanel('Default panel with deprecated error indicator', { + title: 'Default title', leftItems: [ - setLoading(false)} - key="loading-indicator" + , ], })} - - - {renderPanel('Very long title', { - title: 'Very long title that should get ellipsis when there is no more space', + {renderPanel('No padding with deprecated loading indicator', { + padding: 'none', + title: 'Default title', leftItems: [ = (args: PanelChromeProps return ( - {(width: number, height: number) =>
Description text
} + {(width: number, height: number) => ( +
Panel in a loading state
+ )}
); }; @@ -221,6 +218,7 @@ Basic.args = { title: 'Very long title that should get ellipsis when there is no more space', titleItems, menu, + loadingState: LoadingState.Loading, }; export default meta; diff --git a/packages/grafana-ui/src/components/PanelChrome/PanelChrome.test.tsx b/packages/grafana-ui/src/components/PanelChrome/PanelChrome.test.tsx index 35508f8e3c7..9109497b461 100644 --- a/packages/grafana-ui/src/components/PanelChrome/PanelChrome.test.tsx +++ b/packages/grafana-ui/src/components/PanelChrome/PanelChrome.test.tsx @@ -35,12 +35,6 @@ it('renders an empty panel with padding', () => { expect(screen.getByText("Panel's Content").parentElement).not.toHaveStyle({ padding: '0px' }); }); -it('renders an empty panel without a header if no title or titleItems', () => { - setup(); - - expect(screen.queryByTestId('header-container')).not.toBeInTheDocument(); -}); - it('renders panel with a header if prop title', () => { setup({ title: 'Test Panel Header' }); @@ -81,10 +75,9 @@ it('renders panel with a header with icons in place if prop titleItems', () => { expect(screen.getByTestId('title-items-container')).toBeInTheDocument(); }); -it('renders panel with a fixed header if prop hoverHeader is false', () => { - setup({ title: 'Test Panel Header', hoverHeader: false }); - - expect(screen.getByTestId('header-container')).toBeInTheDocument(); +it.skip('renders panel with a fixed header if prop hoverHeader is false', () => { + // setup({ title: 'Test Panel Header', hoverHeader: false }); + // expect(screen.getByTestId('header-container')).toBeInTheDocument(); }); it('renders panel with a header if prop menu', () => { diff --git a/packages/grafana-ui/src/components/PanelChrome/PanelChrome.tsx b/packages/grafana-ui/src/components/PanelChrome/PanelChrome.tsx index 685261d1870..332c9ab98a7 100644 --- a/packages/grafana-ui/src/components/PanelChrome/PanelChrome.tsx +++ b/packages/grafana-ui/src/components/PanelChrome/PanelChrome.tsx @@ -1,15 +1,24 @@ import { css, cx } from '@emotion/css'; -import React, { CSSProperties, ReactNode } from 'react'; +import { isEmpty } from 'lodash'; +import React, { CSSProperties, ReactElement, ReactNode } from 'react'; -import { GrafanaTheme2, isIconName } from '@grafana/data'; +import { GrafanaTheme2, isIconName, LoadingState } from '@grafana/data'; import { useStyles2, useTheme2 } from '../../themes'; import { IconName } from '../../types/icon'; import { Dropdown } from '../Dropdown/Dropdown'; import { Icon } from '../Icon/Icon'; import { IconButton, IconButtonVariant } from '../IconButton/IconButton'; +import { LoadingBar } from '../LoadingBar/LoadingBar'; import { PopoverContent, Tooltip } from '../Tooltip'; +import { PanelStatus } from './PanelStatus'; + +interface Status { + message?: string; + onClick?: (e: React.SyntheticEvent) => void; +} + /** * @internal */ @@ -31,16 +40,16 @@ export interface PanelChromeProps { padding?: PanelPadding; title?: string; titleItems?: PanelChromeInfoState[]; - menu?: React.ReactElement; - /** dragClass, hoverHeader, loadingState, and states not yet implemented */ + menu?: ReactElement; + /** dragClass, hoverHeader not yet implemented */ // dragClass?: string; hoverHeader?: boolean; - // loadingState?: LoadingState; - // states?: ReactNode[]; - /** @deprecated in favor of prop states + loadingState?: LoadingState; + status?: Status; + /** @deprecated in favor of props + * status for errors and loadingState for loading and streaming * which will serve the same purpose - * of showing the panel state in the top right corner - * of itself or its header + * of showing/interacting with the panel's data state * */ leftItems?: ReactNode[]; } @@ -53,7 +62,7 @@ export type PanelPadding = 'none' | 'md'; /** * @internal */ -export const PanelChrome: React.FC = ({ +export function PanelChrome({ width, height, children, @@ -63,14 +72,18 @@ export const PanelChrome: React.FC = ({ menu, // dragClass, hoverHeader = false, - // loadingState, - // states = [], + loadingState, + status, leftItems = [], -}) => { +}: PanelChromeProps) { const theme = useTheme2(); const styles = useStyles2(getStyles); - const headerHeight = !hoverHeader ? getHeaderHeight(theme, title, leftItems) : 0; + // To Do rely on hoverHeader prop for header, not separate props + // once hoverHeader is implemented + const hasHeader = title.length > 0 || leftItems.length > 0; + + const headerHeight = getHeaderHeight(theme, hasHeader); const { contentStyle, innerWidth, innerHeight } = getContentStyle(padding, theme, width, headerHeight, height); const headerStyles: CSSProperties = { @@ -82,72 +95,91 @@ export const PanelChrome: React.FC = ({ }; const containerStyles: CSSProperties = { width, height }; - const handleMenuOpen = () => {}; - - const hasHeader = title || titleItems.length > 0 || menu; + const isUsingDeprecatedLeftItems = isEmpty(status) && !loadingState; + const showLoading = loadingState === LoadingState.Loading && !isUsingDeprecatedLeftItems; + const showStreaming = loadingState === LoadingState.Streaming && !isUsingDeprecatedLeftItems; + const renderStatus = () => { + if (isUsingDeprecatedLeftItems) { + return
{itemsRenderer(leftItems, (item) => item)}
; + } else { + const showError = loadingState === LoadingState.Error || status?.message; + return showError ? ( +
+ +
+ ) : null; + } + }; return (
- {hasHeader && !hoverHeader && ( -
- {title && ( -
- {title} -
- )} - - {titleItems.length > 0 && ( -
- {titleItems - .filter((item) => isIconName(item.icon)) - .map((item, i) => ( -
- {item.onClick ? ( - - ) : ( - - - - )} -
- ))} +
+ {showLoading ? : null} +
+ +
+ {title && ( +
+ {title} +
+ )} + + {showStreaming && ( +
+ + + +
+ )} + + {titleItems.length > 0 && ( +
+ {titleItems + .filter((item) => isIconName(item.icon)) + .map((item, i) => ( +
+ {item.onClick ? ( + + ) : ( + + + + )} +
+ ))} +
+ )} + + {menu && ( + +
+
- )} - - {menu && ( - -
- -
-
- )} - - {leftItems.length > 0 && ( -
{itemsRenderer(leftItems, (item) => item)}
- )} -
- )} + + )} + + {renderStatus()} +
{children(innerWidth, innerHeight)}
); -}; +} const itemsRenderer = (items: ReactNode[], renderer: (items: ReactNode[]) => ReactNode): ReactNode => { const toRender = React.Children.toArray(items).filter(Boolean); return toRender.length > 0 ? renderer(toRender) : null; }; -const getHeaderHeight = (theme: GrafanaTheme2, title: string, items: ReactNode[]) => { - if (title.length > 0 || items.length > 0) { +const getHeaderHeight = (theme: GrafanaTheme2, hasHeader: boolean) => { + if (hasHeader) { return theme.spacing.gridSize * theme.components.panel.headerHeight; } return 0; @@ -161,9 +193,12 @@ const getContentStyle = ( height: number ) => { const chromePadding = (padding === 'md' ? theme.components.panel.padding : 0) * theme.spacing.gridSize; + + const panelPadding = chromePadding * 2; const panelBorder = 1 * 2; - const innerWidth = width - chromePadding * 2 - panelBorder; - const innerHeight = height - headerHeight - chromePadding * 2 - panelBorder; + + const innerWidth = width - panelPadding - panelBorder; + const innerHeight = height - headerHeight - panelPadding - panelBorder; const contentStyle: CSSProperties = { padding: chromePadding, @@ -185,7 +220,7 @@ const getStyles = (theme: GrafanaTheme2) => { height: '100%', display: 'flex', flexDirection: 'column', - flex: '0 0 0', + flex: '1 1 0', '&:focus-visible, &:hover': { // only show menu icon on hover or focused panel @@ -198,11 +233,16 @@ const getStyles = (theme: GrafanaTheme2) => { outline: `1px solid ${theme.colors.action.focus}`, }, }), + loadingBarContainer: css({ + position: 'absolute', + top: 0, + width: '100%', + overflow: 'hidden', + }), content: css({ label: 'panel-content', - width: '100%', - contain: 'strict', flexGrow: 1, + contain: 'strict', }), headerContainer: css({ label: 'panel-header', @@ -210,23 +250,41 @@ const getStyles = (theme: GrafanaTheme2) => { alignItems: 'center', padding: `0 ${theme.spacing(padding)}`, }), + streaming: css({ + marginRight: 0, + color: theme.colors.success.text, + + '&:hover': { + color: theme.colors.success.text, + }, + }), title: css({ + marginBottom: 0, // override default h6 margin-bottom textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap', - fontWeight: theme.typography.fontWeightMedium, + fontSize: theme.typography.h6.fontSize, + fontWeight: theme.typography.h6.fontWeight, }), items: css({ display: 'flex', }), item: css({ display: 'flex', - justifyContent: 'space-around', + justifyContent: 'center', alignItems: 'center', }), menuItem: css({ visibility: 'hidden', }), + errorContainer: css({ + label: 'error-container', + position: 'absolute', + width: '100%', + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + }), rightAligned: css({ marginLeft: 'auto', }), diff --git a/packages/grafana-ui/src/components/PanelChrome/PanelStatus.tsx b/packages/grafana-ui/src/components/PanelChrome/PanelStatus.tsx new file mode 100644 index 00000000000..765701e2355 --- /dev/null +++ b/packages/grafana-ui/src/components/PanelChrome/PanelStatus.tsx @@ -0,0 +1,43 @@ +import { css } from '@emotion/css'; +import React from 'react'; + +import { GrafanaTheme2 } from '@grafana/data'; + +import { useStyles2 } from '../../themes'; +import { ToolbarButton } from '../ToolbarButton/ToolbarButton'; + +export interface Props { + message?: string; + onClick?: (e: React.SyntheticEvent) => void; +} + +export function PanelStatus({ message, onClick }: Props) { + const styles = useStyles2(getStyles); + + return ( + + ); +} + +const getStyles = (theme: GrafanaTheme2) => { + const { headerHeight, padding } = theme.components.panel; + + return { + buttonStyles: css({ + label: 'panel-header-state-button', + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + padding: theme.spacing(padding), + width: theme.spacing(headerHeight), + height: theme.spacing(headerHeight), + borderRadius: 0, + }), + }; +}; diff --git a/public/api-merged.json b/public/api-merged.json index b0f5e2826a3..3d0d0e26e12 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/UpdateQuotaCmd" + } + }, + { + "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/UpdateQuotaCmd" - } + "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,82 +1803,145 @@ } } }, - "/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" + } + }, + { + "type": "string", + "name": "X-Disable-Provenance", + "in": "header" + } + ], + "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" } + }, + { + "type": "string", + "name": "X-Disable-Provenance", + "in": "header" } ], "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", @@ -3550,418 +3428,539 @@ "deprecated": true, "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardID", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "DashboardVersionID", - "in": "path", - "required": true + "type": "string", + "description": "Filter by name", + "name": "name", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "description": "ContactPoints", + "schema": { + "$ref": "#/definitions/ContactPoints" + } } } - } - }, - "/dashboards/import": { + }, "post": { + "consumes": [ + "application/json" + ], "tags": [ - "dashboards" + "provisioning" ], - "summary": "Import dashboard.", - "operationId": "importDashboard", + "summary": "Create a contact point.", + "operationId": "RoutePostContactpoints", "parameters": [ { "name": "Body", "in": "body", - "required": true, "schema": { - "$ref": "#/definitions/ImportDashboardRequest" + "$ref": "#/definitions/EmbeddedContactPoint" } } ], "responses": { - "200": { - "$ref": "#/responses/importDashboardResponse" + "202": { + "description": "EmbeddedContactPoint", + "schema": { + "$ref": "#/definitions/EmbeddedContactPoint" + } }, "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, + "description": "ValidationError", "schema": { - "$ref": "#/definitions/TrimDashboardCommand" + "$ref": "#/definitions/ValidationError" } } - ], - "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).", + "/api/v1/provisioning/contact-points/{UID}": { + "put": { + "consumes": [ + "application/json" + ], "tags": [ - "dashboards" + "provisioning" ], - "summary": "Get dashboard by uid.", - "operationId": "getDashboardByUID", + "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 + }, + { + "name": "Body", + "in": "body", + "schema": { + "$ref": "#/definitions/EmbeddedContactPoint" + } } ], "responses": { - "200": { - "$ref": "#/responses/dashboardResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "202": { + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } }, - "500": { - "$ref": "#/responses/internalServerError" + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } } } }, "delete": { - "description": "Will delete the dashboard given the specified unique identifier (uid).", + "consumes": [ + "application/json" + ], "tags": [ - "dashboards" + "provisioning" ], - "summary": "Delete dashboard by uid.", - "operationId": "deleteDashboardByUID", + "summary": "Delete a contact point.", + "operationId": "RouteDeleteContactpoints", "parameters": [ { "type": "string", - "name": "uid", + "description": "UID is the contact point unique identifier", + "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" + "204": { + "description": " The contact point was deleted successfully." } } } }, - "/dashboards/uid/{uid}/permissions": { + "/api/v1/provisioning/folder/{FolderUID}/rule-groups/{Group}": { "get": { "tags": [ - "dashboard_permissions" + "provisioning" ], - "summary": "Gets all existing permissions for the given dashboard.", - "operationId": "getDashboardPermissionsListByUID", + "summary": "Get a rule group.", + "operationId": "RouteGetAlertRuleGroup", "parameters": [ { "type": "string", - "name": "uid", + "name": "FolderUID", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "Group", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDashboardPermissionsListResponse" - }, - "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." } } }, - "post": { - "description": "This operation will remove existing permissions if they’re not included in the request.", + "put": { + "consumes": [ + "application/json" + ], "tags": [ - "dashboard_permissions" + "provisioning" ], - "summary": "Updates permissions for a dashboard.", - "operationId": "updateDashboardPermissionsByUID", + "summary": "Update the interval of a rule group.", + "operationId": "RoutePutAlertRuleGroup", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateDashboardACLCommand" - } + "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/okResponse" + "description": "AlertRuleGroup", + "schema": { + "$ref": "#/definitions/AlertRuleGroup" + } }, "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": { + "/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": [ - "dashboard_versions" + "provisioning" ], - "summary": "Restore a dashboard to a given dashboard version using UID.", - "operationId": "restoreDashboardVersionByUID", + "summary": "Create a new mute timing.", + "operationId": "RoutePostMuteTiming", "parameters": [ { "name": "Body", "in": "body", - "required": true, "schema": { - "$ref": "#/definitions/RestoreDashboardVersionCommand" + "$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", - "name": "uid", + "description": "Mute timing name", + "name": "name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/postDashboardResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "description": "MuteTimeInterval", + "schema": { + "$ref": "#/definitions/MuteTimeInterval" + } }, "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "description": " Not found." } } - } - }, - "/dashboards/uid/{uid}/versions": { - "get": { + }, + "put": { + "consumes": [ + "application/json" + ], "tags": [ - "dashboard_versions" + "provisioning" ], - "summary": "Gets all existing versions for the dashboard using UID.", - "operationId": "getDashboardVersionsByUID", + "summary": "Replace an existing mute timing.", + "operationId": "RoutePutMuteTiming", "parameters": [ { "type": "string", - "name": "uid", + "description": "Mute timing name", + "name": "name", "in": "path", "required": true }, { - "type": "integer", - "format": "int64", - "default": 0, - "description": "Maximum number of results to return", - "name": "limit", - "in": "query" + "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": "integer", - "format": "int64", - "default": 0, - "description": "Version to start from when returning queries", - "name": "start", - "in": "query" + "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": { - "$ref": "#/responses/dashboardVersionsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" + "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" + } }, - "403": { - "$ref": "#/responses/forbiddenError" + "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": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "description": " Not found." } } } }, - "/dashboards/uid/{uid}/versions/{DashboardVersionID}": { + "/api/v1/provisioning/templates/{name}": { "get": { "tags": [ - "dashboard_versions" + "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": "Get a specific dashboard version using UID.", - "operationId": "getDashboardVersionByUID", + "summary": "Delete a template.", + "operationId": "RouteDeleteTemplate", "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "DashboardVersionID", - "in": "path", - "required": true - }, { "type": "string", - "name": "uid", + "description": "Template Name", + "name": "name", "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" + "204": { + "description": " The template was deleted successfully." } } } }, - "/datasources": { + "/auth/keys": { "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:*`.", + "description": "Will return auth keys.", "tags": [ - "datasources" + "api_keys" + ], + "summary": "Get auth keys.", + "operationId": "getAPIkeys", + "parameters": [ + { + "type": "boolean", + "default": false, + "description": "Show expired keys", + "name": "includeExpired", + "in": "query" + } ], - "summary": "Get all data sources.", - "operationId": "getDataSources", "responses": { "200": { - "$ref": "#/responses/getDataSourcesResponse" + "$ref": "#/responses/getAPIkeyResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3969,31 +3968,37 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "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`", + "description": "Will return details of the created API key.", "tags": [ - "datasources" + "api_keys" ], - "summary": "Create a data source.", - "operationId": "addDataSource", + "summary": "Creates an API key.", + "operationId": "addAPIkey", "parameters": [ { "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddDataSourceCommand" + "$ref": "#/definitions/AddCommand" } } ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" + "$ref": "#/responses/postAPIkeyResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4010,20 +4015,32 @@ } } }, - "/datasources/correlations": { - "get": { + "/auth/keys/{id}": { + "delete": { "tags": [ - "correlations" + "api_keys" + ], + "summary": "Delete API key.", + "operationId": "deleteAPIkey", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "id", + "in": "path", + "required": true + } ], - "summary": "Gets all correlations.", - "operationId": "getCorrelations", "responses": { "200": { - "$ref": "#/responses/getCorrelationsResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "404": { "$ref": "#/responses/notFoundError" }, @@ -4033,34 +4050,32 @@ } } }, - "/datasources/id/{name}": { + "/dashboard/snapshots": { "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:read` and scopes: `datasources:*`, `datasources:name:*` and `datasources:name:test_datasource` (single data source).", "tags": [ - "datasources" + "snapshots" ], - "summary": "Get data source Id by Name.", - "operationId": "getDataSourceIdByName", + "summary": "List snapshots.", + "operationId": "searchDashboardSnapshots", "parameters": [ { "type": "string", - "name": "name", - "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/getDataSourceIDResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "$ref": "#/responses/searchDashboardSnapshotsResponse" }, "500": { "$ref": "#/responses/internalServerError" @@ -4068,25 +4083,46 @@ } } }, - "/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).", + "/dashboards/calculate-diff": { + "post": { + "produces": [ + "application/json", + "text/html" + ], "tags": [ - "datasources" + "dashboards" ], - "summary": "Get a single data source by Name.", - "operationId": "getDataSourceByName", + "summary": "Perform diff on two dashboards.", + "operationId": "calculateDashboardDiff", "parameters": [ { - "type": "string", - "name": "name", - "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": { - "$ref": "#/responses/getDataSourceResponse" + "$ref": "#/responses/calculateDashboardDiffResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4098,25 +4134,32 @@ "$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).", + } + }, + "/dashboards/db": { + "post": { + "description": "Creates a new dashboard or updates an existing dashboard.", "tags": [ - "datasources" + "dashboards" ], - "summary": "Delete an existing data source by name.", - "operationId": "deleteDataSourceByName", + "summary": "Create / Update dashboard", + "operationId": "postDashboard", "parameters": [ { - "type": "string", - "name": "name", - "in": "path", - "required": true + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/SaveDashboardCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/deleteDataSourceByNameResponse" + "$ref": "#/responses/postDashboardResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4127,40 +4170,59 @@ "404": { "$ref": "#/responses/notFoundError" }, + "412": { + "$ref": "#/responses/preconditionFailedError" + }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources/proxy/uid/{uid}/{datasource_proxy_route}": { + "/dashboards/home": { "get": { - "description": "Proxies all calls to the actual data source.", "tags": [ - "datasources" + "dashboards" ], - "summary": "Data source proxy GET calls.", - "operationId": "datasourceProxyGETByUIDcalls", - "parameters": [ - { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true + "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": "uid", + "type": "integer", + "format": "int64", + "name": "DashboardID", "in": "path", "required": true } ], "responses": { "200": { - "description": "(empty)" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getDashboardPermissionsListResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4177,38 +4239,33 @@ } }, "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": "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": "Data source proxy POST calls.", - "operationId": "datasourceProxyPOSTByUIDcalls", + "summary": "Updates permissions for a dashboard.", + "operationId": "updateDashboardPermissionsByID", + "deprecated": true, "parameters": [ { - "name": "DatasourceProxyParam", + "name": "Body", "in": "body", "required": true, - "schema": {} - }, - { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true + "schema": { + "$ref": "#/definitions/UpdateDashboardACLCommand" + } }, { - "type": "string", - "name": "uid", + "type": "integer", + "format": "int64", + "name": "DashboardID", "in": "path", "required": true } ], "responses": { - "201": { - "description": "(empty)" - }, - "202": { - "description": "(empty)" + "200": { + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4226,34 +4283,37 @@ "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Proxies all calls to the actual data source.", + } + }, + "/dashboards/id/{DashboardID}/restore": { + "post": { + "description": "Please refer to [updated API](#/dashboard_versions/restoreDashboardVersionByUID) instead", "tags": [ - "datasources" + "dashboard_versions" ], - "summary": "Data source proxy DELETE calls.", - "operationId": "datasourceProxyDELETEByUIDcalls", + "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": "datasource_proxy_route", + "type": "integer", + "format": "int64", + "name": "DashboardID", "in": "path", "required": true } ], "responses": { - "202": { - "description": "(empty)" - }, - "400": { - "$ref": "#/responses/badRequestError" + "200": { + "$ref": "#/responses/postDashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4270,35 +4330,27 @@ } } }, - "/datasources/proxy/{id}/{datasource_proxy_route}": { + "/dashboards/id/{DashboardID}/versions": { "get": { - "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyGETByUIDcalls) instead", + "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionsByUID) instead", "tags": [ - "datasources" + "dashboard_versions" ], - "summary": "Data source proxy GET calls.", - "operationId": "datasourceProxyGETcalls", + "summary": "Gets all existing versions for the dashboard.", + "operationId": "getDashboardVersionsByID", "deprecated": true, "parameters": [ { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", + "type": "integer", + "format": "int64", + "name": "DashboardID", "in": "path", "required": true } ], "responses": { "200": { - "description": "(empty)" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/dashboardVersionsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4313,44 +4365,36 @@ "$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\n\nPlease refer to [updated API](#/datasources/datasourceProxyPOSTByUIDcalls) instead", + } + }, + "/dashboards/id/{DashboardID}/versions/{DashboardVersionID}": { + "get": { + "description": "Please refer to [updated API](#/dashboard_versions/getDashboardVersionByUID) instead", "tags": [ - "datasources" + "dashboard_versions" ], - "summary": "Data source proxy POST calls.", - "operationId": "datasourceProxyPOSTcalls", + "summary": "Get a specific dashboard version.", + "operationId": "getDashboardVersionByID", "deprecated": true, "parameters": [ { - "name": "DatasourceProxyParam", - "in": "body", - "required": true, - "schema": {} - }, - { - "type": "string", - "name": "datasource_proxy_route", + "type": "integer", + "format": "int64", + "name": "DashboardID", "in": "path", "required": true }, { - "type": "string", - "name": "id", + "type": "integer", + "format": "int64", + "name": "DashboardVersionID", "in": "path", "required": true } ], "responses": { - "201": { - "description": "(empty)" - }, - "202": { - "description": "(empty)" - }, - "400": { - "$ref": "#/responses/badRequestError" + "200": { + "$ref": "#/responses/dashboardVersionResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4365,32 +4409,28 @@ "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyDELETEByUIDcalls) instead", + } + }, + "/dashboards/import": { + "post": { "tags": [ - "datasources" + "dashboards" ], - "summary": "Data source proxy DELETE calls.", - "operationId": "datasourceProxyDELETEcalls", - "deprecated": true, + "summary": "Import dashboard.", + "operationId": "importDashboard", "parameters": [ { - "type": "string", - "name": "id", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ImportDashboardRequest" + } } ], "responses": { - "202": { - "description": "(empty)" + "200": { + "$ref": "#/responses/importDashboardResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -4398,11 +4438,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" @@ -4410,108 +4450,82 @@ } } }, - "/datasources/uid/{sourceUID}/correlations": { + "/dashboards/tags": { "get": { "tags": [ - "correlations" - ], - "summary": "Gets all correlations originating from the given data source.", - "operationId": "getCorrelationsBySourceUID", - "parameters": [ - { - "type": "string", - "name": "sourceUID", - "in": "path", - "required": true - } + "dashboards" ], + "summary": "Get all dashboards tags of an organisation.", + "operationId": "getDashboardTags", "responses": { "200": { - "$ref": "#/responses/getCorrelationsBySourceUIDResponse" + "$ref": "#/responses/getDashboardsTagsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/dashboards/trim": { "post": { "tags": [ - "correlations" + "dashboards" ], - "summary": "Add correlation.", - "operationId": "createCorrelation", + "summary": "Trim defaults from dashboard.", + "operationId": "trimDashboard", "parameters": [ { - "name": "body", + "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateCorrelationCommand" + "$ref": "#/definitions/TrimDashboardCommand" } - }, - { - "type": "string", - "name": "sourceUID", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/createCorrelationResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/trimDashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources/uid/{sourceUID}/correlations/{correlationUID}": { + "/dashboards/uid/{uid}": { "get": { + "description": "Will return the dashboard given the dashboard unique identifier (uid).", "tags": [ - "correlations" + "dashboards" ], - "summary": "Gets a correlation.", - "operationId": "getCorrelation", + "summary": "Get dashboard by uid.", + "operationId": "getDashboardByUID", "parameters": [ { "type": "string", - "name": "sourceUID", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "correlationUID", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getCorrelationResponse" + "$ref": "#/responses/dashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "404": { "$ref": "#/responses/notFoundError" }, @@ -4520,39 +4534,24 @@ } } }, - "patch": { + "delete": { + "description": "Will delete the dashboard given the specified unique identifier (uid).", "tags": [ - "correlations" - ], - "summary": "Updates a correlation.", - "operationId": "updateCorrelation", + "dashboards" + ], + "summary": "Delete dashboard by uid.", + "operationId": "deleteDashboardByUID", "parameters": [ { "type": "string", - "name": "sourceUID", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "correlationUID", + "name": "uid", "in": "path", "required": true - }, - { - "name": "body", - "in": "body", - "schema": { - "$ref": "#/definitions/UpdateCorrelationCommand" - } } ], "responses": { "200": { - "$ref": "#/responses/updateCorrelationResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/deleteDashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4569,14 +4568,13 @@ } } }, - "/datasources/uid/{uid}": { + "/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:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", "tags": [ - "datasources" + "dashboard_permissions" ], - "summary": "Get a single data source by UID.", - "operationId": "getDataSourceByUID", + "summary": "Gets all existing permissions for the given dashboard.", + "operationId": "getDashboardPermissionsListByUID", "parameters": [ { "type": "string", @@ -4587,10 +4585,7 @@ ], "responses": { "200": { - "$ref": "#/responses/getDataSourceResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getDashboardPermissionsListResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4606,20 +4601,20 @@ } } }, - "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": "This 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": "updateDashboardPermissionsByUID", "parameters": [ { "name": "Body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateDataSourceCommand" + "$ref": "#/definitions/UpdateDashboardACLCommand" } }, { @@ -4631,7 +4626,10 @@ ], "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4639,19 +4637,31 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled\nyou need to have a permission with action: `datasources:delete` and scopes: `datasources:*`, `datasources:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", + } + }, + "/dashboards/uid/{uid}/restore": { + "post": { "tags": [ - "datasources" + "dashboard_versions" ], - "summary": "Delete an existing data source by UID.", - "operationId": "deleteDataSourceByUID", + "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", @@ -4661,7 +4671,7 @@ ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/postDashboardResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4678,13 +4688,13 @@ } } }, - "/datasources/uid/{uid}/correlations/{correlationUID}": { - "delete": { + "/dashboards/uid/{uid}/versions": { + "get": { "tags": [ - "correlations" + "dashboard_versions" ], - "summary": "Delete a correlation.", - "operationId": "deleteCorrelation", + "summary": "Gets all existing versions for the dashboard using UID.", + "operationId": "getDashboardVersionsByUID", "parameters": [ { "type": "string", @@ -4693,15 +4703,25 @@ "required": true }, { - "type": "string", - "name": "correlationUID", - "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/deleteCorrelationResponse" + "$ref": "#/responses/dashboardVersionsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4718,14 +4738,21 @@ } } }, - "/datasources/uid/{uid}/health": { + "/dashboards/uid/{uid}/versions/{DashboardVersionID}": { "get": { "tags": [ - "datasources" + "dashboard_versions" ], - "summary": "Sends a health check request to the plugin datasource identified by the UID.", - "operationId": "checkDatasourceHealthWithUID", + "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", @@ -4735,10 +4762,7 @@ ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/dashboardVersionResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4746,39 +4770,26 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources/uid/{uid}/resources/{datasource_proxy_route}": { + "/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": "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 - } - ], + "summary": "Get all data sources.", + "operationId": "getDataSources", "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getDataSourcesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4786,47 +4797,40 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/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).", + "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": [ - "datasource_permissions", - "enterprise" + "datasources" ], - "summary": "Disable permissions for a data source.", - "operationId": "disablePermissions", + "summary": "Create a data source.", + "operationId": "addDataSource", "parameters": [ { - "type": "string", - "name": "datasourceId", - "in": "path", - "required": true + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddDataSourceCommand" + } } ], "responses": { "200": { "$ref": "#/responses/createOrUpdateDatasourceResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -4834,36 +4838,20 @@ } } }, - "/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).", + "/datasources/correlations": { + "get": { "tags": [ - "datasource_permissions", - "enterprise" - ], - "summary": "Enable permissions for a data source.", - "operationId": "enablePermissions", - "parameters": [ - { - "type": "string", - "name": "datasourceId", - "in": "path", - "required": true - } + "correlations" ], + "summary": "Gets all correlations.", + "operationId": "getCorrelations", "responses": { "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getCorrelationsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "404": { "$ref": "#/responses/notFoundError" }, @@ -4873,26 +4861,25 @@ } } }, - "/datasources/{datasourceId}/permissions": { + "/datasources/id/{name}": { "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).", + "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": [ - "datasource_permissions", - "enterprise" + "datasources" ], - "summary": "Get permissions for a data source.", - "operationId": "getAllPermissions", + "summary": "Get data source Id by Name.", + "operationId": "getDataSourceIdByName", "parameters": [ { "type": "string", - "name": "datasourceId", + "name": "name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getAllPermissionseResponse" + "$ref": "#/responses/getDataSourceIDResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4907,49 +4894,27 @@ "$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).", + } + }, + "/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": [ - "datasource_permissions", - "enterprise" + "datasources" ], - "summary": "Add permissions for a data source.", - "operationId": "addPermission", + "summary": "Get a single data source by Name.", + "operationId": "getDataSourceByName", "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": "name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/addPermissionResponse" + "$ref": "#/responses/getDataSourceResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4957,41 +4922,29 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$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": "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": [ - "datasource_permissions", - "enterprise" + "datasources" ], - "summary": "Remove permission for a data source.", - "operationId": "deletePermissions", + "summary": "Delete an existing data source by name.", + "operationId": "deleteDataSourceByName", "parameters": [ { "type": "string", - "name": "datasourceId", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "permissionId", + "name": "name", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/deleteDataSourceByNameResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5001,30 +4954,38 @@ }, "404": { "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/datasources/{id}": { + "/datasources/proxy/uid/{uid}/{datasource_proxy_route}": { "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": "Proxies all calls to the actual data source.", "tags": [ "datasources" ], - "summary": "Get a single data source by Id.", - "operationId": "getDataSourceByID", - "deprecated": true, + "summary": "Data source proxy GET calls.", + "operationId": "datasourceProxyGETByUIDcalls", "parameters": [ { "type": "string", - "name": "id", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDataSourceResponse" + "description": "(empty)" }, "400": { "$ref": "#/responses/badRequestError" @@ -5043,33 +5004,42 @@ } } }, - "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": "Proxies all calls to the actual data source. The data source should support POST methods for the specific path and role as defined", "tags": [ "datasources" ], - "summary": "Update an existing data source by its sequential ID.", - "operationId": "updateDataSourceByID", - "deprecated": true, + "summary": "Data source proxy POST calls.", + "operationId": "datasourceProxyPOSTByUIDcalls", "parameters": [ { - "name": "Body", + "name": "DatasourceProxyParam", "in": "body", "required": true, - "schema": { - "$ref": "#/definitions/UpdateDataSourceCommand" - } + "schema": {} }, { "type": "string", - "name": "id", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { - "200": { - "$ref": "#/responses/createOrUpdateDatasourceResponse" + "201": { + "description": "(empty)" + }, + "202": { + "description": "(empty)" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5077,30 +5047,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", + "description": "Proxies all calls to the actual data source.", "tags": [ "datasources" ], - "summary": "Delete an existing data source by id.", - "operationId": "deleteDataSourceByID", - "deprecated": true, + "summary": "Data source proxy DELETE calls.", + "operationId": "datasourceProxyDELETEByUIDcalls", "parameters": [ { "type": "string", - "name": "id", + "name": "uid", + "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" @@ -5117,16 +5098,22 @@ } } }, - "/datasources/{id}/health": { + "/datasources/proxy/{id}/{datasource_proxy_route}": { "get": { - "description": "Please refer to [updated API](#/datasources/checkDatasourceHealthWithUID) instead", + "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyGETByUIDcalls) instead", "tags": [ "datasources" ], - "summary": "Sends a health check request to the plugin datasource identified by the ID.", - "operationId": "checkDatasourceHealthByID", + "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", @@ -5136,7 +5123,7 @@ ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "description": "(empty)" }, "400": { "$ref": "#/responses/badRequestError" @@ -5147,22 +5134,29 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/datasources/{id}/resources/{datasource_proxy_route}": { - "get": { - "description": "Please refer to [updated API](#/datasources/callDatasourceResourceWithUID) instead", + }, + "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" ], - "summary": "Fetch data source resources by Id.", - "operationId": "callDatasourceResourceByID", + "summary": "Data source proxy POST calls.", + "operationId": "datasourceProxyPOSTcalls", "deprecated": true, "parameters": [ + { + "name": "DatasourceProxyParam", + "in": "body", + "required": true, + "schema": {} + }, { "type": "string", "name": "datasource_proxy_route", @@ -5177,8 +5171,11 @@ } ], "responses": { - "200": { - "$ref": "#/responses/okResponse" + "201": { + "description": "(empty)" + }, + "202": { + "description": "(empty)" }, "400": { "$ref": "#/responses/badRequestError" @@ -5196,32 +5193,32 @@ "$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": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyDELETEByUIDcalls) instead", "tags": [ - "ds" + "datasources" ], - "summary": "DataSource query metrics with expressions.", - "operationId": "queryMetricsWithExpressions", + "summary": "Data source proxy DELETE calls.", + "operationId": "datasourceProxyDELETEcalls", + "deprecated": true, "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/MetricRequest" - } + "type": "string", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true } ], "responses": { - "200": { - "$ref": "#/responses/queryMetricsWithExpressionsRespons" - }, - "207": { - "$ref": "#/responses/queryMetricsWithExpressionsRespons" + "202": { + "description": "(empty)" }, "400": { "$ref": "#/responses/badRequestError" @@ -5232,53 +5229,39 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/folders": { + "/datasources/uid/{sourceUID}/correlations": { "get": { - "description": "Returns all folders that the authenticated user has permission to view.\nIf nested folders are enabled, it expects an additional query parameter with the parent folder UID.", "tags": [ - "folders" + "correlations" ], - "summary": "Get all folders.", - "operationId": "getFolders", + "summary": "Gets all correlations originating from the given data source.", + "operationId": "getCorrelationsBySourceUID", "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" - }, { "type": "string", - "description": "The parent folder UID", - "name": "parent_uid", - "in": "query" + "name": "sourceUID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getFoldersResponse" + "$ref": "#/responses/getCorrelationsBySourceUIDResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -5286,64 +5269,33 @@ } }, "post": { - "description": "If nested folders are enabled then it additionally expects the parent folder UID.", "tags": [ - "folders" + "correlations" ], - "summary": "Create folder.", - "operationId": "createFolder", + "summary": "Add correlation.", + "operationId": "createCorrelation", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateFolderCommand" + "$ref": "#/definitions/CreateCorrelationCommand" } - } - ], - "responses": { - "200": { - "$ref": "#/responses/folderResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "409": { - "$ref": "#/responses/conflictError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/folders/id/{folder_id}": { - "get": { - "description": "Returns the folder identified by id.", - "tags": [ - "folders" - ], - "summary": "Get folder by id.", - "operationId": "getFolderByID", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "folder_id", + }, + { + "type": "string", + "name": "sourceUID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/createCorrelationResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5360,31 +5312,34 @@ } } }, - "/folders/{folder_uid}": { + "/datasources/uid/{sourceUID}/correlations/{correlationUID}": { "get": { "tags": [ - "folders" + "correlations" ], - "summary": "Get folder by uid.", - "operationId": "getFolderByUID", + "summary": "Gets a correlation.", + "operationId": "getCorrelation", "parameters": [ { "type": "string", - "name": "folder_uid", + "name": "sourceUID", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "correlationUID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/getCorrelationResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "404": { "$ref": "#/responses/notFoundError" }, @@ -5393,33 +5348,36 @@ } } }, - "put": { - "description": "If nested folders are enabled then it optionally expects a new parent folder UID that moves the folder and\nincludes it into the response.", + "patch": { "tags": [ - "folders" + "correlations" ], - "summary": "Update folder.", - "operationId": "updateFolder", + "summary": "Updates a correlation.", + "operationId": "updateCorrelation", "parameters": [ { "type": "string", - "name": "folder_uid", + "name": "sourceUID", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "correlationUID", "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/UpdateCorrelationCommand" } } ], "responses": { "200": { - "$ref": "#/responses/folderResponse" + "$ref": "#/responses/updateCorrelationResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5433,39 +5391,31 @@ "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.\nIf nested folders are enabled then it also deletes all the subfolders.", + } + }, + "/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": [ - "folders" + "datasources" ], - "summary": "Delete folder.", - "operationId": "deleteFolder", + "summary": "Get a single data source by UID.", + "operationId": "getDataSourceByUID", "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" } ], "responses": { "200": { - "$ref": "#/responses/deleteFolderResponse" + "$ref": "#/responses/getDataSourceResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5483,26 +5433,33 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/folders/{folder_uid}/permissions": { - "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:uid:*` and `datasources:uid:1` (single data source).", "tags": [ - "folder_permissions" + "datasources" ], - "summary": "Gets all existing permissions for the folder with the given `uid`.", - "operationId": "getFolderPermissionList", + "summary": "Update an existing data source.", + "operationId": "updateDataSourceByUID", "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateDataSourceCommand" + } + }, { "type": "string", - "name": "folder_uid", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getFolderPermissionListResponse" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5510,34 +5467,24 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, - "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:uid:*` and `datasources:uid:kLtEtcRGk` (single data source).", "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": "Delete an existing data source by UID.", + "operationId": "deleteDataSourceByUID", "parameters": [ { "type": "string", - "name": "folder_uid", + "name": "uid", "in": "path", "required": true - }, - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateDashboardACLCommand" - } } ], "responses": { @@ -5559,112 +5506,30 @@ } } }, - "/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.", + "/datasources/uid/{uid}/correlations/{correlationUID}": { + "delete": { "tags": [ - "library_elements" + "correlations" ], - "summary": "Get all library elements.", - "operationId": "getLibraryElements", + "summary": "Delete a correlation.", + "operationId": "deleteCorrelation", "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" + "name": "uid", + "in": "path", + "required": true }, { "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/getLibraryElementsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "post": { - "description": "Creates a new library element.", - "tags": [ - "library_elements" - ], - "summary": "Create library element.", - "operationId": "createLibraryElement", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateLibraryElementCommand" - } + "name": "correlationUID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/deleteCorrelationResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5681,31 +5546,33 @@ } } }, - "/library-elements/name/{library_element_name}": { + "/datasources/uid/{uid}/health": { "get": { - "description": "Returns a library element with the given name.", "tags": [ - "library_elements" + "datasources" ], - "summary": "Get library element by name.", - "operationId": "getLibraryElementByName", + "summary": "Sends a health check request to the plugin datasource identified by the UID.", + "operationId": "checkDatasourceHealthWithUID", "parameters": [ { "type": "string", - "name": "library_element_name", + "name": "uid", "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" @@ -5713,29 +5580,40 @@ } } }, - "/library-elements/{library_element_uid}": { + "/datasources/uid/{uid}/resources/{datasource_proxy_route}": { "get": { - "description": "Returns a library element with the given UID.", "tags": [ - "library_elements" + "datasources" ], - "summary": "Get library element by UID.", - "operationId": "getLibraryElementByUID", + "summary": "Fetch data source resources.", + "operationId": "callDatasourceResourceWithUID", "parameters": [ { "type": "string", - "name": "library_element_uid", + "name": "datasource_proxy_route", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "404": { "$ref": "#/responses/notFoundError" }, @@ -5743,25 +5621,28 @@ "$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/{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": [ - "library_elements" + "datasources" ], - "summary": "Delete library element.", - "operationId": "deleteLibraryElementByUID", + "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/okResponse" + "$ref": "#/responses/getDataSourceResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5780,35 +5661,33 @@ } } }, - "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:id:*` and `datasources:id:1` (single data source).\n\nPlease refer to [updated API](#/datasources/updateDataSourceByUID) instead", "tags": [ - "library_elements" + "datasources" ], - "summary": "Update library element.", - "operationId": "updateLibraryElement", + "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/PatchLibraryElementCommand" + "$ref": "#/definitions/UpdateDataSourceCommand" } }, { "type": "string", - "name": "library_element_uid", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5816,41 +5695,37 @@ "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:id:*` and `datasources:id:1` (single data source).\n\nPlease refer to [updated API](#/datasources/deleteDataSourceByUID) instead", "tags": [ - "library_elements" + "datasources" ], - "summary": "Get library element connections.", - "operationId": "getLibraryElementConnections", + "summary": "Delete an existing data source by id.", + "operationId": "deleteDataSourceByID", + "deprecated": true, "parameters": [ { "type": "string", - "name": "library_element_uid", + "name": "id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementConnectionsResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "404": { "$ref": "#/responses/notFoundError" }, @@ -5860,74 +5735,35 @@ } } }, - "/licensing/check": { + "/datasources/{id}/health": { "get": { + "description": "Please refer to [updated API](#/datasources/checkDatasourceHealthWithUID) instead", "tags": [ - "licensing", - "enterprise" + "datasources" ], - "summary": "Check license availability.", - "operationId": "getStatus", - "responses": { - "200": { - "$ref": "#/responses/getStatusResponse" + "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 } - } - } - }, - "/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/okResponse" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/licensing/custom-permissions-csv": { - "get": { - "description": "You need to have a permission with action `licensing.reports:read`.", - "produces": [ - "text/csv" - ], - "tags": [ - "licensing", - "enterprise" - ], - "summary": "Get custom permissions report in CSV format.", - "operationId": "getCustomPermissionsCSV", - "responses": { - "200": { - "$ref": "#/responses/getCustomPermissionsReportResponse" + "400": { + "$ref": "#/responses/badRequestError" }, - "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" + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -5935,69 +5771,32 @@ } } }, - "/licensing/token": { + "/datasources/{id}/resources/{datasource_proxy_route}": { "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`.", + "description": "Please refer to [updated API](#/datasources/callDatasourceResourceWithUID) instead", "tags": [ - "licensing", - "enterprise" + "datasources" ], - "summary": "Create license token.", - "operationId": "postLicenseToken", + "summary": "Fetch data source resources by Id.", + "operationId": "callDatasourceResourceByID", + "deprecated": true, "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/DeleteTokenCommand" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/getLicenseTokenResponse" + "type": "string", + "name": "datasource_proxy_route", + "in": "path", + "required": true }, - "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": [ - "licensing", - "enterprise" - ], - "summary": "Remove license from database.", - "operationId": "deleteLicenseToken", - "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/DeleteTokenCommand" - } + "type": "string", + "name": "id", + "in": "path", + "required": true } ], "responses": { - "202": { - "$ref": "#/responses/acceptedResponse" + "200": { + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -6008,8 +5807,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "422": { - "$ref": "#/responses/unprocessableEntityError" + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -6017,69 +5816,81 @@ } } }, - "/licensing/token/renew": { + "/ds/query": { "post": { - "description": "Manually ask license issuer for a new token. Available in Grafana Enterprise v7.4+.\n\nYou need to have a permission with action `licensing:update`.", + "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": "Manually force license refresh.", - "operationId": "postRenewLicenseToken", + "summary": "DataSource query metrics with expressions.", + "operationId": "queryMetricsWithExpressions", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "type": "object" + "$ref": "#/definitions/MetricRequest" } } ], "responses": { "200": { - "$ref": "#/responses/postRenewLicenseTokenResponse" + "$ref": "#/responses/queryMetricsWithExpressionsRespons" + }, + "207": { + "$ref": "#/responses/queryMetricsWithExpressionsRespons" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" } } } }, - "/logout/saml": { + "/folders": { "get": { + "description": "Returns all folders that the authenticated user has permission to view.\nIf nested folders are enabled, it expects an additional query parameter with the parent folder UID.", "tags": [ - "saml", - "enterprise" + "folders" ], - "summary": "GetLogout initiates single logout process.", - "operationId": "getSAMLLogout", - "responses": { - "302": { - "description": "(empty)" + "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" }, - "404": { - "$ref": "#/responses/notFoundError" + { + "type": "integer", + "format": "int64", + "default": 1, + "description": "Page index for starting fetching folders", + "name": "page", + "in": "query" }, - "500": { - "$ref": "#/responses/internalServerError" + { + "type": "string", + "description": "The parent folder UID", + "name": "parent_uid", + "in": "query" } - } - } - }, - "/org": { - "get": { - "tags": [ - "org" ], - "summary": "Get current Organization.", - "operationId": "getCurrentOrg", "responses": { "200": { - "$ref": "#/responses/getCurrentOrgResponse" + "$ref": "#/responses/getFoldersResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6092,25 +5903,26 @@ } } }, - "put": { + "post": { + "description": "If nested folders are enabled then it additionally expects the parent folder UID.", "tags": [ - "org" + "folders" ], - "summary": "Update current Organization.", - "operationId": "updateCurrentOrg", + "summary": "Create folder.", + "operationId": "createFolder", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgForm" + "$ref": "#/definitions/CreateFolderCommand" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/folderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -6121,35 +5933,35 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "409": { + "$ref": "#/responses/conflictError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/address": { - "put": { + "/folders/id/{folder_id}": { + "get": { + "description": "Returns the folder identified by id.", "tags": [ - "org" + "folders" ], - "summary": "Update current Organization's address.", - "operationId": "updateCurrentOrgAddress", + "summary": "Get folder by id.", + "operationId": "getFolderByID", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgAddressForm" - } + "type": "integer", + "format": "int64", + "name": "folder_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/folderResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6157,22 +5969,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/invites": { + "/folders/{folder_uid}": { "get": { "tags": [ - "org_invites" + "folders" + ], + "summary": "Get folder by uid.", + "operationId": "getFolderByUID", + "parameters": [ + { + "type": "string", + "name": "folder_uid", + "in": "path", + "required": true + } ], - "summary": "Get pending invites.", - "operationId": "getPendingOrgInvites", "responses": { "200": { - "$ref": "#/responses/getPendingOrgInvitesResponse" + "$ref": "#/responses/folderResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6180,30 +6003,41 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { + "put": { + "description": "If nested folders are enabled then it optionally expects a new parent folder UID that moves the folder and\nincludes it into the response.", "tags": [ - "org_invites" + "folders" ], - "summary": "Add invite.", - "operationId": "addOrgInvite", + "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/AddInviteForm" + "$ref": "#/definitions/UpdateFolderCommand" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/folderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -6214,33 +6048,45 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "412": { - "$ref": "#/responses/SMTPNotEnabledError" + "404": { + "$ref": "#/responses/notFoundError" + }, + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/org/invites/{invitation_code}/revoke": { + }, "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.\nIf nested folders are enabled then it also deletes all the subfolders.", "tags": [ - "org_invites" + "folders" ], - "summary": "Revoke invite.", - "operationId": "revokeInvite", + "summary": "Delete folder.", + "operationId": "deleteFolder", "parameters": [ { "type": "string", - "name": "invitation_code", + "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" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6257,50 +6103,24 @@ } } }, - "/org/preferences": { + "/folders/{folder_uid}/permissions": { "get": { "tags": [ - "org_preferences" - ], - "summary": "Get Current Org Prefs.", - "operationId": "getOrgPreferences", - "responses": { - "200": { - "$ref": "#/responses/getPreferencesResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "put": { - "tags": [ - "org_preferences" + "folder_permissions" ], - "summary": "Update Current Org Prefs.", - "operationId": "updateOrgPreferences", + "summary": "Gets all existing permissions for the folder with the given `uid`.", + "operationId": "getFolderPermissionList", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdatePrefsCmd" - } + "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" @@ -6308,24 +6128,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, - "patch": { + "post": { "tags": [ - "org_preferences" + "folder_permissions" ], - "summary": "Patch Current Org Prefs.", - "operationId": "patchOrgPreferences", + "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/PatchPrefsCmd" + "$ref": "#/definitions/UpdateDashboardACLCommand" } } ], @@ -6333,91 +6162,127 @@ "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/quotas": { + "/library-elements": { "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).", + "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": [ - "getCurrentOrg" + "library_elements" ], - "summary": "Fetch Organization quota.", - "operationId": "getCurrentOrgQuota", - "responses": { - "200": { - "$ref": "#/responses/getQuotaResponse" + "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" }, - "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" + }, + { + "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" + { + "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" } - } - } - }, - "/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" + "$ref": "#/responses/getLibraryElementsResponse" }, "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": "Creates a new library element.", "tags": [ - "org" + "library_elements" ], - "summary": "Add a new user to the current organization.", - "operationId": "addOrgUserToCurrentOrg", + "summary": "Create library element.", + "operationId": "createLibraryElement", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddOrgUserCommand" + "$ref": "#/definitions/CreateLibraryElementCommand" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getLibraryElementResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6425,42 +6290,40 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/users/lookup": { + "/library-elements/name/{library_element_name}": { "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 name.", "tags": [ - "org" + "library_elements" ], - "summary": "Get all users within the current organization (lookup)", - "operationId": "getOrgUsersForCurrentOrgLookup", + "summary": "Get library element by name.", + "operationId": "getLibraryElementByName", "parameters": [ { "type": "string", - "name": "query", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "name": "limit", - "in": "query" + "name": "library_element_name", + "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" @@ -6468,61 +6331,48 @@ } } }, - "/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:*`.", + "/library-elements/{library_element_uid}": { + "get": { + "description": "Returns a library element with the given UID.", "tags": [ - "org" + "library_elements" ], - "summary": "Delete user in current organization.", - "operationId": "removeOrgUserForCurrentOrg", + "summary": "Get library element by UID.", + "operationId": "getLibraryElementByUID", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "name": "library_element_uid", "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" } } }, - "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:*`.", + "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": [ - "org" + "library_elements" ], - "summary": "Updates the given user.", - "operationId": "updateOrgUserForCurrentOrg", + "summary": "Delete library element.", + "operationId": "deleteLibraryElementByUID", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateOrgUserCommand" - } - }, - { - "type": "integer", - "format": "int64", - "name": "user_id", + "type": "string", + "name": "library_element_uid", "in": "path", "required": true } @@ -6540,90 +6390,43 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/orgs": { - "get": { - "security": [ - { - "basic": [] - } - ], - "tags": [ - "orgs" - ], - "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": "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/searchOrgsResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "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" @@ -6631,8 +6434,11 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "409": { - "$ref": "#/responses/conflictError" + "404": { + "$ref": "#/responses/notFoundError" + }, + "412": { + "$ref": "#/responses/preconditionFailedError" }, "500": { "$ref": "#/responses/internalServerError" @@ -6640,35 +6446,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" @@ -6676,30 +6478,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" @@ -6713,16 +6501,11 @@ } }, "put": { - "security": [ - { - "basic": [] - } - ], "tags": [ - "orgs" + "org" ], - "summary": "Update Organization.", - "operationId": "updateOrg", + "summary": "Update current Organization.", + "operationId": "updateCurrentOrg", "parameters": [ { "name": "body", @@ -6731,51 +6514,6 @@ "schema": { "$ref": "#/definitions/UpdateOrgForm" } - }, - { - "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" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "delete": { - "security": [ - { - "basic": [] - } - ], - "tags": [ - "orgs" - ], - "summary": "Delete Organization.", - "operationId": "deleteOrgByID", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { @@ -6791,22 +6529,19 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/orgs/{org_id}/address": { + "/org/address": { "put": { "tags": [ - "orgs" + "org" ], - "summary": "Update Organization's address.", - "operationId": "updateOrgAddress", + "summary": "Update current Organization's address.", + "operationId": "updateCurrentOrgAddress", "parameters": [ { "name": "body", @@ -6815,13 +6550,6 @@ "schema": { "$ref": "#/definitions/UpdateOrgAddressForm" } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { @@ -6843,26 +6571,16 @@ } } }, - "/orgs/{org_id}/quotas": { + "/org/invites": { "get": { - "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `orgs.quotas:read` and scope `org:id:1` (orgIDScope).", "tags": [ - "orgs" - ], - "summary": "Fetch Organization quota.", - "operationId": "getOrgQuota", - "parameters": [ - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - } + "org_invites" ], + "summary": "Get pending invites.", + "operationId": "getPendingOrgInvites", "responses": { "200": { - "$ref": "#/responses/getQuotaResponse" + "$ref": "#/responses/getPendingOrgInvitesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6870,63 +6588,42 @@ "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).", + }, + "post": { "tags": [ - "orgs" + "org_invites" ], - "summary": "Update user quota.", - "operationId": "updateOrgQuota", + "summary": "Add invite.", + "operationId": "addOrgInvite", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateQuotaCmd" + "$ref": "#/definitions/AddInviteForm" } - }, - { - "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" + "412": { + "$ref": "#/responses/SMTPNotEnabledError" }, "500": { "$ref": "#/responses/internalServerError" @@ -6934,31 +6631,24 @@ } } }, - "/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:*`.", + "/org/invites/{invitation_code}/revoke": { + "delete": { "tags": [ - "orgs" + "org_invites" ], - "summary": "Get Users in Organization.", - "operationId": "getOrgUsers", + "summary": "Revoke invite.", + "operationId": "revokeInvite", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "org_id", + "type": "string", + "name": "invitation_code", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getOrgUsersResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6966,38 +6656,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:*`.", + } + }, + "/org/preferences": { + "get": { "tags": [ - "orgs" - ], - "summary": "Add a new user to the current organization.", - "operationId": "addOrgUser", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AddOrgUserCommand" - } - }, - { - "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" + "$ref": "#/responses/getPreferencesResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7009,30 +6686,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:*`.", + }, + "put": { "tags": [ - "orgs" + "org_preferences" ], - "summary": "Delete user in current organization.", - "operationId": "removeOrgUser", + "summary": "Update Current Org Prefs.", + "operationId": "updateOrgPreferences", "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/UpdatePrefsCmd" + } } ], "responses": { @@ -7054,34 +6722,19 @@ } }, "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_preferences" ], - "summary": "Update Users in Organization.", - "operationId": "updateOrgUser", - "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", - "in": "path", - "required": true + "summary": "Patch Current Org Prefs.", + "operationId": "patchOrgPreferences", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PatchPrefsCmd" + } } ], "responses": { @@ -7103,55 +6756,17 @@ } } }, - "/playlists": { + "/org/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": [ - "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" - } - } - }, - "post": { - "tags": [ - "playlists" - ], - "summary": "Create playlist.", - "operationId": "createPlaylist", - "parameters": [ - { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreatePlaylistCommand" - } - } + "getCurrentOrg" ], + "summary": "Fetch Organization quota.", + "operationId": "getCurrentOrgQuota", "responses": { "200": { - "$ref": "#/responses/createPlaylistResponse" + "$ref": "#/responses/getQuotaResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7168,24 +6783,17 @@ } } }, - "/playlists/{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": [ - "playlists" - ], - "summary": "Get playlist.", - "operationId": "getPlaylist", - "parameters": [ - { - "type": "string", - "name": "uid", - "in": "path", - "required": true - } + "org" ], + "summary": "Get all users within the current organization.", + "operationId": "getOrgUsersForCurrentOrg", "responses": { "200": { - "$ref": "#/responses/getPlaylistResponse" + "$ref": "#/responses/getOrgUsersForCurrentOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7193,39 +6801,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": [ - "playlists" + "org" ], - "summary": "Update playlist.", - "operationId": "updatePlaylist", + "summary": "Add a new user to the current organization.", + "operationId": "addOrgUserToCurrentOrg", "parameters": [ { - "name": "Body", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdatePlaylistCommand" + "$ref": "#/definitions/AddOrgUserCommand" } - }, - { - "type": "string", - "name": "uid", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/updatePlaylistResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7233,31 +6833,36 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { + } + }, + "/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": "Delete playlist.", - "operationId": "deletePlaylist", + "summary": "Get all users within the current organization (lookup)", + "operationId": "getOrgUsersForCurrentOrgLookup", "parameters": [ { "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "query", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "name": "limit", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getOrgUsersForCurrentOrgLookupResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7265,33 +6870,35 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/playlists/{uid}/dashboards": { - "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": [ - "playlists" + "org" ], - "summary": "Get playlist dashboards.", - "operationId": "getPlaylistDashboards", + "summary": "Delete user in current organization.", + "operationId": "removeOrgUserForCurrentOrg", "parameters": [ { - "type": "string", - "name": "uid", + "type": "integer", + "format": "int64", + "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getPlaylistDashboardsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7299,33 +6906,41 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/playlists/{uid}/items": { - "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 items.", - "operationId": "getPlaylistItems", + "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/getPlaylistItemsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7333,275 +6948,293 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/query-history": { + "/orgs": { "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.", + "security": [ + { + "basic": [] + } + ], "tags": [ - "query_history" + "orgs" ], - "summary": "Query history search.", - "operationId": "searchQueries", + "summary": "Search all Organizations.", + "operationId": "searchOrgs", "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.", + "default": 1, "name": "page", "in": "query" }, { "type": "integer", "format": "int64", - "description": "Limit the number of returned results", - "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" }, { - "type": "integer", - "format": "int64", - "description": "From range for the query history search", - "name": "from", + "type": "string", + "name": "name", "in": "query" }, { - "type": "integer", - "format": "int64", - "description": "To range for the query history search", - "name": "to", + "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/getQueryHistorySearchResponse" + "$ref": "#/responses/searchOrgsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "409": { + "$ref": "#/responses/conflictError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "post": { - "description": "Adds new query to query history.", + "description": "Only works if [users.allow_org_create](https://grafana.com/docs/grafana/latest/administration/configuration/#allow_org_create) is set.", "tags": [ - "query_history" + "orgs" ], - "summary": "Add query to query history.", - "operationId": "createQuery", + "summary": "Create Organization.", + "operationId": "createOrg", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateQueryInQueryHistoryCommand" + "$ref": "#/definitions/CreateOrgCommand" } } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/createOrgResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "409": { + "$ref": "#/responses/conflictError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/query-history/migrate": { - "post": { - "description": "Adds multiple queries to query history.", + "/orgs/name/{org_name}": { + "get": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "query_history" + "orgs" ], - "summary": "Migrate queries to query history.", - "operationId": "migrateQueries", + "summary": "Get Organization by ID.", + "operationId": "getOrgByName", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/MigrateQueriesToQueryHistoryCommand" - } + "type": "string", + "name": "org_name", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryMigrationResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getOrgByNameResponse" }, "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}": { + "get": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "query_history" + "orgs" ], - "summary": "Add star to query in query history.", - "operationId": "starQuery", + "summary": "Get Organization by ID.", + "operationId": "getOrgByID", "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/getOrgByIDResponse" }, "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.", + "put": { + "security": [ + { + "basic": [] + } + ], "tags": [ - "query_history" + "orgs" ], - "summary": "Remove star to query in query history.", - "operationId": "unstarQuery", + "summary": "Update Organization.", + "operationId": "updateOrg", "parameters": [ { - "type": "string", - "name": "query_history_uid", + "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/getQueryHistoryResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "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.", + "security": [ + { + "basic": [] + } + ], "tags": [ - "query_history" + "orgs" ], - "summary": "Delete query in query history.", - "operationId": "deleteQuery", + "summary": "Delete Organization.", + "operationId": "deleteOrgByID", "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/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "patch": { - "description": "Updates comment for query in query history as specified by the UID.", + } + }, + "/orgs/{org_id}/address": { + "put": { "tags": [ - "query_history" + "orgs" ], - "summary": "Update comment for query in query history.", - "operationId": "patchQueryComment", + "summary": "Update Organization's address.", + "operationId": "updateOrgAddress", "parameters": [ - { - "type": "string", - "name": "query_history_uid", - "in": "path", - "required": true - }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PatchQueryCommentInQueryHistoryCommand" + "$ref": "#/definitions/UpdateOrgAddressForm" } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getQueryHistoryResponse" + "$ref": "#/responses/okResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -7609,23 +7242,35 @@ "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/recording-rules": { + "/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": [ - "recording_rules", - "enterprise" + "orgs" + ], + "summary": "Fetch Organization quota.", + "operationId": "getOrgQuota", + "parameters": [ + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true + } ], - "summary": "Lists all rules in the database: active or deleted.", - "operationId": "listRecordingRules", "responses": { "200": { - "$ref": "#/responses/listRecordingRulesResponse" + "$ref": "#/responses/getQuotaResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7640,27 +7285,47 @@ "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/orgs/{org_id}/quotas/{quota_target}": { "put": { + "security": [ + { + "basic": [] + } + ], + "description": "If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `orgs.quotas:write` and scope `org:id:1` (orgIDScope).", "tags": [ - "recording_rules", - "enterprise" + "orgs" ], - "summary": "Update the active status of a rule.", - "operationId": "updateRecordingRule", + "summary": "Update user quota.", + "operationId": "updateOrgQuota", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/RecordingRuleJSON" + "$ref": "#/definitions/UpdateQuotaCmd" } + }, + { + "type": "string", + "name": "quota_target", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/recordingRuleResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7675,27 +7340,33 @@ "$ref": "#/responses/internalServerError" } } - }, - "post": { + } + }, + "/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": [ - "recording_rules", - "enterprise" + "orgs" ], - "summary": "Create a recording rule that is then registered and started.", - "operationId": "createRecordingRule", + "summary": "Get Users in Organization.", + "operationId": "getOrgUsers", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RecordingRuleJSON" - } + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/recordingRuleResponse" + "$ref": "#/responses/getOrgUsersResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7703,31 +7374,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/recording-rules/test": { + }, "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": [ - "recording_rules", - "enterprise" + "orgs" ], - "summary": "Test a recording rule.", - "operationId": "testCreateRecordingRule", + "summary": "Add a new user to the current organization.", + "operationId": "addOrgUser", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/RecordingRuleJSON" + "$ref": "#/definitions/AddOrgUserCommand" } + }, + { + "type": "integer", + "format": "int64", + "name": "org_id", + "in": "path", + "required": true } ], "responses": { @@ -7740,29 +7413,42 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "422": { - "$ref": "#/responses/unprocessableEntityError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/recording-rules/writer": { - "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": "Return the prometheus remote write target.", - "operationId": "getRecordingRuleWriteTarget", "responses": { "200": { - "$ref": "#/responses/recordingRuleWriteTargetResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7770,35 +7456,48 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { - "description": "It returns a 422 if there is not an existing prometheus data source configured.", + "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": "Create a remote write target.", - "operationId": "createRecordingRuleWriteTarget", + "summary": "Update Users in Organization.", + "operationId": "updateOrgUser", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PrometheusRemoteWriteTargetJSON" + "$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/recordingRuleWriteTargetResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7806,27 +7505,61 @@ "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" }, - "422": { - "$ref": "#/responses/unprocessableEntityError" + { + "type": "integer", + "format": "int64", + "description": "in:limit", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/searchPlaylistsResponse" }, "500": { "$ref": "#/responses/internalServerError" } } }, - "delete": { + "post": { "tags": [ - "recording_rules", - "enterprise" + "playlists" + ], + "summary": "Create playlist.", + "operationId": "createPlaylist", + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreatePlaylistCommand" + } + } ], - "summary": "Delete the remote write target.", - "operationId": "deleteRecordingRuleWriteTarget", "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/createPlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7843,26 +7576,24 @@ } } }, - "/recording-rules/{recordingRuleID}": { - "delete": { + "/playlists/{uid}": { + "get": { "tags": [ - "recording_rules", - "enterprise" + "playlists" ], - "summary": "Delete removes the rule from the registry and stops it.", - "operationId": "deleteRecordingRule", + "summary": "Get playlist.", + "operationId": "getPlaylist", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "recordingRuleID", + "type": "string", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getPlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7877,20 +7608,32 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/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:*`.", + }, + "put": { "tags": [ - "reports", - "enterprise" + "playlists" + ], + "summary": "Update playlist.", + "operationId": "updatePlaylist", + "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdatePlaylistCommand" + } + }, + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + } ], - "summary": "List reports.", - "operationId": "getReports", "responses": { "200": { - "$ref": "#/responses/getReportsResponse" + "$ref": "#/responses/updatePlaylistResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7898,35 +7641,31 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "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`.", + "delete": { "tags": [ - "reports", - "enterprise" + "playlists" ], - "summary": "Create a report.", - "operationId": "createReport", + "summary": "Delete playlist.", + "operationId": "deletePlaylist", "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/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7943,31 +7682,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}/dashboards": { + "get": { "tags": [ - "reports", - "enterprise" + "playlists" ], - "summary": "Send a report.", - "operationId": "sendReport", + "summary": "Get playlist dashboards.", + "operationId": "getPlaylistDashboards", "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/getPlaylistDashboardsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -7984,171 +7716,143 @@ } } }, - "/reports/render/pdf/{dashboardID}": { + "/playlists/{uid}/items": { "get": { - "description": "Please refer to [reports enterprise](#/reports/renderReportPDFs) instead. This will be removed in Grafana 10.", - "produces": [ - "application/pdf" - ], "tags": [ - "reports", - "enterprise" + "playlists" ], - "summary": "Render report for dashboard.", - "operationId": "renderReportPDF", - "deprecated": true, + "summary": "Get playlist items.", + "operationId": "getPlaylistItems", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "DashboardID", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "dashboardID", + "type": "string", + "name": "uid", "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/contentResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getPlaylistItemsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/reports/render/pdfs": { + "/query-history": { "get": { - "description": "Available to all users and with a valid license.", - "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 multiple dashboards.", - "operationId": "renderReportPDFs", + "summary": "Query history search.", + "operationId": "searchQueries", "parameters": [ { - "type": "string", - "name": "dashboardID", + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "List of data source UIDs to search for", + "name": "datasourceUid", "in": "query" }, { "type": "string", - "name": "orientation", + "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", - "name": "layout", + "default": "time-desc", + "description": "Sort method", + "name": "sort", "in": "query" - } - ], - "responses": { - "200": { - "$ref": "#/responses/contentResponse" }, - "400": { - "$ref": "#/responses/badRequestError" + { + "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" }, - "401": { - "$ref": "#/responses/unauthorisedError" + { + "type": "integer", + "format": "int64", + "description": "Limit the number of returned results", + "name": "limit", + "in": "query" }, - "500": { - "$ref": "#/responses/internalServerError" + { + "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" } - } - } - }, - "/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.", + "description": "Adds new query to query history.", "tags": [ - "reports", - "enterprise" + "query_history" ], - "summary": "Save settings.", - "operationId": "saveReportSettings", + "summary": "Add query to query history.", + "operationId": "createQuery", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/SettingsDTO" + "$ref": "#/definitions/CreateQueryInQueryHistoryCommand" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQueryHistoryResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -8156,37 +7860,33 @@ "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/reports/test-email": { + "/query-history/migrate": { "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 multiple queries to query history.", "tags": [ - "reports", - "enterprise" + "query_history" ], - "summary": "Send test report via email.", - "operationId": "sendTestEmail", + "summary": "Migrate queries to query history.", + "operationId": "migrateQueries", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateOrUpdateConfigCmd" + "$ref": "#/definitions/MigrateQueriesToQueryHistoryCommand" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQueryHistoryMigrationResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -8194,241 +7894,128 @@ "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`.", + "/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": "Get a report.", - "operationId": "getReport", + "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/getReportResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/getQueryHistoryResponse" }, "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`.", + "delete": { + "description": "Removes star from query in query history as specified by the UID.", "tags": [ - "reports", - "enterprise" + "query_history" ], - "summary": "Update a report.", - "operationId": "updateReport", + "summary": "Remove star to query in query history.", + "operationId": "unstarQuery", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateOrUpdateConfigCmd" - } - }, - { - "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" } } - }, + } + }, + "/query-history/{query_history_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`.", + "description": "Deletes an existing query in query history as specified by the UID. This operation cannot be reverted.", "tags": [ - "reports", - "enterprise" + "query_history" ], - "summary": "Delete a report.", - "operationId": "deleteReport", + "summary": "Delete query in query history.", + "operationId": "deleteQuery", "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/getQueryHistoryDeleteQueryResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/saml/acs": { - "post": { - "tags": [ - "saml", - "enterprise" - ], - "summary": "It performs assertion Consumer Service (ACS).", - "operationId": "postACS", - "parameters": [ - { - "type": "string", - "name": "RelayState", - "in": "query" - } - ], - "responses": { - "302": { - "description": "(empty)" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/saml/metadata": { - "get": { - "produces": [ - "application/xml;application/samlmetadata+xml" - ], - "tags": [ - "saml", - "enterprise" - ], - "summary": "It exposes the SP (Grafana's) metadata for the IdP's consumption.", - "operationId": "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": { - "302": { - "description": "(empty)" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "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" @@ -8580,7 +8167,7 @@ "tags": [ "service_accounts" ], - "summary": "Create service account", + "summary": "# Create service account", "operationId": "createServiceAccount", "parameters": [ { @@ -8616,7 +8203,7 @@ "tags": [ "service_accounts" ], - "summary": "Search service accounts with paging", + "summary": "# Search service accounts with paging", "operationId": "searchOrgServiceAccountsWithPaging", "parameters": [ { @@ -8672,7 +8259,7 @@ "tags": [ "service_accounts" ], - "summary": "Get single serviceaccount by Id", + "summary": "# Get single serviceaccount by Id", "operationId": "retrieveServiceAccount", "parameters": [ { @@ -8709,7 +8296,7 @@ "tags": [ "service_accounts" ], - "summary": "Delete service account", + "summary": "# Delete service account", "operationId": "deleteServiceAccount", "parameters": [ { @@ -8743,7 +8330,7 @@ "tags": [ "service_accounts" ], - "summary": "Update service account", + "summary": "# Update service account", "operationId": "updateServiceAccount", "parameters": [ { @@ -8789,7 +8376,7 @@ "tags": [ "service_accounts" ], - "summary": "Get service account tokens", + "summary": "# Get service account tokens", "operationId": "listTokens", "parameters": [ { @@ -8823,7 +8410,7 @@ "tags": [ "service_accounts" ], - "summary": "CreateNewToken adds a token to a service account", + "summary": "# CreateNewToken adds a token to a service account", "operationId": "createToken", "parameters": [ { @@ -8872,7 +8459,7 @@ "tags": [ "service_accounts" ], - "summary": "DeleteToken deletes service account tokens", + "summary": "# DeleteToken deletes service account tokens", "operationId": "deleteToken", "parameters": [ { @@ -9145,135 +8732,6 @@ } } }, - "/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" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, "/teams/{team_id}": { "get": { "tags": [ @@ -10420,42 +9878,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": { @@ -10562,25 +9984,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": { @@ -10602,25 +10005,6 @@ } } }, - "AddTeamRoleCommand": { - "type": "object", - "properties": { - "roleUid": { - "type": "string" - } - } - }, - "AddUserRoleCommand": { - "type": "object", - "properties": { - "global": { - "type": "boolean" - }, - "roleUid": { - "type": "string" - } - } - }, "Address": { "type": "object", "properties": { @@ -11372,26 +10756,6 @@ } } }, - "BrandingOptionsDTO": { - "type": "object", - "properties": { - "emailFooterLink": { - "type": "string" - }, - "emailFooterMode": { - "type": "string" - }, - "emailFooterText": { - "type": "string" - }, - "emailLogoUrl": { - "type": "string" - }, - "reportLogoUrl": { - "type": "string" - } - } - }, "CalculateDiffTarget": { "type": "object", "properties": { @@ -11429,110 +10793,28 @@ "title": "Config is the top-level configuration for Alertmanager's config files.", "properties": { "global": { - "$ref": "#/definitions/GlobalConfig" - }, - "inhibit_rules": { - "type": "array", - "items": { - "$ref": "#/definitions/InhibitRule" - } - }, - "mute_time_intervals": { - "type": "array", - "items": { - "$ref": "#/definitions/MuteTimeInterval" - } - }, - "route": { - "$ref": "#/definitions/Route" - }, - "templates": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "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" - }, - "scaleFactor": { - "type": "integer", - "format": "int64" - }, - "schedule": { - "$ref": "#/definitions/ScheduleDTO" + "$ref": "#/definitions/GlobalConfig" }, - "state": { - "$ref": "#/definitions/State" + "inhibit_rules": { + "type": "array", + "items": { + "$ref": "#/definitions/InhibitRule" + } }, - "templateVars": { - "type": "object" + "mute_time_intervals": { + "type": "array", + "items": { + "$ref": "#/definitions/MuteTimeInterval" + } }, - "updated": { - "type": "string", - "format": "date-time" + "route": { + "$ref": "#/definitions/Route" }, - "userId": { - "type": "integer", - "format": "int64" + "templates": { + "type": "array", + "items": { + "type": "string" + } } } }, @@ -11788,64 +11070,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" - }, - "scaleFactor": { - "type": "integer", - "format": "int64" - }, - "schedule": { - "$ref": "#/definitions/ScheduleDTO" - }, - "state": { - "$ref": "#/definitions/State" - }, - "templateVars": { - "type": "object" - } - } - }, "CreateOrgCommand": { "type": "object", "properties": { @@ -11888,42 +11112,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": { @@ -11957,53 +11145,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": { @@ -12107,20 +11248,6 @@ } } }, - "DashboardDTO": { - "type": "object", - "properties": { - "dashboard": { - "$ref": "#/definitions/DashboardReportDTO" - }, - "reportVariables": { - "type": "object" - }, - "timeRange": { - "$ref": "#/definitions/TimeRangeDTO" - } - } - }, "DashboardFullWithMeta": { "type": "object", "properties": { @@ -12237,21 +11364,6 @@ } } }, - "DashboardReportDTO": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "uid": { - "type": "string" - } - } - }, "DashboardSnapshot": { "description": "DashboardSnapshot model", "type": "object", @@ -12603,83 +11715,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." @@ -12693,14 +11728,6 @@ } } }, - "DeleteTokenCommand": { - "type": "object", - "properties": { - "instance": { - "type": "string" - } - } - }, "DiscoveryBase": { "type": "object", "required": [ @@ -12721,11 +11748,6 @@ "DsAccess": { "type": "string" }, - "DsPermissionType": { - "description": "Datasource permission\nDescription:\n`0` - No Access\n`1` - Query\n`2` - Edit\nEnum: 0,1,2", - "type": "integer", - "format": "int64" - }, "Duration": { "description": "A Duration represents the elapsed time between two instants\nas an int64 nanosecond count. The representation limits the\nlargest representable duration to approximately 290 years.", "type": "integer", @@ -12949,18 +11971,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" }, @@ -15034,28 +14044,8 @@ "PauseAllAlertsCommand": { "type": "object", "properties": { - "paused": { - "type": "boolean" - } - } - }, - "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" + "paused": { + "type": "boolean" } } }, @@ -15505,20 +14495,6 @@ } } }, - "PrometheusRemoteWriteTargetJSON": { - "type": "object", - "properties": { - "data_source_uid": { - "type": "string" - }, - "id": { - "type": "string" - }, - "remote_write_path": { - "type": "string" - } - } - }, "Provenance": { "type": "string" }, @@ -16026,51 +15002,6 @@ } } }, - "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": false - } - }, - "range": { - "type": "integer", - "format": "int64" - }, - "target_ref_id": { - "type": "string" - } - } - }, "Regexp": { "description": "A Regexp is safe for concurrent use by multiple goroutines,\nexcept for configuration methods, such as Longest.", "type": "object", @@ -16088,41 +15019,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": { @@ -16157,79 +15053,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", @@ -16745,49 +15568,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": { @@ -16797,26 +15577,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", @@ -16988,9 +15748,6 @@ "SmtpNotEnabled": { "$ref": "#/definitions/ResponseDetails" }, - "State": { - "type": "string" - }, "Status": { "type": "integer", "format": "int64" @@ -17006,39 +15763,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.", @@ -17113,34 +15837,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" } } }, @@ -17461,104 +16161,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": { @@ -17601,10 +16203,6 @@ } } }, - "TokenStatus": { - "type": "integer", - "format": "int64" - }, "TrimDashboardCommand": { "type": "object", "properties": { @@ -17627,9 +16225,6 @@ } } }, - "Type": { - "type": "string" - }, "URL": { "type": "object", "title": "URL is a custom URL type that allows validation at configuration load time.", @@ -18006,39 +16601,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": { @@ -19002,21 +17564,6 @@ "$ref": "#/definitions/ErrorResponseBody" } }, - "addPermissionResponse": { - "description": "(empty)", - "schema": { - "type": "object", - "properties": { - "message": { - "type": "string" - }, - "permissionId": { - "type": "integer", - "format": "int64" - } - } - } - }, "adminCreateUserResponse": { "description": "(empty)", "schema": { @@ -19066,16 +17613,6 @@ "$ref": "#/definitions/ErrorResponseBody" } }, - "contentResponse": { - "description": "(empty)", - "schema": { - "type": "array", - "items": { - "type": "integer", - "format": "uint8" - } - } - }, "createCorrelationResponse": { "description": "(empty)", "schema": { @@ -19171,27 +17708,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": { @@ -19376,12 +17892,6 @@ } } }, - "getAccessControlStatusResponse": { - "description": "(empty)", - "schema": { - "$ref": "#/definitions/Status" - } - }, "getAlertNotificationChannelResponse": { "description": "(empty)", "schema": { @@ -19421,21 +17931,6 @@ } } }, - "getAllPermissionseResponse": { - "description": "(empty)", - "schema": { - "$ref": "#/definitions/DataSourcePermissionsDTO" - } - }, - "getAllRolesResponse": { - "description": "(empty)", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/RoleDTO" - } - } - }, "getAnnotationByIDResponse": { "description": "(empty)", "schema": { @@ -19487,15 +17982,6 @@ "$ref": "#/definitions/OrgDetailsDTO" } }, - "getCustomPermissionsReportResponse": { - "description": "(empty)", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/CustomPermissionsRecordDTO" - } - } - }, "getDashboardPermissionsListResponse": { "description": "(empty)", "schema": { @@ -19597,12 +18083,6 @@ "$ref": "#/definitions/LibraryElementSearchResponse" } }, - "getLicenseTokenResponse": { - "description": "(empty)", - "schema": { - "$ref": "#/definitions/Token" - } - }, "getOrgByIDResponse": { "description": "(empty)", "schema": { @@ -19711,39 +18191,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": { @@ -19779,30 +18226,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": { @@ -19866,36 +18295,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": { @@ -20056,9 +18455,6 @@ } } }, - "postRenewLicenseTokenResponse": { - "description": "(empty)" - }, "preconditionFailedError": { "description": "PreconditionFailedError", "schema": { @@ -20080,24 +18476,6 @@ } } }, - "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": { @@ -20152,12 +18530,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 1144cf60bec..bee5a749acf 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/UpdateQuotaCmd" + } + }, + { + "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,1671 +1179,103 @@ "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/UpdateQuotaCmd" - } + { + "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" - }, - "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" - } + "description": "Limit response to X number of alerts.", + "name": "limit", + "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": "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" }, - "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" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "409": { - "$ref": "#/responses/conflictError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/alert-notifications/lookup": { - "get": { - "description": "Returns all notification channels, but with less detailed information. Accessible by any authenticated user and is mainly used by providing alert notification channels in Grafana UI when configuring alert rule.", - "tags": [ - "legacy_alerts_notification_channels" - ], - "summary": "Get all notification channels (lookup).", - "operationId": "getAlertNotificationLookup", - "responses": { - "200": { - "$ref": "#/responses/getAlertNotificationLookupResponse" - }, - "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" - } - } - } - }, - "/alert-notifications/test": { - "post": { - "description": "Sends a test notification to the channel.", - "tags": [ - "legacy_alerts_notification_channels" - ], - "summary": "Test notification channel.", - "operationId": "notificationChannelTest", - "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/NotificationTestCommand" - } + "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" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "412": { - "$ref": "#/responses/SMTPNotEnabledError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/alert-notifications/uid/{notification_channel_uid}": { - "get": { - "description": "Returns the notification channel given the notification channel UID.", - "tags": [ - "legacy_alerts_notification_channels" - ], - "summary": "Get notification channel by UID.", - "operationId": "getAlertNotificationChannelByUID", - "parameters": [ - { - "type": "string", - "name": "notification_channel_uid", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getAlertNotificationChannelResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - }, - "put": { - "description": "Updates an existing notification channel identified by uid.", - "tags": [ - "legacy_alerts_notification_channels" - ], - "summary": "Update notification channel by UID.", - "operationId": "updateAlertNotificationChannelByUID", - "parameters": [ - { - "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" + "$ref": "#/responses/getAlertsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3000,67 +1286,63 @@ } } }, - "/dashboards/uid/{uid}": { + "/alerts/states-for-dashboard": { "get": { - "description": "Will return the dashboard given the dashboard unique identifier (uid).", "tags": [ - "dashboards" + "legacy_alerts" ], - "summary": "Get dashboard by uid.", - "operationId": "getDashboardByUID", + "summary": "Get alert states for a dashboard.", + "operationId": "getDashboardStates", "parameters": [ { - "type": "string", - "name": "uid", - "in": "path", + "type": "integer", + "format": "int64", + "name": "dashboardId", + "in": "query", "required": true } ], "responses": { "200": { - "$ref": "#/responses/dashboardResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" + "$ref": "#/responses/getDashboardStatesResponse" }, - "404": { - "$ref": "#/responses/notFoundError" + "400": { + "$ref": "#/responses/badRequestError" }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Will delete the dashboard given the specified unique identifier (uid).", + } + }, + "/alerts/test": { + "post": { "tags": [ - "dashboards" + "legacy_alerts" ], - "summary": "Delete dashboard by uid.", - "operationId": "deleteDashboardByUID", + "summary": "Test alert.", + "operationId": "testAlert", "parameters": [ { - "type": "string", - "name": "uid", - "in": "path", - "required": true + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/AlertTestCommand" + } } ], "responses": { "200": { - "$ref": "#/responses/deleteDashboardResponse" + "$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" @@ -3068,68 +1350,61 @@ } } }, - "/dashboards/uid/{uid}/permissions": { + "/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": "Gets all existing permissions for the given dashboard.", - "operationId": "getDashboardPermissionsListByUID", + "summary": "Get alert by ID.", + "operationId": "getAlertByID", "parameters": [ { "type": "string", - "name": "uid", + "name": "alert_id", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getDashboardPermissionsListResponse" + "$ref": "#/responses/getAlertResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/alerts/{alert_id}/pause": { "post": { - "description": "This operation will remove existing permissions if they’re not included in the request.", "tags": [ - "dashboard_permissions" + "legacy_alerts" ], - "summary": "Updates permissions for a dashboard.", - "operationId": "updateDashboardPermissionsByUID", + "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/UpdateDashboardACLCommand" + "$ref": "#/definitions/PauseAlertCommand" } - }, - { - "type": "string", - "name": "uid", - "in": "path", - "required": true } ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/pauseAlertResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3146,82 +1421,132 @@ } } }, - "/dashboards/uid/{uid}/restore": { - "post": { + "/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": "Restore a dashboard to a given dashboard version using UID.", - "operationId": "restoreDashboardVersionByUID", + "summary": "Find Annotations.", + "operationId": "getAnnotations", "parameters": [ { - "name": "Body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/RestoreDashboardVersionCommand" - } + "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", + "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/postDashboardResponse" + "$ref": "#/responses/getAnnotationsResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/dashboards/uid/{uid}/versions": { - "get": { + }, + "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": [ - "dashboard_versions" + "annotations" ], - "summary": "Gets all existing versions for the dashboard using UID.", - "operationId": "getDashboardVersionsByUID", + "summary": "Create Annotation.", + "operationId": "postAnnotation", "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" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PostAnnotationsCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/dashboardVersionsResponse" + "$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,87 +1912,79 @@ } } }, - "/datasources/proxy/{id}/{datasource_proxy_route}": { + "/dashboard/snapshots": { "get": { - "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyGETByUIDcalls) instead", "tags": [ - "datasources" + "snapshots" ], - "summary": "Data source proxy GET calls.", - "operationId": "datasourceProxyGETcalls", - "deprecated": true, + "summary": "List snapshots.", + "operationId": "searchDashboardSnapshots", "parameters": [ { "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true + "description": "Search Query", + "name": "query", + "in": "query" }, { - "type": "string", - "name": "id", - "in": "path", - "required": true + "type": "integer", + "format": "int64", + "default": 1000, + "description": "Limit the number of returned results", + "name": "limit", + "in": "query" } ], "responses": { "200": { - "description": "" - }, - "400": { - "$ref": "#/responses/badRequestError" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" + "$ref": "#/responses/searchDashboardSnapshotsResponse" }, "500": { "$ref": "#/responses/internalServerError" } } - }, + } + }, + "/dashboards/calculate-diff": { "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", + "produces": [ + "application/json", + "text/html" + ], "tags": [ - "datasources" + "dashboards" ], - "summary": "Data source proxy POST calls.", - "operationId": "datasourceProxyPOSTcalls", - "deprecated": true, + "summary": "Perform diff on two dashboards.", + "operationId": "calculateDashboardDiff", "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": { + "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": { - "201": { - "description": "" - }, - "202": { - "description": "" - }, - "400": { - "$ref": "#/responses/badRequestError" + "200": { + "$ref": "#/responses/calculateDashboardDiffResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -3686,39 +1992,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "delete": { - "description": "Proxies all calls to the actual data source.\n\nPlease refer to [updated API](#/datasources/datasourceProxyDELETEByUIDcalls) instead", + } + }, + "/dashboards/db": { + "post": { + "description": "Creates a new dashboard or updates an existing dashboard.", "tags": [ - "datasources" + "dashboards" ], - "summary": "Data source proxy DELETE calls.", - "operationId": "datasourceProxyDELETEcalls", - "deprecated": true, + "summary": "Create / Update dashboard", + "operationId": "postDashboard", "parameters": [ { - "type": "string", - "name": "id", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "datasource_proxy_route", - "in": "path", - "required": true + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/SaveDashboardCommand" + } } ], "responses": { - "202": { - "description": "" + "200": { + "$ref": "#/responses/postDashboardResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -3732,34 +2032,66 @@ "404": { "$ref": "#/responses/notFoundError" }, + "412": { + "$ref": "#/responses/preconditionFailedError" + }, + "422": { + "$ref": "#/responses/unprocessableEntityError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/datasources/uid/{sourceUID}/correlations": { + "/dashboards/home": { "get": { "tags": [ - "correlations" + "dashboards" ], - "summary": "Gets all correlations originating from the given data source.", - "operationId": "getCorrelationsBySourceUID", + "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": "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,28 +2814,29 @@ "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.\nIf nested folders are enabled, it expects an additional query parameter with the parent folder UID.", "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", @@ -4600,7 +2855,10 @@ ], "responses": { "200": { - "$ref": "#/responses/getFoldersResponse" + "description": "" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -4608,31 +2866,47 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "post": { - "description": "If nested folders are enabled then it additionally expects the parent folder UID.", + "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", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateFolderCommand" - } + "name": "DatasourceProxyParam", + "in": "body", + "required": true, + "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" @@ -4643,35 +2917,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" @@ -4688,24 +2968,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" @@ -4721,33 +3012,40 @@ } } }, - "put": { - "description": "If nested folders are enabled then it optionally expects a new parent folder UID that moves the folder and\nincludes it into the response.", + "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" @@ -4761,39 +3059,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.\nIf nested folders are enabled then it also deletes all the subfolders.", + "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" @@ -4813,31 +3108,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" }, @@ -4848,29 +3140,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" @@ -4887,109 +3182,72 @@ } } }, - "/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" - }, - { - "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" + "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" - }, - { - "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" + "name": "correlationUID", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementsResponse" + "$ref": "#/responses/getCorrelationResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, - "post": { - "description": "Creates a new library element.", + "patch": { "tags": [ - "library_elements" + "correlations" ], - "summary": "Create library element.", - "operationId": "createLibraryElement", + "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", - "required": true, "schema": { - "$ref": "#/definitions/CreateLibraryElementCommand" + "$ref": "#/definitions/UpdateCorrelationCommand" } } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/updateCorrelationResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5009,29 +3267,35 @@ } } }, - "/library-elements/name/{library_element_name}": { + "/datasources/uid/{uid}": { "get": { - "description": "Returns a library element with the given name.", + "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": "Get library element by name.", - "operationId": "getLibraryElementByName", + "summary": "Get a single data source by UID.", + "operationId": "getDataSourceByUID", "parameters": [ { "type": "string", - "name": "library_element_name", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/getDataSourceResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, + "403": { + "$ref": "#/responses/forbiddenError" + }, "404": { "$ref": "#/responses/notFoundError" }, @@ -5039,33 +3303,39 @@ "$ref": "#/responses/internalServerError" } } - } - }, - "/library-elements/{library_element_uid}": { - "get": { - "description": "Returns a library element with the given 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": "Get library element by UID.", - "operationId": "getLibraryElementByUID", + "summary": "Update an existing data source.", + "operationId": "updateDataSourceByUID", "parameters": [ + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateDataSourceCommand" + } + }, { "type": "string", - "name": "library_element_uid", + "name": "uid", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" + "$ref": "#/responses/createOrUpdateDatasourceResponse" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -5073,16 +3343,16 @@ } }, "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.", + "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": "Delete library element.", - "operationId": "deleteLibraryElementByUID", + "summary": "Delete an existing data source by UID.", + "operationId": "deleteDataSourceByUID", "parameters": [ { "type": "string", - "name": "library_element_uid", + "name": "uid", "in": "path", "required": true } @@ -5091,9 +3361,6 @@ "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -5107,36 +3374,32 @@ "$ref": "#/responses/internalServerError" } } - }, - "patch": { - "description": "Updates an existing library element identified by uid.", + } + }, + "/datasources/uid/{uid}/correlations/{correlationUID}": { + "delete": { "tags": [ - "library_elements" + "correlations" ], - "summary": "Update library element.", - "operationId": "updateLibraryElement", + "summary": "Delete a correlation.", + "operationId": "deleteCorrelation", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PatchLibraryElementCommand" - } + "type": "string", + "name": "uid", + "in": "path", + "required": true }, { "type": "string", - "name": "library_element_uid", + "name": "correlationUID", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementResponse" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$ref": "#/responses/deleteCorrelationResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5147,40 +3410,39 @@ "404": { "$ref": "#/responses/notFoundError" }, - "412": { - "$ref": "#/responses/preconditionFailedError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/library-elements/{library_element_uid}/connections/": { + "/datasources/uid/{uid}/health": { "get": { - "description": "Returns a list of connections for a library element based on the UID specified.", "tags": [ - "library_elements" + "datasources" ], - "summary": "Get library element connections.", - "operationId": "getLibraryElementConnections", + "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 } ], "responses": { "200": { - "$ref": "#/responses/getLibraryElementConnectionsResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" }, - "404": { - "$ref": "#/responses/notFoundError" + "403": { + "$ref": "#/responses/forbiddenError" }, "500": { "$ref": "#/responses/internalServerError" @@ -5188,74 +3450,42 @@ } } }, - "/licensing/check": { - "get": { - "tags": [ - "licensing", - "enterprise" - ], - "summary": "Check license availability.", - "operationId": "getStatus", - "responses": { - "200": { - "$ref": "#/responses/getStatusResponse" - } - } - } - }, - "/licensing/custom-permissions": { + "/datasources/uid/{uid}/resources/{datasource_proxy_route}": { "get": { - "description": "You need to have a permission with action `licensing.reports:read`.", "tags": [ - "licensing", - "enterprise" + "datasources" ], - "summary": "Get custom permissions report.", - "operationId": "getCustomPermissionsReport", - "responses": { - "200": { - "$ref": "#/responses/getCustomPermissionsReportResponse" + "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/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" + "$ref": "#/responses/okResponse" }, - "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" + "400": { + "$ref": "#/responses/badRequestError" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" }, "500": { "$ref": "#/responses/internalServerError" @@ -5263,72 +3493,71 @@ } } }, - "/licensing/token": { + "/datasources/{id}": { "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`.", + "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" @@ -5336,58 +3565,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": "" + "403": { + "$ref": "#/responses/forbiddenError" }, "404": { "$ref": "#/responses/notFoundError" @@ -5398,16 +3605,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" @@ -5419,21 +3639,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": { @@ -5449,32 +3677,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" @@ -5491,16 +3726,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" @@ -5514,24 +3768,25 @@ } }, "post": { + "description": "If nested folders are enabled then it additionally expects the parent folder UID.", "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" @@ -5542,8 +3797,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "412": { - "$ref": "#/responses/SMTPNotEnabledError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -5551,24 +3806,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" @@ -5585,16 +3842,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" @@ -5602,30 +3867,87 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } }, "put": { + "description": "If nested folders are enabled then it optionally expects a new parent folder UID that moves the folder and\nincludes it into the response.", "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" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "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.\nIf nested folders are enabled then it also deletes all the subfolders.", + "tags": [ + "folders" + ], + "summary": "Delete folder.", + "operationId": "deleteFolder", + "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" + } + ], + "responses": { + "200": { + "$ref": "#/responses/deleteFolderResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -5636,33 +3958,33 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - }, - "patch": { + } + }, + "/folders/{folder_uid}/permissions": { + "get": { "tags": [ - "org_preferences" + "folder_permissions" ], - "summary": "Patch Current Org Prefs.", - "operationId": "patchOrgPreferences", + "summary": "Gets all existing permissions for the folder with the given `uid`.", + "operationId": "getFolderPermissionList", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PatchPrefsCmd" - } + "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" @@ -5670,23 +3992,39 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } - } - }, - "/org/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": [ - "getCurrentOrg" + "folder_permissions" + ], + "summary": "Updates permissions for a folder. This operation will remove existing permissions if they’re not included in the request.", + "operationId": "updateFolderPermissions", + "parameters": [ + { + "type": "string", + "name": "folder_uid", + "in": "path", + "required": true + }, + { + "name": "Body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateDashboardACLCommand" + } + } ], - "summary": "Fetch Organization quota.", - "operationId": "getCurrentOrgQuota", "responses": { "200": { - "$ref": "#/responses/getQuotaResponse" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5703,49 +4041,112 @@ } } }, - "/org/users": { + "/library-elements": { "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:*`.", + "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 library elements.", + "operationId": "getLibraryElements", + "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", + "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" + } ], - "summary": "Get all users within the current organization.", - "operationId": "getOrgUsersForCurrentOrg", "responses": { "200": { - "$ref": "#/responses/getOrgUsersForCurrentOrgResponse" + "$ref": "#/responses/getLibraryElementsResponse" }, "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": "Creates a new library element.", "tags": [ - "org" + "library_elements" ], - "summary": "Add a new user to the current organization.", - "operationId": "addOrgUserToCurrentOrg", + "summary": "Create library element.", + "operationId": "createLibraryElement", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/AddOrgUserCommand" + "$ref": "#/definitions/CreateLibraryElementCommand" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getLibraryElementResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -5753,42 +4154,40 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/org/users/lookup": { + "/library-elements/name/{library_element_name}": { "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 name.", "tags": [ - "org" + "library_elements" ], - "summary": "Get all users within the current organization (lookup)", - "operationId": "getOrgUsersForCurrentOrgLookup", + "summary": "Get library element by name.", + "operationId": "getLibraryElementByName", "parameters": [ { "type": "string", - "name": "query", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "name": "limit", - "in": "query" + "name": "library_element_name", + "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" @@ -5796,19 +4195,48 @@ } } }, - "/org/users/{user_id}": { + "/library-elements/{library_element_uid}": { + "get": { + "description": "Returns a library element with the given UID.", + "tags": [ + "library_elements" + ], + "summary": "Get library element by UID.", + "operationId": "getLibraryElementByUID", + "parameters": [ + { + "type": "string", + "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": "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 } @@ -5826,38 +4254,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" @@ -5868,55 +4298,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" @@ -5924,34 +4359,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" @@ -5959,38 +4393,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" @@ -6004,30 +4435,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" @@ -6040,32 +4457,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": { @@ -6081,27 +4486,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 } @@ -6110,9 +4514,6 @@ "200": { "$ref": "#/responses/okResponse" }, - "400": { - "$ref": "#/responses/badRequestError" - }, "401": { "$ref": "#/responses/unauthorisedError" }, @@ -6128,28 +4529,42 @@ } } }, - "/orgs/{org_id}/address": { + "/org/preferences": { + "get": { + "tags": [ + "org_preferences" + ], + "summary": "Get Current Org Prefs.", + "operationId": "getOrgPreferences", + "responses": { + "200": { + "$ref": "#/responses/getPreferencesResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + }, "put": { "tags": [ - "orgs" + "org_preferences" ], - "summary": "Update Organization's address.", - "operationId": "updateOrgAddress", + "summary": "Update Current Org Prefs.", + "operationId": "updateOrgPreferences", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateOrgAddressForm" + "$ref": "#/definitions/UpdatePrefsCmd" } - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true } ], "responses": { @@ -6169,28 +4584,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).", + }, + "patch": { "tags": [ - "orgs" + "org_preferences" ], - "summary": "Fetch Organization quota.", - "operationId": "getOrgQuota", + "summary": "Patch Current Org Prefs.", + "operationId": "patchOrgPreferences", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PatchPrefsCmd" + } } ], "responses": { "200": { - "$ref": "#/responses/getQuotaResponse" + "$ref": "#/responses/okResponse" + }, + "400": { + "$ref": "#/responses/badRequestError" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6198,54 +4614,23 @@ "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).", + "/org/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": [ - "orgs" - ], - "summary": "Update user quota.", - "operationId": "updateOrgQuota", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/UpdateQuotaCmd" - } - }, - { - "type": "string", - "name": "quota_target", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - } + "getCurrentOrg" ], + "summary": "Fetch Organization quota.", + "operationId": "getCurrentOrgQuota", "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQuotaResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -6262,31 +4647,17 @@ } } }, - "/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" @@ -6302,10 +4673,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", @@ -6314,18 +4685,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" @@ -6339,22 +4740,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", @@ -6384,10 +4778,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", @@ -6397,13 +4791,6 @@ "$ref": "#/definitions/UpdateOrgUserCommand" } }, - { - "type": "integer", - "format": "int64", - "name": "org_id", - "in": "path", - "required": true - }, { "type": "integer", "format": "int64", @@ -6431,129 +4818,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" - } + "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" @@ -6561,31 +4868,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" @@ -6593,8 +4903,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -6602,24 +4912,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" @@ -6627,33 +4942,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" @@ -6661,118 +4979,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" @@ -6780,33 +5060,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" @@ -6814,146 +5106,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/UpdateQuotaCmd" + } + }, { "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" @@ -6961,34 +5320,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" @@ -6996,71 +5369,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" @@ -7071,26 +5434,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" @@ -7106,55 +5473,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" @@ -7169,21 +5512,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 } @@ -7207,54 +5546,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" @@ -7271,31 +5580,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" @@ -7312,171 +5614,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.", + "description": "Adds new query to query history.", "tags": [ - "reports", - "enterprise" + "query_history" ], - "summary": "Save settings.", - "operationId": "saveReportSettings", + "summary": "Add query to query history.", + "operationId": "createQuery", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/SettingsDTO" + "$ref": "#/definitions/CreateQueryInQueryHistoryCommand" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQueryHistoryResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -7484,37 +5724,33 @@ "401": { "$ref": "#/responses/unauthorisedError" }, - "403": { - "$ref": "#/responses/forbiddenError" - }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/reports/test-email": { + "/query-history/migrate": { "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 multiple queries to query history.", "tags": [ - "reports", - "enterprise" + "query_history" ], - "summary": "Send test report via email.", - "operationId": "sendTestEmail", + "summary": "Migrate queries to query history.", + "operationId": "migrateQueries", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/CreateOrUpdateConfigCmd" + "$ref": "#/definitions/MigrateQueriesToQueryHistoryCommand" } } ], "responses": { "200": { - "$ref": "#/responses/okResponse" + "$ref": "#/responses/getQueryHistoryMigrationResponse" }, "400": { "$ref": "#/responses/badRequestError" @@ -7522,241 +5758,128 @@ "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" - }, - "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/star/{query_history_uid}": { + "post": { + "description": "Adds star to query in query history as specified by the UID.", "tags": [ - "reports", - "enterprise" + "query_history" ], - "summary": "Update a report.", - "operationId": "updateReport", + "summary": "Add star to query in query history.", + "operationId": "starQuery", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/CreateOrUpdateConfigCmd" - } - }, - { - "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" } } }, "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`.", + "description": "Removes star from query in query history as specified by the UID.", "tags": [ - "reports", - "enterprise" + "query_history" ], - "summary": "Delete a report.", - "operationId": "deleteReport", + "summary": "Remove star to query in query history.", + "operationId": "unstarQuery", "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": { + "/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 performs assertion Consumer Service (ACS).", - "operationId": "postACS", + "summary": "Delete query in query history.", + "operationId": "deleteQuery", "parameters": [ { "type": "string", - "name": "RelayState", - "in": "query" - } - ], - "responses": { - "302": { - "description": "" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" + "name": "query_history_uid", + "in": "path", + "required": true } - } - } - }, - "/saml/metadata": { - "get": { - "produces": [ - "application/xml;application/samlmetadata+xml" - ], - "tags": [ - "saml", - "enterprise" ], - "summary": "It exposes the SP (Grafana's) metadata for the IdP's consumption.", - "operationId": "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": { - "302": { - "description": "" - }, - "400": { - "$ref": "#/responses/badRequestError" + "$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" @@ -7908,7 +6031,7 @@ "tags": [ "service_accounts" ], - "summary": "Create service account", + "summary": "# Create service account", "operationId": "createServiceAccount", "parameters": [ { @@ -7944,7 +6067,7 @@ "tags": [ "service_accounts" ], - "summary": "Search service accounts with paging", + "summary": "# Search service accounts with paging", "operationId": "searchOrgServiceAccountsWithPaging", "parameters": [ { @@ -8000,7 +6123,7 @@ "tags": [ "service_accounts" ], - "summary": "Get single serviceaccount by Id", + "summary": "# Get single serviceaccount by Id", "operationId": "retrieveServiceAccount", "parameters": [ { @@ -8037,7 +6160,7 @@ "tags": [ "service_accounts" ], - "summary": "Delete service account", + "summary": "# Delete service account", "operationId": "deleteServiceAccount", "parameters": [ { @@ -8071,7 +6194,7 @@ "tags": [ "service_accounts" ], - "summary": "Update service account", + "summary": "# Update service account", "operationId": "updateServiceAccount", "parameters": [ { @@ -8117,7 +6240,7 @@ "tags": [ "service_accounts" ], - "summary": "Get service account tokens", + "summary": "# Get service account tokens", "operationId": "listTokens", "parameters": [ { @@ -8151,7 +6274,7 @@ "tags": [ "service_accounts" ], - "summary": "CreateNewToken adds a token to a service account", + "summary": "# CreateNewToken adds a token to a service account", "operationId": "createToken", "parameters": [ { @@ -8200,7 +6323,7 @@ "tags": [ "service_accounts" ], - "summary": "DeleteToken deletes service account tokens", + "summary": "# DeleteToken deletes service account tokens", "operationId": "deleteToken", "parameters": [ { @@ -8309,157 +6432,7 @@ ], "responses": { "200": { - "$ref": "#/responses/okResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, - "/snapshots/{key}": { - "get": { - "tags": [ - "snapshots" - ], - "summary": "Get Snapshot by Key.", - "operationId": "getDashboardSnapshot", - "parameters": [ - { - "type": "string", - "name": "key", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/getDashboardSnapshotResponse" - }, - "400": { - "$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" + "$ref": "#/responses/okResponse" }, "401": { "$ref": "#/responses/unauthorisedError" @@ -8467,38 +6440,62 @@ "403": { "$ref": "#/responses/forbiddenError" }, + "404": { + "$ref": "#/responses/notFoundError" + }, "500": { "$ref": "#/responses/internalServerError" } } } }, - "/teams/{teamId}/groups": { + "/snapshots/{key}": { "get": { "tags": [ - "sync_team_groups", - "enterprise" + "snapshots" ], - "summary": "Get External Groups.", - "operationId": "getTeamGroupsApi", + "summary": "Get Snapshot by Key.", + "operationId": "getDashboardSnapshot", "parameters": [ { - "type": "integer", - "format": "int64", - "name": "teamId", + "type": "string", + "name": "key", "in": "path", "required": true } ], "responses": { "200": { - "$ref": "#/responses/getTeamGroupsApiResponse" + "$ref": "#/responses/getDashboardSnapshotResponse" }, "400": { "$ref": "#/responses/badRequestError" }, - "401": { - "$ref": "#/responses/unauthorisedError" + "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" @@ -8510,37 +6507,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" @@ -8548,8 +6536,8 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" + "409": { + "$ref": "#/responses/conflictError" }, "500": { "$ref": "#/responses/internalServerError" @@ -8557,35 +6545,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" @@ -8593,9 +6590,6 @@ "403": { "$ref": "#/responses/forbiddenError" }, - "404": { - "$ref": "#/responses/notFoundError" - }, "500": { "$ref": "#/responses/internalServerError" } @@ -9745,42 +7739,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": { @@ -9887,25 +7845,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": { @@ -9927,25 +7866,6 @@ } } }, - "AddTeamRoleCommand": { - "type": "object", - "properties": { - "roleUid": { - "type": "string" - } - } - }, - "AddUserRoleCommand": { - "type": "object", - "properties": { - "global": { - "type": "boolean" - }, - "roleUid": { - "type": "string" - } - } - }, "Address": { "type": "object", "properties": { @@ -10349,140 +8269,38 @@ } } }, - "BrandingOptionsDTO": { - "type": "object", - "properties": { - "emailFooterLink": { - "type": "string" - }, - "emailFooterMode": { - "type": "string" - }, - "emailFooterText": { - "type": "string" - }, - "emailLogoUrl": { - "type": "string" - }, - "reportLogoUrl": { - "type": "string" - } - } - }, "CalculateDiffTarget": { "type": "object", - "properties": { - "dashboardId": { - "type": "integer", - "format": "int64" - }, - "unsavedDashboard": { - "$ref": "#/definitions/Json" - }, - "version": { - "type": "integer", - "format": "int64" - } - } - }, - "ChangeUserPasswordCommand": { - "type": "object", - "properties": { - "newPassword": { - "type": "string" - }, - "oldPassword": { - "type": "string" - } - } - }, - "ConfFloat64": { - "description": "ConfFloat64 is a float64. It Marshals float64 values of NaN of Inf\nto null.", - "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" - }, - "scaleFactor": { - "type": "integer", - "format": "int64" - }, - "schedule": { - "$ref": "#/definitions/ScheduleDTO" - }, - "state": { - "$ref": "#/definitions/State" - }, - "templateVars": { - "type": "object" + "properties": { + "dashboardId": { + "type": "integer", + "format": "int64" }, - "updated": { - "type": "string", - "format": "date-time" + "unsavedDashboard": { + "$ref": "#/definitions/Json" }, - "userId": { + "version": { "type": "integer", "format": "int64" } } }, + "ChangeUserPasswordCommand": { + "type": "object", + "properties": { + "newPassword": { + "type": "string" + }, + "oldPassword": { + "type": "string" + } + } + }, + "ConfFloat64": { + "description": "ConfFloat64 is a float64. It Marshals float64 values of NaN of Inf\nto null.", + "type": "number", + "format": "double" + }, "Correlation": { "description": "Correlation is the model for correlations definitions", "type": "object", @@ -10729,64 +8547,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" - }, - "scaleFactor": { - "type": "integer", - "format": "int64" - }, - "schedule": { - "$ref": "#/definitions/ScheduleDTO" - }, - "state": { - "$ref": "#/definitions/State" - }, - "templateVars": { - "type": "object" - } - } - }, "CreateOrgCommand": { "type": "object", "properties": { @@ -10829,42 +8589,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": { @@ -10898,53 +8622,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": { @@ -11048,20 +8725,6 @@ } } }, - "DashboardDTO": { - "type": "object", - "properties": { - "dashboard": { - "$ref": "#/definitions/DashboardReportDTO" - }, - "reportVariables": { - "type": "object" - }, - "timeRange": { - "$ref": "#/definitions/TimeRangeDTO" - } - } - }, "DashboardFullWithMeta": { "type": "object", "properties": { @@ -11178,21 +8841,6 @@ } } }, - "DashboardReportDTO": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "uid": { - "type": "string" - } - } - }, "DashboardSnapshot": { "description": "DashboardSnapshot model", "type": "object", @@ -11544,83 +9192,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." @@ -11634,22 +9205,9 @@ } } }, - "DeleteTokenCommand": { - "type": "object", - "properties": { - "instance": { - "type": "string" - } - } - }, "DsAccess": { "type": "string" }, - "DsPermissionType": { - "description": "Datasource permission\nDescription:\n`0` - No Access\n`1` - Query\n`2` - Edit\nEnum: 0,1,2", - "type": "integer", - "format": "int64" - }, "Duration": { "description": "A Duration represents the elapsed time between two instants\nas an int64 nanosecond count. The representation limits the\nlargest representable duration to approximately 290 years.", "type": "integer", @@ -11692,18 +9250,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", @@ -12912,31 +10458,11 @@ } } }, - "PauseAllAlertsCommand": { - "type": "object", - "properties": { - "paused": { - "type": "boolean" - } - } - }, - "Permission": { + "PauseAllAlertsCommand": { "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" + "paused": { + "type": "boolean" } } }, @@ -13109,20 +10635,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", @@ -13364,86 +10876,6 @@ } } }, - "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": {} - } - }, - "range": { - "type": "integer", - "format": "int64" - }, - "target_ref_id": { - "type": "string" - } - } - }, - "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" - } - } - }, "Responses": { "description": "The QueryData method the QueryDataHandler method will set the RefId\nproperty on the DataResponses' frames based on these RefIDs.", "type": "object", @@ -13470,79 +10902,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": { @@ -13802,49 +11161,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": { @@ -13854,29 +11170,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": "integer", "format": "int64" @@ -13889,39 +11182,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.", @@ -13961,36 +11221,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" } } }, @@ -14129,104 +11365,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": { @@ -14269,10 +11407,6 @@ } } }, - "TokenStatus": { - "type": "integer", - "format": "int64" - }, "TrimDashboardCommand": { "type": "object", "properties": { @@ -14295,9 +11429,6 @@ } } }, - "Type": { - "type": "string" - }, "UpdateAlertNotificationCommand": { "type": "object", "properties": { @@ -14635,39 +11766,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": { @@ -14952,21 +12050,6 @@ "$ref": "#/definitions/ErrorResponseBody" } }, - "addPermissionResponse": { - "description": "", - "schema": { - "type": "object", - "properties": { - "message": { - "type": "string" - }, - "permissionId": { - "type": "integer", - "format": "int64" - } - } - } - }, "adminCreateUserResponse": { "description": "", "schema": { @@ -15016,16 +12099,6 @@ "$ref": "#/definitions/ErrorResponseBody" } }, - "contentResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "type": "integer", - "format": "uint8" - } - } - }, "createCorrelationResponse": { "description": "", "schema": { @@ -15121,27 +12194,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": { @@ -15326,12 +12378,6 @@ } } }, - "getAccessControlStatusResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/Status" - } - }, "getAlertNotificationChannelResponse": { "description": "", "schema": { @@ -15371,21 +12417,6 @@ } } }, - "getAllPermissionseResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/DataSourcePermissionsDTO" - } - }, - "getAllRolesResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/RoleDTO" - } - } - }, "getAnnotationByIDResponse": { "description": "", "schema": { @@ -15437,15 +12468,6 @@ "$ref": "#/definitions/OrgDetailsDTO" } }, - "getCustomPermissionsReportResponse": { - "description": "", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/CustomPermissionsRecordDTO" - } - } - }, "getDashboardPermissionsListResponse": { "description": "", "schema": { @@ -15547,12 +12569,6 @@ "$ref": "#/definitions/LibraryElementSearchResponse" } }, - "getLicenseTokenResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/Token" - } - }, "getOrgByIDResponse": { "description": "", "schema": { @@ -15661,39 +12677,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": { @@ -15729,30 +12712,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": { @@ -15816,36 +12781,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": { @@ -16006,9 +12941,6 @@ } } }, - "postRenewLicenseTokenResponse": { - "description": "" - }, "preconditionFailedError": { "description": "PreconditionFailedError", "schema": { @@ -16021,24 +12953,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": { @@ -16093,12 +13007,6 @@ "$ref": "#/definitions/SearchUserQueryResult" } }, - "setRoleAssignmentsResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/RoleAssignmentsDTO" - } - }, "testAlertResponse": { "description": "", "schema": { diff --git a/public/app/features/dashboard/dashgrid/PanelStateWrapper.tsx b/public/app/features/dashboard/dashgrid/PanelStateWrapper.tsx index bcd7ebbef26..d0c6c30bbb0 100644 --- a/public/app/features/dashboard/dashgrid/PanelStateWrapper.tsx +++ b/public/app/features/dashboard/dashgrid/PanelStateWrapper.tsx @@ -34,6 +34,7 @@ import { import { PANEL_BORDER } from 'app/core/constants'; import { profiler } from 'app/core/profiler'; import { applyPanelTimeOverrides } from 'app/features/dashboard/utils/panel'; +import { InspectTab } from 'app/features/inspector/types'; import { changeSeriesColorConfigFactory } from 'app/plugins/panel/timeseries/overrides/colorSeriesConfigFactory'; import { RenderEvent } from 'app/types/events'; @@ -45,7 +46,6 @@ import { DashboardModel, PanelModel } from '../state'; import { loadSnapshotData } from '../utils/loadSnapshotData'; import { PanelHeader } from './PanelHeader/PanelHeader'; -import { PanelHeaderLoadingIndicator } from './PanelHeader/PanelHeaderLoadingIndicator'; import { seriesVisibilityConfigFactory } from './SeriesVisibilityConfigFactory'; import { liveTimer } from './liveTimer'; @@ -566,6 +566,11 @@ export class PanelStateWrapper extends PureComponent { return !panel.hasTitle(); } + onOpenErrorInspect(e: React.SyntheticEvent, tab: string) { + e.stopPropagation(); + locationService.partial({ inspect: this.props.panel.id, inspectTab: tab }); + } + render() { const { dashboard, panel, isViewing, isEditing, width, height, plugin } = this.props; const { errorMessage, data } = this.state; @@ -581,17 +586,22 @@ export class PanelStateWrapper extends PureComponent { [`panel-alert-state--${alertState}`]: alertState !== undefined, }); - // for new panel header design - const onCancelQuery = () => panel.getQueryRunner().cancelQuery(); const title = panel.getDisplayTitle(); - const noPadding: PanelPadding = plugin.noPadding ? 'none' : 'md'; - const leftItems = [ - , - ]; + const padding: PanelPadding = plugin.noPadding ? 'none' : 'md'; if (config.featureToggles.newPanelChromeUI) { return ( - + this.onOpenErrorInspect(e, InspectTab.Error), + }} + > {(innerWidth, innerHeight) => ( <>