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/11/14 16:06:33 UTC

[1/5] git commit: Add missing docstrings to some classes in the compute API.

Updated Branches:
  refs/heads/trunk acbe1b4a0 -> c5d36f9d5


Add missing docstrings to some classes in the compute API.


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

Branch: refs/heads/trunk
Commit: 19bbd0fd7bcb562b90d087f97f508a2c68c8eeef
Parents: acbe1b4
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Nov 14 15:45:56 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Nov 14 15:45:56 2013 +0100

----------------------------------------------------------------------
 libcloud/compute/base.py | 83 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 82 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/19bbd0fd/libcloud/compute/base.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/base.py b/libcloud/compute/base.py
index c214b96..503a3a4 100644
--- a/libcloud/compute/base.py
+++ b/libcloud/compute/base.py
@@ -156,6 +156,36 @@ class Node(UuidMixin):
 
     def __init__(self, id, name, state, public_ips, private_ips,
                  driver, size=None, image=None, extra=None):
+        """
+        :param id: Node ID.
+        :type id: ``str``
+
+        :param name: Node name.
+        :type name: ``str``
+
+        :param state: Node state.
+        :type state: :class:`libcloud.compute.types.NodeState`
+
+        :param public_ips: Public IP addresses associated with this node.
+        :type public_ips: ``list``
+
+        :param private_ips: Private IP addresses associated with this node.
+        :type private_ips: ``list``
+
+        :param driver: Driver this node belongs to.
+        :type driver: :class:`.NodeDriver`
+
+        :param size: Size of this node. (optional)
+        :type size: :class:`.NodeSize:
+
+        :param image: Image of this node. (optional)
+        :type size: :class:`.NodeImage:
+
+        :param extra: Optional provided specific attributes associated with
+                      this node.
+        :type extra: ``dict``
+
+        """
         self.id = str(id) if id else None
         self.name = name
         self.state = state
@@ -259,6 +289,28 @@ class NodeSize(UuidMixin):
     """
 
     def __init__(self, id, name, ram, disk, bandwidth, price, driver):
+        """
+        :param id: Size ID.
+        :type id: ``str``
+
+        :param name: Size name.
+        :type name: ``str``
+
+        :param ram: Amount of memory (in MB) provided by this size.
+        :type ram: ``int``
+
+        :param disk: Amount of disk storage (in GB) provided by this image.
+        :type disk: ``int``
+
+        :param bandwidth: Amount of bandiwdth included with this size.
+        :type bandwidth: ``int``
+
+        :param price: Price (in US dollars) of running this node for an hour.
+        :type price: ``float``
+
+        :param driver: Driver this image belongs to.
+        :type driver: :class:`.NodeDriver`
+        """
         self.id = str(id)
         self.name = name
         self.ram = ram
@@ -295,10 +347,23 @@ class NodeImage(UuidMixin):
     to the create_node function to decide which OS image to use.
 
     >>> node = driver.create_node(image=image)
-
     """
 
     def __init__(self, id, name, driver, extra=None):
+        """
+        :param id: Image ID.
+        :type id: ``str``
+
+        :param name: Image name.
+        :type name: ``str``
+
+        :param driver: Driver this image belongs to.
+        :type driver: :class:`.NodeDriver`
+
+        :param extra: Optional provided specific attributes associated with
+                      this image.
+        :type extra: ``dict``
+        """
         self.id = str(id)
         self.name = name
         self.driver = driver
