Class: Fog::Compute::Hyperv::Bios

Inherits:
Hyperv::Model show all
Defined in:
lib/fog/hyperv/models/compute/bios.rb

Instance Method Summary collapse

Methods included from Hyperv::ModelExtends

#lazy_attributes

Methods included from Hyperv::ModelIncludes

#dirty?, #lazy_attributes, #parent

Instance Method Details

#reloadObject



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/fog/hyperv/models/compute/bios.rb', line 36

def reload
  requires :computer_name, :vm_name

  data = service.get_vm_bios(
    computer_name: computer_name,
    vm_name: vm_name,

    _return_fields: self.class.attributes,
    _json_depth: 1
  )
  merge_attributes(data.attributes)
  self
end

#saveObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/fog/hyperv/models/compute/bios.rb', line 14

def save
  requires :computer_name, :vm_name

  raise Fog::Hyperv::Errors::ServiceError, "Can't create Bios instances" unless persisted?

  data = service.set_vm_bios(
    computer_name: computer_name,
    vm_name: vm_name,
    passthru: true,

    disable_num_lock: changed?(:num_lock_enabled) && !num_lock_enabled,
    enable_num_lock: changed?(:num_lock_enabled) && num_lock_enabled,
    startup_order: changed!(:startup_order),

    _return_fields: self.class.attributes,
    _json_depth: 1
  )

  merge_attributes(data)
  self
end