use of com.sequenceiq.it.spark.ambari.model.Clusters 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;
}
Also used :
HostNameUtil(com.sequenceiq.it.util.HostNameUtil)
Set(java.util.Set)
Hosts(com.sequenceiq.it.spark.ambari.model.Hosts)
Clusters(com.sequenceiq.it.spark.ambari.model.Clusters)
Collectors(java.util.stream.Collectors)
ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode)
ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode)
JsonNodeFactory(com.fasterxml.jackson.databind.node.JsonNodeFactory)
Request(spark.Request)
Map(java.util.Map)
ITResponse(com.sequenceiq.it.spark.ITResponse)
Response(spark.Response)
CloudVmMetaDataStatus(com.sequenceiq.cloudbreak.cloud.model.CloudVmMetaDataStatus)
Hosts(com.sequenceiq.it.spark.ambari.model.Hosts)
ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode)
Clusters(com.sequenceiq.it.spark.ambari.model.Clusters)
ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode)