-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.go
84 lines (70 loc) · 2.22 KB
/
model.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package api
import "context"
type Client interface {
GetPolicies(ctx context.Context) ([]PolicyListItem, error)
GetPolicy(ctx context.Context, name string) (*Policy, error)
CreateException(ctx context.Context, request ExceptionRequest) (*ExceptionResponse, error)
}
type PolicyListItem struct {
Category string `json:"category"`
Namespace string `json:"namespace,omitempty"`
Name string `json:"name"`
Title string `json:"title"`
Description string `json:"description"`
Severity string `json:"severity,omitempty"`
}
type Engine struct {
Name string `json:"name"`
Version string `json:"version,omitempty"`
Subjects []string `json:"subjects,omitempty"`
}
type SourceCode struct {
ContentType string `json:"contentType"`
Content string `json:"content"`
}
type DetailsItem struct {
Title string `json:"title"`
Value string `json:"value"`
}
type Details struct {
Title string `json:"title"`
Items []DetailsItem `json:"items"`
}
type Reference struct {
URL string `json:"url"`
}
type Policy struct {
Category string `json:"category"`
Namespace string `json:"namespace,omitempty"`
Name string `json:"name"`
Title string `json:"title"`
Description string `json:"description"`
Severity string `json:"severity,omitempty"`
Engine *Engine `json:"engine,omitempty"`
SourceCode *SourceCode `json:"code,omitempty"`
References []Reference `json:"references,omitempty"`
Details []DetailsItem `json:"details,omitempty"`
Additional []Details `json:"additional,omitempty"`
}
type Resource struct {
APIVersion string `json:"apiVersion"`
Kind string `json:"kind"`
Name string `json:"name"`
Namespace string `json:"namespace"`
}
type ExceptionRule struct {
Name string `json:"name"`
Props map[string]string `json:"props"`
}
type ExceptionPolicy struct {
Name string `json:"name"`
Rules []ExceptionRule `json:"rules"`
}
type ExceptionRequest struct {
Resource Resource `json:"resource"`
Policies []*ExceptionPolicy `json:"policies"`
}
type ExceptionResponse struct {
MinVersion string `json:"minVersion,omitempty"`
Resource string `json:"resource,omitempty"`
}