code: public String checkName(String name) throws Failure {
          if(name==null)
              throw new Failure("Query parameter 'name' is required");
  
          name = name.trim();
          Jenkins.checkGoodName(name);
  
          if(Jenkins.getInstance().getNode(name)!=null)
              throw new Failure(Messages.ComputerSet_SlaveAlreadyExists(name));
  
          // looks good
          return name;
      }
docs: Makes sure that the given name is good as an agent name.
  @return trimmed name if valid; throws ParseException if not