Class: Pvectl::Models::DnsConfig
- Defined in:
- lib/pvectl/models/dns_config.rb
Overview
Represents the DNS resolver configuration for a Proxmox node.
Immutable value object. Created by Repositories::Dns from API data. Each node has its own DNS settings — there is no cluster-wide DNS config.
Instance Attribute Summary collapse
-
#dns1 ⇒ String?
readonly
First nameserver IP address.
-
#dns2 ⇒ String?
readonly
Second nameserver IP address (optional).
-
#dns3 ⇒ String?
readonly
Third nameserver IP address (optional).
-
#node ⇒ String?
readonly
Node name (not part of the API payload — added by repository).
-
#search ⇒ String?
readonly
Search domain for hostname lookup.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ DnsConfig
constructor
Creates a new DnsConfig.
-
#servers ⇒ Array<String>
Returns the configured DNS servers in order, omitting unset entries.
Constructor Details
#initialize(attributes = {}) ⇒ DnsConfig
Creates a new DnsConfig.
37 38 39 40 41 42 43 44 |
# File 'lib/pvectl/models/dns_config.rb', line 37 def initialize(attributes = {}) super @node = attributes[:node] || attributes["node"] @search = attributes[:search] || attributes["search"] @dns1 = attributes[:dns1] || attributes["dns1"] @dns2 = attributes[:dns2] || attributes["dns2"] @dns3 = attributes[:dns3] || attributes["dns3"] end |
Instance Attribute Details
#dns1 ⇒ String? (readonly)
Returns first nameserver IP address.
26 27 28 |
# File 'lib/pvectl/models/dns_config.rb', line 26 def dns1 @dns1 end |
#dns2 ⇒ String? (readonly)
Returns second nameserver IP address (optional).
29 30 31 |
# File 'lib/pvectl/models/dns_config.rb', line 29 def dns2 @dns2 end |
#dns3 ⇒ String? (readonly)
Returns third nameserver IP address (optional).
32 33 34 |
# File 'lib/pvectl/models/dns_config.rb', line 32 def dns3 @dns3 end |
#node ⇒ String? (readonly)
Returns node name (not part of the API payload — added by repository).
20 21 22 |
# File 'lib/pvectl/models/dns_config.rb', line 20 def node @node end |
#search ⇒ String? (readonly)
Returns search domain for hostname lookup.
23 24 25 |
# File 'lib/pvectl/models/dns_config.rb', line 23 def search @search end |
Instance Method Details
#servers ⇒ Array<String>
Returns the configured DNS servers in order, omitting unset entries.
49 50 51 |
# File 'lib/pvectl/models/dns_config.rb', line 49 def servers [dns1, dns2, dns3].compact end |