1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #879 from ack/bugfix/vpc-release-address

[aws|address] fixes release_address for VPC EIPs
This commit is contained in:
Wesley Beary 2012-04-26 14:56:12 -07:00
commit 910923771e

View file

@ -14,10 +14,18 @@ module Fog
# * 'return'<~Boolean> - success?
#
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ReleaseAddress.html]
def release_address(public_ip)
#
# non-VPC: requires public_ip only
# VPC: requires allocation_id only
def release_address(ip_or_allocation)
field = if ip_or_allocation.to_s =~ /^(\d|\.)+$/
"PublicIp"
else
"AllocationId"
end
request(
'Action' => 'ReleaseAddress',
'PublicIp' => public_ip,
field => ip_or_allocation,
:idempotent => true,
:parser => Fog::Parsers::Compute::AWS::Basic.new
)