Skip to content
This repository has been archived by the owner on Mar 25, 2018. It is now read-only.

Commit

Permalink
Examples for Rackspace Cloud Load Balancers. Doc clean up. Updates fo…
Browse files Browse the repository at this point in the history
…r 1.6.0.
  • Loading branch information
Everett Toews committed Apr 27, 2013
1 parent 1492f2f commit 7589ace
Show file tree
Hide file tree
Showing 34 changed files with 1,362 additions and 127 deletions.
14 changes: 10 additions & 4 deletions rackspace/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Rackspace Examples
Example code that uses jclouds to perform common tasks on the Rackspace open cloud. The class names are self explanatory and the code is well commented for you to follow along.
Example code that uses jclouds to perform common tasks on the Rackspace Cloud. The class names are self explanatory and the code is well commented for you to follow along.

## Requirements

1. Username and API key for the Rackspace open cloud - See the [Getting Started guide](http://www.jclouds.org/documentation/quickstart/rackspace/).
1. Username and API key for the Rackspace Cloud - See the [Getting Started guide](http://www.jclouds.org/documentation/quickstart/rackspace/).
1. Java Development Kit (JDK) version 6 or later - [Download](http://www.oracle.com/technetwork/java/javase/downloads/index.html).
1. Apache Ant - [Download](http://ant.apache.org/bindownload.cgi).
1. Git - [Download](http://git-scm.com/downloads) or you can just [download this repository as a zip or tar.gz](https://github.com/jclouds/jclouds-examples/downloads).
Expand All @@ -30,7 +30,7 @@ build.xml maven-ant-tasks.jar README.md images/ lib/ src/
Start with the [rackspace package](https://github.com/jclouds/jclouds-examples/tree/master/rackspace/src/main/java/org/jclouds/examples/rackspace). There you will find general purpose examples of things that are useful across all services.

* [Logging.java](https://github.com/jclouds/jclouds-examples/blob/master/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java) - How to enable and configure logging.
* [Authentication.java](https://github.com/jclouds/jclouds-examples/blob/master/rackspace/src/main/java/org/jclouds/examples/rackspace/Authentication.java) - How you can use your credentials to authenticate with the Rackspace open cloud.
* [Authentication.java](https://github.com/jclouds/jclouds-examples/blob/master/rackspace/src/main/java/org/jclouds/examples/rackspace/Authentication.java) - How you can use your credentials to authenticate with the Rackspace Cloud.

The [cloudfiles package](https://github.com/jclouds/jclouds-examples/tree/master/rackspace/src/main/java/org/jclouds/examples/rackspace/cloudfiles) demonstrates how to accomplish common tasks for putting files in and getting files from the cloud.

Expand All @@ -47,6 +47,12 @@ The [cloudblockstorage package](https://github.com/jclouds/jclouds-examples/tree
* [CreateVolumeAndAttach.java](https://github.com/jclouds/jclouds-examples/blob/master/rackspace/src/main/java/org/jclouds/examples/rackspace/cloudblockstorage/CreateVolumeAndAttach.java) - An end to end example of creating a volume, attaching it to a server, putting a filesystem on it, and mounting it for use to store persistent data.
* Other examples of creating, manipulating, listing, and deleting volumes and snapshots.

The [cloudloadbalancers package](https://github.com/jclouds/jclouds-examples/tree/master/rackspace/src/main/java/org/jclouds/examples/rackspace/cloudloadbalancers) demonstrates how to accomplish common tasks for working with load balancers in the cloud.

* [CreateLoadBalancerWithExistingServers.java](https://github.com/jclouds/jclouds-examples/blob/master/rackspace/src/main/java/org/jclouds/examples/rackspace/cloudloadbalancers/CreateLoadBalancerWithExistingServers.java) - An end to end example of creating a load balancer and adding existing servers (nodes) to it.
* [CreateLoadBalancerWithNewServers.java](https://github.com/jclouds/jclouds-examples/blob/master/rackspace/src/main/java/org/jclouds/examples/rackspace/cloudloadbalancers/CreateLoadBalancerWithNewServers.java) - An end to end example of creating a load balancer and adding new servers (nodes) to it.
* Other examples of creating, manipulating, listing, and deleting load balancers and nodes.


## Command Line
To run these examples from the command line use these commands:
Expand Down Expand Up @@ -108,4 +114,4 @@ Your feedback is appreciated! If you have specific issues with Rackspace support

For general feedback and support requests, send an email to:

[[email protected]](mailto:[email protected])
[[email protected]](mailto:[email protected])
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

/**
* To authenticate using jclouds you need to provide your credentials to a Context as in the init() method below.
* Authentication occurs on your first actual interaction with the Rackspace open cloud (i.e. the very first time
* Authentication occurs on your first actual interaction with the Rackspace Cloud (i.e. the very first time
* you call a method that needs to talk to the cloud). Once you are authenticated you receive a token that is
* cached and you won't reauthenticate for subsequent calls. If your token expires before the JVM quits, jclouds
* will automatically handle reauthentication and get a new token for you.
Expand Down Expand Up @@ -71,8 +71,8 @@ public static void main(String[] args) {
}

private void init(String[] args) {
// The provider configures jclouds to use the Rackspace open cloud (US)
// to use the Rackspace open cloud (UK) set the provider to "rackspace-cloudservers-uk"
// The provider configures jclouds To use the Rackspace Cloud (US)
// To use the Rackspace Cloud (UK) set the provider to "rackspace-cloudservers-uk"
String provider = "rackspace-cloudservers-us";

String username = args[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ public static void main(String[] args) {
}

private void init(String[] args) {
// The provider configures jclouds to use the Rackspace open cloud (US)
// to use the Rackspace open cloud (UK) set the provider to "rackspace-cloudservers-uk"
// The provider configures jclouds To use the Rackspace Cloud (US)
// To use the Rackspace Cloud (UK) set the provider to "rackspace-cloudservers-uk"
String provider = "rackspace-cloudservers-us";

String username = args[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,18 @@
import org.jclouds.examples.rackspace.cloudblockstorage.ListVolumes;
import org.jclouds.examples.rackspace.cloudfiles.CloudFilesPublish;
import org.jclouds.examples.rackspace.cloudfiles.CreateContainer;
import org.jclouds.examples.rackspace.cloudfiles.CreateObjects;
import org.jclouds.examples.rackspace.cloudfiles.DeleteObjectsAndContainer;
import org.jclouds.examples.rackspace.cloudfiles.ListContainers;
import org.jclouds.examples.rackspace.cloudfiles.ListObjects;
import org.jclouds.examples.rackspace.cloudfiles.UploadObjects;
import org.jclouds.examples.rackspace.cloudloadbalancers.AddNodes;
import org.jclouds.examples.rackspace.cloudloadbalancers.CreateLoadBalancerWithExistingServers;
import org.jclouds.examples.rackspace.cloudloadbalancers.CreateLoadBalancerWithNewServers;
import org.jclouds.examples.rackspace.cloudloadbalancers.DeleteLoadBalancers;
import org.jclouds.examples.rackspace.cloudloadbalancers.ListLoadBalancers;
import org.jclouds.examples.rackspace.cloudloadbalancers.RemoveNodes;
import org.jclouds.examples.rackspace.cloudloadbalancers.UpdateLoadBalancers;
import org.jclouds.examples.rackspace.cloudloadbalancers.UpdateNodes;
import org.jclouds.examples.rackspace.cloudservers.CloudServersPublish;
import org.jclouds.examples.rackspace.cloudservers.CreateServer;
import org.jclouds.examples.rackspace.cloudservers.DeleteServer;
Expand Down Expand Up @@ -71,7 +79,7 @@ private void smokeTest(String[] args) {
CloudFilesPublish.main(args);
CreateContainer.main(args);
ListContainers.main(args);
CreateObjects.main(args);
UploadObjects.main(args);
ListObjects.main(args);
DeleteObjectsAndContainer.main(args);

Expand All @@ -85,5 +93,15 @@ private void smokeTest(String[] args) {
DeleteSnapshot.main(args);
DeleteVolume.main(args);
DeleteServer.main(args);

CreateLoadBalancerWithExistingServers.main(args);
UpdateLoadBalancers.main(args);
ListLoadBalancers.main(args);
AddNodes.main(args);
UpdateNodes.main(args);
RemoveNodes.main(args);
CreateLoadBalancerWithNewServers.main(args);
DeleteServer.main(args);
DeleteLoadBalancers.main(args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ public static void main(String[] args) {
}

private void init(String[] args) {
// The provider configures jclouds to use the Rackspace open cloud (US)
// to use the Rackspace open cloud (UK) set the provider to "rackspace-cloudblockstorage-uk"
// The provider configures jclouds To use the Rackspace Cloud (US)
// To use the Rackspace Cloud (UK) set the provider to "rackspace-cloudblockstorage-uk"
String provider = "rackspace-cloudblockstorage-us";

String username = args[0];
Expand Down Expand Up @@ -107,7 +107,7 @@ private void createSnapshot(Volume volume) throws TimeoutException {

// Wait for the snapshot to become Available before moving on
// If you want to know what's happening during the polling, enable logging. See
// /jclouds-exmaple/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java
// /jclouds-example/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java
if (!SnapshotPredicates.awaitAvailable(snapshotApi).apply(snapshot)) {
throw new TimeoutException("Timeout on volume: " + volume);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ public static void main(String[] args) {
}

private void init(String[] args) {
// The provider configures jclouds to use the Rackspace open cloud (US)
// to use the Rackspace open cloud (UK) set the provider to "rackspace-cloudservers-uk"
// The provider configures jclouds To use the Rackspace Cloud (US)
// To use the Rackspace Cloud (UK) set the provider to "rackspace-cloudservers-uk"
String provider = "rackspace-cloudservers-us";

String username = args[0];
Expand Down Expand Up @@ -155,12 +155,12 @@ private Volume createVolume() throws TimeoutException {

System.out.println("Create Volume");

// 100 GB is the minimum volume size on the Rackspace open cloud
// 100 GB is the minimum volume size on the Rackspace Cloud
Volume volume = volumeApi.create(100, options);

// Wait for the volume to become Available before moving on
// If you want to know what's happening during the polling, enable logging. See
// /jclouds-exmaple/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java
// /jclouds-example/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java
if (!VolumePredicates.awaitAvailable(volumeApi).apply(volume)) {
throw new TimeoutException("Timeout on volume: " + volume);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public static void main(String[] args) {
}

private void init(String[] args) {
// The provider configures jclouds to use the Rackspace open cloud (US)
// to use the Rackspace open cloud (UK) set the provider to "rackspace-cloudblockstorage-uk"
// The provider configures jclouds To use the Rackspace Cloud (US)
// To use the Rackspace Cloud (UK) set the provider to "rackspace-cloudblockstorage-uk"
String provider = "rackspace-cloudblockstorage-us";

String username = args[0];
Expand Down Expand Up @@ -98,7 +98,7 @@ private void deleteSnapshot(Snapshot snapshot) throws TimeoutException {

// Wait for the snapshot to be deleted before moving on
// If you want to know what's happening during the polling, enable logging.
// See /jclouds-exmaple/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java
// See /jclouds-example/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java
if (!SnapshotPredicates.awaitDeleted(snapshotApi).apply(snapshot)) {
throw new TimeoutException("Timeout on snapshot: " + snapshot);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public static void main(String[] args) {
}

private void init(String[] args) {
// The provider configures jclouds to use the Rackspace open cloud (US)
// to use the Rackspace open cloud (UK) set the provider to "rackspace-cloudblockstorage-uk"
// The provider configures jclouds To use the Rackspace Cloud (US)
// To use the Rackspace Cloud (UK) set the provider to "rackspace-cloudblockstorage-uk"
String provider = "rackspace-cloudblockstorage-us";

String username = args[0];
Expand Down Expand Up @@ -98,7 +98,7 @@ private void deleteVolume(Volume volume) throws TimeoutException {

// Wait for the volume to be deleted before moving on
// If you want to know what's happening during the polling, enable
// logging. See /jclouds-exmaple/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java
// logging. See /jclouds-example/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java
if (!VolumePredicates.awaitDeleted(volumeApi).apply(volume)) {
throw new TimeoutException("Timeout on volume: " + volume);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ public static void main(String[] args) {
}

private void init(String[] args) {
// The provider configures jclouds to use the Rackspace open cloud (US)
// to use the Rackspace open cloud (UK) set the provider to "rackspace-cloudservers-uk"
// The provider configures jclouds To use the Rackspace Cloud (US)
// To use the Rackspace Cloud (UK) set the provider to "rackspace-cloudservers-uk"
String provider = "rackspace-cloudservers-us";

String username = args[0];
Expand Down Expand Up @@ -164,7 +164,7 @@ private void detachVolume(VolumeAttachment volumeAttachment) throws TimeoutExcep

// Wait for the volume to become Attached (aka In Use) before moving on
// If you want to know what's happening during the polling, enable
// logging. See /jclouds-exmaple/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java
// logging. See /jclouds-example/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java
if (!VolumePredicates.awaitAvailable(volumeApi).apply(Volume.forId(volumeAttachment.getVolumeId()))) {
throw new TimeoutException("Timeout on volume: " + volumeAttachment.getVolumeId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public static void main(String[] args) {
}

private void init(String[] args) {
// The provider configures jclouds to use the Rackspace open cloud (US)
// to use the Rackspace open cloud (UK) set the provider to "rackspace-cloudblockstorage-uk"
// The provider configures jclouds To use the Rackspace Cloud (US)
// To use the Rackspace Cloud (UK) set the provider to "rackspace-cloudblockstorage-uk"
String provider = "rackspace-cloudblockstorage-us";

String username = args[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public static void main(String[] args) {
}

private void init(String[] args) {
// The provider configures jclouds to use the Rackspace open cloud (US)
// to use the Rackspace open cloud (UK) set the provider to "rackspace-cloudservers-uk"
// The provider configures jclouds To use the Rackspace Cloud (US)
// To use the Rackspace Cloud (UK) set the provider to "rackspace-cloudservers-uk"
String provider = "rackspace-cloudservers-us";

String username = args[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public static void main(String[] args) {
}

private void init(String[] args) {
// The provider configures jclouds to use the Rackspace open cloud (US)
// to use the Rackspace open cloud (UK) set the provider to "rackspace-cloudblockstorage-uk"
// The provider configures jclouds To use the Rackspace Cloud (US)
// To use the Rackspace Cloud (UK) set the provider to "rackspace-cloudblockstorage-uk"
String provider = "rackspace-cloudblockstorage-us";

String username = args[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public static void main(String[] args) {
}

private void init(String[] args) {
// The provider configures jclouds to use the Rackspace open cloud (US)
// to use the Rackspace open cloud (UK) set the provider to "rackspace-cloudblockstorage-uk"
// The provider configures jclouds To use the Rackspace Cloud (US)
// To use the Rackspace Cloud (UK) set the provider to "rackspace-cloudblockstorage-uk"
String provider = "rackspace-cloudblockstorage-us";

String username = args[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ public static void main(String[] args) {
}

private void init(String[] args) {
// The provider configures jclouds to use the Rackspace open cloud (US)
// to use the Rackspace open cloud (UK) set the provider to "cloudfiles-uk"
// The provider configures jclouds To use the Rackspace Cloud (US)
// To use the Rackspace Cloud (UK) set the provider to "cloudfiles-uk"
String provider = "cloudfiles-us";

String username = args[0];
Expand Down Expand Up @@ -122,7 +122,7 @@ private void createObjectFromFile() throws IOException {
*/
private void enableCdnContainer() {
System.out.println("Enable CDN Container");
URI cdnURI = rackspace.enableCDN(Constants.CONTAINER);
URI cdnURI = rackspace.enableCDN(Constants.CONTAINER_PUBLISH);
System.out.println(" Go to " + cdnURI + "/" + Constants.FILENAME + Constants.SUFFIX);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public static void main(String[] args) {
}

private void init(String[] args) {
// The provider configures jclouds to use the Rackspace open cloud (US)
// to use the Rackspace open cloud (UK) set the provider to "cloudfiles-uk"
// The provider configures jclouds To use the Rackspace Cloud (US)
// To use the Rackspace Cloud (UK) set the provider to "cloudfiles-uk"
String provider = "cloudfiles-us";

String username = args[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public static void main(String[] args) {
}

private void init(String[] args) {
// The provider configures jclouds to use the Rackspace open cloud (US)
// to use the Rackspace open cloud (UK) set the provider to "cloudfiles-uk"
// The provider configures jclouds To use the Rackspace Cloud (US)
// To use the Rackspace Cloud (UK) set the provider to "cloudfiles-uk"
String provider = "cloudfiles-us";

String username = args[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public static void main(String[] args) {
}

private void init(String[] args) {
// The provider configures jclouds to use the Rackspace open cloud (US)
// to use the Rackspace open cloud (UK) set the provider to "cloudfiles-uk"
// The provider configures jclouds To use the Rackspace Cloud (US)
// To use the Rackspace Cloud (UK) set the provider to "cloudfiles-uk"
String provider = "cloudfiles-us";

String username = args[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public static void main(String[] args) {
}

private void init(String[] args) {
// The provider configures jclouds to use the Rackspace open cloud (US)
// to use the Rackspace open cloud (UK) set the provider to "cloudfiles-uk"
// The provider configures jclouds To use the Rackspace Cloud (US)
// To use the Rackspace Cloud (UK) set the provider to "cloudfiles-uk"
String provider = "cloudfiles-us";

String username = args[0];
Expand Down
Loading

0 comments on commit 7589ace

Please sign in to comment.