Search in sources :

Example 1 with Clusters

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)

Aggregations

ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 JsonNodeFactory (com.fasterxml.jackson.databind.node.JsonNodeFactory)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 CloudVmMetaDataStatus (com.sequenceiq.cloudbreak.cloud.model.CloudVmMetaDataStatus)1 ITResponse (com.sequenceiq.it.spark.ITResponse)1 Clusters (com.sequenceiq.it.spark.ambari.model.Clusters)1 Hosts (com.sequenceiq.it.spark.ambari.model.Hosts)1 HostNameUtil (com.sequenceiq.it.util.HostNameUtil)1 Map (java.util.Map)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Request (spark.Request)1 Response (spark.Response)1