Search in sources :

Example 1 with KubernetesApiProvider.convertToString

use of com.hazelcast.kubernetes.KubernetesApiProvider.convertToString in project hazelcast by hazelcast.

the class KubernetesApiEndpointProvider method extractNodes.

private Map<EndpointAddress, String> extractNodes(JsonValue addressesJson, List<Integer> ports) {
    Map<EndpointAddress, String> result = new HashMap<>();
    for (JsonValue address : toJsonArray(addressesJson)) {
        String ip = address.asObject().get("ip").asString();
        String nodeName = KubernetesApiProvider.convertToString(address.asObject().get("nodeName"));
        for (Integer port : ports) {
            result.put(new EndpointAddress(ip, port), nodeName);
        }
    }
    return result;
}
Also used : HashMap(java.util.HashMap) JsonValue(com.hazelcast.internal.json.JsonValue) KubernetesApiProvider.convertToString(com.hazelcast.kubernetes.KubernetesApiProvider.convertToString) EndpointAddress(com.hazelcast.kubernetes.KubernetesClient.EndpointAddress)

Aggregations

JsonValue (com.hazelcast.internal.json.JsonValue)1 KubernetesApiProvider.convertToString (com.hazelcast.kubernetes.KubernetesApiProvider.convertToString)1 EndpointAddress (com.hazelcast.kubernetes.KubernetesClient.EndpointAddress)1 HashMap (java.util.HashMap)1