Class: Fog::Vsphere::Compute::Servers
- Inherits:
-
Collection
- Object
- Collection
- Fog::Vsphere::Compute::Servers
- Defined in:
- lib/fog/vsphere/models/compute/servers.rb
Instance Attribute Summary collapse
-
#cluster ⇒ Object
Returns the value of attribute cluster.
-
#datacenter ⇒ Object
Returns the value of attribute datacenter.
-
#folder ⇒ Object
Returns the value of attribute folder.
-
#network ⇒ Object
Returns the value of attribute network.
-
#recursive ⇒ Object
Returns the value of attribute recursive.
-
#resource_pool ⇒ Object
Returns the value of attribute resource_pool.
Instance Method Summary collapse
-
#all(filters = {}) ⇒ Object
‘folder’ => ‘/Datacenters/vm/Jeff/Templates’ will be MUCH faster.
- #get(id, datacenter = nil) ⇒ Object
-
#new(attributes = {}) ⇒ Object
Pass attributes we know about down to any VM we’re creating.
Instance Attribute Details
#cluster ⇒ Object
Returns the value of attribute cluster.
10 11 12 |
# File 'lib/fog/vsphere/models/compute/servers.rb', line 10 def cluster @cluster end |
#datacenter ⇒ Object
Returns the value of attribute datacenter.
8 9 10 |
# File 'lib/fog/vsphere/models/compute/servers.rb', line 8 def datacenter @datacenter end |
#folder ⇒ Object
Returns the value of attribute folder.
12 13 14 |
# File 'lib/fog/vsphere/models/compute/servers.rb', line 12 def folder @folder end |
#network ⇒ Object
Returns the value of attribute network.
9 10 11 |
# File 'lib/fog/vsphere/models/compute/servers.rb', line 9 def network @network end |
#recursive ⇒ Object
Returns the value of attribute recursive.
13 14 15 |
# File 'lib/fog/vsphere/models/compute/servers.rb', line 13 def recursive @recursive end |
#resource_pool ⇒ Object
Returns the value of attribute resource_pool.
11 12 13 |
# File 'lib/fog/vsphere/models/compute/servers.rb', line 11 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 28 |
# 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, recursive: recursive }.merge(filters) load service.list_virtual_machines(f) end |
#get(id, datacenter = nil) ⇒ Object
30 31 32 33 34 |
# File 'lib/fog/vsphere/models/compute/servers.rb', line 30 def get(id, datacenter = nil) new service.get_virtual_machine id, datacenter, folder, recursive rescue Fog::Vsphere::Compute::NotFound nil end |
#new(attributes = {}) ⇒ Object
Pass attributes we know about down to any VM we’re creating
37 38 39 40 41 42 43 44 |
# File 'lib/fog/vsphere/models/compute/servers.rb', line 37 def new(attributes = {}) super({ datacenter: datacenter, path: folder, cluster: cluster, resource_pool: resource_pool }.merge(attributes)) end |