Search in sources :

Example 1 with UpdateNode

use of org.jclouds.rackspace.cloudloadbalancers.v1.domain.UpdateNode in project legacy-jclouds-examples by jclouds.

the class UpdateNodes method updateNodesInLoadBalancer.

private void updateNodesInLoadBalancer(Set<Node> nodes, LoadBalancer loadBalancer) throws TimeoutException {
    System.out.println("Update Nodes");
    NodeApi nodeApi = clb.getNodeApiForZoneAndLoadBalancer(Constants.ZONE, loadBalancer.getId());
    UpdateNode updateNode = UpdateNode.builder().condition(Node.Condition.ENABLED).weight(20).build();
    for (Node node : nodes) {
        nodeApi.update(node.getId(), updateNode);
        System.out.println("  " + node.getId() + " " + updateNode);
    }
    // /jclouds-example/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java
    if (!LoadBalancerPredicates.awaitAvailable(lbApi).apply(loadBalancer)) {
        throw new TimeoutException("Timeout on loadBalancer: " + loadBalancer);
    }
}
Also used : UpdateNode(org.jclouds.rackspace.cloudloadbalancers.v1.domain.UpdateNode) Node(org.jclouds.rackspace.cloudloadbalancers.v1.domain.Node) UpdateNode(org.jclouds.rackspace.cloudloadbalancers.v1.domain.UpdateNode) NodeApi(org.jclouds.rackspace.cloudloadbalancers.v1.features.NodeApi) TimeoutException(java.util.concurrent.TimeoutException)

Aggregations

TimeoutException (java.util.concurrent.TimeoutException)1 Node (org.jclouds.rackspace.cloudloadbalancers.v1.domain.Node)1 UpdateNode (org.jclouds.rackspace.cloudloadbalancers.v1.domain.UpdateNode)1 NodeApi (org.jclouds.rackspace.cloudloadbalancers.v1.features.NodeApi)1