sdk
sdk copied to clipboard
StatusMessage Datasource Bug
Hello,
So the response being returned from: CreateDatasource is StatusMessage unfortunately that does not map out correctly.
The response for the current version of the API looks like this for: Version 8.3.6
{
"datasource": {
"id": 5,
"uid": "EwLFuaBnk",
"orgId": 1,
"name": "testing",
"type": "elasticsearch",
"typeLogoUrl": "",
"access": "direct",
"url": "http://1.2.3.4",
"password": "",
"user": "",
"database": "grafanasdk",
"basicAuth": false,
"basicAuthUser": "",
"basicAuthPassword": "",
"withCredentials": false,
"isDefault": false,
"jsonData": {
"esVersion": "5",
"maxConcurrentShardRequests": "256",
"timeField": "@timestamp"
},
"secureJsonFields": {},
"version": 1,
"readOnly": false
},
"id": 5,
"message": "Datasource added",
"name": "testing"
}
Except for id, message and name none of the other fields will be mapped correctly. As StatusMessage is being used by a variety of fields, before I attempt to fix it, I was wondering what approach would you like to take?
I saw a Generics 1.18 ticket so not sure if this would benefit from it.
I was thinking of a few approaches.
- Parse the the message twice giving it raw JSON and a 2nd time with just the content of datasource ?
- Create a new DatasourceStatusMessage.
- Look at how Generics might come into play to create a more generic approach.
Any suggestions on how you'd prefer to have this handled?