@@ -371,6 +436,22 @@ class StorageVolume(UuidMixin):
     """
 
     def __init__(self, id, name, size, driver, extra=None):
+        """
+        :param id: Storage volume ID.
+        :type id: ``str``
+
+        :param name: Storage volume name.
+        :type name: ``str``
+
+        :param size: Size of this volume (in GB).
+        :type size: ``int``
+
+        :param driver: Driver this image belongs to.
+        :type driver: :class:`.NodeDriver`
+
+        :param extra: Optional provider specific attributes.
+        :type extra: ``dict``
+        """
         self.id = id
         self.name = name
         self.size = size


[2/5] git commit: Fix format of some return type docstrings (return s -> rtype).

Posted by to...@apache.org.
Fix format of some return type docstrings (return s -> rtype).


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

Branch: refs/heads/trunk
Commit: 00aec6f1cba073dcf907c0c275f0eb725b1913bb
Parents: 19bbd0f
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Nov 14 15:47:33 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Nov 14 15:47:33 2013 +0100

----------------------------------------------------------------------
 libcloud/compute/base.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/00aec6f1/libcloud/compute/base.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/base.py b/libcloud/compute/base.py
index 503a3a4..155a017 100644
--- a/libcloud/compute/base.py
+++ b/libcloud/compute/base.py
@@ -470,7 +470,7 @@ class StorageVolume(UuidMixin):
                             e.g. '/dev/sdb (optional)
         :type device: ``str``
 
-        :return s ``bool``
+        :rtype: ``bool``
         """
 
         return self.driver.attach_volume(node=node, volume=self, device=device)
@@ -479,14 +479,14 @@ class StorageVolume(UuidMixin):
         """
         Detach this volume from its node
 
-        :return s ``bool``
+        :rtype: ``bool``
         """
 
         return self.driver.detach_volume(volume=self)
 
     def list_snapshots(self):
         """
-        :return s ``list`` of ``VolumeSnapshot``
+        :rtype: ``list`` of ``VolumeSnapshot``
         """
         return self.driver.list_volume_snapshots(volume=self)
 
@@ -494,7 +494,7 @@ class StorageVolume(UuidMixin):
         """
         Creates a snapshot of this volume.
 
-        :return s ``VolumeSnapshot``
+        :rtype: ``VolumeSnapshot``
         """
         return self.driver.create_volume_snapshot(volume=self, name=name)
 
@@ -502,7 +502,7 @@ class StorageVolume(UuidMixin):
         """
         Destroy this storage volume.
 
-        :return s ``bool``
+        :rtype: ``bool``
         """
 
         return self.driver.destroy_volume(volume=self)
@@ -538,7 +538,7 @@ class VolumeSnapshot(object):
         """
         Destroys this snapshot.
 
-        :return s ``bool``
+        :rtype: ``bool``
         """
         return self.driver.destroy_volume_snapshot(snapshot=self)
 


[4/5] git commit: libcloud.compute.base: Add some more missing docstrings, use consistent docstring format and fix some broken class references.

Posted by to...@apache.org.
libcloud.compute.base: Add some more missing docstrings, use consistent
docstring format and fix some broken class references.


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

Branch: refs/heads/trunk
Commit: f941c9dfdafa649a978601bba06026973d48b09a
Parents: 0d27fce
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Nov 14 16:02:42 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Nov 14 16:02:42 2013 +0100

----------------------------------------------------------------------
 libcloud/compute/base.py | 107 ++++++++++++++++++++++++++++--------------
 1 file changed, 72 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/f941c9df/libcloud/compute/base.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/base.py b/libcloud/compute/base.py
index 155a017..2172e6b 100644
--- a/libcloud/compute/base.py
+++ b/libcloud/compute/base.py
@@ -387,6 +387,19 @@ class NodeLocation(object):
     """
 
     def __init__(self, id, name, country, driver):
+        """
+        :param id: Location ID.
+        :type id: ``str``
+
+        :param name: Location name.
+        :type name: ``str``
+
+        :param country: Location country.
+        :type country : ``str``
+
+        :param driver: Driver this location belongs to.
+        :type driver: :class:`.NodeDriver`
+        """
         self.id = str(id)
         self.name = name
         self.country = country
@@ -412,6 +425,10 @@ class NodeAuthSSHKey(object):
     """
 
     def __init__(self, pubkey):
+        """
+        :param pubkey: Public key matetiral.
+        :type pubkey: ``str``
+        """
         self.pubkey = pubkey
 
     def __repr__(self):
