-
Notifications
You must be signed in to change notification settings - Fork 70
/
api.go
46 lines (37 loc) · 997 Bytes
/
api.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
package api
import "policy-server/store"
//go:generate counterfeiter -o fakes/policy_mapper.go --fake-name PolicyMapper . PolicyMapper
type PolicyMapper interface {
AsStorePolicy([]byte) ([]store.Policy, error) // marshal
AsBytes([]store.Policy) ([]byte, error) // unmarshal
}
type Policies struct {
TotalPolicies int `json:"total_policies"`
Policies []Policy `json:"policies"`
}
type Policy struct {
Source Source `json:"source"`
Destination Destination `json:"destination"`
}
type Source struct {
ID string `json:"id"`
Tag string `json:"tag,omitempty"`
}
type Destination struct {
ID string `json:"id"`
Tag string `json:"tag,omitempty"`
Protocol string `json:"protocol"`
Ports Ports `json:"ports"`
}
type Ports struct {
Start int `json:"start"`
End int `json:"end"`
}
type Tag struct {
ID string `json:"id"`
Tag string `json:"tag"`
}
type Space struct {
Name string `json:name`
OrgGUID string `json:organization_guid`
}