From 53030e2141b807d03db812811344fa533caedf1e Mon Sep 17 00:00:00 2001 From: Ivana Huckova Date: Wed, 4 Sep 2024 14:17:02 +0200 Subject: [PATCH] Fix deprecated methods based on instructions --- pkg/datasource/resource_handler.go | 6 +++--- pkg/plugin.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/datasource/resource_handler.go b/pkg/datasource/resource_handler.go index d8d8e70ce..9e20b0df3 100644 --- a/pkg/datasource/resource_handler.go +++ b/pkg/datasource/resource_handler.go @@ -8,8 +8,8 @@ import ( "github.com/alexanderzobnin/grafana-zabbix/pkg/zabbix" + "github.com/grafana/grafana-plugin-sdk-go/backend" "github.com/grafana/grafana-plugin-sdk-go/backend/log" - "github.com/grafana/grafana-plugin-sdk-go/backend/resource/httpadapter" ) // Resource handler describes handlers for the resources populated by plugin in plugin.go, like: @@ -48,7 +48,7 @@ func (ds *ZabbixDatasource) ZabbixAPIHandler(rw http.ResponseWriter, req *http.R } ctx := req.Context() - pluginCxt := httpadapter.PluginConfigFromContext(ctx) + pluginCxt := backend.PluginConfigFromContext(ctx) dsInstance, err := ds.getDSInstance(ctx, pluginCxt) if err != nil { ds.logger.Error("Error loading datasource", "error", err) @@ -89,7 +89,7 @@ func (ds *ZabbixDatasource) DBConnectionPostProcessingHandler(rw http.ResponseWr } ctx := req.Context() - pluginCxt := httpadapter.PluginConfigFromContext(ctx) + pluginCxt := backend.PluginConfigFromContext(ctx) dsInstance, err := ds.getDSInstance(ctx, pluginCxt) if err != nil { ds.logger.Error("Error loading datasource", "error", err) diff --git a/pkg/plugin.go b/pkg/plugin.go index bfa9c3ccf..cd35a26cb 100644 --- a/pkg/plugin.go +++ b/pkg/plugin.go @@ -22,7 +22,7 @@ func main() { pluginLogger.Debug("Starting Zabbix datasource") - err := backend.Serve(backend.ServeOpts{ + err := backend.Manage(ZABBIX_PLUGIN_ID, backend.ServeOpts{ CallResourceHandler: httpResourceHandler, QueryDataHandler: ds, CheckHealthHandler: ds,