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



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

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)


86
87
88
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 86

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)


32
33
34
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 32

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)


67
68
69
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 67

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](docs.cloud.oracle.com/iaas/Content/DNS/Reference/supporteddnsresource.htm).

Returns:

  • (String)


46
47
48
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 46

def rdata
  @rdata
end

#rtypeString

[Required] The canonical name for the record’s type. Only A, AAAA, and CNAME are supported. For more information, see [Supported DNS Resource Record Types](docs.cloud.oracle.com/iaas/Content/DNS/Reference/supporteddnsresource.htm).

Returns:

  • (String)


38
39
40
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 38

def rtype
  @rtype
end

Class Method Details

.attribute_mapObject

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



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

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.



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

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



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

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



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

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


167
168
169
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 167

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



176
177
178
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 176

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



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

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



214
215
216
# File 'lib/oci/dns/models/steering_policy_answer.rb', line 214

def to_s
  to_hash.to_s
end