@DELETE @Path("/kit/{name}") @Permission({ "kit", "delete" }) @ApiOperation(value = "Delete a kit", notes = "Delete an existing kit.") public CachedKit deleteKit(@PathParam("name") String name) throws NotFoundException { Optional<NucleusKitService> optSrv = NucleusAPI.getKitService(); if (!optSrv.isPresent()) { throw new InternalServerErrorException("Nuclues kit service not available"); } NucleusKitService srv = optSrv.get(); return WebAPI.runOnMain(() -> { Optional<Kit> optKit = srv.getKit(name); if (!optKit.isPresent()) { throw new NotFoundException("Kit with name " + name + " not found"); } srv.removeKit(name); return new CachedKit(optKit.get()); }); }