Class: Fog::Vsphere::Compute::Customvalues

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#vmObject

Returns the value of attribute vm.



7
8
9
# File 'lib/fog/vsphere/models/compute/customvalues.rb', line 7

def vm
  @vm
end

Instance Method Details

#all(_filters = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/fog/vsphere/models/compute/customvalues.rb', line 9

def all(_filters = {})
  requires :vm
  case vm
  when Fog::Vsphere::Compute::Server
    load service.list_vm_customvalues(vm.id)
  else
    raise 'customvalues should have vm'
  end
end

#get(key) ⇒ Object



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

def get(key)
  requires :vm
  case vm
  when Fog::Vsphere::Compute::Server
    load service.list_vm_customvalues(vm.id)
  else
    raise 'customvalues should have vm'
  end.find { |cv| cv.key == key }
end