@@ -423,6 +440,13 @@ class NodeAuthPassword(object):
     A password to be used for authentication to a node.
     """
     def __init__(self, password, generated=False):
+        """
+        :param password: Password.
+        :type password: ``str``
+
+        :type generated: ``True`` if this password was automatically generated,
+                         ``False`` otherwise.
+        """
         self.password = password
         self.generated = generated
 
@@ -464,12 +488,13 @@ class StorageVolume(UuidMixin):
         Attach this volume to a node.
 
         :param node: Node to attach volume to
-        :type node: :class:`Node`
+        :type node: :class:`.Node`
 
         :param device: Where the device is exposed,
                             e.g. '/dev/sdb (optional)
         :type device: ``str``
 
+        :return: ``True`` if attach was successful, ``False`` otherwise.
         :rtype: ``bool``
         """
 
@@ -479,6 +504,7 @@ class StorageVolume(UuidMixin):
         """
         Detach this volume from its node
 
+        :return: ``True`` if detach was successful, ``False`` otherwise.
         :rtype: ``bool``
         """
 
@@ -494,6 +520,7 @@ class StorageVolume(UuidMixin):
         """
         Creates a snapshot of this volume.
 
+        :return: Created snapshot.
         :rtype: ``VolumeSnapshot``
         """
         return self.driver.create_volume_snapshot(volume=self, name=name)
@@ -502,6 +529,7 @@ class StorageVolume(UuidMixin):
         """
         Destroy this storage volume.
 
+        :return: ``True`` if destroy was successful, ``False`` otherwise.
         :rtype: ``bool``
         """
 
@@ -558,12 +586,14 @@ class NodeDriver(BaseDriver):
     type = None
     port = None
     features = {"create_node": []}
+
     """
     List of available features for a driver.
-        - :class:`create_node`
-            - ssh_key: Supports :class:`NodeAuthSSHKey` as an authentication
+        - :meth:`libcloud.compute.base.NodeDriver.create_node`
+            - ssh_key: Supports :class:`.NodeAuthSSHKey` as an authentication
               method for nodes.
-            - password: Supports :class:`NodeAuthPassword` as an authentication
+            - password: Supports :class:`.NodeAuthPassword` as an
+              authentication
               method for nodes.
             - generates_password: Returns a password attribute on the Node
               object returned from creation.
@@ -579,13 +609,13 @@ class NodeDriver(BaseDriver):
 
     def _get_and_check_auth(self, auth):
         """
-        Helper function for providers supporting :class:`NodeAuthPassword` or
-        :class:`NodeAuthSSHKey`
+        Helper function for providers supporting :class:`.NodeAuthPassword` or
+        :class:`.NodeAuthSSHKey`
 
         Validates that only a supported object type is passed to the auth
         parameter and raises an exception if it is not.
 
-        If no :class:`NodeAuthPassword` object is provided but one is expected
+        If no :class:`.NodeAuthPassword` object is provided but one is expected
         then a password is automatically generated.
         """
 
@@ -668,8 +698,8 @@ class NodeDriver(BaseDriver):
         actually provided to the driver API by the hosting provider rather than
         generated by libcloud.
 
-        You can only pass a :class:`NodeAuthPassword` or
-        :class:`NodeAuthSSHKey` to ``create_node`` via the auth parameter if
+        You can only pass a :class:`.NodeAuthPassword` or
+        :class:`.NodeAuthSSHKey` to ``create_node`` via the auth parameter if
         has the corresponding feature flag.
 
         :param name:   String with a name for this new node (required)
@@ -677,21 +707,21 @@ class NodeDriver(BaseDriver):
 
         :param size:   The size of resources allocated to this node.
                             (required)
-        :type size:   :class:`NodeSize`
+        :type size:   :class:`.NodeSize`
 
         :param image:  OS Image to boot on node. (required)
-        :type image:  :class:`NodeImage`
+        :type image:  :class:`.NodeImage`
 
         :param location: Which data center to create a node in. If empty,
                               undefined behavoir will be selected. (optional)
-        :type location: :class:`NodeLocation`
+        :type location: :class:`.NodeLocation`
 
         :param auth:   Initial authentication information for the node
                             (optional)
-        :type auth:   :class:`NodeAuthSSHKey` or :class:`NodeAuthPassword`
+        :type auth:   :class:`.NodeAuthSSHKey` or :class:`NodeAuthPassword`
 
         :return: The newly created node.
-        :rtype: :class:`Node`
+        :rtype: :class:`.Node`
         """
         raise NotImplementedError(
             'create_node not implemented for this driver')
