Class: OCI::Dns::Models::SteeringPolicyAnswer

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/dns/models/steering_policy_answer.rb

Overview

DNS record data with metadata for processing in a steering policy.

Warning: Oracle recommends that you avoid using any confidential information when you supply string values using the API.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SteeringPolicyAnswer

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :name (String)

    The value to assign to the #name property

  • :rtype (String)

    The value to assign to the #rtype property

  • :rdata (String)

    The value to assign to the #rdata property

  • :pool (String)

    The value to assign to the #pool property

  • :is_disabled (BOOLEAN)

    The value to assign to the #is_disabled property



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 127

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

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

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

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

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

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

  self.is_disabled = attributes[:'isDisabled'] unless attributes[:'isDisabled'].nil?

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

  self.is_disabled = attributes[:'is_disabled'] unless attributes[:'is_disabled'].nil?
end

Instance Attribute Details

#is_disabledBOOLEAN

Set this property to true to indicate that the answer is administratively disabled, such as when the corresponding server is down for maintenance. An answer's isDisabled property can be referenced in answerCondition properties in rules using answer.isDisabled.

Example: "rules": [ { "ruleType": "FILTER", "defaultAnswerData": [ { "answerCondition": "answer.isDisabled != true", "shouldKeep": true } ] },

Returns:

  • (BOOLEAN)


88
89
90
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 88

def is_disabled
  @is_disabled
end

#nameString

[Required] A user-friendly name for the answer, unique within the steering policy. An answer's name property can be referenced in answerCondition properties of rules using answer.name.

Example:

"rules": [ { "ruleType": "FILTER", "defaultAnswerData": [ { "answerCondition": "answer.name == 'server 1'", "shouldKeep": true } ] } ]

Returns:

  • (String)


34
35
36
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 34

def name
  @name
end

#poolString

The freeform name of a group of one or more records in which this record is included, such as "LAX data center". An answer's pool property can be referenced in answerCondition properties of rules using answer.pool.

Example:

"rules": [ { "ruleType": "FILTER", "defaultAnswerData": [ { "answerCondition": "answer.pool == 'US East Servers'", "shouldKeep": true } ] } ]

Returns:

  • (String)


69
70
71
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 69

def pool
  @pool
end

#rdataString

[Required] The record's data, as whitespace-delimited tokens in type-specific presentation format. All RDATA is normalized and the returned presentation of your RDATA may differ from its initial input. For more information about RDATA, see Supported DNS Resource Record Types.

Returns:

  • (String)


48
49
50
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 48

def rdata
  @rdata
end

#rtypeString

[Required] The type of DNS record, such as A or CNAME. Only A, AAAA, and CNAME are supported. For more information, see Supported DNS Resource Record Types.

Returns:

  • (String)


40
41
42
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 40

def rtype
  @rtype
end

Class Method Details

.attribute_mapObject

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



91
92
93
94
95
96
97
98
99
100
101
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 91

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'name',
    'rtype': :'rtype',
    'rdata': :'rdata',
    'pool': :'pool',
    'is_disabled': :'isDisabled'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



104
105
106
107
108
109
110
111
112
113
114
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 104

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'String',
    'rtype': :'String',
    'rdata': :'String',
    'pool': :'String',
    'is_disabled': :'BOOLEAN'
    # 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



155
156
157
158
159
160
161
162
163
164
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 155

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

  self.class == other.class &&
    name == other.name &&
    rtype == other.rtype &&
    rdata == other.rdata &&
    pool == other.pool &&
    is_disabled == other.is_disabled
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



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 189

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


169
170
171
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 169

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



178
179
180
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 178

def hash
  [name, rtype, rdata, pool, is_disabled].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



222
223
224
225
226
227
228
229
230
231
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 222

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



216
217
218
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 216

def to_s
  to_hash.to_s
end