-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpolicies.go
48 lines (41 loc) · 1.19 KB
/
policies.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
package gobdgz
type Policy struct {
request Request
}
// prepare request before sening the request
func (p *Policy) SetRequest(r Request) {
p.request = r
}
type ExportPolicyResponse struct {
ID *string `json:"id"`
JSONRPC string `json:"jsonrpc"`
Result ExportPolicyResult `json:"result"`
}
type ExportPolicyResult struct {
Total int `json:"total"`
Page int `json:"page"`
PerPage int `json:"perPage"`
PagesCount int `json:"pagesPage"`
Items []PolicyItems `json:"items"`
CompatVersion string `json:"compatVersion"`
}
type ImportPolicyResponse struct {
ID *string `json:"id"`
JSONRPC string `json:"jsonrpc"`
Result ImportPolicyResult `json:"result"`
}
type ImportPolicyResult struct {
Success bool `json:"success"`
}
// ExportPolicies
func (p *Policy) ExportPolicies() (ExportPolicyResponse, error) {
var resp ExportPolicyResponse
err := p.request.SendRequest(&resp)
return resp, err
}
// ImportPolicies
func (p *Policy) ImportPolicies() (ImportPolicyResponse, error) {
var resp ImportPolicyResponse
err := p.request.SendRequest(&resp)
return resp, err
}