You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2016/07/10 09:55:29 UTC

libcloud git commit: docs: Update AuroraCompute examples

Repository: libcloud
Updated Branches:
  refs/heads/trunk be9097eec -> 8048cefeb


docs: Update AuroraCompute examples

Might be a bit redundant, but gives end-users a overview on a single
page.

Easy for people to refer to.

Closes #836

Signed-off-by: Tomaz Muraus <to...@tomaz.me>


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/8048cefe
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/8048cefe
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/8048cefe

Branch: refs/heads/trunk
Commit: 8048cefeb378e14173d334638b92344abb2cd07e
Parents: be9097e
Author: Wido den Hollander <wi...@widodh.nl>
Authored: Thu Jul 7 11:08:37 2016 +0200
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Sun Jul 10 11:45:12 2016 +0200

----------------------------------------------------------------------
 docs/compute/drivers/auroracompute.rst          | 14 +++++++++++++
 .../compute/auroracompute/create_node.py        | 22 ++++++++++++++++++++
 2 files changed, 36 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/8048cefe/docs/compute/drivers/auroracompute.rst
----------------------------------------------------------------------
diff --git a/docs/compute/drivers/auroracompute.rst b/docs/compute/drivers/auroracompute.rst
index 36bd575..74b9997 100644
--- a/docs/compute/drivers/auroracompute.rst
+++ b/docs/compute/drivers/auroracompute.rst
@@ -41,6 +41,20 @@ With these credentials you can instantiate a driver:
    :language: python
 
 
+Create a Virtual Machine (node)
+-------------------------------
+
+Creating a Virtual Machine on AuroraCompute using libcloud works the same as on any
+other platform. This example is just to show exactly that.
+
+This example will create a Virtual Machine in Amsterdam. Should you want to create
+one in one of our other regions you should take a look at the example below which
+shows how to use our different regions.
+
+.. literalinclude:: /examples/compute/auroracompute/create_node.py
+   :language: python
+
+
 Using a different region
 ------------------------
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/8048cefe/docs/examples/compute/auroracompute/create_node.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/auroracompute/create_node.py b/docs/examples/compute/auroracompute/create_node.py
new file mode 100644
index 0000000..c315ea4
--- /dev/null
+++ b/docs/examples/compute/auroracompute/create_node.py
@@ -0,0 +1,22 @@
+from libcloud.compute.types import Provider
+from libcloud.compute.providers import get_driver
+
+apikey = 'mykey'
+secretkey = 'mysecret'
+
+Driver = get_driver(Provider.AURORACOMPUTE)
+driver = Driver(key=apikey, secret=secretkey)
+
+images = driver.list_images()
+sizes = driver.list_sizes()
+
+# Find a Agile Offering with 2GB of Memory
+size = [s for s in sizes if s.ram == 2048 and s.name.startswith('Agile')][0]
+
+# Search for the Ubuntu 16.04 image
+image = [i for i in images if i.name == 'Ubuntu 16.04'][0]
+
+# Create the new Virtual Machine
+node = driver.create_node(image=image, size=size)
+
+print(node)