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.



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

def vm
  @vm
end

Instance Method Details

#all(_filters = {}) ⇒ Object



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

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



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

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