use of org.jclouds.rackspace.cloudloadbalancers.v1.domain.Node in project legacy-jclouds-examples by jclouds.
the class RemoveNodes method main.
/**
* To get a username and API key see http://www.jclouds.org/documentation/quickstart/rackspace/
*
* The first argument (args[0]) must be your username
* The second argument (args[1]) must be your API key
*/
public static void main(String[] args) {
RemoveNodes removeNodes = new RemoveNodes();
try {
removeNodes.init(args);
LoadBalancer loadBalancer = removeNodes.getLoadBalancer();
Set<Node> nodes = removeNodes.getNodes(loadBalancer);
removeNodes.removeNodesFromLoadBalancer(nodes, loadBalancer);
} catch (Exception e) {
e.printStackTrace();
} finally {
removeNodes.close();
}
}
use of org.jclouds.rackspace.cloudloadbalancers.v1.domain.Node in project legacy-jclouds-examples by jclouds.
the class UpdateNodes method main.
/**
* To get a username and API key see http://www.jclouds.org/documentation/quickstart/rackspace/
*
* The first argument (args[0]) must be your username
* The second argument (args[1]) must be your API key
*/
public static void main(String[] args) {
UpdateNodes updateNodes = new UpdateNodes();
try {
updateNodes.init(args);
LoadBalancer loadBalancer = updateNodes.getLoadBalancer();
Set<Node> nodes = updateNodes.getNodes(loadBalancer);
updateNodes.updateNodesInLoadBalancer(nodes, loadBalancer);
} catch (Exception e) {
e.printStackTrace();
} finally {
updateNodes.close();
}
}
use of org.jclouds.rackspace.cloudloadbalancers.v1.domain.Node in project legacy-jclouds-examples by jclouds.
the class CreateLoadBalancerWithNewServers method createNodeRequests.
/**
* AddNodes specify the nodes (Cloud Servers) that requests will be sent to by the Load Balancer.
*/
private Set<AddNode> createNodeRequests(Set<? extends NodeMetadata> nodes) {
Set<AddNode> addNodes = Sets.newHashSet();
for (NodeMetadata node : nodes) {
String privateAddress = node.getPrivateAddresses().iterator().next();
AddNode addNode = AddNode.builder().address(privateAddress).condition(Node.Condition.ENABLED).port(80).weight(20).build();
addNodes.add(addNode);
}
return addNodes;
}
Aggregations