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 2015/06/13 14:44:15 UTC
[5/7] libcloud git commit: Added Gandi Computer Driver Documentation
Added Gandi Computer Driver Documentation
Closes #534
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/3c5522f5
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/3c5522f5
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/3c5522f5
Branch: refs/heads/trunk
Commit: 3c5522f5141b2422b2e4cbabd474f7caf27d4433
Parents: cec4b49
Author: ZuluPro <mo...@hotmail.com>
Authored: Wed Jun 3 03:06:36 2015 -0400
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Sat Jun 13 20:32:20 2015 +0800
----------------------------------------------------------------------
docs/compute/drivers/gandi.rst | 36 +++++++++++++++++++++++++
docs/examples/compute/gandi/create_node.py | 12 +++++++++
libcloud/test/compute/test_gandi.py | 2 +-
3 files changed, 49 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/3c5522f5/docs/compute/drivers/gandi.rst
----------------------------------------------------------------------
diff --git a/docs/compute/drivers/gandi.rst b/docs/compute/drivers/gandi.rst
new file mode 100644
index 0000000..01d2a7a
--- /dev/null
+++ b/docs/compute/drivers/gandi.rst
@@ -0,0 +1,36 @@
+Gandi Computer Driver Documentation
+===================================
+
+`Gandi SAS`_ is a registrar, web hosting and private and `public cloud`_
+provider based in France with data centers in France, Luxembourg and USA.
+
+.. figure:: /_static/images/provider_logos/gandi.png
+ :align: center
+ :width: 300
+ :target: https://www.gandi.net/
+
+Instantiating a driver
+----------------------
+
+When you instantiate a driver you need to pass the API key and activate
+the API platforms. See this `Gandi's documentation`_ for how to do it.
+
+Examples
+--------
+
+Create instance
+~~~~~~~~~~~~~~~
+
+.. literalinclude:: /examples/compute/gandi/create_node.py
+
+
+.. _`Gandi SAS`: https://www.gandi.net/
+.. _`public cloud`: https://www.gandi.net/hebergement/serveur
+.. _`Gandi's documentation`: https://wiki.gandi.net/en/xml-api/activate
+
+API Docs
+--------
+
+.. autoclass:: libcloud.compute.drivers.gandi.GandiNodeDriver
+ :members:
+ :inherited-members:
http://git-wip-us.apache.org/repos/asf/libcloud/blob/3c5522f5/docs/examples/compute/gandi/create_node.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/gandi/create_node.py b/docs/examples/compute/gandi/create_node.py
new file mode 100644
index 0000000..213f9eb
--- /dev/null
+++ b/docs/examples/compute/gandi/create_node.py
@@ -0,0 +1,12 @@
+from libcloud.compute.types import Provider
+from libcloud.compute.providers import get_driver
+
+Gandi = get_driver(Provider.GANDI)
+driver = Gandi('api_key')
+
+image = [i for i in driver.list_images() if 'Debian 8 64' in i.name][0]
+size = [s for s in driver.list_sizes() if s.name == 'Medium instance'][0]
+location = [l for l in driver.list_locations() if l.name == 'Equinix Paris'][0]
+
+node = driver.create_node(name='yournode', size=size, image=image,
+ location=location, login="youruser", password="pass")
http://git-wip-us.apache.org/repos/asf/libcloud/blob/3c5522f5/libcloud/test/compute/test_gandi.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_gandi.py b/libcloud/test/compute/test_gandi.py
index 1cdbcf2..0c00c15 100644
--- a/libcloud/test/compute/test_gandi.py
+++ b/libcloud/test/compute/test_gandi.py
@@ -156,7 +156,7 @@ class GandiTests(unittest.TestCase):
def test_list_key_pairs(self):
keys = self.driver.list_key_pairs()
- self.assertGreater(len(keys), 0)
+ self.assertTrue(len(keys) > 0)
def test_get_key_pair(self):
key = self.driver.get_key_pair(10)