2012-01-10 17:20:56 -05:00
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class IBM
|
|
|
|
class Real
|
|
|
|
|
2011-04-26 22:49:05 -07:00
|
|
|
# Requests a new static IP address to be created
|
|
|
|
#
|
|
|
|
# ==== Parameters
|
|
|
|
# * location_id<~String> - id of location
|
|
|
|
# * offering_id<~String> - id for offering
|
|
|
|
# * vlan_id<~String> - id of vlan
|
2012-01-10 17:20:56 -05:00
|
|
|
#
|
|
|
|
# ==== Returns
|
|
|
|
# * response<~Excon::Response>:
|
2011-04-26 22:49:05 -07:00
|
|
|
# * body<~Hash>:
|
|
|
|
# * 'location'<~String>: location of new address
|
|
|
|
# * 'offeringId'<~String>: offering id of new address
|
|
|
|
# * 'id'<~String>: id
|
|
|
|
# * 'ip'<~String>: returns string of spaces (ip not yet allocated right after creation)
|
|
|
|
# * 'state'<~Integer>: status of address (0 when new)
|
2012-02-23 18:26:35 -05:00
|
|
|
def create_address(location, offering_id, options={})
|
2012-01-17 16:34:47 -05:00
|
|
|
request(
|
2012-01-10 17:20:56 -05:00
|
|
|
:method => 'POST',
|
|
|
|
:expects => 200,
|
|
|
|
:path => '/addresses',
|
2012-01-17 16:34:47 -05:00
|
|
|
:body => {
|
|
|
|
'offeringID' => offering_id,
|
|
|
|
'location' => location,
|
2012-02-23 18:26:35 -05:00
|
|
|
'vlanID' => options[:vlan_id]
|
2012-01-17 16:34:47 -05:00
|
|
|
}
|
|
|
|
)
|
2012-01-10 17:20:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2011-12-02 10:27:44 -08:00
|
|
|
|
|
|
|
class Mock
|
|
|
|
|
2012-02-13 10:03:00 -05:00
|
|
|
def create_address(location_id, offering_id="20001223", options={})
|
|
|
|
address = Fog::IBM::Mock.create_address(location_id, offering_id, options)
|
2011-12-02 10:27:44 -08:00
|
|
|
self.data[:addresses][address['id']] = address
|
|
|
|
response = Excon::Response.new
|
|
|
|
response.status = 200
|
|
|
|
response.body = address
|
|
|
|
response
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2012-01-10 17:20:56 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|