private static VmPool lookupClusterId(PowerShellPool shellPool, PowerShellParser parser, VmPool pool) { StringBuilder buf = new StringBuilder(); buf.append("select-cluster -searchtext "); buf.append(PowerShellUtils.escape("name = " + pool.getCluster().getName())); Cluster cluster = new Cluster(); cluster.setId(PowerShellClusterResource.runAndParseSingle(shellPool, parser, buf.toString()).getId()); pool.setCluster(cluster); return pool; }
if (pool.getCluster().isSetId()) { clusterArg = PowerShellUtils.escape(pool.getCluster().getId()); } else { buf.append("$c = select-cluster -searchtext "); buf.append(PowerShellUtils.escape("name=" + pool.getCluster().getName())); buf.append(";"); clusterArg = "$c.ClusterId";
public void updateModel(VmPool pool) { // update writable fields only if (pool.isSetName()) { getModel().setName(pool.getName()); } if (pool.isSetDescription()) { getModel().setDescription(pool.getDescription()); } if (pool.isSetCluster() && pool.getCluster().isSetId()) { getModel().setCluster(new Cluster()); getModel().getCluster().setId(pool.getCluster().getId()); } if (pool.isSetTemplate() && pool.getTemplate().isSetId()) { getModel().setTemplate(new Template()); getModel().getTemplate().setId(pool.getTemplate().getId()); } }