summaryrefslogtreecommitdiffstats
path: root/exercise_rsapi.py
diff options
context:
space:
mode:
authorTodd Willey <todd@rubidine.com>2010-06-21 12:44:39 -0400
committerTodd Willey <todd@rubidine.com>2010-06-21 12:44:39 -0400
commitc7f28358ad01e069ac60e4ee85c450c35c628dde (patch)
tree00b5421eb7a3da14c6e2a5cd1ae0ea9364ee1a9a /exercise_rsapi.py
parent79964253e910dd2884de56138bbe6fa75a3bf283 (diff)
downloadnova-c7f28358ad01e069ac60e4ee85c450c35c628dde.tar.gz
nova-c7f28358ad01e069ac60e4ee85c450c35c628dde.tar.xz
nova-c7f28358ad01e069ac60e4ee85c450c35c628dde.zip
More rackspace API.
Diffstat (limited to 'exercise_rsapi.py')
-rw-r--r--exercise_rsapi.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/exercise_rsapi.py b/exercise_rsapi.py
new file mode 100644
index 000000000..4b9e65fc6
--- /dev/null
+++ b/exercise_rsapi.py
@@ -0,0 +1,33 @@
+import cloudservers
+
+class IdFake:
+ def __init__(self, id):
+ self.id = id
+
+# to get your access key:
+# from nova.auth import users
+# users.UserManger.instance().get_users()[0].access
+rscloud = cloudservers.CloudServers(
+ 'admin',
+ '6cca875e-5ab3-4c60-9852-abf5c5c60cc6'
+ )
+rscloud.client.AUTH_URL = 'http://localhost:8773/v1.0'
+
+
+rv = rscloud.servers.list()
+print "SERVERS: %s" % rv
+
+if len(rv) == 0:
+ server = rscloud.servers.create(
+ "test-server",
+ IdFake("ami-tiny"),
+ IdFake("m1.tiny")
+ )
+ print "LAUNCH: %s" % server
+else:
+ server = rv[0]
+ print "Server to kill: %s" % server
+
+raw_input("press enter key to kill the server")
+
+server.delete()