Class: Fog::Compute::Hyperv::Firmware

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

Instance Method Summary collapse

Methods inherited from Hyperv::Model

#initialize

Methods included from Hyperv::ModelExtends

#lazy_attributes

Methods included from Hyperv::ModelIncludes

#cluster, #computer, #dirty?, #lazy_attributes, #parent, #vm

Constructor Details

This class inherits a constructor from Fog::Hyperv::Model

Instance Method Details

#reloadObject



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

def reload
  requires :computer_name, :vm_name

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

    _return_fields: self.class.attributes
  )
  merge_attributes(data)
  @old = data
  self
end

#saveObject



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

def save
  requires :computer_name, :vm_name

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

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

    enable_secure_boot: changed!(:secure_boot),
    preferred_network_boot_protocol: changed!(:preferred_network_boot_protocol),
    console_mode: changed!(:console_mode),

    _return_fields: self.class.attributes
  )

  merge_attributes(data)
  @old = dup
  self
end