You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2014/01/31 19:32:54 UTC
[4/7] git commit: Include subscribed_object attribute on the
Subscription class.
Include subscribed_object attribute on the Subscription class.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/1c6caeb6
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/1c6caeb6
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/1c6caeb6
Branch: refs/heads/trunk
Commit: 1c6caeb60e389b267a900f2051ade2b28c21e349
Parents: 7003847
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Jan 31 18:24:15 2014 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Jan 31 18:24:15 2014 +0100
----------------------------------------------------------------------
libcloud/compute/drivers/cloudsigma.py | 16 ++++++++++++----
libcloud/test/compute/test_cloudsigma_v2_0.py | 1 +
2 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/1c6caeb6/libcloud/compute/drivers/cloudsigma.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudsigma.py b/libcloud/compute/drivers/cloudsigma.py
index 990f906..034f55a 100644
--- a/libcloud/compute/drivers/cloudsigma.py
+++ b/libcloud/compute/drivers/cloudsigma.py
@@ -689,7 +689,7 @@ class CloudSigmaSubscription(object):
"""
def __init__(self, id, resource, amount, period, status, price, start_time,
- end_time, auto_renew):
+ end_time, auto_renew, subscribed_object=None):
"""
:param id: Subscription ID.
:type id: ``str``
@@ -714,6 +714,9 @@ class CloudSigmaSubscription(object):
:param auto_renew: True if the subscription is auto renewed.
:type auto_renew: ``bool``
+
+ :param subscribed_object: Optional UUID of the subscribed object.
+ :type subscribed_object: ``str``
"""
self.id = id
self.resource = resource
@@ -724,13 +727,16 @@ class CloudSigmaSubscription(object):
self.start_time = start_time
self.end_time = end_time
self.auto_renew = auto_renew
+ self.subscribed_object = subscribed_object
def __str__(self):
return self.__repr__()
def __repr__(self):
- return ('<CloudSigmaSubscription id=%s, resource=%s, amount=%s>' %
- (self.id, self.resource, self.amount))
+ return ('<CloudSigmaSubscription id=%s, resource=%s, amount=%s, '
+ 'period=%s, object_uuid=%s>' %
+ (self.id, self.resource, self.amount, self.period,
+ self.subscribed_object))
class CloudSigmaTag(object):
@@ -1904,6 +1910,7 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver):
def _to_subscription(self, data):
start_time = parse_date(data['start_time'])
end_time = parse_date(data['end_time'])
+ obj_uuid = data['subscribed_object']
subscription = CloudSigmaSubscription(id=data['id'],
resource=data['resource'],
@@ -1913,7 +1920,8 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver):
price=data['price'],
start_time=start_time,
end_time=end_time,
- auto_renew=data['auto_renew'])
+ auto_renew=data['auto_renew'],
+ subscribed_object=obj_uuid)
return subscription
def _to_firewall_policy(self, data):
http://git-wip-us.apache.org/repos/asf/libcloud/blob/1c6caeb6/libcloud/test/compute/test_cloudsigma_v2_0.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_cloudsigma_v2_0.py b/libcloud/test/compute/test_cloudsigma_v2_0.py
index aa5035e..358c1e7 100644
--- a/libcloud/test/compute/test_cloudsigma_v2_0.py
+++ b/libcloud/test/compute/test_cloudsigma_v2_0.py
@@ -347,6 +347,7 @@ class CloudSigmaAPI20BaseTestCase(object):
self.assertEqual(subscription.resource, 'vlan')
self.assertEqual(subscription.price, '10.26666666666666666666666667')
self.assertEqual(subscription.auto_renew, False)
+ self.assertEqual(subscription.subscribed_object, '2494079f-8376-40bf-9b37-34d633b8a7b7')
def test_ex_list_subscriptions_status_filterting(self):
CloudSigmaMockHttp.type = 'STATUS_FILTER'