Class: VagrantPlugins::AliyunECS::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-aliyun/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/vagrant-aliyun/config.rb', line 19

def initialize()
  @access_key_id = UNSET_VALUE
  @access_key_secret = UNSET_VALUE
  @region_id = UNSET_VALUE
  @image_id = UNSET_VALUE
  @instance_type = UNSET_VALUE
  @internet_max_bandwidth_out = UNSET_VALUE
  @security_group_id = UNSET_VALUE
  @password = UNSET_VALUE
  @instance_charge_type = UNSET_VALUE
  @instance_period = UNSET_VALUE
  @instance_ready_timeout = UNSET_VALUE
end

Instance Attribute Details

#access_key_idObject

Returns the value of attribute access_key_id.



7
8
9
# File 'lib/vagrant-aliyun/config.rb', line 7

def access_key_id
  @access_key_id
end

#access_key_secretObject

Returns the value of attribute access_key_secret.



8
9
10
# File 'lib/vagrant-aliyun/config.rb', line 8

def access_key_secret
  @access_key_secret
end

#image_idObject

Returns the value of attribute image_id.



10
11
12
# File 'lib/vagrant-aliyun/config.rb', line 10

def image_id
  @image_id
end

#instance_charge_typeObject

Returns the value of attribute instance_charge_type.



15
16
17
# File 'lib/vagrant-aliyun/config.rb', line 15

def instance_charge_type
  @instance_charge_type
end

#instance_periodObject

Returns the value of attribute instance_period.



16
17
18
# File 'lib/vagrant-aliyun/config.rb', line 16

def instance_period
  @instance_period
end

#instance_ready_timeoutObject

Returns the value of attribute instance_ready_timeout.



17
18
19
# File 'lib/vagrant-aliyun/config.rb', line 17

def instance_ready_timeout
  @instance_ready_timeout
end

#instance_typeObject

Returns the value of attribute instance_type.



11
12
13
# File 'lib/vagrant-aliyun/config.rb', line 11

def instance_type
  @instance_type
end

#internet_max_bandwidth_outObject

Returns the value of attribute internet_max_bandwidth_out.



12
13
14
# File 'lib/vagrant-aliyun/config.rb', line 12

def internet_max_bandwidth_out
  @internet_max_bandwidth_out
end

#passwordObject

Returns the value of attribute password.



14
15
16
# File 'lib/vagrant-aliyun/config.rb', line 14

def password
  @password
end

#region_idObject

Returns the value of attribute region_id.



9
10
11
# File 'lib/vagrant-aliyun/config.rb', line 9

def region_id
  @region_id
end

#security_group_idObject

Returns the value of attribute security_group_id.



13
14
15
# File 'lib/vagrant-aliyun/config.rb', line 13

def security_group_id
  @security_group_id
end

Instance Method Details

#finalize!Object



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/vagrant-aliyun/config.rb', line 33

def finalize!
  @access_key_id = nil if @access_key_id == UNSET_VALUE
  @access_key_secret = nil if @access_key_secret == UNSET_VALUE
  @region_id = nil if @region_id == UNSET_VALUE
  @image_id = nil if @image_id == UNSET_VALUE
  @instance_type = nil if @instance_type == UNSET_VALUE
  @internet_max_bandwidth_out = nil if @internet_max_bandwidth_out == UNSET_VALUE
  @security_group_id = nil if @security_group_id == UNSET_VALUE
  @password = nil if @password == UNSET_VALUE
  @instance_charge_type = nil if @instance_charge_type == UNSET_VALUE
  @instance_period = nil if @instance_period == UNSET_VALUE
  @instance_ready_timeout = 120 if @instance_ready_timeout == UNSET_VALUE
end

#validate(machine) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/vagrant-aliyun/config.rb', line 47

def validate(machine)
  errors = _detected_errors
  errors << I18n.t("vagrant_aliyun.config.access_key_id_required") if @access_key_id.nil?
  errors << I18n.t("vagrant_aliyun.config.access_key_secret_required") if @access_key_secret.nil?
  errors << I18n.t("vagrant_aliyun.config.region_id_required") if @region_id.nil?
  errors << I18n.t("vagrant_aliyun.config.image_id_required") if @image_id.nil?
  errors << I18n.t("vagrant_aliyun.config.instance_type_required") if @instance_type.nil?
  errors << I18n.t("vagrant_aliyun.config.internet_max_bandwidth_out_required") if @internet_max_bandwidth_out.nil?
  errors << I18n.t("vagrant_aliyun.config.security_group_id_required") if @security_group_id.nil?
  errors << I18n.t("vagrant_aliyun.config.password_required") if @password.nil?
  errors << I18n.t("vagrant_aliyun.config.instance_charge_type_required") if @instance_charge_type.nil?
  if @instance_charge_type != nil && @instance_charge_type == 'PrePaid' && @instance_period == nil
    errors << I18n.t("vagrant_aliyun.config.instance_period_required")
  end
  { "Aliyun Provider" => errors }
end