1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/openstack/models/compute/addresses.rb
Alfonso Juan Dillera 62e73549e6 [openstack|compute] Add requests, models and tests for address
management

- Added tests to already existing requests.
- Modified the all method in the model as it doesn't have the server id
  when querying.
2012-04-30 10:34:58 +08:00

29 lines
585 B
Ruby

require 'fog/core/collection'
require 'fog/openstack/models/compute/address'
module Fog
module Compute
class OpenStack
class Addresses < Fog::Collection
model Fog::Compute::OpenStack::Address
def all(server_id)
load(connection.list_all_addresses(server_id).body['floating_ips'])
end
def get(address_id)
if address = connection.get_address(address_id).body['floating_ip']
new(address)
end
rescue Fog::Compute::OpenStack::NotFound
nil
end
end
end
end
end