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:
Sofia Papagiannaki
2022-05-23 16:13:13 +03:00
committed by GitHub
parent 8f4c3e94b0
commit be0d043673
6 changed files with 403 additions and 48 deletions

View File

@@ -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",