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/glesys/models/compute/ips.rb

39 lines
846 B
Ruby

require 'fog/core/collection'
require 'fog/glesys/models/compute/ip'
module Fog
module Compute
class Glesys
class Ips < Fog::Collection
model Fog::Glesys::Compute::Ip
attribute :serverid
def all
data = connection.ip_list_own.body['response']['iplist']
load(data)
end
def get(identifier)
return nil if identifier.nil? || identifier == ""
self.new( :serverid => identifier )
data = connection.ip_list_own(:serverid => identifier).body['response']
if data['iplist'].empty?
nil
else
new(data['iplist'].first)
end
end
def new(attributes = {})
super({ :serverid => serverid }.merge!(attributes))
end
end
end
end
end