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']

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



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/oraclebmc/core/models/dhcp_dns_option.rb', line 32

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>)


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

def custom_dns_servers
  @custom_dns_servers
end

#server_typeString

  • VcnLocal: Reserved for future use.

  • VcnLocalPlusInternet: Instances can resolve only internet host

names (no Internet Gateway is required). The instances still need to use their IP addresses to communicate with each other. This is the default value in the default set of DHCP options in the VCN.

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

Returns:

  • (String)


27
28
29
# File 'lib/oraclebmc/core/models/dhcp_dns_option.rb', line 27

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



64
65
66
67
68
69
70
# File 'lib/oraclebmc/core/models/dhcp_dns_option.rb', line 64

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



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/oraclebmc/core/models/dhcp_dns_option.rb', line 87

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| _deserialize($1, v) } )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(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


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

def eql?(other_object)
  self == other_object
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



80
81
82
# File 'lib/oraclebmc/core/models/dhcp_dns_option.rb', line 80

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



112
113
114
115
116
117
118
119
120
# File 'lib/oraclebmc/core/models/dhcp_dns_option.rb', line 112

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



106
107
108
# File 'lib/oraclebmc/core/models/dhcp_dns_option.rb', line 106

def to_s
  to_hash.to_s
end