Class: OCI::Core::Models::DhcpDnsOption

Inherits:
DhcpOption
  • Object
show all
Defined in:
lib/oci/core/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](docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm).

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

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



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/oci/core/models/dhcp_dns_option.rb', line 47

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

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

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

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

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

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


22
23
24
# File 'lib/oci/core/models/dhcp_dns_option.rb', line 22

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](docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm).

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

Returns:

  • (String)


40
41
42
# File 'lib/oci/core/models/dhcp_dns_option.rb', line 40

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



91
92
93
94
95
96
97
# File 'lib/oci/core/models/dhcp_dns_option.rb', line 91

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



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/oci/core/models/dhcp_dns_option.rb', line 114

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

Parameters:

  • other_object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


101
102
103
# File 'lib/oci/core/models/dhcp_dns_option.rb', line 101

def eql?(other_object)
  self == other_object
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



107
108
109
# File 'lib/oci/core/models/dhcp_dns_option.rb', line 107

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



139
140
141
142
143
144
145
146
147
# File 'lib/oci/core/models/dhcp_dns_option.rb', line 139

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



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

def to_s
  to_hash.to_s
end