libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [03/10] git commit: GCE: add a parameter to ex_create_address to promote specific ephemeral addresses to static ones.
Date Sat, 20 Sep 2014 20:19:35 GMT
GCE: add a parameter to ex_create_address to promote specific ephemeral addresses to static
ones.

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


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

Branch: refs/heads/trunk
Commit: 951fb161a4b5c67ca43e64cee9011bfbf2aca992
Parents: 6ab8fb5
Author: Evgeny Egorochkin <phreedom@yandex.ru>
Authored: Tue Jul 1 06:41:42 2014 +0300
Committer: Tomaz Muraus <tomaz@apache.org>
Committed: Sat Sep 20 22:06:36 2014 +0200

----------------------------------------------------------------------
 libcloud/compute/drivers/gce.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/951fb161/libcloud/compute/drivers/gce.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py
index 9e65b92..f096637 100644
--- a/libcloud/compute/drivers/gce.py
+++ b/libcloud/compute/drivers/gce.py
@@ -910,7 +910,7 @@ class GCENodeDriver(NodeDriver):
         list_zones = [self._to_zone(z) for z in response['items']]
         return list_zones
 
-    def ex_create_address(self, name, region=None):
+    def ex_create_address(self, name, region=None, address=None):
         """
         Create a static address in a region.
 
@@ -920,6 +920,10 @@ class GCENodeDriver(NodeDriver):
         :keyword  region: Name of region for the address (e.g. 'us-central1')
         :type     region: ``str`` or :class:`GCERegion`
 
+        :keyword  address: Ephemeral IP address to promote to a static one
+                           (e.g. 'xxx.xxx.xxx.xxx')
+        :type     address: ``str`` or ``None``
+
         :return:  Static Address object
         :rtype:   :class:`GCEAddress`
         """
@@ -930,6 +934,8 @@ class GCENodeDriver(NodeDriver):
             raise ValueError('REGION_NOT_SPECIFIED',
                              'Region must be provided for an address')
         address_data = {'name': name}
+        if address:
+            address_data['address'] = address
         request = '/regions/%s/addresses' % (region.name)
         self.connection.async_request(request, method='POST',
                                       data=address_data)


Mime
View raw message