libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [10/18] libcloud git commit: Commenting the existing network functions to provide clearer help
Date Wed, 18 Nov 2015 07:52:14 GMT
Commenting the existing network functions to provide clearer help


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

Branch: refs/heads/trunk
Commit: c923de363ae478505b7e84c9485f2832aa28d7e2
Parents: b90060b
Author: Anthony Shaw <anthony.p.shaw@gmail.com>
Authored: Fri Oct 30 09:52:52 2015 +1100
Committer: Anthony Shaw <anthony.p.shaw@gmail.com>
Committed: Fri Oct 30 09:52:52 2015 +1100

----------------------------------------------------------------------
 libcloud/compute/drivers/dimensiondata.py | 155 ++++++++++++++++++++++++-
 1 file changed, 149 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/c923de36/libcloud/compute/drivers/dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/dimensiondata.py b/libcloud/compute/drivers/dimensiondata.py
index ee76daf..1015562 100644
--- a/libcloud/compute/drivers/dimensiondata.py
+++ b/libcloud/compute/drivers/dimensiondata.py
@@ -165,6 +165,15 @@ class DimensionDataNodeDriver(NodeDriver):
         return node
 
     def destroy_node(self, node):
+        """
+        Deletes a node, node must be stopped before deletion
+
+
+        :keyword node: The node to delete
+        :type    node: :class:`Node`
+
+        :rtype: ``bool``
+        """
         request_elm = ET.Element('deleteServer',
                                  {'xmlns': TYPES_URN, 'id': node.id})
         body = self.connection.request_with_orgId_api_2(
@@ -175,6 +184,15 @@ class DimensionDataNodeDriver(NodeDriver):
         return response_code in ['IN_PROGRESS', 'OK']
 
     def reboot_node(self, node):
+        """
+        Reboots a node by requesting the OS restart via the hypervisor
+
+
+        :keyword node: The node to reboot
+        :type    node: :class:`Node`
+
+        :rtype: ``bool``
+        """
         request_elm = ET.Element('rebootServer',
                                  {'xmlns': TYPES_URN, 'id': node.id})
         body = self.connection.request_with_orgId_api_2(
@@ -185,6 +203,13 @@ class DimensionDataNodeDriver(NodeDriver):
         return response_code in ['IN_PROGRESS', 'OK']
 
     def list_nodes(self):
+        """
+        List nodes deployed across all data center locations for your
+        organization.
+
+        :return: a list of `Node` objects
+        :rtype: ``list`` of :class:`Node`
+        """
         nodes = self._to_nodes(
             self.connection.request_with_orgId_api_2('server/server').object)
 
@@ -377,6 +402,19 @@ class DimensionDataNodeDriver(NodeDriver):
         return response_code in ['IN_PROGRESS', 'OK']
 
     def ex_attach_node_to_vlan(self, node, vlan):
+        """
+        Attach a node to a VLAN by adding an additional NIC to
+        the node on the target VLAN. The IP will be automatically
+        assigned based on the VLAN IP network space.
+
+        :param      node: Node which should be used
+        :type       node: :class:`Node`
+
+        :param      vlan: VLAN to attach the node to
+        :type       vlan: :class:`DimensionDataVlan`
+
+        :rtype: ``bool``
+        """
         request = ET.Element('addNic',
                              {'xmlns': TYPES_URN})
         ET.SubElement(request, 'serverId').text = node.id
@@ -391,6 +429,14 @@ class DimensionDataNodeDriver(NodeDriver):
         return response_code in ['IN_PROGRESS', 'OK']
 
     def ex_destroy_nic(self, nic_id):
+        """
+        Remove a NIC on a node, removing the node from a VLAN
+
+        :param      nic_id: The identifier of the NIC to remove
+        :type       nic_id: ``str``
+
+        :rtype: ``bool``
+        """
         request = ET.Element('removeNic',
                              {'xmlns': TYPES_URN,
                               'id': nic_id})
@@ -420,6 +466,14 @@ class DimensionDataNodeDriver(NodeDriver):
         return self._to_networks(response)
 
     def ex_get_network_domain(self, network_domain_id):
+        """
+        Get an individual Network Domain, by identifier
+
+        :param      network_domain_id: The identifier of the network domain
+        :type       network_domain_id: ``str``
+
+        :rtype: :class:`DimensionDataNetworkDomain`
+        """
         locations = self.list_locations()
         net = self.connection.request_with_orgId_api_2(
             'network/networkDomain/%s' % network_domain_id).object
@@ -427,10 +481,14 @@ class DimensionDataNodeDriver(NodeDriver):
 
     def ex_list_network_domains(self, location=None):
         """
-        List networks deployed across all data center locations for your
-        organization.  The response includes the location of each network.
+        List networks domains deployed across all data center locations
+        for your organization.
+        The response includes the location of each network domain.
 
-        :return: a list of DimensionDataNetwork objects
+        :param      location: The data center to list (optional)
+        :type       location: :class:`NodeLocation`
+
+        :return: a list of `DimensionDataNetwork` objects
         :rtype: ``list`` of :class:`DimensionDataNetwork`
         """
         params = {}
@@ -446,6 +504,22 @@ class DimensionDataNodeDriver(NodeDriver):
                                  description=None):
         """
         Deploy a new network domain to a data center
+
+        :param      location: The data center to list
+        :type       location: :class:`NodeLocation`
+
+        :param      name: The name of the network domain to create
+        :type       name: ``str``
+
+        :param      service_plan: The service plan, either "ESSENTIALS"
+            or "ADVANCED"
+        :type       service_plan: ``str``
+
+        :param      description: An additional description of the network domain
+        :type       description: ``str``
+
+        :return: an instance of `DimensionDataNetworkDomain`
+        :rtype: :class:`DimensionDataNetworkDomain`
         """
         create_node = ET.Element('deployNetworkDomain', {'xmlns': TYPES_URN})
         ET.SubElement(create_node, "datacenterId").text = location.id
@@ -477,6 +551,12 @@ class DimensionDataNodeDriver(NodeDriver):
     def ex_update_network_domain(self, network_domain):
         """
         Update the properties of a network domain
+
+        :param      network_domain: The network domain with updated properties
+        :type       network_domain: :class:`DimensionDataNetworkDomain`
+
+        :return: an instance of `DimensionDataNetworkDomain`
+        :rtype: :class:`DimensionDataNetworkDomain`
         """
         edit_node = ET.Element('editNetworkDomain', {'xmlns': TYPES_URN})
         edit_node.set('id', network_domain.id)
@@ -494,6 +574,14 @@ class DimensionDataNodeDriver(NodeDriver):
         return network_domain
 
     def ex_delete_network_domain(self, network_domain):
+        """
+        Delete a network domain
+
+        :param      network_domain: The network domain to delete
+        :type       network_domain: :class:`DimensionDataNetworkDomain`
+
+        :rtype: ``bool``
+        """
         delete_node = ET.Element('deleteNetworkDomain', {'xmlns': TYPES_URN})
         delete_node.set('id', network_domain.id)
         result = self.connection.request_with_orgId_api_2(
@@ -509,9 +597,29 @@ class DimensionDataNodeDriver(NodeDriver):
                        name,
                        private_ipv4_base_address,
                        description=None,
-                       private_ipv4_prefix_size='24'):
+                       private_ipv4_prefix_size=24):
         """
         Deploy a new VLAN to a network domain
+
+        :param      network_domain: The network domain to add the VLAN to
+        :type       network_domain: :class:`DimensionDataNetworkDomain`
+
+        :param      name: The name of the VLAN to create
+        :type       name: ``str``
+
+        :param      private_ipv4_base_address: The base IPv4 address
+            e.g. 192.168.1.0
+        :type       private_ipv4_base_address: ``str``
+
+        :param      description: An additional description of the VLAN
+        :type       description: ``str``
+
+        :param      private_ipv4_prefix_size: The size of the IPv4
+            address space, e.g 24
+        :type       private_ipv4_prefix_size: ``int``
+
+        :return: an instance of `DimensionDataVlan`
+        :rtype: :class:`DimensionDataVlan`
         """
         create_node = ET.Element('deployVlan', {'xmlns': TYPES_URN})
         ET.SubElement(create_node, "networkDomainId").text = network_domain.id
