private static Map<String, String> mapClusterMapping(RegistrationClusterMappings model) { return model.getRegistrationClusterMappings() .stream() .collect(Collectors.toMap( registrationMap -> registrationMap.isSetFrom() ? registrationMap.getFrom().getName() : null, registrationMap -> registrationMap.isSetTo() ? ClusterMapper.map(registrationMap.getTo(), null).getName() : null)); }
protected Cluster getCluster(Vm vm) { if (namedCluster(vm)) { return isFiltered() ? lookupClusterByName(vm.getCluster().getName()) : getEntity(Cluster.class, QueryType.GetClusterByName, new NameQueryParameters(vm.getCluster().getName()), "Cluster: name=" + vm.getCluster().getName()); } return lookupCluster(asGuid(vm.getCluster().getId())); }
@Override public GlusterVolumes list() { String constraint = QueryHelper.getConstraint(httpHeaders, uriInfo, "cluster = " + parent.get().getName(), GlusterVolume.class); return mapCollection(getBackendCollection(SearchType.GlusterVolume, constraint)); }
protected Cluster getCluster(VmPool pool) { if (namedCluster(pool)) { return getEntity(Cluster.class, QueryType.GetClusterByName, new NameQueryParameters(pool.getCluster().getName()), "Cluster: name=" + pool.getCluster().getName()); } else { return getEntity(Cluster.class, QueryType.GetClusterById, new IdQueryParameters(asGuid(pool.getCluster().getId())), "Cluster: id=" + pool.getCluster().getId()); } }
protected Guid getClusterId(Action action) { if (action.getCluster().isSetId()) { return asGuid(action.getCluster().getId()); } else { return lookupClusterIdByName(action.getCluster().getName()); } }
protected Guid getClusterId(Action action) { if (action.getCluster().isSetId()) { return asGuid(action.getCluster().getId()); } else { Cluster cluster = lookupClusterByName(action.getCluster().getName()); return cluster != null ? cluster.getId() : null; } }
protected Guid lookupClusterId(Host host) { return host.getCluster().isSetId() ? asGuid(host.getCluster().getId()) : lookupClusterByName(host.getCluster().getName()).getId(); }
private Guid getClusterId(Host host) { if (host.isSetCluster()) { org.ovirt.engine.api.model.Cluster cluster = host.getCluster(); if (cluster.isSetId()) { return asGuid(cluster.getId()); } if (cluster.isSetName()) { return getClusterIdByName(cluster.getName()); } } return getClusterIdByName(DEFAULT_NAME); }
private Host setCluster(Host host, org.ovirt.engine.api.model.Cluster cluster) { if (cluster.isSetId()) { host.setCluster(cluster); } else { host.setCluster(new org.ovirt.engine.api.model.Cluster()); host.getCluster().setId(lookupClusterByName(cluster.getName()).getId().toString()); } return host; }
public static void validateAdd(Cluster cluster) { if (cluster == null) { throw new ValidationException("Parameter 'cluster' is mandatory but was not provided."); } if (cluster.getName()==null) { throw new ValidationException("Parameter 'cluster.name' is mandatory but was not provided."); } if ( (cluster.getDataCenter()==null || cluster.getDataCenter().getId()==null) && (cluster.getDataCenter()==null || cluster.getDataCenter().getName()==null) ) { throw new ValidationException("Parameters 'cluster.data_center.id' or 'cluster.data_center.name' are mandatory but both were not provided."); } }
private Guid getClusterId(ExternalVmImport vmImport) { if (vmImport.getCluster().isSetId()) { return asGuid(vmImport.getCluster().getId()); } else /* if (vmImport.getCluster().isSetName()) */ { String clusterName = vmImport.getCluster().getName(); Cluster cluster = getEntity(Cluster.class, QueryType.GetClusterByName, new NameQueryParameters(clusterName), clusterName, true); return cluster.getId(); } }
public static Method getAddSignature(Host host) throws NoSuchMethodException, SecurityException { if (host == null) { throw new ValidationException("Parameter 'host' is mandatory but was not provided."); } if (host.getAddress()==null) { throw new ValidationException("Parameter 'host.address' is mandatory but was not provided."); } if (host.getName()==null) { throw new ValidationException("Parameter 'host.name' is mandatory but was not provided."); } if ( (host.getCluster()==null || host.getCluster().getId()==null) && (host.getCluster()==null || host.getCluster().getName()==null) ) { throw new ValidationException("Parameters 'host.cluster.id' or 'host.cluster.name' are mandatory but both were not provided."); } /** * using_root_password */ if (host!=null && host.getRootPassword()!=null ) { return HostsResource.class.getMethod("addUsingRootPassword", Host.class); } throw new ValidationException("No matching signature found, make sure that mandatory attributes are provided."); }
&& (( vm.getCluster()!=null && vm.getCluster().getId()!=null) || ( vm.getCluster()!=null && vm.getCluster().getName()!=null)) && (( vm.getTemplate()!=null && vm.getTemplate().getId()!=null) || ( vm.getTemplate()!=null && vm.getTemplate().getName()!=null)) ) { && (( vm.getCluster()!=null && vm.getCluster().getId()!=null) || ( vm.getCluster()!=null && vm.getCluster().getName()!=null)) && (( vm.getTemplate()!=null && vm.getTemplate().getId()!=null) || ( vm.getTemplate()!=null && vm.getTemplate().getName()!=null)) && vm.getSnapshots()!=null && vm.getSnapshots().getSnapshots()!=null && vm.getSnapshots().getSnapshots().size() > 0 && vm.getSnapshots().getSnapshots().get(0).getId()!=null
public static void validateAdd(VmPool pool) { if (pool == null) { throw new ValidationException("Parameter 'pool' is mandatory but was not provided."); } if (pool.getName()==null) { throw new ValidationException("Parameter 'pool.name' is mandatory but was not provided."); } if ( (pool.getCluster()==null || pool.getCluster().getId()==null) && (pool.getCluster()==null || pool.getCluster().getName()==null) ) { throw new ValidationException("Parameters 'pool.cluster.id' or 'pool.cluster.name' are mandatory but both were not provided."); } if ( (pool.getTemplate()==null || pool.getTemplate().getId()==null) && (pool.getTemplate()==null || pool.getTemplate().getName()==null) ) { throw new ValidationException("Parameters 'pool.template.id' or 'pool.template.name' are mandatory but both were not provided."); } }
&& template.getInitialization()!=null && template.getInitialization().getConfiguration()!=null && template.getInitialization().getConfiguration().getType()!=null && template.getInitialization()!=null && template.getInitialization().getConfiguration()!=null && template.getInitialization().getConfiguration().getData()!=null && (( template.getCluster()!=null && template.getCluster().getId()!=null) || ( template.getCluster()!=null && template.getCluster().getName()!=null)) ) { return TemplatesResource.class.getMethod("addFromConfiguration", Template.class);
entity.setClusterId(GuidUtils.asGuid(model.getCluster().getId())); } else if (model.getCluster().isSetName()) { entity.setClusterName(model.getCluster().getName());
entity.setName(model.getName());
@Override protected void verify(org.ovirt.engine.api.model.Cluster model, org.ovirt.engine.api.model.Cluster transform) { assertNotNull(transform); assertEquals(model.getName(), transform.getName()); assertEquals(model.getId(), transform.getId()); assertEquals(model.getDescription(), transform.getDescription());