Repository: libcloud
Updated Branches:
  refs/heads/trunk e71615f8d -> ee39aad51


LIBCLOUD-571 subnet-filters for ec2 driver

Closes #306

Signed-off-by: Tomaz Muraus <to...@apache.org>


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

Branch: refs/heads/trunk
Commit: c4148551d062a4e20d4b79369534f1729f4af626
Parents: e71615f
Author: Lior Goikhburg <goikhb...@gmail.com>
Authored: Tue Jun 3 18:44:41 2014 +0400
Committer: Tomaz Muraus <to...@apache.org>
Committed: Mon Jun 23 12:44:56 2014 +0200

----------------------------------------------------------------------
 CHANGES.rst                     | 12 ++++++++++++
 libcloud/compute/drivers/ec2.py | 18 +++++++++++++++++-
 2 files changed, 29 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/c4148551/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 5e2dcca..a33bc9e 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,6 +1,18 @@
 Changelog
 =========
 
+Changes with Apache Libcloud in development
+-------------------------------------------
+
+Compute
+~~~~~~~
+
+- Allow user to limit a list of subnets which are returned by passing
+  ``subnet_ids`` and ``filters`` argument to the ``ex_list_subnets``
+  method in the EC2 driver.
+  (LIBCLOUD-571, GITHUB-306)
+  [Lior Goikhburg]
+
 Changes with Apache Libcloud 0.15.0
 -----------------------------------
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/c4148551/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index 1f86789..72d9f22 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -2610,15 +2610,31 @@ class BaseEC2NodeDriver(NodeDriver):
 
         return element == 'true'
 
-    def ex_list_subnets(self):
+    def ex_list_subnets(self, subnet_ids=None, filters=None):
         """
         Return a list of :class:`EC2NetworkSubnet` objects for the
         current region.
 
+        :param      subnet_ids: Return only subnets matching the provided
+                                subnet IDs. If not specified, a list of all
+                                the subnets in the corresponding region
+                                is returned.
+        :type       subnet_ids: ``list``
+
+        :param      filters: The filters so that the response includes
+                             information for only certain subnets.
+        :type       filters: ``dict``
+
         :rtype:     ``list`` of :class:`EC2NetworkSubnet`
         """
         params = {'Action': 'DescribeSubnets'}
 
+        if subnet_ids:
+            params.update(self._pathlist('SubnetId', subnet_ids))
+
+        if filters:
+            params.update(self._build_filters(filters))
+
         return self._to_subnets(
             self.connection.request(self.path, params=params).object
         )

Reply via email to