2010-03-16 15:46:21 -07:00
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
module EC2
|
|
|
|
class Real
|
2009-08-24 20:59:19 -07:00
|
|
|
|
|
|
|
# Disassociate an elastic IP address from its instance (if any)
|
|
|
|
#
|
|
|
|
# ==== Parameters
|
|
|
|
# * public_ip<~String> - Public ip to assign to instance
|
|
|
|
#
|
|
|
|
# ==== Returns
|
2009-11-02 18:48:49 -08:00
|
|
|
# * response<~Excon::Response>:
|
2009-08-24 20:59:19 -07:00
|
|
|
# * body<~Hash>:
|
|
|
|
# * 'requestId'<~String> - Id of request
|
|
|
|
# * 'return'<~Boolean> - success?
|
|
|
|
def disassociate_address(public_ip)
|
2010-03-15 22:15:33 -07:00
|
|
|
request(
|
|
|
|
'Action' => 'DisassociateAddress',
|
|
|
|
'PublicIp' => public_ip,
|
|
|
|
:parser => Fog::Parsers::AWS::EC2::Basic.new
|
|
|
|
)
|
2009-08-24 20:59:19 -07:00
|
|
|
end
|
|
|
|
|
2009-07-22 22:25:24 -07:00
|
|
|
end
|
|
|
|
|
2010-03-16 15:46:21 -07:00
|
|
|
class Mock
|
2009-08-24 20:59:19 -07:00
|
|
|
|
|
|
|
def disassociate_address(public_ip)
|
2009-11-20 11:08:08 -08:00
|
|
|
response = Excon::Response.new
|
2009-08-24 20:59:19 -07:00
|
|
|
response.status = 200
|
2010-03-16 15:46:21 -07:00
|
|
|
if address = @data[:addresses][public_ip]
|
2010-05-05 14:22:22 -07:00
|
|
|
address['instanceId'] = nil
|
2009-08-24 20:59:19 -07:00
|
|
|
response.status = 200
|
|
|
|
response.body = {
|
|
|
|
'requestId' => Fog::AWS::Mock.request_id,
|
|
|
|
'return' => true
|
|
|
|
}
|
|
|
|
else
|
|
|
|
response.status = 400
|
2009-11-20 11:08:08 -08:00
|
|
|
raise(Excon::Errors.status_error({:expects => 200}, response))
|
2009-08-24 20:59:19 -07:00
|
|
|
end
|
|
|
|
response
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2009-07-22 22:25:24 -07:00
|
|
|
end
|
|
|
|
end
|
2009-08-24 20:59:19 -07:00
|
|
|
end
|