1package api
2
3import "time"
4
5type ServiceIntentionsConfigEntry struct {
6	Kind      string
7	Name      string
8	Namespace string `json:",omitempty"`
9
10	Sources []*SourceIntention
11
12	Meta map[string]string `json:",omitempty"`
13
14	CreateIndex uint64
15	ModifyIndex uint64
16}
17
18type SourceIntention struct {
19	Name        string
20	Namespace   string                 `json:",omitempty"`
21	Action      IntentionAction        `json:",omitempty"`
22	Permissions []*IntentionPermission `json:",omitempty"`
23	Precedence  int
24	Type        IntentionSourceType
25	Description string `json:",omitempty"`
26
27	LegacyID         string            `json:",omitempty" alias:"legacy_id"`
28	LegacyMeta       map[string]string `json:",omitempty" alias:"legacy_meta"`
29	LegacyCreateTime *time.Time        `json:",omitempty" alias:"legacy_create_time"`
30	LegacyUpdateTime *time.Time        `json:",omitempty" alias:"legacy_update_time"`
31}
32
33func (e *ServiceIntentionsConfigEntry) GetKind() string {
34	return e.Kind
35}
36
37func (e *ServiceIntentionsConfigEntry) GetName() string {
38	return e.Name
39}
40
41func (e *ServiceIntentionsConfigEntry) GetNamespace() string {
42	return e.Namespace
43}
44
45func (e *ServiceIntentionsConfigEntry) GetMeta() map[string]string {
46	return e.Meta
47}
48
49func (e *ServiceIntentionsConfigEntry) GetCreateIndex() uint64 {
50	return e.CreateIndex
51}
52
53func (e *ServiceIntentionsConfigEntry) GetModifyIndex() uint64 {
54	return e.ModifyIndex
55}
56
57type IntentionPermission struct {
58	Action IntentionAction
59	HTTP   *IntentionHTTPPermission `json:",omitempty"`
60}
61
62type IntentionHTTPPermission struct {
63	PathExact  string `json:",omitempty" alias:"path_exact"`
64	PathPrefix string `json:",omitempty" alias:"path_prefix"`
65	PathRegex  string `json:",omitempty" alias:"path_regex"`
66
67	Header []IntentionHTTPHeaderPermission `json:",omitempty"`
68
69	Methods []string `json:",omitempty"`
70}
71
72type IntentionHTTPHeaderPermission struct {
73	Name    string
74	Present bool   `json:",omitempty"`
75	Exact   string `json:",omitempty"`
76	Prefix  string `json:",omitempty"`
77	Suffix  string `json:",omitempty"`
78	Regex   string `json:",omitempty"`
79	Invert  bool   `json:",omitempty"`
80}
81