use of com.infiniteautomation.mango.rest.latest.model.ValueMonitorModel in project ma-modules-public by infiniteautomation.
the class SystemMetricsRestController method query.
@ApiOperation(value = "Get the current value for all System Metrics", notes = "TBD Add RQL Support to this endpoint")
@RequestMapping(method = RequestMethod.GET)
public List<ValueMonitorModel> query(@AuthenticationPrincipal User user) {
MangoPermission permission = definition.getPermission();
service.ensurePermission(user, permission);
return Common.MONITORED_VALUES.getMonitors().stream().sorted(Comparator.comparing(a -> a.getName().translate(user.getTranslations()))).map(ValueMonitorModel::new).collect(Collectors.toList());
}
use of com.infiniteautomation.mango.rest.latest.model.ValueMonitorModel in project ma-modules-public by infiniteautomation.
the class SystemMetricsRestController method get.
@ApiOperation(value = "Get the current value for one System Metric by its ID", notes = "")
@RequestMapping(method = RequestMethod.GET, value = "/{id}")
public ValueMonitorModel get(@ApiParam(value = "Valid Monitor id", required = true, allowMultiple = false) @PathVariable String id, @AuthenticationPrincipal PermissionHolder user) {
MangoPermission permission = definition.getPermission();
service.ensurePermission(user, permission);
List<ValueMonitor<?>> values = Common.MONITORED_VALUES.getMonitors();
for (ValueMonitor<?> v : values) {
if (v.getId().equals(id)) {
return new ValueMonitorModel(v);
}
}
throw new NotFoundException();
}
Aggregations