Repository: libcloud Updated Branches: refs/heads/trunk 2f20ef358 -> 7c841938a
Add an option to create a static public IP address. Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/cc99a1a9 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/cc99a1a9 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/cc99a1a9 Branch: refs/heads/trunk Commit: cc99a1a937b314dc2663c69d33e5def004bf9375 Parents: 2f20ef3 Author: Aki Ketolainen <[email protected]> Authored: Thu Aug 17 21:06:32 2017 +0300 Committer: Anthony Shaw <[email protected]> Committed: Mon Aug 21 19:02:32 2017 +1000 ---------------------------------------------------------------------- libcloud/compute/drivers/azure_arm.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/cc99a1a9/libcloud/compute/drivers/azure_arm.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py index eb770ad..ca92535 100644 --- a/libcloud/compute/drivers/azure_arm.py +++ b/libcloud/compute/drivers/azure_arm.py @@ -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,
