@@ -30,6 +30,38 @@ const (
30
30
NotificationTypeMessageCenter = "MessageCenter"
31
31
)
32
32
33
+ const (
34
+ CountConditionKey = "__count__"
35
+ )
36
+
37
+ type Severity int
38
+
39
+ const (
40
+ Report Severity = 2
41
+ Low Severity = 4
42
+ Medium Severity = 6
43
+ High Severity = 8
44
+ Critical Severity = 10
45
+ )
46
+
47
+ const (
48
+ JoinTypeCross = "cross_join"
49
+ JoinTypeInner = "inner_join"
50
+ JoinTypeLeft = "left_join"
51
+ JoinTypeRight = "right_join"
52
+ JoinTypeFull = "full_join"
53
+ JoinTypeLeftExclude = "left_exclude"
54
+ JoinTypeRightExclude = "right_exclude"
55
+ JoinTypeConcat = "concat"
56
+ JoinTypeNo = "no_join"
57
+ )
58
+
59
+ const (
60
+ GroupTypeNoGroup = "no_group"
61
+ GroupTypeLabelsAuto = "labels_auto"
62
+ GroupTypeCustom = "custom"
63
+ )
64
+
33
65
const (
34
66
ScheduleTypeFixedRate = "FixedRate"
35
67
ScheduleTypeHourly = "Hourly"
@@ -40,6 +72,63 @@ const (
40
72
ScheduleTypeResident = "Resident"
41
73
)
42
74
75
+ const (
76
+ StoreTypeLog = "log"
77
+ StoreTypeMetric = "metric"
78
+ StoreTypeMeta = "meta"
79
+ )
80
+
81
+ // SeverityConfiguration severity config by group
82
+ type SeverityConfiguration struct {
83
+ Severity Severity `json:"severity"`
84
+ EvalCondition ConditionConfiguration `json:"evalCondition"`
85
+ }
86
+
87
+ type ConditionConfiguration struct {
88
+ Condition string `json:"condition"`
89
+ CountCondition string `json:"countCondition"`
90
+ }
91
+
92
+ type JoinConfiguration struct {
93
+ Type string `json:"type"`
94
+ Condition string `json:"condition"`
95
+ }
96
+
97
+ type GroupConfiguration struct {
98
+ Type string `json:"type"`
99
+ Fields []string `json:"fields"`
100
+ }
101
+
102
+ type Tag struct {
103
+ Key string `json:"key"`
104
+ Value string `json:"value"`
105
+ }
106
+
107
+ type Token struct {
108
+ Name string `json:"name"`
109
+ DisplayName string `json:"display_name"`
110
+ Required bool `json:"required"`
111
+ Type string `json:"type"`
112
+ Default string `json:"default"`
113
+ Hide bool `json:"hide"`
114
+ }
115
+
116
+ type TemplateConfiguration struct {
117
+ Id string `json:"id"`
118
+ Type string `json:"type"`
119
+ Version string `json:"version"`
120
+ Lang string `json:"lang"`
121
+ Tokens map [string ]string `json:"tokens"`
122
+ Annotations map [string ]string `json:"annotations"`
123
+ }
124
+
125
+ type PolicyConfiguration struct {
126
+ UseDefault bool `json:"useDefault"`
127
+ RepeatInterval string `json:"repeatInterval"`
128
+ AlertPolicyId string `json:"alertPolicyId"`
129
+ ActionPolicyId string `json:"actionPolicyId"`
130
+ }
131
+
43
132
type Alert struct {
44
133
Name string `json:"name"`
45
134
DisplayName string `json:"displayName"`
@@ -66,23 +155,20 @@ func (alert *Alert) MarshalJSON() ([]byte, error) {
66
155
return json .Marshal (body )
67
156
}
68
157
69
- type AlertConfiguration struct {
70
- Condition string `json:"condition"`
71
- Dashboard string `json:"dashboard"`
72
- QueryList []* AlertQuery `json:"queryList"`
73
- MuteUntil int64 `json:"muteUntil"`
74
- NotificationList []* Notification `json:"notificationList"`
75
- NotifyThreshold int32 `json:"notifyThreshold"`
76
- Throttling string `json:"throttling"`
77
- }
78
-
79
158
type AlertQuery struct {
80
159
ChartTitle string `json:"chartTitle"`
81
160
LogStore string `json:"logStore"`
82
161
Query string `json:"query"`
83
162
TimeSpanType string `json:"timeSpanType"`
84
163
Start string `json:"start"`
85
164
End string `json:"end"`
165
+
166
+ StoreType string `json:"storeType"`
167
+ Project string `json:"project"`
168
+ Store string `json:"store"`
169
+ Region string `json:"region"`
170
+ RoleArn string `json:"roleArn"`
171
+ DashboardId string `json:"dashboardId"`
86
172
}
87
173
88
174
type Notification struct {
@@ -104,6 +190,33 @@ type Schedule struct {
104
190
Hour int32 `json:"hour"`
105
191
}
106
192
193
+ type AlertConfiguration struct {
194
+ Condition string `json:"condition"`
195
+ MuteUntil int64 `json:"muteUntil"`
196
+ NotificationList []* Notification `json:"notificationList"`
197
+ NotifyThreshold int32 `json:"notifyThreshold"`
198
+ Throttling string `json:"throttling"`
199
+
200
+ Version string `json:"version"`
201
+ Type string `json:"type"`
202
+ TemplateConfiguration * TemplateConfiguration `json:"templateConfiguration"`
203
+
204
+ Dashboard string `json:"dashboard"`
205
+ Threshold int `json:"threshold"`
206
+ NoDataFire bool `json:"noDataFire"`
207
+ NoDataSeverity Severity `json:"noDataSeverity"`
208
+ SendResolved bool `json:"sendResolved"`
209
+ QueryList []* AlertQuery `json:"queryList"`
210
+ Annotations []* Tag `json:"annotations"`
211
+ Labels []* Tag `json:"labels"`
212
+ SeverityConfigurations []* SeverityConfiguration `json:"severityConfigurations"`
213
+
214
+ JoinConfigurations []* JoinConfiguration `json:"joinConfigurations"`
215
+ GroupConfiguration GroupConfiguration `json:"groupConfiguration"`
216
+
217
+ PolicyConfiguration PolicyConfiguration `json:"policyConfiguration"`
218
+ }
219
+
107
220
func (c * Client ) CreateSavedSearch (project string , savedSearch * SavedSearch ) error {
108
221
body , err := json .Marshal (savedSearch )
109
222
if err != nil {
0 commit comments