Class: Fog::Hyperv::Compute::Bios
- Defined in:
- lib/fog/hyperv/compute/models/bios.rb
Overview
Configuration for the BIOS settings of a VM
Instance Attribute Summary collapse
-
#computer_name ⇒ String
readonly
The name of the computer running the VM that this BIOS configuration is attached to.
-
#num_lock_enabled ⇒ Boolean
If num-lock should be enabled on boot.
-
#startup_order ⇒ Array<Symbol>
The boot order of the VM.
-
#vm_id ⇒ String
readonly
The GUID of the VM this BIOS configuration is attached to.
Instance Method Summary collapse
-
#reload ⇒ Object
Reload attributes from Hyper-V.
-
#update ⇒ Object
Save any modifications to Hyper-V.
Methods inherited from Model
#initialize, #merge_attributes
Methods included from ModelExtends
Methods included from ModelIncludes
#cluster, #computer, #dirty, #dirty?, #vm
Constructor Details
This class inherits a constructor from Fog::Hyperv::Model
Instance Attribute Details
#computer_name ⇒ String (readonly)
Returns the name of the computer running the VM that this BIOS configuration is attached to.
14 |
# File 'lib/fog/hyperv/compute/models/bios.rb', line 14 attribute :computer_name, type: :string |
#num_lock_enabled ⇒ Boolean
Returns if num-lock should be enabled on boot.
19 |
# File 'lib/fog/hyperv/compute/models/bios.rb', line 19 attribute :num_lock_enabled, type: :boolean |
#startup_order ⇒ Array<Symbol>
Hyper-V only really allows reordering these entries, not adding/removing from the list
Returns the boot order of the VM.
28 |
# File 'lib/fog/hyperv/compute/models/bios.rb', line 28 attribute :startup_order, type: :hypervenumarray, values: Fog::Hyperv::BOOT_DEVICE_ENUM_VALUES |
#vm_id ⇒ String (readonly)
Returns the GUID of the VM this BIOS configuration is attached to.
10 |
# File 'lib/fog/hyperv/compute/models/bios.rb', line 10 identity :vm_id, type: :string |
Instance Method Details
#reload ⇒ Object
Reload attributes from Hyper-V
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/fog/hyperv/compute/models/bios.rb', line 56 def reload requires :vm_id data = service.get_vm_bios( computer_name:, vm_id:, _return_fields: self.class.attributes ) return unless data merge_attributes(data) end |
#update ⇒ Object
Save any modifications to Hyper-V
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/fog/hyperv/compute/models/bios.rb', line 31 def update requires :vm_id # raise ArgumentError, 'Startup order can only be rearranged, not modified' \ # if changed?(:startup_order) && startup_order.sort != old.startup_order.sort changes = { startup_order: changed!(:startup_order) }.compact changes[num_lock_enabled ? :enable_num_lock : :disable_num_lock] = true if changed?(:num_lock_enabled) return self unless changes.any? data = service.set_vm_bios( computer_name:, vm_id:, **changes, _return_fields: self.class.attributes ) merge_attributes(data) end |