Class: VagrantPlugins::Scaleway::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::Scaleway::Config
- Defined in:
- lib/vagrant-scaleway/config.rb
Instance Attribute Summary collapse
-
#bootscript ⇒ String
The bootscript ID.
-
#commercial_type ⇒ String
The type of the server to launch, such as ‘C1’.
-
#image ⇒ String
The image ID.
-
#name ⇒ String
The name of the server.
-
#organization ⇒ String
The organization ID.
-
#region ⇒ String
The name of the Scaleway region to create the server in.
-
#security_group ⇒ String
The security group ID to associate with the server.
-
#server_check_interval ⇒ Fixnum
The interval to wait for checking a server’s state.
-
#server_ready_timeout ⇒ Fixnum
The timeout to wait for a server to become ready.
-
#ssh_host_attribute ⇒ Symbol
Specifies which address to connect to with ssh.
-
#tags ⇒ Array
Tags to apply to the server.
-
#token ⇒ String
The API token to access Scaleway.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/vagrant-scaleway/config.rb', line 77 def initialize @bootscript = UNSET_VALUE @commercial_type = UNSET_VALUE @image = UNSET_VALUE @name = UNSET_VALUE @organization = UNSET_VALUE @region = UNSET_VALUE @server_check_interval = UNSET_VALUE @server_ready_timeout = UNSET_VALUE @security_group = UNSET_VALUE @ssh_host_attribute = UNSET_VALUE @tags = [] @token = UNSET_VALUE end |
Instance Attribute Details
#bootscript ⇒ String
The bootscript ID. If nil, the default bootscript for the image will be used.
8 9 10 |
# File 'lib/vagrant-scaleway/config.rb', line 8 def bootscript @bootscript end |
#commercial_type ⇒ String
The type of the server to launch, such as ‘C1’. Defaults to ‘C2S’.
13 14 15 |
# File 'lib/vagrant-scaleway/config.rb', line 13 def commercial_type @commercial_type end |
#image ⇒ String
The image ID.
18 19 20 |
# File 'lib/vagrant-scaleway/config.rb', line 18 def image @image end |
#name ⇒ String
The name of the server.
23 24 25 |
# File 'lib/vagrant-scaleway/config.rb', line 23 def name @name end |
#organization ⇒ String
The organization ID. It can also be configured with SCW_ORGANIZATION environment variable.
29 30 31 |
# File 'lib/vagrant-scaleway/config.rb', line 29 def organization @organization end |
#region ⇒ String
The name of the Scaleway region to create the server in. It can also be configured with SCW_REGION environment variable. Defaults to par1.
35 36 37 |
# File 'lib/vagrant-scaleway/config.rb', line 35 def region @region end |
#security_group ⇒ String
The security group ID to associate with the server. If nil, organization’s default security group will be used.
41 42 43 |
# File 'lib/vagrant-scaleway/config.rb', line 41 def security_group @security_group end |
#server_check_interval ⇒ Fixnum
The interval to wait for checking a server’s state. Defaults to 2 seconds.
47 48 49 |
# File 'lib/vagrant-scaleway/config.rb', line 47 def server_check_interval @server_check_interval end |
#server_ready_timeout ⇒ Fixnum
The timeout to wait for a server to become ready. Defaults to 120 seconds.
53 54 55 |
# File 'lib/vagrant-scaleway/config.rb', line 53 def server_ready_timeout @server_ready_timeout end |
#ssh_host_attribute ⇒ Symbol
Specifies which address to connect to with ssh. Must be one of:
- :public_ip_address
- :public_dns_name
- :private_ip_address
- :private_dns_name
This attribute also accepts an array of symbols.
64 65 66 |
# File 'lib/vagrant-scaleway/config.rb', line 64 def ssh_host_attribute @ssh_host_attribute end |
#tags ⇒ Array
Tags to apply to the server.
69 70 71 |
# File 'lib/vagrant-scaleway/config.rb', line 69 def @tags end |
#token ⇒ String
The API token to access Scaleway. It can also be configured with SCW_TOKEN environment variable.
75 76 77 |
# File 'lib/vagrant-scaleway/config.rb', line 75 def token @token end |
Instance Method Details
#finalize! ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/vagrant-scaleway/config.rb', line 92 def finalize! @bootscript = nil if @bootscript == UNSET_VALUE @commercial_type = 'C2S' if @commercial_type == UNSET_VALUE @image = '75c28f52-6c64-40fc-bb31-f53ca9d02de9' if @image == UNSET_VALUE if @name == UNSET_VALUE require 'securerandom' @name = "scw-#{SecureRandom.hex(3)}" end @organization = ENV['SCW_ORGANIZATION'] if @organization == UNSET_VALUE @region = (ENV['SCW_REGION'] || 'par1') if @region == UNSET_VALUE @server_check_interval = 2 if @server_check_interval == UNSET_VALUE @server_ready_timeout = 120 if @server_ready_timeout == UNSET_VALUE @security_group = nil if @security_group == UNSET_VALUE @ssh_host_attribute = nil if @ssh_host_attribute == UNSET_VALUE @token = ENV['SCW_TOKEN'] if @token == UNSET_VALUE end |