Open mblaschke-daimlertruck opened 9 months ago
I ended up doing this for some unsupported calls:
https://github.com/esnet/gdg/blob/master/internal/api/extended.go
Then, to use it:
var result []*models.UserOrgDTO
req := extended.getRequestBuilder().
Path("api/user/orgs").
ToJSON(&result).
Method(http.MethodGet)
In this case i'm using the OpenAPI models but you can place it with anything you like...
All you really need is something like this:
req := requests.URL(extended.grafanaCfg.URL)
if extended.grafanaCfg.APIToken != "" {
req.Header("Authorization", "Bearer "+extended.grafanaCfg.APIToken)
} else {
req.BasicAuth(extended.grafanaCfg.UserName, extended.grafanaCfg.Password)
}
then use the req entity to build your call.
Is your feature request related to a problem? Currently only prebuild APIs can be used with this client. Datasources also have own endpoints which are currently not useable.
Describe the solution you'd like Add a function to send own API requests to Grafana
Describe alternatives you've considered Forking is not a good idea
Additional context eg. to trigger the subscription list of the
grafana-azure-monitor-datasource
using API/api/datasources/{uid}/resources/azuremonitor/subscriptions