You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2016/10/07 02:25:02 UTC
[06/12] libcloud git commit: Add new DescribeProductTypes API in
Outscale EC2 driver
Add new DescribeProductTypes API in Outscale EC2 driver
Signed-off-by: Javier M. Mellid <jm...@igalia.com>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/c6527a5e
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/c6527a5e
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/c6527a5e
Branch: refs/heads/trunk
Commit: c6527a5ee0ef2440aaf36aecda4cdcc014e0ca8b
Parents: e45b3d0
Author: Javier M. Mellid <jm...@igalia.com>
Authored: Mon Oct 3 13:01:19 2016 +0200
Committer: Anthony Shaw <an...@apache.org>
Committed: Fri Oct 7 13:23:41 2016 +1100
----------------------------------------------------------------------
libcloud/compute/drivers/ec2.py | 41 ++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/c6527a5e/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index 7a4a9d6..cf5184c 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -6908,6 +6908,47 @@ class OutscaleNodeDriver(BaseEC2NodeDriver):
return is_truncated, quota
+ def _to_product_types(self, elem):
+
+ product_types = []
+ for product_types_item in findall(element=elem,
+ xpath='productTypeSet/item',
+ namespace=OUTSCALE_NAMESPACE):
+ productTypeId = findtext(element=product_types_item,
+ xpath='productTypeId',
+ namespace=OUTSCALE_NAMESPACE)
+ description = findtext(element=product_types_item,
+ xpath='description',
+ namespace=OUTSCALE_NAMESPACE)
+ product_types.append({'productTypeId': productTypeId,
+ 'description': description})
+
+ return product_types
+
+ def ex_describe_product_types(self, filters=None):
+ """
+ Describes Product Types.
+
+ :param filters: The filters so that the response includes
+ information for only certain quotas
+ :type filters: ``dict``
+
+ :return: A product types list
+ :rtype: ``list``
+ """
+
+ params = {'Action': 'DescribeProductTypes'}
+
+ if filters:
+ params.update(self._build_filters(filters))
+
+ response = self.connection.request(self.path, params=params,
+ method='GET').object
+
+ product_types = self._to_product_types(response)
+
+ return product_types
+
class OutscaleSASNodeDriver(OutscaleNodeDriver):
"""