2009-08-14 13:35:16 -04:00
|
|
|
unless Fog.mocking?
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class EC2
|
|
|
|
|
|
|
|
# Acquire an elastic IP address.
|
|
|
|
#
|
|
|
|
# ==== Returns
|
2009-11-02 21:48:49 -05:00
|
|
|
# * response<~Excon::Response>:
|
2009-08-14 13:35:16 -04:00
|
|
|
# * body<~Hash>:
|
|
|
|
# * 'publicIp'<~String> - The acquired address
|
|
|
|
# * 'requestId'<~String> - Id of the request
|
|
|
|
def allocate_address
|
|
|
|
request({
|
|
|
|
'Action' => 'AllocateAddress'
|
|
|
|
}, Fog::Parsers::AWS::EC2::AllocateAddress.new)
|
|
|
|
end
|
|
|
|
|
2009-07-13 22:14:59 -04:00
|
|
|
end
|
2009-08-14 13:35:16 -04:00
|
|
|
end
|
|
|
|
end
|
2009-07-13 22:14:59 -04:00
|
|
|
|
2009-08-14 13:35:16 -04:00
|
|
|
else
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class EC2
|
|
|
|
|
|
|
|
def allocate_address
|
2009-11-20 14:08:08 -05:00
|
|
|
response = Excon::Response.new
|
2009-08-14 13:35:16 -04:00
|
|
|
response.status = 200
|
2009-08-16 15:32:36 -04:00
|
|
|
public_ip = Fog::AWS::Mock.ip_address
|
2009-08-14 13:35:16 -04:00
|
|
|
data ={
|
2009-08-14 14:28:57 -04:00
|
|
|
'instanceId' => '',
|
2009-08-16 15:32:36 -04:00
|
|
|
'publicIp' => public_ip
|
2009-08-14 13:35:16 -04:00
|
|
|
}
|
2009-08-20 22:25:52 -04:00
|
|
|
Fog::AWS::EC2.data[:addresses][public_ip] = data
|
2009-08-14 13:35:16 -04:00
|
|
|
response.body = {
|
2009-08-16 15:32:36 -04:00
|
|
|
'publicIp' => public_ip,
|
2009-08-14 13:35:16 -04:00
|
|
|
'requestId' => Fog::AWS::Mock.request_id
|
|
|
|
}
|
|
|
|
response
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2009-07-13 22:14:59 -04:00
|
|
|
end
|
|
|
|
end
|
2009-08-14 13:35:16 -04:00
|
|
|
|
2009-07-13 22:14:59 -04:00
|
|
|
end
|