LIBCLOUD-572 internet-gateways-filters for ec2 driver Closes #307
Signed-off-by: Tomaz Muraus <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/ee39aad5 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/ee39aad5 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/ee39aad5 Branch: refs/heads/trunk Commit: ee39aad51021453e4d0425ddcd859b87293c3217 Parents: c414855 Author: Lior Goikhburg <[email protected]> Authored: Tue Jun 3 20:10:57 2014 +0400 Committer: Tomaz Muraus <[email protected]> Committed: Mon Jun 23 12:50:16 2014 +0200 ---------------------------------------------------------------------- CHANGES.rst | 6 ++++++ libcloud/compute/drivers/ec2.py | 19 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/ee39aad5/CHANGES.rst ---------------------------------------------------------------------- diff --git a/CHANGES.rst b/CHANGES.rst index a33bc9e..d5ccdc5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -13,6 +13,12 @@ Compute (LIBCLOUD-571, GITHUB-306) [Lior Goikhburg] +- Allow user to limit a list of internet gateways which are returned by + passing ``gateway_ids`` and ``filters`` argument to the + ``ex_list_internet_gateways`` method in the EC2 driver. + (LIBCLOUD-572, GITHUB-307) + [Lior Goikhburg] + Changes with Apache Libcloud 0.15.0 ----------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/ee39aad5/libcloud/compute/drivers/ec2.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py index 72d9f22..657ae36 100644 --- a/libcloud/compute/drivers/ec2.py +++ b/libcloud/compute/drivers/ec2.py @@ -3992,16 +3992,33 @@ class BaseEC2NodeDriver(NodeDriver): return result - def ex_list_internet_gateways(self): + def ex_list_internet_gateways(self, gateway_ids=None, filters=None): """ Describes available Internet gateways and whether or not they are attached to a VPC. These are required for VPC nodes to communicate over the Internet. + :param gateway_ids: Return only intenet gateways matching the + provided internet gateway IDs. If not + specified, a list of all the internet + gateways in the corresponding region is + returned. + :type gateway_ids: ``list`` + + :param filters: The filters so that the response includes + information for only certain gateways. + :type filters: ``dict`` + :rtype: ``list`` of :class:`.VPCInternetGateway` """ params = {'Action': 'DescribeInternetGateways'} + if gateway_ids: + params.update(self._pathlist('InternetGatewayId', gateway_ids)) + + if filters: + params.update(self._build_filters(filters)) + response = self.connection.request(self.path, params=params).object return self._to_internet_gateways(response, 'internetGatewaySet/item')
