Class: VagrantPlugins::ArubaCloud::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::ArubaCloud::Config
- Defined in:
- lib/vagrant-arubacloud/config.rb
Instance Attribute Summary collapse
-
#arubacloud_password ⇒ String
ArubaCloud Password.
-
#arubacloud_username ⇒ String
ArubaCloud Username.
-
#cpu_number ⇒ Integer
Number of Virtual CPU to be assigned to the VM Pro VMWare: 1 < n < 8 Pro Hyper-V: 1 < n < 4.
-
#endpoint ⇒ String
Ws EndPoint id : can be dc2,dc2,dc3,…dc8 (dc7 is not defined at this release).
-
#hds ⇒ Array
Array containing hard disk Configuration Example configuration (size is expressed in GB): Hds = [=> 0, :size => 100, => 1, :size => 200] Hd type 0 is required because specify the first hard disk, max size per hd: 500 GB Hd type > 0 < 4 are 3 additional hard disks (optional).
-
#package_id ⇒ String
The smart vm type expressed as String: ‘small’ ‘medium’ ‘large’ ‘extra large’.
-
#ram_qty ⇒ Integer
Amount of GB of RAM to be assigned to the VM n <= 16.
-
#reserved_list_owned ⇒ Object
Returns the value of attribute reserved_list_owned.
-
#reserved_status ⇒ Object
reserved for internal use.
-
#server_name ⇒ String
The name of the server.
-
#service_type ⇒ Integer
Service Type expressed in ID [Integer]: 1 = Pro Hyper-V 2 = Pro VMWare 3 = Pro Hyper-V Low Cost 4 = Smart.
-
#template_id ⇒ Integer
The ID of the template to use, use vagrant arubacloud templates to obtain the complete list.
-
#url ⇒ String
Ws EndPoint Url Expected to be the url of the web service to use.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate(machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/vagrant-arubacloud/config.rb', line 86 def initialize @arubacloud_username = UNSET_VALUE @arubacloud_password = UNSET_VALUE @url = UNSET_VALUE @reserved_status = UNSET_VALUE @reserved_list_owned = UNSET_VALUE @endpoint = UNSET_VALUE @server_name = UNSET_VALUE @template_id = UNSET_VALUE @package_id = UNSET_VALUE @service_type = UNSET_VALUE @cpu_number = UNSET_VALUE @ram_qty = UNSET_VALUE @hds = UNSET_VALUE end |
Instance Attribute Details
#arubacloud_password ⇒ String
ArubaCloud Password
26 27 28 |
# File 'lib/vagrant-arubacloud/config.rb', line 26 def arubacloud_password @arubacloud_password end |
#arubacloud_username ⇒ String
ArubaCloud Username
22 23 24 |
# File 'lib/vagrant-arubacloud/config.rb', line 22 def arubacloud_username @arubacloud_username end |
#cpu_number ⇒ Integer
Number of Virtual CPU to be assigned to the VM Pro VMWare: 1 < n < 8 Pro Hyper-V: 1 < n < 4
71 72 73 |
# File 'lib/vagrant-arubacloud/config.rb', line 71 def cpu_number @cpu_number end |
#endpoint ⇒ String
Ws EndPoint id : can be dc2,dc2,dc3,…dc8 (dc7 is not defined at this release)
39 40 41 |
# File 'lib/vagrant-arubacloud/config.rb', line 39 def endpoint @endpoint end |
#hds ⇒ Array
Array containing hard disk Configuration Example configuration (size is expressed in GB): Hds = [=> 0, :size => 100, => 1, :size => 200] Hd type 0 is required because specify the first hard disk, max size per hd: 500 GB Hd type > 0 < 4 are 3 additional hard disks (optional)
84 85 86 |
# File 'lib/vagrant-arubacloud/config.rb', line 84 def hds @hds end |
#package_id ⇒ String
The smart vm type expressed as String: ‘small’ ‘medium’ ‘large’ ‘extra large’
57 58 59 |
# File 'lib/vagrant-arubacloud/config.rb', line 57 def package_id @package_id end |
#ram_qty ⇒ Integer
Amount of GB of RAM to be assigned to the VM n <= 16
76 77 78 |
# File 'lib/vagrant-arubacloud/config.rb', line 76 def ram_qty @ram_qty end |
#reserved_list_owned ⇒ Object
Returns the value of attribute reserved_list_owned.
30 31 32 |
# File 'lib/vagrant-arubacloud/config.rb', line 30 def reserved_list_owned @reserved_list_owned end |
#reserved_status ⇒ Object
reserved for internal use
29 30 31 |
# File 'lib/vagrant-arubacloud/config.rb', line 29 def reserved_status @reserved_status end |
#server_name ⇒ String
The name of the server. This defaults to the name of the machine defined by Vagrant (via ‘config.vm.define’), but can be override here.
44 45 46 |
# File 'lib/vagrant-arubacloud/config.rb', line 44 def server_name @server_name end |
#service_type ⇒ Integer
Service Type expressed in ID [Integer]: 1 = Pro Hyper-V 2 = Pro VMWare 3 = Pro Hyper-V Low Cost 4 = Smart
65 66 67 |
# File 'lib/vagrant-arubacloud/config.rb', line 65 def service_type @service_type end |
#template_id ⇒ Integer
The ID of the template to use, use vagrant arubacloud templates to obtain the complete list.
49 50 51 |
# File 'lib/vagrant-arubacloud/config.rb', line 49 def template_id @template_id end |
#url ⇒ String
Ws EndPoint Url Expected to be the url of the web service to use
35 36 37 |
# File 'lib/vagrant-arubacloud/config.rb', line 35 def url @url end |
Instance Method Details
#finalize! ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/vagrant-arubacloud/config.rb', line 102 def finalize! @arubacloud_username = nil if @arubacloud_username == UNSET_VALUE @arubacloud_password = nil if @arubacloud_password == UNSET_VALUE @url = nil if @url == UNSET_VALUE @reserved_status = nil if @reserved_status = UNSET_VALUE @reserved_list_owned = nil if @reserved_list_owned = UNSET_VALUE @endpoint = nil if @endpoint == UNSET_VALUE @server_name = nil if @server_name == UNSET_VALUE @template_id = nil if @template_id == UNSET_VALUE @package_id = nil if @package_id == UNSET_VALUE @service_type = nil if @service_type == UNSET_VALUE @cpu_number = nil if @cpu_number == UNSET_VALUE @ram_qty = nil if @ram_qty == UNSET_VALUE @hds = nil if @hds == UNSET_VALUE end |
#validate(machine) ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/vagrant-arubacloud/config.rb', line 118 def validate(machine) errors = _detected_errors # Global configurations needed by all service types errors << I18n.t('vagrant_arubacloud.config.arubacloud_username_required') unless @arubacloud_username errors << I18n.t('vagrant_arubacloud.config.arubacloud_password_required') unless @arubacloud_password errors << I18n.t('vagrant_arubacloud.config.template_id_required') unless @template_id errors << I18n.t('vagrant_arubacloud.config.service_type_required') unless @service_type errors << I18n.t('vagrant_arubacloud.config.ssh_password_required') unless machine.config.ssh.password #check if coded url or endpoint #if url not in table or dc wrong return error if (@url) if (DC_TABLES.key(@url)) @endpoint = DC_TABLES.key(@url) else errors << I18n.t('vagrant_arubacloud.config.url_is_wrong') end else if (@endpoint) if DC_TABLES.key?(@endpoint.to_sym) @url = DC_TABLES[@endpoint.to_sym] else errors << I18n.t('vagrant_arubacloud.config.endpoint_is_wrong') end else @endpoint = DC_DEFAULT.to_sym @url = DC_TABLES[DC_DEFAULT.to_sym] end end if @service_type.eql? 4 errors << I18n.t('vagrant_arubacloud.config.package_id_required') unless @package_id else errors << I18n.t('vagrant_arubacloud.config.cpu_number_required') unless @cpu_number errors << I18n.t('vagrant_arubacloud.config.ram_qty_required') unless @ram_qty if @hds errors << I18n.t('vagrant_arubacloud.config.hds_conf_must_be_array') unless @hds.kind_of?(Array) elsif errors << I18n.t('vagrant_arubacloud.config.hds_conf_required') end end {'ArubaCloud Provider' => errors} end |