@@ -521,7 +629,7 @@ class DimensionDataNodeDriver(NodeDriver):
         ET.SubElement(create_node, "privateIpv4BaseAddress").text = \
             private_ipv4_base_address
         ET.SubElement(create_node, "privateIpv4PrefixSize").text = \
-            private_ipv4_prefix_size
+            str(private_ipv4_prefix_size)
 
         response = self.connection.request_with_orgId_api_2(
             'network/deployVlan',
@@ -545,6 +653,15 @@ class DimensionDataNodeDriver(NodeDriver):
         )
 
     def ex_get_vlan(self, vlan_id):
+        """
+        Get a single VLAN, by it's identifier
+
+        :param   vlan_id: The identifier of the VLAN
+        :type    vlan_id: ``str``
+
+        :return: an instance of `DimensionDataVlan`
+        :rtype: :class:`DimensionDataVlan`
+        """
         locations = self.list_locations()
         vlan = self.connection.request_with_orgId_api_2(
             'network/vlan/%s' % vlan_id).object
@@ -554,6 +671,12 @@ class DimensionDataNodeDriver(NodeDriver):
         """
         Updates the properties of the given VLAN
         Only name and description are updated
+
+        :param      vlan: The VLAN to update
+        :type       vlan: :class:`DimensionDataNetworkDomain`
+
+        :return: an instance of `DimensionDataVlan`
+        :rtype: :class:`DimensionDataVlan`
         """
         edit_node = ET.Element('editVlan', {'xmlns': TYPES_URN})
         edit_node.set('id', vlan.id)
