Class: Fog::Compute::Vmfusion::Servers

Inherits:
Fog::Collection
  • Object
show all
Defined in:
lib/fog/vmfusion/models/compute/servers.rb

Instance Method Summary collapse

Instance Method Details

#all(filter = nil) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fog/vmfusion/models/compute/servers.rb', line 10

def all(filter = nil)
  data = []

  states = ::Fission::VM.all_with_status.data

  filter = {} if filter.nil?
  unless filter.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

#get(name) ⇒ Object



30
31
32
# File 'lib/fog/vmfusion/models/compute/servers.rb', line 30

def get(name)
  self.all(:name => name).first
end