libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [01/14] libcloud git commit: Implement update_record.
Date Sun, 06 Dec 2015 06:32:39 GMT
Repository: libcloud
Updated Branches:
  refs/heads/trunk 049dfa4e7 -> c7ffbe780


Implement update_record.


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

Branch: refs/heads/trunk
Commit: b513396e6006acdbd69454cea921c38a52f7cf12
Parents: 91ada1e
Author: Tomaz Muraus <tomaz@tomaz.me>
Authored: Sun Nov 22 16:45:57 2015 +0100
Committer: Tomaz Muraus <tomaz@tomaz.me>
Committed: Sun Dec 6 13:00:29 2015 +0800

----------------------------------------------------------------------
 libcloud/dns/drivers/cloudflare.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/b513396e/libcloud/dns/drivers/cloudflare.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/drivers/cloudflare.py b/libcloud/dns/drivers/cloudflare.py
index 44ed160..751674a 100644
--- a/libcloud/dns/drivers/cloudflare.py
+++ b/libcloud/dns/drivers/cloudflare.py
@@ -152,6 +152,20 @@ class CloudFlareDNSDriver(DNSDriver):
         record = self._to_record(zone=zone, item=result['response']['rec']['obj'])
         return record
 
+    def update_record(self, record, name=None, type=None, data=None,
+                      extra=None):
+        extra = extra or {}
+        params = {'z': record.zone.domain, 'id': record.id}
+
+        params['name'] = name or record.name
+        params['type'] = type or record.type
+        params['content'] = data or record.data
+        params['ttl'] = extra.get('ttl', None) or record.extra['ttl']
+
+        result = self.connection.request(action='rec_edit', params=params).object
+        record = self._to_record(zone=record.zone, item=result['response']['rec']['obj'])
+        return record
+
     def delete_record(self, record):
         params = {'z': record.zone.domain, 'id': record.id}
         result = self.connection.request(action='rec_delete', params=params).object


Mime
View raw message