Class: OCI::Costad::Models::CostAlertSubscriptionMap
- Inherits:
-
Object
- Object
- OCI::Costad::Models::CostAlertSubscriptionMap
- Defined in:
- lib/oci/costad/models/cost_alert_subscription_map.rb
Overview
The mapping of cost monitor to alert subscription along with thresholds.
Constant Summary collapse
- OPERATOR_ENUM =
[ OPERATOR_AND = 'AND'.freeze, OPERATOR_OR = 'OR'.freeze, OPERATOR_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
Instance Attribute Summary collapse
-
#cost_alert_subscription_id ⇒ String
The costAlertSubscription ocid which the cost monitor alert maps to.
-
#operator ⇒ String
The filter operator.
-
#threshold_absolute_value ⇒ Integer
The absolute threshold value.
-
#threshold_relative_percent ⇒ Integer
The relative percentage threshold value.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.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 = {}) ⇒ CostAlertSubscriptionMap
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 = {}) ⇒ CostAlertSubscriptionMap
Initializes the object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/oci/costad/models/cost_alert_subscription_map.rb', line 68 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.operator = attributes[:'operator'] if attributes[:'operator'] self.threshold_absolute_value = attributes[:'thresholdAbsoluteValue'] if attributes[:'thresholdAbsoluteValue'] raise 'You cannot provide both :thresholdAbsoluteValue and :threshold_absolute_value' if attributes.key?(:'thresholdAbsoluteValue') && attributes.key?(:'threshold_absolute_value') self.threshold_absolute_value = attributes[:'threshold_absolute_value'] if attributes[:'threshold_absolute_value'] self.threshold_relative_percent = attributes[:'thresholdRelativePercent'] if attributes[:'thresholdRelativePercent'] raise 'You cannot provide both :thresholdRelativePercent and :threshold_relative_percent' if attributes.key?(:'thresholdRelativePercent') && attributes.key?(:'threshold_relative_percent') self.threshold_relative_percent = attributes[:'threshold_relative_percent'] if attributes[:'threshold_relative_percent'] self.cost_alert_subscription_id = attributes[:'costAlertSubscriptionId'] if attributes[:'costAlertSubscriptionId'] raise 'You cannot provide both :costAlertSubscriptionId and :cost_alert_subscription_id' if attributes.key?(:'costAlertSubscriptionId') && attributes.key?(:'cost_alert_subscription_id') self.cost_alert_subscription_id = attributes[:'cost_alert_subscription_id'] if attributes[:'cost_alert_subscription_id'] end |
Instance Attribute Details
#cost_alert_subscription_id ⇒ String
The costAlertSubscription ocid which the cost monitor alert maps to.
32 33 34 |
# File 'lib/oci/costad/models/cost_alert_subscription_map.rb', line 32 def cost_alert_subscription_id @cost_alert_subscription_id end |
#operator ⇒ String
The filter operator. Example: 'AND', 'OR'.
20 21 22 |
# File 'lib/oci/costad/models/cost_alert_subscription_map.rb', line 20 def operator @operator end |
#threshold_absolute_value ⇒ Integer
The absolute threshold value.
24 25 26 |
# File 'lib/oci/costad/models/cost_alert_subscription_map.rb', line 24 def threshold_absolute_value @threshold_absolute_value end |
#threshold_relative_percent ⇒ Integer
The relative percentage threshold value.
28 29 30 |
# File 'lib/oci/costad/models/cost_alert_subscription_map.rb', line 28 def threshold_relative_percent @threshold_relative_percent end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/oci/costad/models/cost_alert_subscription_map.rb', line 35 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'operator': :'operator', 'threshold_absolute_value': :'thresholdAbsoluteValue', 'threshold_relative_percent': :'thresholdRelativePercent', 'cost_alert_subscription_id': :'costAlertSubscriptionId' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/oci/costad/models/cost_alert_subscription_map.rb', line 47 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'operator': :'String', 'threshold_absolute_value': :'Integer', 'threshold_relative_percent': :'Integer', 'cost_alert_subscription_id': :'String' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
115 116 117 118 119 120 121 122 123 |
# File 'lib/oci/costad/models/cost_alert_subscription_map.rb', line 115 def ==(other) return true if equal?(other) self.class == other.class && operator == other.operator && threshold_absolute_value == other.threshold_absolute_value && threshold_relative_percent == other.threshold_relative_percent && cost_alert_subscription_id == other.cost_alert_subscription_id end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/oci/costad/models/cost_alert_subscription_map.rb', line 148 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
128 129 130 |
# File 'lib/oci/costad/models/cost_alert_subscription_map.rb', line 128 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
137 138 139 |
# File 'lib/oci/costad/models/cost_alert_subscription_map.rb', line 137 def hash [operator, threshold_absolute_value, threshold_relative_percent, cost_alert_subscription_id].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
181 182 183 184 185 186 187 188 189 190 |
# File 'lib/oci/costad/models/cost_alert_subscription_map.rb', line 181 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
175 176 177 |
# File 'lib/oci/costad/models/cost_alert_subscription_map.rb', line 175 def to_s to_hash.to_s end |