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 2013/08/04 20:24:54 UTC

[3/9] git commit: docs: Update getting started and examples page.

docs: Update getting started and examples page.


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

Branch: refs/heads/trunk
Commit: 8f40d34c516370cad3065c3461138a975f8dcd65
Parents: 2b04dfb
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Aug 4 15:54:58 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Aug 4 15:54:58 2013 +0200

----------------------------------------------------------------------
 docs/compute/examples.rst | 18 ++++++++++
 docs/getting_started.rst  | 74 +++++++++++++++++++++++++++++++-----------
 docs/index.rst            |  2 +-
 3 files changed, 74 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/8f40d34c/docs/compute/examples.rst
----------------------------------------------------------------------
diff --git a/docs/compute/examples.rst b/docs/compute/examples.rst
index 18e9d99..95b2d3e 100644
--- a/docs/compute/examples.rst
+++ b/docs/compute/examples.rst
@@ -1,6 +1,24 @@
 Compute Examples
 ================
 
+Example: Creating a Node
+------------------------
+
+.. literalinclude:: /examples/compute/create_node.py
+   :language: python
+
+Example: List Nodes Across Multiple Providers
+---------------------------------------------
+
+.. literalinclude:: /examples/compute/list_nodes_across_multiple_providers.py
+   :language: python
+
+Example: Bootstrapping Puppet on a Node
+---------------------------------------
+
+.. literalinclude:: /examples/compute/bootstrapping_puppet_on_node.py
+   :language: python
+
 Create an OpenStack node using trystack.org provider
 ----------------------------------------------------
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/8f40d34c/docs/getting_started.rst
----------------------------------------------------------------------
diff --git a/docs/getting_started.rst b/docs/getting_started.rst
index 7352480..3b702ad 100644
--- a/docs/getting_started.rst
+++ b/docs/getting_started.rst
@@ -1,15 +1,24 @@
 Getting Started
 ===============
 
-Installation
-------------
+Installation (stable version)
+----------------------------
 
-Libcloud is available on PyPi and can be installed using pip:
+Libcloud is available on PyPi. You can install latest stable version using pip:
 
 .. sourcecode:: bash
 
     pip install apache-libcloud
 
+Installation (development version)
+---------------------------------
+
+You can install latest development version from out Git repository:
+
+.. sourcecode:: bash
+
+    pip install -e https://git-wip-us.apache.org/repos/asf/libcloud.git@trunk#egg=apache-libcloud
+
 Upgrading
 ---------
 
@@ -19,26 +28,53 @@ If you used pip to install the library you can also use it to upgrade it:
 
     pip install --upgrade apache-libcloud
 
-Example: Connecting with a Driver
----------------------------------
+Using it
+--------
+
+This section describes a standard work-flow which you follow when working
+with any of the Libcloud drivers.
+
+1. Obtain reference to the provider driver
+
+.. sourcecode:: python
+
+    from pprint import pprint
+
+    from libcloud.compute.types import Provider
+    from libcloud.compute.providers import get_driver
+
+    cls = get_driver(Provider.RACKSPACE)
+
+2. Instantiate the driver with your provider credentials
+
+.. sourcecode:: python
+
+   driver = cls('my username', 'my api key')
+
+3. Start using the driver
+
+.. sourcecode:: python
+
+    pprint(driver.list_sizes())
+    pprint(driver.list_nodes())
+
+4. Putting it all together
 
-.. literalinclude:: /examples/compute/list_nodes.py
-   :language: python
+.. sourcecode:: python
 
-Example: Creating a Node
-------------------------
+    from pprint import pprint
 
-.. literalinclude:: /examples/compute/create_node.py
-   :language: python
+    from libcloud.compute.types import Provider
+    from libcloud.compute.providers import get_driver
 
-Example: List Nodes Across Multiple Providers
----------------------------------------------
+    cls = get_driver(Provider.RACKSPACE)
+    driver = cls('my username', 'my api key')
 
-.. literalinclude:: /examples/compute/list_nodes_across_multiple_providers.py
-   :language: python
+    pprint(driver.list_sizes())
+    pprint(driver.list_nodes())
 
-Example: Bootstrapping Puppet on a Node
----------------------------------------
+You can find more examples with common patterns which can help you get started
+on the :doc:`Compute Examples </compute/examples>` page.
 
-.. literalinclude:: /examples/compute/bootstrapping_puppet_on_node.py
-   :language: python
+Where to go from here?
+----------------------

http://git-wip-us.apache.org/repos/asf/libcloud/blob/8f40d34c/docs/index.rst
----------------------------------------------------------------------
diff --git a/docs/index.rst b/docs/index.rst
index ebec441..66e3e84 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -18,7 +18,7 @@ a unified and easy to use API.
 
 Resource you can manage with Libcloud are divided in the following categories:
 
-* :doc:`Cloud Servers </compute/index>` - services such as Amazon EC2 and
+* :doc:`Cloud Servers and Block Storage </compute/index>` - services such as Amazon EC2 and
   RackSpace CloudServers
 * :doc:`Cloud Object Storage </storage/index>` - services such as Amazon S3 and
   Rackspace CloudFiles