mirror of
https://github.com/grafana/grafana.git
synced 2025-07-29 19:52:35 +08:00
AccessControl: Document new permissions restricting data source access. (#39091)
* Add data sources roles and permissions to docs Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
This commit is contained in:
@ -7,10 +7,23 @@ aliases = ["/docs/grafana/latest/http_api/datasource/"]
|
||||
|
||||
# Data source API
|
||||
|
||||
> If you are running Grafana Enterprise and have [Fine-grained access control]({{< relref "../enterprise/access-control/_index.md" >}}) enabled, for some endpoints you would need to have relevant permissions.
|
||||
> Refer to specific resources to understand what permissions are required.
|
||||
|
||||
## Get all data sources
|
||||
|
||||
`GET /api/datasources`
|
||||
|
||||
### Required permissions
|
||||
|
||||
See note in the [introduction]({{< ref "#data-source-api" >}}) for an explanation.
|
||||
|
||||
| Action | Scope |
|
||||
| ---------------- | -------------- |
|
||||
| datasources:read | datasources:\* |
|
||||
|
||||
### Examples
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
@ -57,6 +70,16 @@ Content-Type: application/json
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
```
|
||||
|
||||
## Get a single data source by UID
|
||||
|
||||
`GET /api/datasources/uid/:uid`
|
||||
|
||||
### Required permissions
|
||||
|
||||
See note in the [introduction]({{< ref "#data-source-api" >}}) for an explanation.
|
||||
|
||||
| Action | Scope |
|
||||
| ---------------- | -------------------------------------------------------------------------------------- |
|
||||
| datasources:read | datasources:\*<br>datasources:uid:\*<br>datasources:uid:kLtEtcRGk (single data source) |
|
||||
@ -103,6 +126,16 @@ Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
```
|
||||
|
||||
## Get data source Id by Name
|
||||
|
||||
`GET /api/datasources/id/:name`
|
||||
|
||||
### Required permissions
|
||||
@ -149,6 +182,16 @@ Content-Type: application/json
|
||||
**Example Graphite Request**:
|
||||
|
||||
```http
|
||||
POST /api/datasources HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
|
||||
```
|
||||
|
||||
**Example Graphite Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -195,6 +238,16 @@ Content-Type: application/json
|
||||
| Action | Scope |
|
||||
| ----------------- | ---------------------------------------------------------------------------- |
|
||||
| datasources:write | datasources:\*<br>datasources:id:\*<br>datasources:id:1 (single data source) |
|
||||
|
||||
### Examples
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
PUT /api/datasources/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
|
||||
```
|
||||
|
||||
@ -219,6 +272,16 @@ Content-Type: application/json
|
||||
| Action | Scope |
|
||||
| ------------------ | ---------------------------------------------------------------------------- |
|
||||
| datasources:delete | datasources:\*<br>datasources:id:\*<br>datasources:id:1 (single data source) |
|
||||
|
||||
### Examples
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
DELETE /api/datasources/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
@ -357,6 +420,16 @@ Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
|
||||
`PUT /api/datasources/:datasourceId`
|
||||
|
||||
### Required permissions
|
||||
|
||||
See note in the [introduction]({{< ref "#data-source-api" >}}) for an explanation.
|
||||
|
||||
| Action | Scope |
|
||||
| ----------------- | ---------------------------------------------------------------------------- |
|
||||
| datasources:write | datasources:\*<br>datasources:id:\*<br>datasources:id:1 (single data source) |
|
||||
|
||||
### Examples
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
@ -427,6 +500,16 @@ Content-Type: application/json
|
||||
|
||||
`DELETE /api/datasources/:datasourceId`
|
||||
|
||||
### Required permissions
|
||||
|
||||
See note in the [introduction]({{< ref "#data-source-api" >}}) for an explanation.
|
||||
|
||||
| Action | Scope |
|
||||
| ------------------ | ---------------------------------------------------------------------------- |
|
||||
| datasources:delete | datasources:\*<br>datasources:id:\*<br>datasources:id:1 (single data source) |
|
||||
|
||||
### Examples
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
@ -449,6 +532,16 @@ Content-Type: application/json
|
||||
|
||||
`DELETE /api/datasources/uid/:uid`
|
||||
|
||||
### Required permissions
|
||||
|
||||
See note in the [introduction]({{< ref "#data-source-api" >}}) for an explanation.
|
||||
|
||||
| Action | Scope |
|
||||
| ------------------ | -------------------------------------------------------------------------------------- |
|
||||
| datasources:delete | datasources:\*<br>datasources:uid:\*<br>datasources:uid:kLtEtcRGk (single data source) |
|
||||
|
||||
### Examples
|
||||
|
||||
**Example request:**
|
||||
|
||||
```http
|
||||
@ -471,6 +564,16 @@ Content-Type: application/json
|
||||
|
||||
`DELETE /api/datasources/name/:datasourceName`
|
||||
|
||||
### Required permissions
|
||||
|
||||
See note in the [introduction]({{< ref "#data-source-api" >}}) for an explanation.
|
||||
|
||||
| Action | Scope |
|
||||
| ------------------ | ---------------------------------------------------------------------------------------------- |
|
||||
| datasources:delete | datasources:\*<br>datasources:name:\*<br>datasources:name:test_datasource (single data source) |
|
||||
|
||||
### Examples
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
|
Reference in New Issue
Block a user