forked from pulse-vadc/go-vtm
-
Notifications
You must be signed in to change notification settings - Fork 2
/
statistics_rule.go
36 lines (32 loc) · 1.09 KB
/
statistics_rule.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
// Copyright (C) 2018-2019, Pulse Secure, LLC.
// Licensed under the terms of the MPL 2.0. See LICENSE file for details.
// Go library for Pulse Virtual Traffic Manager REST version 5.2.
package vtm
import (
"encoding/json"
)
type RuleStatistics struct {
Statistics struct {
Aborts *int `json:"aborts"`
Discards *int `json:"discards"`
ExecutionTimeWarnings *int `json:"execution_time_warnings"`
Executions *int `json:"executions"`
PoolSelect *int `json:"pool_select"`
Responds *int `json:"responds"`
Retries *int `json:"retries"`
} `json:"statistics"`
}
func (vtm VirtualTrafficManager) GetRuleStatistics(name string) (*RuleStatistics, *vtmErrorResponse) {
conn := vtm.connector.getChildConnector("/tm/5.2/status/local_tm/statistics/rules/" + name)
data, ok := conn.get()
if ok != true {
object := new(vtmErrorResponse)
json.NewDecoder(data).Decode(object)
return nil, object
}
object := new(RuleStatistics)
if err := json.NewDecoder(data).Decode(object); err != nil {
panic(err)
}
return object, nil
}