forked from pulse-vadc/go-vtm
/
statistics_service_protection.go
38 lines (34 loc) · 1.23 KB
/
statistics_service_protection.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
// Copyright (C) 2018, 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 6.1.
package vtm
import (
"encoding/json"
)
type ServiceProtectionStatistics struct {
Statistics struct {
LastRefusalTime *int `json:"last_refusal_time"`
RefusalBinary *int `json:"refusal_binary"`
RefusalConc10Ip *int `json:"refusal_conc10_ip"`
RefusalConc1Ip *int `json:"refusal_conc1_ip"`
RefusalConnRate *int `json:"refusal_conn_rate"`
RefusalIp *int `json:"refusal_ip"`
RefusalRfc2396 *int `json:"refusal_rfc2396"`
RefusalSize *int `json:"refusal_size"`
TotalRefusal *int `json:"total_refusal"`
} `json:"statistics"`
}
func (vtm VirtualTrafficManager) GetServiceProtectionStatistics(name string) (*ServiceProtectionStatistics, *vtmErrorResponse) {
conn := vtm.connector.getChildConnector("/tm/6.1/status/local_tm/statistics/service_protection/" + name)
data, ok := conn.get()
if ok != true {
object := new(vtmErrorResponse)
json.NewDecoder(data).Decode(object)
return nil, object
}
object := new(ServiceProtectionStatistics)
if err := json.NewDecoder(data).Decode(object); err != nil {
panic(err)
}
return object, nil
}