-
Notifications
You must be signed in to change notification settings - Fork 20
/
monitor_wmi.go
78 lines (67 loc) · 2.42 KB
/
monitor_wmi.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Copyright e-Xpert Solutions SA. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ltm
import "github.com/e-XpertSolutions/f5-rest-client/f5"
type MonitorWMIConfigList struct {
Items []MonitorWMIConfig `json:"items,omitempty"`
Kind string `json:"kind,omitempty"`
SelfLink string `json:"selflink,omitempty"`
}
type MonitorWMIConfig struct {
Agent string `json:"agent,omitempty"`
AppService string `json:"appService,omitempty"`
DefaultsFrom string `json:"defaultsFrom,omitempty"`
Description string `json:"description,omitempty"`
Destination string `json:"destination,omitempty"`
FullPath string `json:"fullPath,omitempty"`
Generation int `json:"generation,omitempty"`
Interval int `json:"interval,omitempty"`
Kind string `json:"kind,omitempty"`
Method string `json:"method,omitempty"`
Metrics string `json:"metrics,omitempty"`
Name string `json:"name,omitempty"`
Partition string `json:"partition,omitempty"`
Post string `json:"post,omitempty"`
SelfLink string `json:"selfLink,omitempty"`
TimeUntilUp int `json:"timeUntilUp,omitempty"`
Timeout int `json:"timeout,omitempty"`
TmCommand string `json:"tmCommand,omitempty"`
URL string `json:"url,omitempty"`
}
const MonitorWMIEndpoint = "/monitor/wmi"
type MonitorWMIResource struct {
c *f5.Client
}
func (r *MonitorWMIResource) ListAll() (*MonitorWMIConfigList, error) {
var list MonitorWMIConfigList
if err := r.c.ReadQuery(BasePath+MonitorWMIEndpoint, &list); err != nil {
return nil, err
}
return &list, nil
}
func (r *MonitorWMIResource) Get(id string) (*MonitorWMIConfig, error) {
var item MonitorWMIConfig
if err := r.c.ReadQuery(BasePath+MonitorWMIEndpoint+"/"+id, &item); err != nil {
return nil, err
}
return &item, nil
}
func (r *MonitorWMIResource) Create(item MonitorWMIConfig) error {
if err := r.c.ModQuery("POST", BasePath+MonitorWMIEndpoint, item); err != nil {
return err
}
return nil
}
func (r *MonitorWMIResource) Edit(id string, item MonitorWMIConfig) error {
if err := r.c.ModQuery("PUT", BasePath+MonitorWMIEndpoint+"/"+id, item); err != nil {
return err
}
return nil
}
func (r *MonitorWMIResource) Delete(id string) error {
if err := r.c.ModQuery("DELETE", BasePath+MonitorWMIEndpoint+"/"+id, nil); err != nil {
return err
}
return nil
}