@@ -703,9 +733,9 @@ class NodeDriver(BaseDriver):
         the node, including backups.
 
         :param node: The node to be destroyed
-        :type node: :class:`Node`
+        :type node: :class:`.Node`
 
-        :return: True if the destroy was successful, otherwise False
+        :return: True if the destroy was successful, False otherwise.
         :rtype: ``bool``
         """
         raise NotImplementedError(
@@ -716,7 +746,7 @@ class NodeDriver(BaseDriver):
         Reboot a node.
 
         :param node: The node to be rebooted
-        :type node: :class:`Node`
+        :type node: :class:`.Node`
 
         :return: True if the reboot was successful, otherwise False
         :rtype: ``bool``
@@ -728,7 +758,7 @@ class NodeDriver(BaseDriver):
         """
         List all nodes
         :return:  list of node objects
-        :rtype: ``list`` of :class:`Node`
+        :rtype: ``list`` of :class:`.Node`
         """
         raise NotImplementedError(
             'list_nodes not implemented for this driver')
@@ -738,10 +768,10 @@ class NodeDriver(BaseDriver):
         List images on a provider
 
         :param location: The location at which to list images
-        :type location: :class:`NodeLocation`
+        :type location: :class:`.NodeLocation`
 
         :return: list of node image objects
-        :rtype: ``list`` of :class:`NodeImage`
+        :rtype: ``list`` of :class:`.NodeImage`
         """
         raise NotImplementedError(
             'list_images not implemented for this driver')
@@ -751,10 +781,10 @@ class NodeDriver(BaseDriver):
         List sizes on a provider
 
         :param location: The location at which to list sizes
-        :type location: :class:`NodeLocation`
+        :type location: :class:`.NodeLocation`
 
         :return: list of node size objects
-        :rtype: ``list`` of :class:`NodeSize`
+        :rtype: ``list`` of :class:`.NodeSize`
         """
         raise NotImplementedError(
             'list_sizes not implemented for this driver')
@@ -764,7 +794,7 @@ class NodeDriver(BaseDriver):
         List data centers for a provider
 
         :return: list of node location objects
-        :rtype: ``list`` of :class:`NodeLocation`
+        :rtype: ``list`` of :class:`.NodeLocation`
         """
         raise NotImplementedError(
             'list_locations not implemented for this driver')
@@ -776,8 +806,8 @@ class NodeDriver(BaseDriver):
         In order to be able to SSH into a created node access credentials are
         required.
 
-        A user can pass either a :class:`NodeAuthPassword` or
-        :class:`NodeAuthSSHKey` to the ``auth`` argument. If the
+        A user can pass either a :class:`.NodeAuthPassword` or
+        :class:`.NodeAuthSSHKey` to the ``auth`` argument. If the
         ``create_node`` implementation supports that kind if credential (as
         declared in ``self.features['create_node']``) then it is passed on to
         ``create_node``. Otherwise it is not passed on to ``create_node`` and
@@ -837,7 +867,7 @@ class NodeDriver(BaseDriver):
 
         :param auth:   Initial authentication information for the node
                             (optional)
-        :type auth:   :class:`NodeAuthSSHKey` or :class:`NodeAuthPassword`
+        :type auth:   :class:`.NodeAuthSSHKey` or :class:`NodeAuthPassword`
 
         :param ssh_key: A path (or paths) to an SSH private key with which
                              to attempt to authenticate. (optional)
@@ -947,7 +977,7 @@ class NodeDriver(BaseDriver):
         :param location: Which data center to create a volume in. If
                                empty, undefined behavoir will be selected.
                                (optional)
-        :type location: :class:`NodeLocation`
+        :type location: :class:`.NodeLocation`
 
         :param snapshot:  Name of snapshot from which to create the new
                                volume.  (optional)
