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

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

Instance Method Summary collapse

Instance Method Details

#all(filter = nil) ⇒ Object



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

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



27
28
29
# File 'lib/fog/compute/vmfusion/servers.rb', line 27

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