@@ -575,6 +698,12 @@ class DimensionDataNodeDriver(NodeDriver):
         The expansion will
         not be permitted if the proposed IP space overlaps with an
         already deployed VLANs IP space.
+
+        :param      vlan: The VLAN to update
+        :type       vlan: :class:`DimensionDataNetworkDomain`
+
+        :return: an instance of `DimensionDataVlan`
+        :rtype: :class:`DimensionDataVlan`
         """
         edit_node = ET.Element('expandVlan', {'xmlns': TYPES_URN})
         edit_node.set('id', vlan.id)
@@ -589,6 +718,14 @@ class DimensionDataNodeDriver(NodeDriver):
         return vlan
 
     def ex_delete_vlan(self, vlan):
+        """
+        Deletes an existing VLAN
+
+        :param      vlan: The VLAN to delete
+        :type       vlan: :class:`DimensionDataNetworkDomain`
+
+        :rtype: ``bool``
+        """
         delete_node = ET.Element('deleteVlan', {'xmlns': TYPES_URN})
         delete_node.set('id', vlan.id)
         result = self.connection.request_with_orgId_api_2(
@@ -601,7 +738,13 @@ class DimensionDataNodeDriver(NodeDriver):
 
     def ex_list_vlans(self, location=None, network_domain=None):
         """
-        List VLANs available in a given networkDomain
+        List VLANs available, can filter by location and/or network domain
+
+        :param      location: Only VLANs in this location (optional)
+        :type       location: :class:`NodeLocation`
+
+        :param      network_domain: Only VLANs in this domain (optional)
+        :type       network_domain: :class:`DimensionDataNetworkDomain`
 
         :return: a list of DimensionDataVlan objects
         :rtype: ``list`` of :class:`DimensionDataVlan`


Mime
View raw message