@@ -976,11 +1006,16 @@ class NodeDriver(BaseDriver):
         """
         Attaches volume to node.
 
-        :param Node node: Node to attach volume to.
-        :param StorageVolume volume: Volume to attach.
-        :param str device: Where the device is exposed, e.g. '/dev/sdb'
+        :param node: Node to attach volume to.
+        :type node: :class:`.Node`
+
+        :param volume: Volume to attach.
+        :type volume: :class:`.StorageVolume`
 
-        :return bool:
+        :param device: Where the device is exposed, e.g. '/dev/sdb'
+        :type device: ``str``
+
+        :rytpe: ``bool``
         """
         raise NotImplementedError('attach not implemented for this driver')
 
@@ -988,8 +1023,10 @@ class NodeDriver(BaseDriver):
         """
         Detaches a volume from a node.
 
-        :param StorageVolume volume: Volume to be detached
-        :return bool:
+        :param volume: Volume to be detached
+        :type volume: :class:`.StorageVolume`
+
+        :rtype: ``bool``
         """
 
         raise NotImplementedError('detach not implemented for this driver')
@@ -998,7 +1035,7 @@ class NodeDriver(BaseDriver):
         """
         List storage volumes.
 
-        :return [StorageVolume]:
+        :rtype: ``list`` of :class:`.StorageVolume`
         """
         raise NotImplementedError(
             'list_volumes not implemented for this driver')
@@ -1046,7 +1083,7 @@ class NodeDriver(BaseDriver):
         assigned.
 
         :param nodes: list of node instances.
-        :type nodes: ``List`` of :class:`Node`
+        :type nodes: ``List`` of :class:`.Node`
 
         :param wait_period: How many seconds to between each loop
                                  iteration (default is 3)


[3/5] git commit: docs: Update wording.

Posted by to...@apache.org.
docs: Update wording.


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

Branch: refs/heads/trunk
Commit: 0d27fce818b561fd03ba87b61d016a7c7898a349
Parents: 00aec6f
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Nov 14 15:50:29 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Nov 14 15:51:15 2013 +0100

----------------------------------------------------------------------
 docs/compute/index.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/0d27fce8/docs/compute/index.rst
----------------------------------------------------------------------
diff --git a/docs/compute/index.rst b/docs/compute/index.rst
index fff997e..86900f7 100644
--- a/docs/compute/index.rst
+++ b/docs/compute/index.rst
@@ -70,5 +70,5 @@ We have :doc:`examples of several common patterns </compute/examples>`.
 API Reference
 -------------
 
-There is a reference to :doc:`all the methods on the base compute driver
-</compute/api/>`.
+For a full reference of all the classes and methods exposed by the compute
+API, see :doc:`this page </compute/api>`.


[5/5] git commit: docs: Also expose NodeAuthSSHKey, NodeAuthPassword and NodeLocation class in the api docs.

Posted by to...@apache.org.
docs: Also expose NodeAuthSSHKey, NodeAuthPassword and NodeLocation class in the
api docs.


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

Branch: refs/heads/trunk
Commit: c5d36f9d5ebfbac9a04387effda98b823e5ea3ea
Parents: f941c9d
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Nov 14 16:02:52 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Nov 14 16:02:52 2013 +0100

----------------------------------------------------------------------
 docs/compute/api.rst | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/c5d36f9d/docs/compute/api.rst
----------------------------------------------------------------------
diff --git a/docs/compute/api.rst b/docs/compute/api.rst
index e6c17b9..d73a372 100644
--- a/docs/compute/api.rst
+++ b/docs/compute/api.rst
@@ -13,5 +13,14 @@ Compute Base API
 .. autoclass:: libcloud.compute.base.NodeImage
     :members:
 
+.. autoclass:: libcloud.compute.base.NodeLocation
+    :members:
+
+.. autoclass:: libcloud.compute.base.NodeAuthSSHKey
+    :members:
+
+.. autoclass:: libcloud.compute.base.NodeAuthPassword
+    :members:
+
 .. autoclass:: libcloud.compute.base.StorageVolume
     :members: