@RequestMapping(value = "/resourcepool/{rpName}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) public void deleteResourcePool(@PathVariable("rpName") final String rpName) { if (rpName == null || rpName.isEmpty()) { throw BddException.INVALID_PARAMETER("resource pool name", rpName); } vcRpMgr.deleteResourcePool(rpName); }
@RequestMapping( value = "/resourcepools", method = RequestMethod.GET, produces = "application/json") @ResponseBody public List<ResourcePoolRead> getResourcePools() { return vcRpMgr.getAllResourcePoolForRest(); }
@RequestMapping( value = "/resourcepool/{rpName}", method = RequestMethod.GET, produces = "application/json") @ResponseBody public ResourcePoolRead getResourcePool(@PathVariable("rpName") final String rpName) { if (rpName == null || rpName.isEmpty()) { throw BddException.INVALID_PARAMETER("resource pool name", rpName); } ResourcePoolRead read = vcRpMgr.getResourcePoolForRest(rpName); if (read == null) { throw BddException.NOT_FOUND("resource pool", rpName); } return read; }
// cloud provider API @RequestMapping( value = "/resourcepools", method = RequestMethod.POST, consumes = "application/json") @ResponseStatus(HttpStatus.OK) public void addResourcePool(@RequestBody ResourcePoolAdd rpSpec) { if (rpSpec == null) { throw BddException.INVALID_PARAMETER("rpSpec", null); } if (rpSpec.getName() == null || rpSpec.getName().isEmpty()) { throw BddException.INVALID_PARAMETER("resource pool name", rpSpec.getName()); } if (rpSpec.getVcClusterName() == null || rpSpec.getVcClusterName().isEmpty()) { throw BddException.INVALID_PARAMETER("vc cluster name", rpSpec.getVcClusterName()); } if (rpSpec.getResourcePoolName() == null || rpSpec.getResourcePoolName().isEmpty()) { throw BddException.INVALID_PARAMETER("vc resource pool name", rpSpec.getResourcePoolName()); } vcRpMgr.addResourcePool( rpSpec.getName(), rpSpec.getVcClusterName(), rpSpec.getResourcePoolName()); }