Class: OCI::Dns::Models::SteeringPolicyRule
- Inherits:
-
Object
- Object
- OCI::Dns::Models::SteeringPolicyRule
- Defined in:
- lib/oci/dns/models/steering_policy_rule.rb
Overview
The configuration of the sorting and filtering behaviors in a steering policy. Rules can filter and sort answers based on weight, priority, endpoint health, and other data.
A rule may optionally include a sequence of cases, each with an optional ‘caseCondition` expression. Cases allow a sequence of conditions to be defined that will apply different parameters to the rule when the conditions are met. For more information about cases, see [Traffic Management API Guide](docs.cloud.oracle.com/iaas/Content/TrafficManagement/Concepts/trafficmanagementapi.htm).
Warning: Oracle recommends that you avoid using any confidential information when you supply string values using the API.
This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class
Direct Known Subclasses
SteeringPolicyFilterRule, SteeringPolicyHealthRule, SteeringPolicyLimitRule, SteeringPolicyPriorityRule, SteeringPolicyWeightedRule
Constant Summary collapse
- RULE_TYPE_ENUM =
rubocop:disable Metrics/LineLength
[ RULE_TYPE_FILTER = 'FILTER'.freeze, RULE_TYPE_HEALTH = 'HEALTH'.freeze, RULE_TYPE_WEIGHTED = 'WEIGHTED'.freeze, RULE_TYPE_PRIORITY = 'PRIORITY'.freeze, RULE_TYPE_LIMIT = 'LIMIT'.freeze, RULE_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
Instance Attribute Summary collapse
-
#description ⇒ String
A user-defined description of the rule’s purpose or behavior.
-
#rule_type ⇒ String
[Required] The type of a rule determines its sorting/filtering behavior.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.get_subtype(object_hash) ⇒ Object
Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ SteeringPolicyRule
constructor
Initializes the object.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ SteeringPolicyRule
Initializes the object
108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/oci/dns/models/steering_policy_rule.rb', line 108 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.description = attributes[:'description'] if attributes[:'description'] self.rule_type = attributes[:'ruleType'] if attributes[:'ruleType'] raise 'You cannot provide both :ruleType and :rule_type' if attributes.key?(:'ruleType') && attributes.key?(:'rule_type') self.rule_type = attributes[:'rule_type'] if attributes[:'rule_type'] end |
Instance Attribute Details
#description ⇒ String
A user-defined description of the rule’s purpose or behavior.
33 34 35 |
# File 'lib/oci/dns/models/steering_policy_rule.rb', line 33 def description @description end |
#rule_type ⇒ String
[Required] The type of a rule determines its sorting/filtering behavior.
-
‘FILTER` - Filters the list of answers based on their defined boolean data. Answers remain only if their `shouldKeep` value is `true`.
-
‘HEALTH` - Removes answers from the list if their `rdata` matches a target in the health check monitor referenced by the steering policy and the target is reported down.
-
‘WEIGHTED` - Uses a number between 0 and 255 to determine how often an answer will be served in relation to other answers. Anwers with a higher weight will be served more frequently.
-
‘PRIORITY` - Uses a defined rank value of answers to determine which answer to serve, moving those with the lowest values to the beginning of the list without changing the relative order of those with the same value. Answers can be given a value between `0` and `255`.
-
‘LIMIT` - Filters answers that are too far down the list. Parameter `defaultCount` specifies how many answers to keep. Example: If `defaultCount` has a value of `2` and there are five answers left, when the `LIMIT` rule is processed, only the first two answers will remain in the list.
59 60 61 |
# File 'lib/oci/dns/models/steering_policy_rule.rb', line 59 def rule_type @rule_type end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
62 63 64 65 66 67 68 69 |
# File 'lib/oci/dns/models/steering_policy_rule.rb', line 62 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'description': :'description', 'rule_type': :'ruleType' # rubocop:enable Style/SymbolLiteral } end |
.get_subtype(object_hash) ⇒ Object
Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.
86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/oci/dns/models/steering_policy_rule.rb', line 86 def self.get_subtype(object_hash) type = object_hash[:'ruleType'] # rubocop:disable Style/SymbolLiteral return 'OCI::Dns::Models::SteeringPolicyFilterRule' if type == 'FILTER' return 'OCI::Dns::Models::SteeringPolicyWeightedRule' if type == 'WEIGHTED' return 'OCI::Dns::Models::SteeringPolicyLimitRule' if type == 'LIMIT' return 'OCI::Dns::Models::SteeringPolicyHealthRule' if type == 'HEALTH' return 'OCI::Dns::Models::SteeringPolicyPriorityRule' if type == 'PRIORITY' # TODO: Log a warning when the subtype is not found. 'OCI::Dns::Models::SteeringPolicyRule' end |
.swagger_types ⇒ Object
Attribute type mapping.
72 73 74 75 76 77 78 79 |
# File 'lib/oci/dns/models/steering_policy_rule.rb', line 72 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'description': :'String', 'rule_type': :'String' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
145 146 147 148 149 150 151 |
# File 'lib/oci/dns/models/steering_policy_rule.rb', line 145 def ==(other) return true if equal?(other) self.class == other.class && description == other.description && rule_type == other.rule_type end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/oci/dns/models/steering_policy_rule.rb', line 176 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
156 157 158 |
# File 'lib/oci/dns/models/steering_policy_rule.rb', line 156 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
165 166 167 |
# File 'lib/oci/dns/models/steering_policy_rule.rb', line 165 def hash [description, rule_type].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
209 210 211 212 213 214 215 216 217 218 |
# File 'lib/oci/dns/models/steering_policy_rule.rb', line 209 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_s ⇒ String
Returns the string representation of the object
203 204 205 |
# File 'lib/oci/dns/models/steering_policy_rule.rb', line 203 def to_s to_hash.to_s end |