Refactor API calls

This commit is contained in:
Alexander Zobnin
2020-05-29 12:31:43 +03:00
parent efb4d41da5
commit 9f344cb867
10 changed files with 66 additions and 254 deletions

View File

@@ -68,6 +68,11 @@ func (ds *ZabbixDatasourceInstance) ZabbixRequest(ctx context.Context, method st
var result *simplejson.Json
var err error
// Skip auth for methods that are not required it
if method == "apiinfo.version" {
return ds.ZabbixAPIRequest(ctx, method, params, ds.authToken)
}
for attempt := 0; attempt <= 3; attempt++ {
if ds.authToken == "" {
// Authenticate