use of com.emc.storageos.model.host.cluster.ClusterRestRep in project coprhd-controller by CoprHD.
the class HostClusters method availableHostJson.
public static void availableHostJson(String id) {
final URI clusterId = uri(id);
ClusterRestRep cluster = ClusterUtils.getCluster(clusterId);
List<HostRestRep> hosts = null;
DefaultResourceFilter<HostRestRep> defaultHostResourceFilter = new DefaultResourceFilter<HostRestRep>() {
@Override
public boolean accept(HostRestRep hostRestRep) {
return hostRestRep.getCluster() == null || !hostRestRep.getCluster().getId().equals(clusterId);
}
};
// If we have existing hosts in the cluster, limit to that host type
List<HostRestRep> existingHosts = ClusterUtils.getHosts(uri(id));
if (!existingHosts.isEmpty()) {
FilterChain<HostRestRep> hostTypeFilter = new FilterChain<HostRestRep>(new HostTypeFilter(existingHosts.get(0).getType()));
hosts = getViprClient().hosts().getByTenant(cluster.getTenant().getId(), hostTypeFilter.and(defaultHostResourceFilter));
} else {
hosts = getViprClient().hosts().getByTenant(cluster.getTenant().getId(), defaultHostResourceFilter);
}
renderJSON(DataTablesSupport.createJSON(hosts, params));
}
use of com.emc.storageos.model.host.cluster.ClusterRestRep in project coprhd-controller by CoprHD.
the class HostClusters method editHosts.
@FlashException("list")
public static void editHosts(String id) {
ClusterRestRep cluster = ClusterUtils.getCluster(uri(id));
if (cluster != null) {
SimpleHostDataTable dataTable = new SimpleHostDataTable();
render(dataTable, cluster);
} else {
flash.error(MessagesUtils.get(UNKNOWN, id));
list();
}
}
use of com.emc.storageos.model.host.cluster.ClusterRestRep in project coprhd-controller by CoprHD.
the class HostClusters method itemDetails.
public static void itemDetails(String id) {
ClusterRestRep cluster = ClusterUtils.getCluster(uri(id));
if (cluster == null) {
error(MessagesUtils.get(UNKNOWN, id));
}
ProjectRestRep project = ProjectUtils.getProject(ResourceUtils.id(cluster.getProject()));
List<HostRestRep> hosts = ClusterUtils.getHosts(uri(id));
VcenterDataCenterRestRep dataCenter = VCenterUtils.getDataCenter(ResourceUtils.id(cluster.getVcenterDataCenter()));
VcenterRestRep vcenter = VCenterUtils.getVCenter(dataCenter);
render(cluster, project, hosts, dataCenter, vcenter);
}
use of com.emc.storageos.model.host.cluster.ClusterRestRep in project coprhd-controller by CoprHD.
the class HostClusters method edit.
@FlashException("list")
public static void edit(String id) {
ClusterRestRep cluster = ClusterUtils.getCluster(uri(id));
if (cluster != null) {
HostClusterForm hostCluster = new HostClusterForm(cluster);
render(hostCluster);
} else {
flash.error(MessagesUtils.get(UNKNOWN, id));
list();
}
}
use of com.emc.storageos.model.host.cluster.ClusterRestRep in project coprhd-controller by CoprHD.
the class Hosts method itemDetails.
public static void itemDetails(String id) {
HostRestRep host = HostUtils.getHost(uri(id));
ClusterRestRep cluster = ClusterUtils.getCluster(ResourceUtils.id(host.getCluster()));
VcenterDataCenterRestRep dataCenter = VCenterUtils.getDataCenter(ResourceUtils.id(host.getvCenterDataCenter()));
VcenterRestRep vcenter = VCenterUtils.getVCenter(dataCenter);
render(host, cluster, dataCenter, vcenter);
}
Aggregations