Class: OCI::VnMonitoring::Models::DhcpDnsOption

Inherits:
DhcpOption
  • Object
show all
Defined in:
lib/oci/vn_monitoring/models/dhcp_dns_option.rb

Overview

DHCP option for specifying how DNS (hostname resolution) is handled in the subnets in the VCN. For more information, see DNS in Your Virtual Cloud Network.

Constant Summary collapse

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

Instance Attribute Summary collapse

Attributes inherited from DhcpOption

#type

Class Method Summary collapse

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

Options Hash (attributes):

  • :custom_dns_servers (Array<String>)

    The value to assign to the #custom_dns_servers property

  • :server_type (String)

    The value to assign to the #server_type property



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/oci/vn_monitoring/models/dhcp_dns_option.rb', line 78

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 }

  self.custom_dns_servers = attributes[:'customDnsServers'] if attributes[:'customDnsServers']

  raise 'You cannot provide both :customDnsServers and :custom_dns_servers' if attributes.key?(:'customDnsServers') && attributes.key?(:'custom_dns_servers')

  self.custom_dns_servers = attributes[:'custom_dns_servers'] if attributes[:'custom_dns_servers']

  self.server_type = attributes[:'serverType'] if attributes[:'serverType']

  raise 'You cannot provide both :serverType and :server_type' if attributes.key?(:'serverType') && attributes.key?(:'server_type')

  self.server_type = attributes[:'server_type'] if attributes[:'server_type']
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>)


27
28
29
# File 'lib/oci/vn_monitoring/models/dhcp_dns_option.rb', line 27

def custom_dns_servers
  @custom_dns_servers
end

#server_typeString

[Required] * 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.

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

Returns:

  • (String)


46
47
48
# File 'lib/oci/vn_monitoring/models/dhcp_dns_option.rb', line 46

def server_type
  @server_type
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



49
50
51
52
53
54
55
56
57
# File 'lib/oci/vn_monitoring/models/dhcp_dns_option.rb', line 49

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'type': :'type',
    'custom_dns_servers': :'customDnsServers',
    'server_type': :'serverType'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



60
61
62
63
64
65
66
67
68
# File 'lib/oci/vn_monitoring/models/dhcp_dns_option.rb', line 60

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'type': :'String',
    'custom_dns_servers': :'Array<String>',
    'server_type': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



121
122
123
124
125
126
127
128
# File 'lib/oci/vn_monitoring/models/dhcp_dns_option.rb', line 121

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    type == other.type &&
    custom_dns_servers == other.custom_dns_servers &&
    server_type == other.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



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/oci/vn_monitoring/models/dhcp_dns_option.rb', line 153

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)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::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) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


133
134
135
# File 'lib/oci/vn_monitoring/models/dhcp_dns_option.rb', line 133

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



142
143
144
# File 'lib/oci/vn_monitoring/models/dhcp_dns_option.rb', line 142

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



186
187
188
189
190
191
192
193
194
195
# File 'lib/oci/vn_monitoring/models/dhcp_dns_option.rb', line 186

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



180
181
182
# File 'lib/oci/vn_monitoring/models/dhcp_dns_option.rb', line 180

def to_s
  to_hash.to_s
end