...
1 package rulesengine
2
3 import (
4 "edge-infra.dev/pkg/sds/emergencyaccess/eaconst"
5 )
6
7
8
9 type BannerPrivOverrides struct {
10 Banner Banner `json:"banner"`
11 Privileges []Privilege `json:"privileges"`
12 }
13
14 type ReadBannerRule struct {
15 Command Command `json:"command"`
16 Banners []BannerPrivOverrides `json:"banners"`
17 }
18
19 type RuleWithOverrides struct {
20 Command Command `json:"command"`
21 Banners []BannerPrivOverrides `json:"banners"`
22 Default DefaultRule `json:"default"`
23 }
24
25 type DefaultRule struct {
26 Privileges []Privilege `json:"privileges,omitempty"`
27 }
28
29 type ValidateCommandResponse struct {
30 Valid bool `json:"valid"`
31 }
32
33 type Identity struct {
34 UserID string `json:"userid"`
35 EAroles []string `json:"earoles"`
36 }
37
38 type Target struct {
39 BannerID string `json:"bannerid"`
40 }
41
42 type ErrorType string
43
44 const (
45 UnknownBanner ErrorType = "Unknown Banner"
46 UnknownCommand ErrorType = "Unknown Command"
47 UnknownPrivilege ErrorType = "Unknown Privilege"
48 UnknownRule ErrorType = "Unknown Rule association"
49 Conflict ErrorType = "Conflict"
50 )
51
52 type Error struct {
53 Type ErrorType `json:"type"`
54 Banner string `json:"banner,omitempty"`
55 Command string `json:"command,omitempty"`
56 Privilege string `json:"privilege,omitempty"`
57 }
58
59 type AddNameResult struct {
60 Conflicts []string `json:"conflicts"`
61 }
62
63 type AddRuleResult struct {
64 Errors []Error `json:"errors"`
65 }
66
67 type AddRuleConflict struct {
68 Banner string `json:"banner,omitempty"`
69 Privilege string `json:"privilege"`
70 Command string `json:"command"`
71 Error string `json:"error"`
72 }
73
74 type DeleteResult struct {
75 Errors []Error `json:"errors,omitempty"`
76 RowsAffected int64 `json:"-"`
77 }
78
79
80
81
82 type Command struct {
83 Name string `json:"name"`
84 ID string `json:"id"`
85 Type eaconst.RequestType `json:"type,omitempty"`
86 }
87
88 type Privilege struct {
89 Name string `json:"name"`
90 ID string `json:"id"`
91 }
92
93 type Banner struct {
94 BannerName string `json:"name"`
95 BannerID string `json:"id"`
96 }
97
98
99
100 type Rule struct {
101 Command Command `json:"command"`
102 Privileges []Privilege `json:"privileges"`
103 }
104
105 type ReturnRuleSet struct {
106 Privilege Privilege
107 Commands []Command
108 }
109
View as plain text