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/vmfusion/models/compute/servers.rb

42 lines
911 B
Ruby
Raw Normal View History

require 'fog/core/collection'
require 'fog/vmfusion/models/compute/server'
module Fog
module Compute
class Vmfusion
class Servers < Fog::Collection
model Fog::Compute::Vmfusion::Server
def all(filter = nil)
data = []
states = ::Fission::VM.all_with_status.data
filter = {} if filter.nil?
unless filter.has_key?(:name)
vms=::Fission::VM.all.data
vms.each do |vm|
data << { :raw => { :fission => vm,
:state => states[vm.name] } }
end
else
data << { :raw => { :fission => ::Fission::VM.new(filter[:name]),
:state => states[filter[:name]] } }
end
load(data)
end
def get(name)
self.all(:name => name).first
end
end
end
end
end