use of com.sequenceiq.it.spark.ambari.model.Hosts in project cloudbreak by hortonworks.
the class AmbariClusterResponse method handle.
@Override
public Object handle(Request request, Response response) {
response.type("text/plain");
ObjectNode rootNode = JsonNodeFactory.instance.objectNode();
Set<String> hostNames = instanceMap.values().stream().map(cv -> HostNameUtil.generateHostNameByIp(cv.getMetaData().getPrivateIp())).collect(Collectors.toSet());
rootNode.putObject("hosts").set("Hosts", getObjectMapper().valueToTree(new Hosts(hostNames, "HEALTHY")));
ArrayNode items = rootNode.putArray("items");
items.addObject().set("Clusters", getObjectMapper().valueToTree(new Clusters(clusterName)));
return rootNode;
}
use of com.sequenceiq.it.spark.ambari.model.Hosts in project cloudbreak by hortonworks.
the class AmbariHostsResponse method handle.
@Override
public Object handle(Request request, Response response) {
response.type("text/plain");
List<Map<String, ?>> itemList = new ArrayList<>();
for (Entry<String, CloudVmMetaDataStatus> stringCloudVmMetaDataStatusEntry : instanceMap.entrySet()) {
CloudVmMetaDataStatus status = stringCloudVmMetaDataStatusEntry.getValue();
if (InstanceStatus.STARTED == status.getCloudVmInstanceStatus().getStatus()) {
Hosts hosts = new Hosts(Collections.singletonList(HostNameUtil.generateHostNameByIp(status.getMetaData().getPrivateIp())), "HEALTHY");
itemList.add(Collections.singletonMap("Hosts", hosts));
}
}
return Collections.singletonMap("items", itemList);
}
Aggregations