mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
62e73549e6
management - Added tests to already existing requests. - Modified the all method in the model as it doesn't have the server id when querying.
29 lines
585 B
Ruby
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
|
|
|