Package org.jclouds.rackspace.cloudloadbalancers.v1.features

Examples of org.jclouds.rackspace.cloudloadbalancers.v1.features.NodeApi


   }

   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);
      }

      // Wait for the Load Balancer to become Active before moving on
      // If you want to know what's happening during the polling, enable logging. See
View Full Code Here


     
      throw new RuntimeException(Constants.NAME + " not found. Run a CreateLoadBalancer* example first.");
   }
  
   private Set<Node> getNodes(LoadBalancer loadBalancer) {
      NodeApi nodeApi = clb.getNodeApiForZoneAndLoadBalancer(Constants.ZONE, loadBalancer.getId());
      Set<Node> nodes = Sets.newHashSet();
     
      for (Node node: nodeApi.list().concat()) {
         if (node.getAddress().startsWith("10.180.1")) {
            nodes.add(node);
         }
      }
     
View Full Code Here

   }

   private void removeNodesFromLoadBalancer(Set<Node> nodes, LoadBalancer loadBalancer) throws TimeoutException {
      System.out.println("Remove Nodes");

      NodeApi nodeApi = clb.getNodeApiForZoneAndLoadBalancer(Constants.ZONE, loadBalancer.getId());
      Iterable<Integer> nodeIds = Iterables.transform(nodes, new NodeToInteger());
     
      nodeApi.remove(nodeIds);

      // Wait for the Load Balancer to become Active before moving on
      // If you want to know what's happening during the polling, enable logging. See
      // /jclouds-example/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java
      if (!LoadBalancerPredicates.awaitAvailable(lbApi).apply(loadBalancer)) {
View Full Code Here

      }

      @Override
      protected Function<Object, IterableWithMarker<Node>> markerToNextForArg0(Optional<Object> arg0) {
         String zone = arg0.isPresent() ? arg0.get().toString() : null;
         final NodeApi nodeApi = api.getNodeApiForZoneAndLoadBalancer(zone, lbId);
        
         return new Function<Object, IterableWithMarker<Node>>() {

            @Override
            public IterableWithMarker<Node> apply(Object input) {
               IterableWithMarker<Node> list = nodeApi.list(marker(input.toString()));
               return list;
            }

            @Override
            public String toString() {
View Full Code Here

      throw new RuntimeException(NAME + " not found. Run a CreateLoadBalancer* example first.");
   }

   private Set<Node> getNodes(LoadBalancer loadBalancer) {
      NodeApi nodeApi = clbApi.getNodeApiForZoneAndLoadBalancer(ZONE, loadBalancer.getId());
      Set<Node> nodes = Sets.newHashSet();

      for (Node node: nodeApi.list().concat()) {
         if (node.getCondition().equals(DISABLED)) {
            nodes.add(node);
         }
      }

View Full Code Here

   }

   private void updateNodesInLoadBalancer(Set<Node> nodes, LoadBalancer loadBalancer) throws TimeoutException {
      System.out.format("Update Nodes%n");

      NodeApi nodeApi = clbApi.getNodeApiForZoneAndLoadBalancer(ZONE, loadBalancer.getId());
      UpdateNode updateNode = UpdateNode.builder()
            .condition(ENABLED)
            .weight(20)
            .build();

      for (Node node: nodes) {
         nodeApi.update(node.getId(), updateNode);
         System.out.format("  %s %s%n", node.getId(), updateNode);
      }

      // Wait for the Load Balancer to become Active before moving on
      // If you want to know what's happening during the polling, enable logging. See
View Full Code Here

      throw new RuntimeException(NAME + " not found. Run a CreateLoadBalancer* example first.");
   }

   private Set<Node> getNodes(LoadBalancer loadBalancer) {
      NodeApi nodeApi = clbApi.getNodeApiForZoneAndLoadBalancer(ZONE, loadBalancer.getId());
      Set<Node> nodes = Sets.newHashSet();

      for (Node node: nodeApi.list().concat()) {
         if (node.getAddress().startsWith("10.180.1")) {
            nodes.add(node);
         }
      }

View Full Code Here

   }

   private void removeNodesFromLoadBalancer(Set<Node> nodes, LoadBalancer loadBalancer) throws TimeoutException {
      System.out.format("Remove Nodes%n");

      NodeApi nodeApi = clbApi.getNodeApiForZoneAndLoadBalancer(ZONE, loadBalancer.getId());
      Iterable<Integer> nodeIds = Iterables.transform(nodes, new NodeToId());

      nodeApi.remove(nodeIds);

      // Wait for the Load Balancer to become Active before moving on
      // If you want to know what's happening during the polling, enable logging. See
      // /jclouds-example/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java
      if (!LoadBalancerPredicates.awaitAvailable(lbApi).apply(loadBalancer)) {
View Full Code Here

    * CreateLoadBalancerWithNewServers.
    */
   private void addNodesToLoadBalancer(Set<AddNode> addNodes, LoadBalancer loadBalancer) throws TimeoutException {
      System.out.format("Add Nodes%n");

      NodeApi nodeApi = clbApi.getNodeApiForZoneAndLoadBalancer(ZONE, loadBalancer.getId());
      Set<Node> nodes = nodeApi.add(addNodes);

      // Wait for the Load Balancer to become Active before moving on
      // If you want to know what's happening during the polling, enable logging. See
      // /jclouds-example/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java
      if (!LoadBalancerPredicates.awaitAvailable(lbApi).apply(loadBalancer)) {
View Full Code Here

      }

      @Override
      protected Function<Object, IterableWithMarker<Node>> markerToNextForArg0(Optional<Object> arg0) {
         String region = arg0.get().toString();
         final NodeApi nodeApi = api.getNodeApi(region, lbId);

         return new Function<Object, IterableWithMarker<Node>>() {

            @Override
            public IterableWithMarker<Node> apply(Object input) {
               PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
               return nodeApi.list(paginationOptions);
            }

            @Override
            public String toString() {
               return "list()";
View Full Code Here

TOP

Related Classes of org.jclouds.rackspace.cloudloadbalancers.v1.features.NodeApi

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.