public void setEnabled(String deploymentName, String notificationName, boolean enabled) { Notification notification = getNotification(deploymentName, notificationName); notification.setEnabled(enabled); }
@RequestMapping(value = "/{notificationName:.+}", method = RequestMethod.GET) DaemonTask<Halconfig, Notification> notification(@PathVariable String deploymentName, @PathVariable String notificationName, @ModelAttribute ValidationSettings validationSettings) { return GenericGetRequest.<Notification>builder() .getter(() -> notificationService.getNotification(deploymentName, notificationName)) .validator(() -> notificationService.validateNotification(deploymentName, notificationName)) .description("Get " + notificationName + " notification") .build() .execute(validationSettings); }
@RequestMapping(value = "/{notificationName:.+}/enabled", method = RequestMethod.PUT) DaemonTask<Halconfig, Void> setEnabled(@PathVariable String deploymentName, @PathVariable String notificationName, @ModelAttribute ValidationSettings validationSettings, @RequestBody boolean enabled) { return GenericEnableDisableRequest.builder(halconfigParser) .updater(e -> notificationService.setEnabled(deploymentName, notificationName, e)) .validator(() -> notificationService.validateNotification(deploymentName, notificationName)) .description("Edit " + notificationName + " settings") .build() .execute(validationSettings, enabled); }
@RequestMapping(value = "/", method = RequestMethod.GET) DaemonTask<Halconfig, Notifications> notifications(@PathVariable String deploymentName, @ModelAttribute ValidationSettings validationSettings) { return GenericGetRequest.<Notifications>builder() .getter( () -> notificationService.getNotifications(deploymentName)) .validator(() -> notificationService.validateAllNotifications(deploymentName)) .description("Get all notification settings") .build() .execute(validationSettings); }
@RequestMapping(value = "/{notificationName:.+}", method = RequestMethod.PUT) DaemonTask<Halconfig, Void> setNotification(@PathVariable String deploymentName, @PathVariable String notificationName, @ModelAttribute ValidationSettings validationSettings, @RequestBody Object rawNotification) { Notification notification = objectMapper.convertValue( rawNotification, Notifications.translateNotificationType(notificationName) ); return GenericUpdateRequest.<Notification>builder(halconfigParser) .stagePath(halconfigDirectoryStructure.getStagingPath(deploymentName)) .updater(n -> notificationService.setNotification(deploymentName, n)) .validator(() -> notificationService.validateNotification(deploymentName, notificationName)) .description("Edit the " + notificationName + " notification") .build() .execute(validationSettings, notification); } }
public void setEnabled(String deploymentName, String notificationName, boolean enabled) { Notification notification = getNotification(deploymentName, notificationName); notification.setEnabled(enabled); }