func UpdateMonitor(c *middleware.Context, cmd m.UpdateMonitorCommand) Response { cmd.OrgId = c.OrgId err := bus.Dispatch(&cmd) if err != nil { return ApiError(500, "Failed to update monitor", err) } return ApiSuccess("Monitor updated") }
func UpdateMonitor(c *middleware.Context, cmd m.UpdateMonitorCommand) Response { cmd.OrgId = c.OrgId if cmd.EndpointId == 0 { return ApiError(400, "EndpointId not set.", nil) } if cmd.MonitorTypeId == 0 { return ApiError(400, "MonitorTypeId not set.", nil) } if cmd.Frequency == 0 { return ApiError(400, "Frequency not set.", nil) } err := bus.Dispatch(&cmd) if err != nil { return ApiError(500, "Failed to update monitor", err) } return ApiSuccess("Monitor updated") }