示例#1
0
 /**
  * Edits a cluster
  *
  * @param name the cluster's name
  */
 @RequestMapping(value = "/clusters/{name}", method = RequestMethod.PUT)
 public Cluster updateCluster(
     @PathVariable("name") final String name,
     @RequestParam(value = "name", required = true) final String newName) {
   Cluster cluster = clusterRepo.findByName(name).orElseThrow(NotFoundException::new);
   cluster.setName(newName);
   clusterRepo.save(cluster);
   return cluster;
 }
示例#2
0
 /**
  * Adds a new cluster
  *
  * @param name the cluster's name
  */
 @RequestMapping(value = "/clusters", method = RequestMethod.POST)
 public Cluster addCluster(
     @RequestParam(value = "name", required = true) final String name,
     @RequestParam(value = "vagrant", required = true) final String provider) {
   Cluster cluster = new Cluster();
   cluster.setName(name);
   cluster.setProvider(provider);
   clusterRepo.save(cluster);
   return cluster;
 }