Class: VagrantPlugins::CommandDns::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::CommandDns::Config
- Defined in:
- lib/vagrant-command-dns/config.rb
Instance Attribute Summary collapse
-
#__skip ⇒ Object
Returns the value of attribute __skip.
-
#aliases ⇒ Array<String>
List of VM aliases in FQDN format.
-
#host_skip_aliases ⇒ Array<String>
List of disallowed aliases in FQDN format.
-
#route53_access_key_id ⇒ String
The access key ID for accessing AWS.
-
#route53_secret_access_key ⇒ String
The secret access key for accessing AWS.
-
#route53_session_token ⇒ String
The token associated with the key for accessing AWS.
-
#route53_skip_aliases ⇒ Array<String>
List of disallowed aliases in FQDN format.
-
#route53_version ⇒ String
The version of the AWS api to use.
-
#route53_zone_id ⇒ String
The Route53 Zone ID.
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.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/vagrant-command-dns/config.rb', line 51 def initialize @aliases = UNSET_VALUE @host_skip_aliases = UNSET_VALUE @route53_skip_aliases = UNSET_VALUE @route53_version = UNSET_VALUE @route53_access_key_id = UNSET_VALUE @route53_secret_access_key = UNSET_VALUE @route53_session_token = UNSET_VALUE @route53_zone_id = UNSET_VALUE # Internal @__skip = false end |
Instance Attribute Details
#__skip ⇒ Object
Returns the value of attribute __skip.
49 50 51 |
# File 'lib/vagrant-command-dns/config.rb', line 49 def __skip @__skip end |
#aliases ⇒ Array<String>
List of VM aliases in FQDN format
8 9 10 |
# File 'lib/vagrant-command-dns/config.rb', line 8 def aliases @aliases end |
#host_skip_aliases ⇒ Array<String>
List of disallowed aliases in FQDN format
15 16 17 |
# File 'lib/vagrant-command-dns/config.rb', line 15 def host_skip_aliases @host_skip_aliases end |
#route53_access_key_id ⇒ String
The access key ID for accessing AWS
32 33 34 |
# File 'lib/vagrant-command-dns/config.rb', line 32 def route53_access_key_id @route53_access_key_id end |
#route53_secret_access_key ⇒ String
The secret access key for accessing AWS
37 38 39 |
# File 'lib/vagrant-command-dns/config.rb', line 37 def route53_secret_access_key @route53_secret_access_key end |
#route53_session_token ⇒ String
The token associated with the key for accessing AWS
42 43 44 |
# File 'lib/vagrant-command-dns/config.rb', line 42 def route53_session_token @route53_session_token end |
#route53_skip_aliases ⇒ Array<String>
List of disallowed aliases in FQDN format
22 23 24 |
# File 'lib/vagrant-command-dns/config.rb', line 22 def route53_skip_aliases @route53_skip_aliases end |
#route53_version ⇒ String
The version of the AWS api to use
27 28 29 |
# File 'lib/vagrant-command-dns/config.rb', line 27 def route53_version @route53_version end |
#route53_zone_id ⇒ String
The Route53 Zone ID
47 48 49 |
# File 'lib/vagrant-command-dns/config.rb', line 47 def route53_zone_id @route53_zone_id end |
Instance Method Details
#finalize! ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/vagrant-command-dns/config.rb', line 67 def finalize! @aliases = [] if @aliases == UNSET_VALUE @host_skip_aliases = [] if @host_skip_aliases == UNSET_VALUE @route53_skip_aliases = [] if @route53_skip_aliases == UNSET_VALUE @route53_version = nil if @route53_version == UNSET_VALUE @route53_zone_id = nil if @route53_zone_id == UNSET_VALUE # Try to get access keys from standard AWS environment variables; they # will default to nil if the environment variables are not present. @route53_access_key_id = ENV['AWS_ACCESS_KEY'] if @route53_access_key_id == UNSET_VALUE @route53_secret_access_key = ENV['AWS_SECRET_KEY'] if @route53_secret_access_key == UNSET_VALUE @route53_session_token = ENV['AWS_SESSION_TOKEN'] if @route53_session_token == UNSET_VALUE end |
#validate(machine) ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/vagrant-command-dns/config.rb', line 84 def validate(machine) errors = _detected_errors errors << I18n.t('vagrant_command_dns.config.common.aliases_list_required') unless @aliases.kind_of? Array errors << I18n.t('vagrant_command_dns.config.host.skip_aliases_list_required') unless @host_skip_aliases.kind_of? Array if machine.provider_name == :aws aws_config = machine.provider_config # If these values are still not set and the AWS provider is being used, borrow it's config values @route53_version = aws_config.version if @route53_version == nil @route53_access_key_id = aws_config.access_key_id if @route53_access_key_id == nil @route53_secret_access_key = aws_config.secret_access_key if @route53_secret_access_key == nil @route53_session_token = aws_config.session_token if @route53_session_token == nil end errors << I18n.t('vagrant_command_dns.config.route53.skip_aliases_list_required') unless @route53_skip_aliases.kind_of? Array { :DNS => errors } end |