2010-11-08 07:21:31 -05:00
|
|
|
require 'fog/core/collection'
|
|
|
|
require 'fog/brightbox/models/compute/cloud_ip'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Brightbox
|
|
|
|
class Compute
|
|
|
|
|
|
|
|
class CloudIps < Fog::Collection
|
|
|
|
|
|
|
|
model Fog::Brightbox::Compute::CloudIp
|
|
|
|
|
|
|
|
def all
|
2010-11-09 12:40:04 -05:00
|
|
|
data = connection.list_cloud_ips
|
2010-11-08 07:21:31 -05:00
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(identifier)
|
|
|
|
return nil if identifier.nil? || identifier == ""
|
2010-11-09 12:40:04 -05:00
|
|
|
data = connection.get_cloud_ip(identifier)
|
2010-11-08 07:21:31 -05:00
|
|
|
new(data)
|
|
|
|
rescue Excon::Errors::NotFound
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
def allocate
|
2010-11-09 12:40:04 -05:00
|
|
|
data = connection.create_cloud_ip
|
2010-11-08 07:21:31 -05:00
|
|
|
new(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|