LBAC for datasources: Docs update HTTP API (#95392)

This commit is contained in:
Eric Leijonmarck
2024-10-25 15:20:36 +01:00
committed by GitHub
parent 94bbc081c8
commit cc1976693b
4 changed files with 66 additions and 22 deletions
@@ -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
```
## Update LBAC rules for a data source
`PUT /api/datasources/:uid/lbac/teams`
Updates LBAC rules for teams associated with the data source with the given `uid`. Here you submit a list of teams and the rules for each team.
Deleting a team from the list will remove the team's LBAC rules. You have to submit all teams and their rules to be updated, to remove a team's rules, you have to submit the current list of rules without the team.
**Required permissions**
| Action | Scope |
| ----------------------------- | ---------------------------------------------------------------------------------------- |
| datasources:write | datasources:_<br>datasources:uid:_<br>datasources:uid:my_datasource (single data source) |
| datasources.permissions:write | datasources:_<br>datasources:uid:_<br>datasources:uid:my_datasource (single data source) |
### Examples
**Example request:**
```http
@@ -72,11 +97,18 @@ Content-Type: application/json
]
}
```
"teamId": 1,
**Example response:**
"header": "X-Prom-Label-Policy",
"value": "18042:{ foo=\"bar\" }"
```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 35
```
"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",
}
```