Class: Fog::Compute::Vsphere::Servers

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#clusterObject

Returns the value of attribute cluster.



11
12
13
# File 'lib/fog/vsphere/models/compute/servers.rb', line 11

def cluster
  @cluster
end

#datacenterObject

Returns the value of attribute datacenter.



9
10
11
# File 'lib/fog/vsphere/models/compute/servers.rb', line 9

def datacenter
  @datacenter
end

#folderObject

Returns the value of attribute folder.



13
14
15
# File 'lib/fog/vsphere/models/compute/servers.rb', line 13

def folder
  @folder
end

#networkObject

Returns the value of attribute network.



10
11
12
# File 'lib/fog/vsphere/models/compute/servers.rb', line 10

def network
  @network
end

#resource_poolObject

Returns the value of attribute resource_pool.



12
13
14
# File 'lib/fog/vsphere/models/compute/servers.rb', line 12

def resource_pool
  @resource_pool
end

Instance Method Details

#all(filters = { }) ⇒ Object

‘folder’ => ‘/Datacenters/vm/Jeff/Templates’ will be MUCH faster. than simply listing everything.



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fog/vsphere/models/compute/servers.rb', line 17

def all(filters = { })
  f = {
    :datacenter    => datacenter,
    :cluster       => cluster,
    :network       => network,
    :resource_pool => resource_pool,
    :folder        => folder
  }.merge(filters)

  load service.list_virtual_machines(f)
end

#get(id, datacenter = nil) ⇒ Object



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

def get(id, datacenter = nil)
  new service.get_virtual_machine id, datacenter
rescue Fog::Compute::Vsphere::NotFound
  nil
end