Add an option to create a static public IP address.
@@ -1609,7 +1609,8 @@ class AzureNodeDriver(NodeDriver):
params={"api-version": "2015-06-15"})
return [self._to_ip_address(net) for net in r.object["value"]]
- def ex_create_public_ip(self, name, resource_group, location=None):
+ def ex_create_public_ip(self, name, resource_group, location=None,
+ publicIPAllocationMethod=None):
"""
Create a public IP resources.
@@ -1623,6 +1624,11 @@ class AzureNodeDriver(NodeDriver):
(if None, use default location specified as 'region' in __init__)
:type location: :class:`.NodeLocation`
+ :param publicIPAllocationMethod: Call ex_create_public_ip with
+ publicIPAllocationMethod="Static" to create a static public
+ IP address
+ :type publicIPAllocationMethod: ``str``
+
:return: The newly created public ip object
:rtype: :class:`.AzureIPAddress`
"""
@@ -1642,6 +1648,10 @@ class AzureNodeDriver(NodeDriver):
"publicIPAllocationMethod": "Dynamic"
}
}
+
+ if publicIPAllocationMethod == "Static":
+ data['properties']['publicIPAllocationMethod'] = "Static"
+
r = self.connection.request(target,
params={"api-version": "2015-06-15"},
data=data,
