libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [02/24] libcloud git commit: Enhance get_list_of_xx calls by allowing for filter by network id
Date Mon, 05 Sep 2016 11:56:42 GMT
Enhance get_list_of_xx calls by allowing for filter by network id


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

Branch: refs/heads/trunk
Commit: 3b7e4ad576b87fa57f163dc9ccd3e61f91a387e6
Parents: 605d27b
Author: jr2730 <jay.riddell@gmail.com>
Authored: Thu Aug 25 15:51:31 2016 -0700
Committer: jr2730 <jay.riddell@gmail.com>
Committed: Thu Aug 25 15:51:31 2016 -0700

----------------------------------------------------------------------
 libcloud/loadbalancer/drivers/dimensiondata.py | 45 ++++++++++++++++-----
 1 file changed, 36 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/3b7e4ad5/libcloud/loadbalancer/drivers/dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/drivers/dimensiondata.py b/libcloud/loadbalancer/drivers/dimensiondata.py
index 33c0ab4..a73da66 100644
--- a/libcloud/loadbalancer/drivers/dimensiondata.py
+++ b/libcloud/loadbalancer/drivers/dimensiondata.py
@@ -173,18 +173,26 @@ class DimensionDataLBDriver(Driver):
                    'listener_ip_address': ex_listener_ip_address}
         )
 
-    def list_balancers(self):
+    def list_balancers(self, network_id=None):
         """
-        List all loadbalancers inside a geography.
+        List all loadbalancers inside a geography or in given network.
 
         In Dimension Data terminology these are known as virtual listeners
 
+        :param network_id: UUID of Network Domain
+               if not None returns only balancers in the given network
+               if None then returns all pools for the organization
+        :type  network_id: ``str``
+
         :rtype: ``list`` of :class:`LoadBalancer`
         """
+        params = None
+        if ( network_id is not None ):
+            params = { "networkDomainId": network_id }
 
         return self._to_balancers(
             self.connection
-            .request_with_orgId_api_2('networkDomainVip/virtualListener')
+            .request_with_orgId_api_2('networkDomainVip/virtualListener', params=params)
             .object)
 
     def get_balancer(self, balancer_id):
@@ -685,15 +693,25 @@ class DimensionDataLBDriver(Driver):
             status=State.RUNNING
         )
 
-    def ex_get_pools(self):
+    def ex_get_pools(self, network_id=None):
         """
-        Get all of the pools inside the current geography
+        Get all of the pools inside the current geography or
+        in given network.
+
+        :param network_id: UUID of Network Domain
+               if not None returns only balancers in the given network
+               if None then returns all pools for the organization
+        :type  network_id: ``str``
 
         :return: Returns a ``list`` of type ``DimensionDataPool``
         :rtype: ``list`` of ``DimensionDataPool``
         """
+        params = None
+        if ( network_id is not None ):
+            params = { "networkDomainId": network_id }
+
         pools = self.connection \
-            .request_with_orgId_api_2('networkDomainVip/pool').object
+            .request_with_orgId_api_2('networkDomainVip/pool', params=params).object
         return self._to_pools(pools)
 
     def ex_get_pool(self, pool_id):
@@ -833,15 +851,24 @@ class DimensionDataLBDriver(Driver):
             response_code = findtext(result, 'responseCode', TYPES_URN)
             return response_code in ['IN_PROGRESS', 'OK']
 
-    def ex_get_nodes(self):
+    def ex_get_nodes(self, network_id=None):
         """
-        Get the nodes within this geography
+        Get the nodes within this geography or in given network.
+
+        :param network_id: UUID of Network Domain
+               if not None returns only balancers in the given network
+               if None then returns all pools for the organization
+        :type  network_id: ``str``
 
         :return: Returns an ``list`` of ``DimensionDataVIPNode``
         :rtype: ``list`` of ``DimensionDataVIPNode``
         """
+        params = None
+        if ( network_id is not None ):
+            params = { "networkDomainId": network_id }
+
         nodes = self.connection \
-            .request_with_orgId_api_2('networkDomainVip/node').object
+            .request_with_orgId_api_2('networkDomainVip/node', params=params).object
         return self._to_nodes(nodes)
 
     def ex_get_node(self, node_id):


Mime
View raw message