From cc1976693b23ea30163a6ceee6bfe48f8fbf9aac Mon Sep 17 00:00:00 2001 From: Eric Leijonmarck Date: Fri, 25 Oct 2024 15:20:36 +0100 Subject: [PATCH] LBAC for datasources: Docs update HTTP API (#95392) --- .../http_api/datasource_lbac_rules.md | 61 +++++++++++++++---- public/api-enterprise-spec.json | 9 ++- public/api-merged.json | 9 ++- public/openapi3.json | 9 ++- 4 files changed, 66 insertions(+), 22 deletions(-) diff --git a/docs/sources/developers/http_api/datasource_lbac_rules.md b/docs/sources/developers/http_api/datasource_lbac_rules.md index 002d43fe4f2..ef97c71cb99 100644 --- a/docs/sources/developers/http_api/datasource_lbac_rules.md +++ b/docs/sources/developers/http_api/datasource_lbac_rules.md @@ -47,6 +47,31 @@ Content-Type: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk ``` +**Example response:** + +```http +HTTP/1.1 200 OK +Content-Type: application/json; charset=UTF-8 +Content-Length: 131 + +{ + "rules": [ + { + "teamId": "1", + "rules": [ + "{ service_name=\"bigquery-sync-mysql\" }" + ] + }, + { + "teamId": "2", + "rules": [ + "{ service_name=\"api\" }" + ] + } + ] +} +``` + ## Update LBAC rules for a data source `PUT /api/datasources/:uid/lbac/teams` @@ -72,11 +97,18 @@ Content-Type: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk { - "teamId": 1, "rules": [ { - "header": "X-Prom-Label-Policy", - "value": "18042:{ foo=\"bar\" }" + "teamId": "1", + "rules": [ + "{ service_name=\"bigquery-sync-mysql\" }" + ] + }, + { + "teamId": "2", + "rules": [ + "{ service_name=\"api\" }" + ] } ] } @@ -90,20 +122,23 @@ Content-Type: application/json; charset=UTF-8 Content-Length: 35 { - "message": "Data source LBAC rules updated", "id": 1, - "uid": "my_datasource", - "name": "My Data Source", - "lbacRules": [ + "message": "Data source LBAC rules updated", + "name": "loki", + "rules": [ { - "teamId": 1, + "teamId": "1", "rules": [ - { - "header": "X-Prom-Label-Policy", - "value": "18042:{ foo=\"bar\" }" - } + "{ service_name=\"bigquery-sync-mysql\" }" + ] + }, + { + "teamId": "2", + "rules": [ + "{ service_name=\"api\" }" ] } - ] + ], + "uid": "ee1nm1t7spog0e", } ``` diff --git a/public/api-enterprise-spec.json b/public/api-enterprise-spec.json index d04a43e6c86..4c0dcb2ce34 100644 --- a/public/api-enterprise-spec.json +++ b/public/api-enterprise-spec.json @@ -10392,15 +10392,18 @@ "type": "integer", "format": "int64" }, - "lbacRules": { - "$ref": "#/definitions/TeamLBACRules" - }, "message": { "type": "string" }, "name": { "type": "string" }, + "rules": { + "type": "array", + "items": { + "$ref": "#/definitions/TeamLBACRule" + } + }, "uid": { "type": "string" } diff --git a/public/api-merged.json b/public/api-merged.json index 2fb766b6014..393760e29c1 100644 --- a/public/api-merged.json +++ b/public/api-merged.json @@ -24741,15 +24741,18 @@ "type": "integer", "format": "int64" }, - "lbacRules": { - "$ref": "#/definitions/TeamLBACRules" - }, "message": { "type": "string" }, "name": { "type": "string" }, + "rules": { + "type": "array", + "items": { + "$ref": "#/definitions/TeamLBACRule" + } + }, "uid": { "type": "string" } diff --git a/public/openapi3.json b/public/openapi3.json index fc1ebcb5d0d..be6e8bbce23 100644 --- a/public/openapi3.json +++ b/public/openapi3.json @@ -2112,15 +2112,18 @@ "format": "int64", "type": "integer" }, - "lbacRules": { - "$ref": "#/components/schemas/TeamLBACRules" - }, "message": { "type": "string" }, "name": { "type": "string" }, + "rules": { + "items": { + "$ref": "#/components/schemas/TeamLBACRule" + }, + "type": "array" + }, "uid": { "type": "string" }