Class: OracleBMC::Core::Models::DhcpDnsOption

Inherits:
DhcpOption
  • Object
show all
Defined in:
lib/oraclebmc/core/models/dhcp_dns_option.rb

Constant Summary collapse

SERVER_TYPE_ENUM =
[SERVER_TYPE_VCN_LOCAL = 'VcnLocal',
SERVER_TYPE_VCN_LOCAL_PLUS_INTERNET = 'VcnLocalPlusInternet',
SERVER_TYPE_CUSTOM_DNS_SERVER = 'CustomDnsServer',
SERVER_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE']

Instance Attribute Summary collapse

Attributes inherited from DhcpOption

#type

Instance Method Summary collapse

Methods inherited from DhcpOption

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ DhcpDnsOption

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/oraclebmc/core/models/dhcp_dns_option.rb', line 41

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  attributes['type'] = 'DomainNameServer'

  super(attributes)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

  
  if attributes[:'customDnsServers']
    self.custom_dns_servers = attributes[:'customDnsServers']
  end
  
  if attributes[:'serverType']
    self.server_type = attributes[:'serverType']
  end
  
end

Instance Attribute Details

#custom_dns_serversArray<String>

If you set ‘serverType` to `CustomDnsServer`, specify the IP address of at least one DNS server of your choice (three maximum).

Returns:

  • (Array<String>)


18
19
20
# File 'lib/oraclebmc/core/models/dhcp_dns_option.rb', line 18

def custom_dns_servers
  @custom_dns_servers
end

#server_typeString

  • VcnLocal: Reserved for future use.

  • VcnLocalPlusInternet: Also referred to as "Internet and VCN Resolver".

Instances can resolve internet hostnames (no Internet Gateway is required), and can resolve hostnames of instances in the VCN. This is the default value in the default set of DHCP options in the VCN. For the Internet and VCN Resolver to work across the VCN, there must also be a DNS label set for the VCN, a DNS label set for each subnet, and a hostname for each instance. The Internet and VCN Resolver also enables reverse DNS lookup, which lets you determine the hostname corresponding to the private IP address. For more information, see [DNS in Your Virtual Cloud Network](docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm).

  • CustomDnsServer: Instances use a DNS server of your choice (three maximum).

Returns:

  • (String)


36
37
38
# File 'lib/oraclebmc/core/models/dhcp_dns_option.rb', line 36

def server_type
  @server_type
end

Instance Method Details

#==(other_object) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other_object (Object)

    to be compared



74
75
76
77
78
79
80
# File 'lib/oraclebmc/core/models/dhcp_dns_option.rb', line 74

def ==(other_object)
  return true if self.equal?(other_object)
  self.class == other_object.class &&
      type == other_object.type &&
      custom_dns_servers == other_object.custom_dns_servers &&
      server_type == other_object.server_type
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/oraclebmc/core/models/dhcp_dns_option.rb', line 97

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OracleBMC::Internal::Util.convert_to_type($1, v) } )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", OracleBMC::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other_object) ⇒ Boolean

Parameters:

  • other_object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


84
85
86
# File 'lib/oraclebmc/core/models/dhcp_dns_option.rb', line 84

def eql?(other_object)
  self == other_object
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



90
91
92
# File 'lib/oraclebmc/core/models/dhcp_dns_option.rb', line 90

def hash
  [type, custom_dns_servers, server_type].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



122
123
124
125
126
127
128
129
130
# File 'lib/oraclebmc/core/models/dhcp_dns_option.rb', line 122

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



116
117
118
# File 'lib/oraclebmc/core/models/dhcp_dns_option.rb', line 116

def to_s
  to_hash.to_s
end