Class: Fog::Proxmox::Compute::ServerConfig
- Inherits:
-
Model
- Object
- Model
- Fog::Proxmox::Compute::ServerConfig
- Defined in:
- lib/fog/compute/proxmox/models/server_config.rb
Overview
ServerConfig model
Instance Method Summary collapse
- #flatten ⇒ Object
-
#initialize(new_attributes = {}) ⇒ ServerConfig
constructor
A new instance of ServerConfig.
- #mac_addresses ⇒ Object
- #type_console ⇒ Object
Constructor Details
#initialize(new_attributes = {}) ⇒ ServerConfig
Returns a new instance of ServerConfig.
73 74 75 76 77 78 79 80 |
# File 'lib/fog/compute/proxmox/models/server_config.rb', line 73 def initialize(new_attributes = {}) prepare_service_value(new_attributes) Fog::Proxmox::Attributes.set_attr_and_sym('vmid', attributes, new_attributes) requires :vmid initialize_interfaces(new_attributes) initialize_disks(new_attributes) super(new_attributes) end |
Instance Method Details
#flatten ⇒ Object
93 94 95 96 97 98 |
# File 'lib/fog/compute/proxmox/models/server_config.rb', line 93 def flatten flat_hash = attributes.reject { |attribute| [:node_id, :type, :vmid, :disks, :interfaces].include? attribute } flat_hash.merge(interfaces_flatten) flat_hash.merge(disks_flatten) flat_hash end |
#mac_addresses ⇒ Object
82 83 84 |
# File 'lib/fog/compute/proxmox/models/server_config.rb', line 82 def mac_addresses Fog::Proxmox::NicHelper.to_mac_adresses_array(interfaces) end |
#type_console ⇒ Object
86 87 88 89 90 91 |
# File 'lib/fog/compute/proxmox/models/server_config.rb', line 86 def type_console console = 'vnc' if %w[std cirrus vmware].include?(vga) console = 'spice' if %w[qxl qxl2 qxl3 qxl4].include?(vga) console = 'term' if %w[serial0 serial1 serial2 serial3].include?(vga) console end |