@@ -10,7 +10,7 @@ import (
10
10
"github.com/grafana/grafana/pkg/services/guardian"
11
11
)
12
12
13
- func ValidateOrgAlert (c * m.Context ) {
13
+ func ValidateOrgAlert (c * m.ReqContext ) {
14
14
id := c .ParamsInt64 (":alertId" )
15
15
query := m.GetAlertByIdQuery {Id : id }
16
16
@@ -25,7 +25,7 @@ func ValidateOrgAlert(c *m.Context) {
25
25
}
26
26
}
27
27
28
- func GetAlertStatesForDashboard (c * m.Context ) Response {
28
+ func GetAlertStatesForDashboard (c * m.ReqContext ) Response {
29
29
dashboardId := c .QueryInt64 ("dashboardId" )
30
30
31
31
if dashboardId == 0 {
@@ -45,7 +45,7 @@ func GetAlertStatesForDashboard(c *m.Context) Response {
45
45
}
46
46
47
47
// GET /api/alerts
48
- func GetAlerts (c * m.Context ) Response {
48
+ func GetAlerts (c * m.ReqContext ) Response {
49
49
query := m.GetAlertsQuery {
50
50
OrgId : c .OrgId ,
51
51
DashboardId : c .QueryInt64 ("dashboardId" ),
@@ -71,7 +71,7 @@ func GetAlerts(c *m.Context) Response {
71
71
}
72
72
73
73
// POST /api/alerts/test
74
- func AlertTest (c * m.Context , dto dtos.AlertTestCommand ) Response {
74
+ func AlertTest (c * m.ReqContext , dto dtos.AlertTestCommand ) Response {
75
75
if _ , idErr := dto .Dashboard .Get ("id" ).Int64 (); idErr != nil {
76
76
return ApiError (400 , "The dashboard needs to be saved at least once before you can test an alert rule" , nil )
77
77
}
@@ -113,7 +113,7 @@ func AlertTest(c *m.Context, dto dtos.AlertTestCommand) Response {
113
113
}
114
114
115
115
// GET /api/alerts/:id
116
- func GetAlert (c * m.Context ) Response {
116
+ func GetAlert (c * m.ReqContext ) Response {
117
117
id := c .ParamsInt64 (":alertId" )
118
118
query := m.GetAlertByIdQuery {Id : id }
119
119
@@ -124,11 +124,11 @@ func GetAlert(c *m.Context) Response {
124
124
return Json (200 , & query .Result )
125
125
}
126
126
127
- func GetAlertNotifiers (c * m.Context ) Response {
127
+ func GetAlertNotifiers (c * m.ReqContext ) Response {
128
128
return Json (200 , alerting .GetNotifiers ())
129
129
}
130
130
131
- func GetAlertNotifications (c * m.Context ) Response {
131
+ func GetAlertNotifications (c * m.ReqContext ) Response {
132
132
query := & m.GetAllAlertNotificationsQuery {OrgId : c .OrgId }
133
133
134
134
if err := bus .Dispatch (query ); err != nil {
@@ -151,7 +151,7 @@ func GetAlertNotifications(c *m.Context) Response {
151
151
return Json (200 , result )
152
152
}
153
153
154
- func GetAlertNotificationById (c * m.Context ) Response {
154
+ func GetAlertNotificationById (c * m.ReqContext ) Response {
155
155
query := & m.GetAlertNotificationsQuery {
156
156
OrgId : c .OrgId ,
157
157
Id : c .ParamsInt64 ("notificationId" ),
@@ -164,7 +164,7 @@ func GetAlertNotificationById(c *m.Context) Response {
164
164
return Json (200 , query .Result )
165
165
}
166
166
167
- func CreateAlertNotification (c * m.Context , cmd m.CreateAlertNotificationCommand ) Response {
167
+ func CreateAlertNotification (c * m.ReqContext , cmd m.CreateAlertNotificationCommand ) Response {
168
168
cmd .OrgId = c .OrgId
169
169
170
170
if err := bus .Dispatch (& cmd ); err != nil {
@@ -174,7 +174,7 @@ func CreateAlertNotification(c *m.Context, cmd m.CreateAlertNotificationCommand)
174
174
return Json (200 , cmd .Result )
175
175
}
176
176
177
- func UpdateAlertNotification (c * m.Context , cmd m.UpdateAlertNotificationCommand ) Response {
177
+ func UpdateAlertNotification (c * m.ReqContext , cmd m.UpdateAlertNotificationCommand ) Response {
178
178
cmd .OrgId = c .OrgId
179
179
180
180
if err := bus .Dispatch (& cmd ); err != nil {
@@ -184,7 +184,7 @@ func UpdateAlertNotification(c *m.Context, cmd m.UpdateAlertNotificationCommand)
184
184
return Json (200 , cmd .Result )
185
185
}
186
186
187
- func DeleteAlertNotification (c * m.Context ) Response {
187
+ func DeleteAlertNotification (c * m.ReqContext ) Response {
188
188
cmd := m.DeleteAlertNotificationCommand {
189
189
OrgId : c .OrgId ,
190
190
Id : c .ParamsInt64 ("notificationId" ),
@@ -198,7 +198,7 @@ func DeleteAlertNotification(c *m.Context) Response {
198
198
}
199
199
200
200
//POST /api/alert-notifications/test
201
- func NotificationTest (c * m.Context , dto dtos.NotificationTestCommand ) Response {
201
+ func NotificationTest (c * m.ReqContext , dto dtos.NotificationTestCommand ) Response {
202
202
cmd := & alerting.NotificationTestCommand {
203
203
Name : dto .Name ,
204
204
Type : dto .Type ,
@@ -216,7 +216,7 @@ func NotificationTest(c *m.Context, dto dtos.NotificationTestCommand) Response {
216
216
}
217
217
218
218
//POST /api/alerts/:alertId/pause
219
- func PauseAlert (c * m.Context , dto dtos.PauseAlertCommand ) Response {
219
+ func PauseAlert (c * m.ReqContext , dto dtos.PauseAlertCommand ) Response {
220
220
alertId := c .ParamsInt64 ("alertId" )
221
221
222
222
query := m.GetAlertByIdQuery {Id : alertId }
@@ -261,7 +261,7 @@ func PauseAlert(c *m.Context, dto dtos.PauseAlertCommand) Response {
261
261
}
262
262
263
263
//POST /api/admin/pause-all-alerts
264
- func PauseAllAlerts (c * m.Context , dto dtos.PauseAllAlertsCommand ) Response {
264
+ func PauseAllAlerts (c * m.ReqContext , dto dtos.PauseAllAlertsCommand ) Response {
265
265
updateCmd := m.PauseAllAlertCommand {
266
266
Paused : dto .Paused ,
267
267
}
0 commit comments