2010-11-08 07:21:31 -05:00
|
|
|
require 'fog/core/collection'
|
2011-08-24 21:31:12 -04:00
|
|
|
require 'fog/brightbox/models/compute/cloud_ip'
|
2010-11-08 07:21:31 -05:00
|
|
|
|
|
|
|
module Fog
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
class Brightbox
|
2010-11-08 07:21:31 -05:00
|
|
|
|
|
|
|
class CloudIps < Fog::Collection
|
|
|
|
|
2011-06-16 19:28:54 -04:00
|
|
|
model Fog::Compute::Brightbox::CloudIp
|
2010-11-08 07:21:31 -05:00
|
|
|
|
|
|
|
def all
|
2012-12-22 18:29:21 -05:00
|
|
|
data = service.list_cloud_ips
|
2010-11-08 07:21:31 -05:00
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(identifier)
|
|
|
|
return nil if identifier.nil? || identifier == ""
|
2012-12-22 18:29:21 -05:00
|
|
|
data = service.get_cloud_ip(identifier)
|
2010-11-08 07:21:31 -05:00
|
|
|
new(data)
|
|
|
|
rescue Excon::Errors::NotFound
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
def allocate
|
2012-12-22 18:29:21 -05:00
|
|
|
data = service.create_cloud_ip
|
2010-11-08 07:21:31 -05:00
|
|
|
new(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
2012-12-22 18:29:21 -05:00
|
|
|
end
|