mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 02:40:26 -06:00
API: Add endpoint for updating a data source by its UID (#49396)
* API: Add endpoint for updating a data source by UID * Update docs markdown * Update swagger * Apply suggestions from code review Co-authored-by: Selene <selenepinillos@gmail.com>
This commit is contained in:
parent
8f4c3e94b0
commit
be0d043673
@ -415,10 +415,12 @@ Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
}
|
||||
```
|
||||
|
||||
## Update an existing data source
|
||||
## Update an existing data source by id
|
||||
|
||||
`PUT /api/datasources/:datasourceId`
|
||||
|
||||
> **Warning:** This API is deprecated since Grafana v9.0.0 and will be removed in a future release. Refer to the [new data source update API](#update-an-existing-data-source).
|
||||
|
||||
**Required permissions**
|
||||
|
||||
See note in the [introduction]({{< ref "#data-source-api" >}}) for an explanation.
|
||||
@ -466,6 +468,7 @@ Content-Type: application/json
|
||||
{
|
||||
"datasource": {
|
||||
"id": 1,
|
||||
"uid": "kLtEtcRGk",
|
||||
"orgId": 1,
|
||||
"name": "test_datasource",
|
||||
"type": "graphite",
|
||||
@ -495,6 +498,88 @@ Content-Type: application/json
|
||||
|
||||
> **Note:** Similar to [creating a data source](#create-a-data-source), `password` and `basicAuthPassword` should be defined under `secureJsonData` in order to be stored securely as an encrypted blob in the database. Then, the encrypted fields are listed under `secureJsonFields` section in the response.
|
||||
|
||||
## Update an existing data source
|
||||
|
||||
`PUT /api/datasources/uid/:uid`
|
||||
|
||||
**Required permissions**
|
||||
|
||||
See note in the [introduction]({{< ref "#data-source-api" >}}) for an explanation.
|
||||
|
||||
| Action | Scope |
|
||||
| ----------------- | -------------------------------------------------------------------------------------- |
|
||||
| datasources:write | datasources:\*<br>datasources:uid:\*<br>datasources:uid:kLtEtcRGk (single data source) |
|
||||
|
||||
### Examples
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
PUT /api/datasources/uid/kLtEtcRGk HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
|
||||
{
|
||||
"id":1,
|
||||
"uid": "updated UID",
|
||||
"orgId":1,
|
||||
"name":"test_datasource",
|
||||
"type":"graphite",
|
||||
"access":"proxy",
|
||||
"url":"http://mydatasource.com",
|
||||
"password":"",
|
||||
"user":"",
|
||||
"database":"",
|
||||
"basicAuth":true,
|
||||
"basicAuthUser":"basicuser",
|
||||
"secureJsonData": {
|
||||
"basicAuthPassword": "basicpassword"
|
||||
},
|
||||
"isDefault":false,
|
||||
"jsonData":null
|
||||
}
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"datasource": {
|
||||
"id": 1,
|
||||
"uid": "updated UID",
|
||||
"orgId": 1,
|
||||
"name": "test_datasource",
|
||||
"type": "graphite",
|
||||
"typeLogoUrl": "",
|
||||
"access": "proxy",
|
||||
"url": "http://mydatasource.com",
|
||||
"password": "",
|
||||
"user": "",
|
||||
"database": "",
|
||||
"basicAuth": true,
|
||||
"basicAuthUser": "basicuser",
|
||||
"basicAuthPassword": "",
|
||||
"withCredentials": false,
|
||||
"isDefault": false,
|
||||
"jsonData": {},
|
||||
"secureJsonFields": {
|
||||
"basicAuthPassword": true
|
||||
},
|
||||
"version": 1,
|
||||
"readOnly": false
|
||||
},
|
||||
"id": 102,
|
||||
"message": "Datasource updated",
|
||||
"name": "test_datasource"
|
||||
}
|
||||
```
|
||||
|
||||
> **Note:** Similar to [creating a data source](#create-a-data-source), `password` and `basicAuthPassword` should be defined under `secureJsonData` in order to be stored securely as an encrypted blob in the database. Then, the encrypted fields are listed under `secureJsonFields` section in the response.## Update an existing data source by id
|
||||
|
||||
## Delete an existing data source by id
|
||||
|
||||
`DELETE /api/datasources/:datasourceId`
|
||||
|
@ -305,7 +305,8 @@ func (hs *HTTPServer) registerRoutes() {
|
||||
apiRoute.Group("/datasources", func(datasourceRoute routing.RouteRegister) {
|
||||
datasourceRoute.Get("/", authorize(reqOrgAdmin, ac.EvalPermission(datasources.ActionRead)), routing.Wrap(hs.GetDataSources))
|
||||
datasourceRoute.Post("/", authorize(reqOrgAdmin, ac.EvalPermission(datasources.ActionCreate)), quota("data_source"), routing.Wrap(hs.AddDataSource))
|
||||
datasourceRoute.Put("/:id", authorize(reqOrgAdmin, ac.EvalPermission(datasources.ActionWrite, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":id")))), routing.Wrap(hs.UpdateDataSource))
|
||||
datasourceRoute.Put("/:id", authorize(reqOrgAdmin, ac.EvalPermission(datasources.ActionWrite, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":id")))), routing.Wrap(hs.UpdateDataSourceByID))
|
||||
datasourceRoute.Put("/uid/:uid", authorize(reqOrgAdmin, ac.EvalPermission(datasources.ActionWrite, datasources.ScopeProvider.GetResourceScopeUID(ac.Parameter(":uid")))), routing.Wrap(hs.UpdateDataSourceByUID))
|
||||
datasourceRoute.Delete("/:id", authorize(reqOrgAdmin, ac.EvalPermission(datasources.ActionDelete, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":id")))), routing.Wrap(hs.DeleteDataSourceById))
|
||||
datasourceRoute.Delete("/uid/:uid", authorize(reqOrgAdmin, ac.EvalPermission(datasources.ActionDelete, datasources.ScopeProvider.GetResourceScopeUID(ac.Parameter(":uid")))), routing.Wrap(hs.DeleteDataSourceByUID))
|
||||
datasourceRoute.Delete("/name/:name", authorize(reqOrgAdmin, ac.EvalPermission(datasources.ActionDelete, datasources.ScopeProvider.GetResourceScopeName(ac.Parameter(":name")))), routing.Wrap(hs.DeleteDataSourceByName))
|
||||
|
@ -275,7 +275,7 @@ func (hs *HTTPServer) AddDataSource(c *models.ReqContext) response.Response {
|
||||
}
|
||||
|
||||
// PUT /api/datasources/:id
|
||||
func (hs *HTTPServer) UpdateDataSource(c *models.ReqContext) response.Response {
|
||||
func (hs *HTTPServer) UpdateDataSourceByID(c *models.ReqContext) response.Response {
|
||||
cmd := models.UpdateDataSourceCommand{}
|
||||
if err := web.Bind(c.Req, &cmd); err != nil {
|
||||
return response.Error(http.StatusBadRequest, "bad request data", err)
|
||||
@ -297,12 +297,38 @@ func (hs *HTTPServer) UpdateDataSource(c *models.ReqContext) response.Response {
|
||||
}
|
||||
return response.Error(500, "Failed to update datasource", err)
|
||||
}
|
||||
return hs.updateDataSourceByID(c, ds, cmd)
|
||||
}
|
||||
|
||||
// PUT /api/datasources/:uid
|
||||
func (hs *HTTPServer) UpdateDataSourceByUID(c *models.ReqContext) response.Response {
|
||||
cmd := models.UpdateDataSourceCommand{}
|
||||
if err := web.Bind(c.Req, &cmd); err != nil {
|
||||
return response.Error(http.StatusBadRequest, "bad request data", err)
|
||||
}
|
||||
datasourcesLogger.Debug("Received command to update data source", "url", cmd.Url)
|
||||
cmd.OrgId = c.OrgId
|
||||
if resp := validateURL(cmd.Type, cmd.Url); resp != nil {
|
||||
return resp
|
||||
}
|
||||
|
||||
ds, err := hs.getRawDataSourceByUID(c.Req.Context(), web.Params(c.Req)[":uid"], c.OrgId)
|
||||
if err != nil {
|
||||
if errors.Is(err, models.ErrDataSourceNotFound) {
|
||||
return response.Error(http.StatusNotFound, "Data source not found", nil)
|
||||
}
|
||||
return response.Error(http.StatusInternalServerError, "Failed to update datasource", err)
|
||||
}
|
||||
cmd.Id = ds.Id
|
||||
return hs.updateDataSourceByID(c, ds, cmd)
|
||||
}
|
||||
|
||||
func (hs *HTTPServer) updateDataSourceByID(c *models.ReqContext, ds *models.DataSource, cmd models.UpdateDataSourceCommand) response.Response {
|
||||
if ds.ReadOnly {
|
||||
return response.Error(403, "Cannot update read-only data source", nil)
|
||||
}
|
||||
|
||||
err = hs.DataSourcesService.UpdateDataSource(c.Req.Context(), &cmd)
|
||||
err := hs.DataSourcesService.UpdateDataSource(c.Req.Context(), &cmd)
|
||||
if err != nil {
|
||||
if errors.Is(err, models.ErrDataSourceUpdatingOldVersion) {
|
||||
return response.Error(409, "Datasource has already been updated by someone else. Please reload and try again", err)
|
||||
|
@ -37,7 +37,28 @@ import (
|
||||
// 409: conflictError
|
||||
// 500: internalServerError
|
||||
|
||||
// swagger:route PUT /datasources/{datasource_id} datasources updateDatasource
|
||||
// swagger:route PUT /datasources/{datasource_id} datasources updateDatasourceByID
|
||||
//
|
||||
// Update an existing data source by its sequential ID.
|
||||
//
|
||||
// Similar to creating a data source, `password` and `basicAuthPassword` should be defined under
|
||||
// secureJsonData in order to be stored securely as an encrypted blob in the database. Then, the
|
||||
// encrypted fields are listed under secureJsonFields section in the response.
|
||||
//
|
||||
// If you are running Grafana Enterprise and have Fine-grained access control enabled
|
||||
// you need to have a permission with action: `datasources:write` and scopes: `datasources:*`, `datasources:id:*` and `datasources:id:1` (single data source).
|
||||
//
|
||||
// Please refer to [updated API](#/datasources/updateDatasourceByUID) instead
|
||||
//
|
||||
// Deprecated: true
|
||||
//
|
||||
// Responses:
|
||||
// 200: createOrUpdateDatasourceResponse
|
||||
// 401: unauthorisedError
|
||||
// 403: forbiddenError
|
||||
// 500: internalServerError
|
||||
|
||||
// swagger:route PUT /datasources/uid/{datasource_uid} datasources updateDatasourceByUID
|
||||
//
|
||||
// Update an existing data source.
|
||||
//
|
||||
@ -316,7 +337,7 @@ import (
|
||||
// 404: notFoundError
|
||||
// 500: internalServerError
|
||||
|
||||
// swagger:parameters updateDatasource deleteDatasourceByID getDatasourceByID datasourceProxyGETcalls datasourceProxyPOSTcalls datasourceProxyDELETEcalls
|
||||
// swagger:parameters updateDatasourceByID deleteDatasourceByID getDatasourceByID datasourceProxyGETcalls datasourceProxyPOSTcalls datasourceProxyDELETEcalls
|
||||
// swagger:parameters enablePermissions disablePermissions getPermissions deletePermissions
|
||||
// swagger:parameters checkDatasourceHealthByID fetchDatasourceResourcesByID
|
||||
type DatasourceID struct {
|
||||
@ -325,7 +346,7 @@ type DatasourceID struct {
|
||||
DatasourceID string `json:"datasource_id"`
|
||||
}
|
||||
|
||||
// swagger:parameters deleteDatasourceByUID getDatasourceByUID datasourceProxyGETByUIDcalls datasourceProxyPOSTByUIDcalls datasourceProxyDELETEByUIDcalls
|
||||
// swagger:parameters updateDatasourceByUID deleteDatasourceByUID getDatasourceByUID datasourceProxyGETByUIDcalls datasourceProxyPOSTByUIDcalls datasourceProxyDELETEByUIDcalls
|
||||
// swagger:parameters checkDatasourceHealth fetchDatasourceResources
|
||||
type DatasourceUID struct {
|
||||
// in:path
|
||||
@ -363,7 +384,7 @@ type AddDatasourceParam struct {
|
||||
Body models.AddDataSourceCommand
|
||||
}
|
||||
|
||||
// swagger:parameters updateDatasource
|
||||
// swagger:parameters updateDatasourceByID updateDatasourceByUID
|
||||
type UpdateDatasource struct {
|
||||
// in:body
|
||||
// required:true
|
||||
|
@ -4598,6 +4598,43 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": ["datasources"],
|
||||
"summary": "Update an existing data source.",
|
||||
"operationId": "updateDatasourceByUID",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"x-go-name": "DatasourceUID",
|
||||
"name": "datasource_uid",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "Body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/UpdateDataSourceCommand"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/responses/createOrUpdateDatasourceResponse"
|
||||
},
|
||||
"401": {
|
||||
"$ref": "#/responses/unauthorisedError"
|
||||
},
|
||||
"403": {
|
||||
"$ref": "#/responses/forbiddenError"
|
||||
},
|
||||
"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).",
|
||||
"tags": ["datasources"],
|
||||
@ -4744,10 +4781,11 @@
|
||||
}
|
||||
},
|
||||
"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).",
|
||||
"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": ["datasources"],
|
||||
"summary": "Update an existing data source.",
|
||||
"operationId": "updateDatasource",
|
||||
"summary": "Update an existing data source by its sequential ID.",
|
||||
"operationId": "updateDatasourceByID",
|
||||
"deprecated": true,
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@ -7574,11 +7612,12 @@
|
||||
},
|
||||
"/reports/render/pdf/{DashboardID}": {
|
||||
"get": {
|
||||
"description": "Available to all users and with a valid license.",
|
||||
"description": "Please refer to [reports enterprise](#/reports/renderReportPDFs) instead. This will be removed in Grafana 10.",
|
||||
"produces": ["application/pdf"],
|
||||
"tags": ["reports", "enterprise"],
|
||||
"summary": "Render report for dashboard.",
|
||||
"operationId": "renderReportPDF",
|
||||
"deprecated": true,
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
@ -7604,6 +7643,29 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/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",
|
||||
"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.",
|
||||
@ -8643,14 +8705,6 @@
|
||||
"summary": "Add External Group.",
|
||||
"operationId": "addTeamGroupApi",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "TeamID",
|
||||
"name": "teamId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"x-go-name": "Body",
|
||||
"name": "body",
|
||||
@ -8659,6 +8713,14 @@
|
||||
"schema": {
|
||||
"$ref": "#/definitions/TeamGroupMapping"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "TeamID",
|
||||
"name": "teamId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@ -8692,16 +8754,16 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "TeamID",
|
||||
"name": "teamId",
|
||||
"x-go-name": "GroupID",
|
||||
"name": "groupId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "GroupID",
|
||||
"name": "groupId",
|
||||
"x-go-name": "TeamID",
|
||||
"name": "teamId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -11130,6 +11192,13 @@
|
||||
"type": "string",
|
||||
"x-go-name": "DashboardUID"
|
||||
},
|
||||
"dashboards": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/DashboardDTO"
|
||||
},
|
||||
"x-go-name": "Dashboards"
|
||||
},
|
||||
"enableCsv": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "EnableCSV"
|
||||
@ -11341,6 +11410,13 @@
|
||||
"type": "string",
|
||||
"x-go-name": "DashboardUID"
|
||||
},
|
||||
"dashboards": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/DashboardDTO"
|
||||
},
|
||||
"x-go-name": "Dashboards"
|
||||
},
|
||||
"enableCsv": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "EnableCSV"
|
||||
@ -11631,6 +11707,22 @@
|
||||
},
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/api/dtos"
|
||||
},
|
||||
"DashboardDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"dashboard": {
|
||||
"$ref": "#/definitions/DashboardReportDTO"
|
||||
},
|
||||
"reportVariables": {
|
||||
"type": "object",
|
||||
"x-go-name": "ReportVariables"
|
||||
},
|
||||
"timeRange": {
|
||||
"$ref": "#/definitions/TimeRangeDTO"
|
||||
}
|
||||
},
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/extensions/report/api"
|
||||
},
|
||||
"DashboardFullWithMeta": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -11771,6 +11863,25 @@
|
||||
},
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/api/dtos"
|
||||
},
|
||||
"DashboardReportDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "ID"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"x-go-name": "Name"
|
||||
},
|
||||
"uid": {
|
||||
"type": "string",
|
||||
"x-go-name": "UID"
|
||||
}
|
||||
},
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/extensions/report/api"
|
||||
},
|
||||
"DashboardSnapshot": {
|
||||
"description": "DashboardSnapshot model",
|
||||
"type": "object",
|
||||
@ -14052,7 +14163,7 @@
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"x-go-name": "Id"
|
||||
"x-go-name": "ID"
|
||||
},
|
||||
"target": {
|
||||
"type": "string",
|
||||
@ -14067,7 +14178,7 @@
|
||||
"x-go-name": "Url"
|
||||
}
|
||||
},
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/models"
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/preference"
|
||||
},
|
||||
"NavbarPreference": {
|
||||
"type": "object",
|
||||
@ -14080,7 +14191,7 @@
|
||||
"x-go-name": "SavedItems"
|
||||
}
|
||||
},
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/models"
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/preference"
|
||||
},
|
||||
"NewApiKeyResult": {
|
||||
"type": "object",
|
||||
@ -15164,7 +15275,7 @@
|
||||
"x-go-name": "HomeTab"
|
||||
}
|
||||
},
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/preference"
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/models"
|
||||
},
|
||||
"Receiver": {
|
||||
"type": "object",
|
||||
|
@ -3660,6 +3660,43 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": ["datasources"],
|
||||
"summary": "Update an existing data source.",
|
||||
"operationId": "updateDatasourceByUID",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"x-go-name": "DatasourceUID",
|
||||
"name": "datasource_uid",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "Body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/UpdateDataSourceCommand"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/responses/createOrUpdateDatasourceResponse"
|
||||
},
|
||||
"401": {
|
||||
"$ref": "#/responses/unauthorisedError"
|
||||
},
|
||||
"403": {
|
||||
"$ref": "#/responses/forbiddenError"
|
||||
},
|
||||
"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).",
|
||||
"tags": ["datasources"],
|
||||
@ -3806,10 +3843,11 @@
|
||||
}
|
||||
},
|
||||
"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).",
|
||||
"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": ["datasources"],
|
||||
"summary": "Update an existing data source.",
|
||||
"operationId": "updateDatasource",
|
||||
"summary": "Update an existing data source by its sequential ID.",
|
||||
"operationId": "updateDatasourceByID",
|
||||
"deprecated": true,
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@ -6281,11 +6319,12 @@
|
||||
},
|
||||
"/reports/render/pdf/{DashboardID}": {
|
||||
"get": {
|
||||
"description": "Available to all users and with a valid license.",
|
||||
"description": "Please refer to [reports enterprise](#/reports/renderReportPDFs) instead. This will be removed in Grafana 10.",
|
||||
"produces": ["application/pdf"],
|
||||
"tags": ["reports", "enterprise"],
|
||||
"summary": "Render report for dashboard.",
|
||||
"operationId": "renderReportPDF",
|
||||
"deprecated": true,
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
@ -6311,6 +6350,29 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/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",
|
||||
"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.",
|
||||
@ -6988,14 +7050,6 @@
|
||||
"summary": "Add External Group.",
|
||||
"operationId": "addTeamGroupApi",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "TeamID",
|
||||
"name": "teamId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"x-go-name": "Body",
|
||||
"name": "body",
|
||||
@ -7004,6 +7058,14 @@
|
||||
"schema": {
|
||||
"$ref": "#/definitions/TeamGroupMapping"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "TeamID",
|
||||
"name": "teamId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@ -7037,16 +7099,16 @@
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "TeamID",
|
||||
"name": "teamId",
|
||||
"x-go-name": "GroupID",
|
||||
"name": "groupId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "GroupID",
|
||||
"name": "groupId",
|
||||
"x-go-name": "TeamID",
|
||||
"name": "teamId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -9054,6 +9116,13 @@
|
||||
"type": "string",
|
||||
"x-go-name": "DashboardUID"
|
||||
},
|
||||
"dashboards": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/DashboardDTO"
|
||||
},
|
||||
"x-go-name": "Dashboards"
|
||||
},
|
||||
"enableCsv": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "EnableCSV"
|
||||
@ -9265,6 +9334,13 @@
|
||||
"type": "string",
|
||||
"x-go-name": "DashboardUID"
|
||||
},
|
||||
"dashboards": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/DashboardDTO"
|
||||
},
|
||||
"x-go-name": "Dashboards"
|
||||
},
|
||||
"enableCsv": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "EnableCSV"
|
||||
@ -9555,6 +9631,22 @@
|
||||
},
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/api/dtos"
|
||||
},
|
||||
"DashboardDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"dashboard": {
|
||||
"$ref": "#/definitions/DashboardReportDTO"
|
||||
},
|
||||
"reportVariables": {
|
||||
"type": "object",
|
||||
"x-go-name": "ReportVariables"
|
||||
},
|
||||
"timeRange": {
|
||||
"$ref": "#/definitions/TimeRangeDTO"
|
||||
}
|
||||
},
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/extensions/report/api"
|
||||
},
|
||||
"DashboardFullWithMeta": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -9695,6 +9787,25 @@
|
||||
},
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/api/dtos"
|
||||
},
|
||||
"DashboardReportDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "ID"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"x-go-name": "Name"
|
||||
},
|
||||
"uid": {
|
||||
"type": "string",
|
||||
"x-go-name": "UID"
|
||||
}
|
||||
},
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/extensions/report/api"
|
||||
},
|
||||
"DashboardSnapshot": {
|
||||
"description": "DashboardSnapshot model",
|
||||
"type": "object",
|
||||
@ -11060,7 +11171,7 @@
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"x-go-name": "Id"
|
||||
"x-go-name": "ID"
|
||||
},
|
||||
"target": {
|
||||
"type": "string",
|
||||
@ -11075,7 +11186,7 @@
|
||||
"x-go-name": "Url"
|
||||
}
|
||||
},
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/models"
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/preference"
|
||||
},
|
||||
"NavbarPreference": {
|
||||
"type": "object",
|
||||
@ -11088,7 +11199,7 @@
|
||||
"x-go-name": "SavedItems"
|
||||
}
|
||||
},
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/models"
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/preference"
|
||||
},
|
||||
"NewApiKeyResult": {
|
||||
"type": "object",
|
||||
@ -11541,7 +11652,7 @@
|
||||
"x-go-name": "HomeTab"
|
||||
}
|
||||
},
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/services/preference"
|
||||
"x-go-package": "github.com/grafana/grafana/pkg/models"
|
||||
},
|
||||
"RecordingRuleJSON": {
|
||||
"description": "RecordingRuleJSON is the external representation of a recording rule",
|
||||
|
Loading…
Reference in New Issue
Block a user