Migrate to new backend sdk, use /zabbix-api endpoint for API queries

This commit is contained in:
Alexander Zobnin
2020-05-28 17:04:49 +03:00
parent 9f93faaebf
commit f0daa9fcb9
12 changed files with 478 additions and 141 deletions

View File

@@ -60,7 +60,9 @@ func (p *zabbixParamOutput) UnmarshalJSON(data []byte) error {
}
type ZabbixAPIParams struct {
type ZabbixAPIParams = map[string]interface{}
type ZabbixAPIParamsLegacy struct {
Output *zabbixParamOutput `json:"output,omitempty"`
SortField string `json:"sortfield,omitempty"`
SortOrder string `json:"sortorder,omitempty"`
@@ -101,3 +103,19 @@ type ZabbixAPIParams struct {
TimeFrom int64 `json:"time_from,omitempty"`
TimeTill int64 `json:"time_till,omitempty"`
}
type ZabbixAPIResourceRequest struct {
DatasourceId int64 `json:"datasourceId"`
Method string `json:"method"`
Params map[string]interface{} `json:"params,omitempty"`
}
type ZabbixAPIRequest struct {
Method string `json:"method"`
Params map[string]interface{} `json:"params,omitempty"`
}
func (r *ZabbixAPIRequest) String() string {
jsonRequest, _ := json.Marshal(r.Params)
return r.Method + string(jsonRequest)
}