forked from AlekSi/zabbix
-
Notifications
You must be signed in to change notification settings - Fork 4
/
template.go
35 lines (28 loc) · 919 Bytes
/
template.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package zabbix
import (
"github.com/AlekSi/reflector"
)
// https://www.zabbix.com/documentation/2.2/manual/api/reference/template/object
type Template struct {
TemplateId string `json:"templateid,omitempty"`
Host string `json:"host"`
Description string `json:"description,omitempty"`
Name string `json:"name,omitempty"`
}
type Templates []Template
type TemplateId struct {
TemplateId string `json:"templateid"`
}
type TemplateIds []TemplateId
// Wrapper for template.get: https://www.zabbix.com/documentation/2.2/manual/api/reference/template/get
func (api *API) TemplatesGet(params Params) (res Templates, err error) {
if _, present := params["output"]; !present {
params["output"] = "extend"
}
response, err := api.CallWithError("template.get", params)
if err != nil {
return
}
reflector.MapsToStructs2(response.Result.([]interface{}), &res, reflector.Strconv, "json")
return
}