-
Notifications
You must be signed in to change notification settings - Fork 37
/
constants.go
172 lines (150 loc) · 4.82 KB
/
constants.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
package metadata
import "strings"
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
type Kind string
const (
KindAnalyticsRule Kind = "AnalyticsRule"
KindAnalyticsRuleTemplate Kind = "AnalyticsRuleTemplate"
KindAutomationRule Kind = "AutomationRule"
KindAzureFunction Kind = "AzureFunction"
KindDataConnector Kind = "DataConnector"
KindDataType Kind = "DataType"
KindHuntingQuery Kind = "HuntingQuery"
KindInvestigationQuery Kind = "InvestigationQuery"
KindLogicAppsCustomConnector Kind = "LogicAppsCustomConnector"
KindParser Kind = "Parser"
KindPlaybook Kind = "Playbook"
KindPlaybookTemplate Kind = "PlaybookTemplate"
KindSolution Kind = "Solution"
KindWatchlist Kind = "Watchlist"
KindWatchlistTemplate Kind = "WatchlistTemplate"
KindWorkbook Kind = "Workbook"
KindWorkbookTemplate Kind = "WorkbookTemplate"
)
func PossibleValuesForKind() []string {
return []string{
string(KindAnalyticsRule),
string(KindAnalyticsRuleTemplate),
string(KindAutomationRule),
string(KindAzureFunction),
string(KindDataConnector),
string(KindDataType),
string(KindHuntingQuery),
string(KindInvestigationQuery),
string(KindLogicAppsCustomConnector),
string(KindParser),
string(KindPlaybook),
string(KindPlaybookTemplate),
string(KindSolution),
string(KindWatchlist),
string(KindWatchlistTemplate),
string(KindWorkbook),
string(KindWorkbookTemplate),
}
}
func parseKind(input string) (*Kind, error) {
vals := map[string]Kind{
"analyticsrule": KindAnalyticsRule,
"analyticsruletemplate": KindAnalyticsRuleTemplate,
"automationrule": KindAutomationRule,
"azurefunction": KindAzureFunction,
"dataconnector": KindDataConnector,
"datatype": KindDataType,
"huntingquery": KindHuntingQuery,
"investigationquery": KindInvestigationQuery,
"logicappscustomconnector": KindLogicAppsCustomConnector,
"parser": KindParser,
"playbook": KindPlaybook,
"playbooktemplate": KindPlaybookTemplate,
"solution": KindSolution,
"watchlist": KindWatchlist,
"watchlisttemplate": KindWatchlistTemplate,
"workbook": KindWorkbook,
"workbooktemplate": KindWorkbookTemplate,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := Kind(input)
return &out, nil
}
type Operator string
const (
OperatorAND Operator = "AND"
OperatorOR Operator = "OR"
)
func PossibleValuesForOperator() []string {
return []string{
string(OperatorAND),
string(OperatorOR),
}
}
func parseOperator(input string) (*Operator, error) {
vals := map[string]Operator{
"and": OperatorAND,
"or": OperatorOR,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := Operator(input)
return &out, nil
}
type SourceKind string
const (
SourceKindCommunity SourceKind = "Community"
SourceKindLocalWorkspace SourceKind = "LocalWorkspace"
SourceKindSolution SourceKind = "Solution"
SourceKindSourceRepository SourceKind = "SourceRepository"
)
func PossibleValuesForSourceKind() []string {
return []string{
string(SourceKindCommunity),
string(SourceKindLocalWorkspace),
string(SourceKindSolution),
string(SourceKindSourceRepository),
}
}
func parseSourceKind(input string) (*SourceKind, error) {
vals := map[string]SourceKind{
"community": SourceKindCommunity,
"localworkspace": SourceKindLocalWorkspace,
"solution": SourceKindSolution,
"sourcerepository": SourceKindSourceRepository,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := SourceKind(input)
return &out, nil
}
type SupportTier string
const (
SupportTierCommunity SupportTier = "Community"
SupportTierMicrosoft SupportTier = "Microsoft"
SupportTierPartner SupportTier = "Partner"
)
func PossibleValuesForSupportTier() []string {
return []string{
string(SupportTierCommunity),
string(SupportTierMicrosoft),
string(SupportTierPartner),
}
}
func parseSupportTier(input string) (*SupportTier, error) {
vals := map[string]SupportTier{
"community": SupportTierCommunity,
"microsoft": SupportTierMicrosoft,
"partner": SupportTierPartner,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := SupportTier(input)
return &out, nil
}