From 310b234fbc370cad1e8557c71ffc226edfab25ef Mon Sep 17 00:00:00 2001 From: Ezequiel Victorero Date: Thu, 8 May 2025 15:35:43 +0100 Subject: [PATCH] Reporting: Update filter and docs to get reports by dashboard (#104560) --- pkg/services/accesscontrol/filter.go | 1 + public/api-enterprise-spec.json | 33 ++++++++++++++++++++++++++ public/api-merged.json | 33 ++++++++++++++++++++++++++ public/openapi3.json | 35 ++++++++++++++++++++++++++++ 4 files changed, 102 insertions(+) diff --git a/pkg/services/accesscontrol/filter.go b/pkg/services/accesscontrol/filter.go index 8ecd12d5108..23ba69828bb 100644 --- a/pkg/services/accesscontrol/filter.go +++ b/pkg/services/accesscontrol/filter.go @@ -19,6 +19,7 @@ var sqlIDAcceptList = map[string]struct{}{ "\"user\".\"id\"": {}, // For Postgres "`user`.`id`": {}, // For MySQL and SQLite "dashboard.uid": {}, + "report.id": {}, } var ( diff --git a/public/api-enterprise-spec.json b/public/api-enterprise-spec.json index fdc686ac78f..0814ff5e70f 100644 --- a/public/api-enterprise-spec.json +++ b/public/api-enterprise-spec.json @@ -1704,6 +1704,39 @@ } } }, + "/reports/dashboards/{uid}": { + "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 by dashboard uid.", + "operationId": "getReportsByDashboardUID", + "parameters": [ + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getReportsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, "/reports/email": { "post": { "description": "Generate and send a report. This API waits for the report to be generated before returning. We recommend that you set the client’s timeout to at least 60 seconds. Available to org admins only and with a valid license.\n\nOnly available in Grafana Enterprise v7.0+.\nThis API endpoint is experimental and may be deprecated in a future release. On deprecation, a migration strategy will be provided and the endpoint will remain functional until the next major release of Grafana.\n\nYou need to have a permission with action `reports:send`.", diff --git a/public/api-merged.json b/public/api-merged.json index fce0085ad8b..56d3abe287b 100644 --- a/public/api-merged.json +++ b/public/api-merged.json @@ -8086,6 +8086,39 @@ } } }, + "/reports/dashboards/{uid}": { + "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 by dashboard uid.", + "operationId": "getReportsByDashboardUID", + "parameters": [ + { + "type": "string", + "name": "uid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/getReportsResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, "/reports/email": { "post": { "description": "Generate and send a report. This API waits for the report to be generated before returning. We recommend that you set the client’s timeout to at least 60 seconds. Available to org admins only and with a valid license.\n\nOnly available in Grafana Enterprise v7.0+.\nThis API endpoint is experimental and may be deprecated in a future release. On deprecation, a migration strategy will be provided and the endpoint will remain functional until the next major release of Grafana.\n\nYou need to have a permission with action `reports:send`.", diff --git a/public/openapi3.json b/public/openapi3.json index 081b3a7445f..aadd3405837 100644 --- a/public/openapi3.json +++ b/public/openapi3.json @@ -22330,6 +22330,41 @@ ] } }, + "/reports/dashboards/{uid}": { + "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:*`.", + "operationId": "getReportsByDashboardUID", + "parameters": [ + { + "in": "path", + "name": "uid", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/getReportsResponse" + }, + "401": { + "$ref": "#/components/responses/unauthorisedError" + }, + "403": { + "$ref": "#/components/responses/forbiddenError" + }, + "500": { + "$ref": "#/components/responses/internalServerError" + } + }, + "summary": "List reports by dashboard uid.", + "tags": [ + "reports", + "enterprise" + ] + } + }, "/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`.",