Search in sources :

Example 1 with HostInfo

use of models.datatable.HostDataTable.HostInfo in project coprhd-controller by CoprHD.

the class Hosts method listJson.

public static void listJson() {
    String tenantId = Models.currentAdminTenant();
    List<HostRestRep> hosts = HostUtils.getHosts(tenantId);
    Map<URI, String> clusterMap = ResourceUtils.mapNames(getViprClient().clusters().listByTenant(uri(tenantId)));
    Set<URI> dataCenterIds = HostUtils.getDataCenterIds(hosts);
    Map<URI, VcenterDataCenterRestRep> vcenterDataCenters = HostUtils.getVcenterDataCenters(dataCenterIds);
    List<HostInfo> hostInfos = Lists.newArrayList();
    for (HostRestRep host : hosts) {
        hostInfos.add(new HostInfo(host, clusterMap, vcenterDataCenters));
    }
    renderJSON(DataTablesSupport.createJSON(hostInfos, params));
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep) VcenterDataCenterRestRep(com.emc.storageos.model.host.vcenter.VcenterDataCenterRestRep) URI(java.net.URI) HostInfo(models.datatable.HostDataTable.HostInfo)

Example 2 with HostInfo

use of models.datatable.HostDataTable.HostInfo in project coprhd-controller by CoprHD.

the class Hosts method itemsJson.

public static void itemsJson(@As(",") String[] ids) {
    Map<URI, String> clusterMap = ResourceUtils.mapNames(getViprClient().clusters().listByTenant(uri(Models.currentAdminTenant())));
    List<HostInfo> results = Lists.newArrayList();
    if ((ids != null) && (ids.length > 0)) {
        for (String id : ids) {
            if (StringUtils.isBlank(id)) {
                continue;
            }
            HostRestRep host = HostUtils.getHost(uri(id));
            if (host != null) {
                Set<URI> dataCenterIds = HostUtils.getDataCenterIds(Lists.newArrayList(host));
                Map<URI, VcenterDataCenterRestRep> vcenterDataCenters = HostUtils.getVcenterDataCenters(dataCenterIds);
                results.add(new HostInfo(host, clusterMap, vcenterDataCenters));
            }
        }
    }
    renderJSON(results);
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep) VcenterDataCenterRestRep(com.emc.storageos.model.host.vcenter.VcenterDataCenterRestRep) URI(java.net.URI) HostInfo(models.datatable.HostDataTable.HostInfo)

Aggregations

HostRestRep (com.emc.storageos.model.host.HostRestRep)2 VcenterDataCenterRestRep (com.emc.storageos.model.host.vcenter.VcenterDataCenterRestRep)2 URI (java.net.URI)2 HostInfo (models.datatable.HostDataTable.HostInfo)2