-
Notifications
You must be signed in to change notification settings - Fork 1
/
administration.go
60 lines (51 loc) · 1.68 KB
/
administration.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
package administration
import (
"net/http"
"github.com/zscaler/zscaler-sdk-go/v2/zdx/services/common"
)
const (
departmentsEndpoint = "v1/administration/departments"
locationsEndpoint = "v1/administration/locations"
)
type Departments struct {
ID int `json:"id"`
Name string `json:"name,omitempty"`
}
type Locations struct {
ID int `json:"id"`
Name string `json:"name,omitempty"`
}
type GetDepartmentsFilters struct {
common.GetFromToFilters
// The Zscaler location (ID). You can add multiple location IDs.
Loc []int `json:"loc,omitempty" url:"loc,omitempty"`
// The search string used to support search by name or department ID.
Search string `json:"search,omitempty" url:"search,omitempty"`
}
type GetLocationsFilters struct {
common.GetFromToFilters
// The Zscaler location (ID). You can add multiple location IDs.
Loc []int `json:"loc,omitempty" url:"loc,omitempty"`
// The search string used to support search by name or department ID.
Search string `json:"q,omitempty" url:"q,omitempty"`
}
// Gets configured departments.
func (service *Service) GetDepartments(appID string, filters GetDepartmentsFilters) (*Departments, *http.Response, error) {
v := new(Departments)
path := departmentsEndpoint
resp, err := service.Client.NewRequestDo("GET", path, filters, nil, v)
if err != nil {
return nil, nil, err
}
return v, resp, nil
}
// Gets configured departments.
func (service *Service) GetLocations(appID string, filters GetLocationsFilters) (*Locations, *http.Response, error) {
v := new(Locations)
path := locationsEndpoint
resp, err := service.Client.NewRequestDo("GET", path, filters, nil, v)
if err != nil {
return nil, nil, err
}
return v, resp, nil
}