-
Notifications
You must be signed in to change notification settings - Fork 0
/
device_cloudpath_probes.go
56 lines (48 loc) · 2.22 KB
/
device_cloudpath_probes.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
package devices
import (
"fmt"
"net/http"
"github.com/SecurityGeekIO/zscaler-sdk-go/v2/zdx/services/common"
)
const (
deviceCloudPathProbesEndpoint = "v1/cloudpath-probes"
)
type DeviceCloudPathProbe struct {
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
NumProbes int `json:"num_probes,omitempty"`
AverageLatency []AverageLatency `json:"avg_latencies,omitempty"`
}
type AverageLatency struct {
LegSRC string `json:"leg_src,omitempty"`
LegDst string `json:"leg_dst,omitempty"`
Latency int `json:"latency,omitempty"`
}
type DeviceCloudPathProbeMetric struct {
LegSRC string `json:"leg_src,omitempty"`
LegDst string `json:"leg_dst,omitempty"`
Stats []common.Metric `json:"stats,omitempty"`
}
// Gets the CloudPath Probe's metric trend on a device for an application.
// For Cloud Path Probes, you can access latency metrics for End to End, Client - Egress, Egress - Application, ZIA Service Edge- Egress, and ZIA Service Edge - Application.
// If not specified, it defaults to End to End latency.
// If the time range is not specified, the endpoint defaults to the last 2 hours.
func (service *Service) GetCloudPathProbesMetric(deviceID, appID, probeID string, filters common.GetFromToFilters) (*DeviceCloudPathProbeMetric, *http.Response, error) {
v := new(DeviceCloudPathProbeMetric)
path := fmt.Sprintf("%v/%v/%v/%v/%v/%v", devicesEndpoint, deviceID, deviceAppsEndpoint, appID, deviceCloudPathProbesEndpoint, probeID)
resp, err := service.Client.NewRequestDo("GET", path, filters, nil, v)
if err != nil {
return nil, nil, err
}
return v, resp, nil
}
// Gets the list of all active Cloud Path probes on a device. If the time range is not specified, the endpoint defaults to the last 2 hours.
func (service *Service) GetAllCloudPathProbes(deviceID, appID string, filters common.GetFromToFilters) ([]DeviceCloudPathProbe, *http.Response, error) {
var v []DeviceCloudPathProbe
path := fmt.Sprintf("%v/%v/%v/%v/%v", devicesEndpoint, deviceID, deviceAppsEndpoint, appID, deviceCloudPathProbesEndpoint)
resp, err := service.Client.NewRequestDo("GET", path, filters, nil, v)
if err != nil {
return nil, nil, err
}
return v, resp, nil
}