Class: ApiReference::ThresholdOverrideParams
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::ThresholdOverrideParams
- Defined in:
- lib/api_reference/models/threshold_override_params.rb
Overview
Per-group threshold override on a grouped cost alert. - An empty
thresholds list silences alerts for this group (never fires). - A
non-empty list fully replaces the default thresholds for this group.
Instance Attribute Summary collapse
-
#group_values ⇒ Array[String]
The values of the grouping keys that identify this group.
-
#thresholds ⇒ Array[Threshold]
The thresholds to apply to this group.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(group_values:, thresholds:, additional_properties: nil) ⇒ ThresholdOverrideParams
constructor
A new instance of ThresholdOverrideParams.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(group_values:, thresholds:, additional_properties: nil) ⇒ ThresholdOverrideParams
Returns a new instance of ThresholdOverrideParams.
44 45 46 47 48 49 50 51 |
# File 'lib/api_reference/models/threshold_override_params.rb', line 44 def initialize(group_values:, thresholds:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @group_values = group_values @thresholds = thresholds @additional_properties = additional_properties end |
Instance Attribute Details
#group_values ⇒ Array[String]
The values of the grouping keys that identify this group. The list length must match the alert's grouping_keys, and values appear in the same order as grouping_keys.
18 19 20 |
# File 'lib/api_reference/models/threshold_override_params.rb', line 18 def group_values @group_values end |
#thresholds ⇒ Array[Threshold]
The thresholds to apply to this group. An empty list silences alerts for this group. A non-empty list fully replaces the default thresholds for this group.
24 25 26 |
# File 'lib/api_reference/models/threshold_override_params.rb', line 24 def thresholds @thresholds end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/api_reference/models/threshold_override_params.rb', line 54 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. group_values = hash.key?('group_values') ? hash['group_values'] : nil # Parameter is an array, so we need to iterate through it thresholds = nil unless hash['thresholds'].nil? thresholds = [] hash['thresholds'].each do |structure| thresholds << (Threshold.from_hash(structure) if structure) end end thresholds = nil unless hash.key?('thresholds') # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. ThresholdOverrideParams.new(group_values: group_values, thresholds: thresholds, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
27 28 29 30 31 32 |
# File 'lib/api_reference/models/threshold_override_params.rb', line 27 def self.names @_hash = {} if @_hash.nil? @_hash['group_values'] = 'group_values' @_hash['thresholds'] = 'thresholds' @_hash end |
.nullables ⇒ Object
An array for nullable fields
40 41 42 |
# File 'lib/api_reference/models/threshold_override_params.rb', line 40 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
35 36 37 |
# File 'lib/api_reference/models/threshold_override_params.rb', line 35 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
91 92 93 94 95 |
# File 'lib/api_reference/models/threshold_override_params.rb', line 91 def inspect class_name = self.class.name.split('::').last "<#{class_name} group_values: #{@group_values.inspect}, thresholds: #{@thresholds.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
84 85 86 87 88 |
# File 'lib/api_reference/models/threshold_override_params.rb', line 84 def to_s class_name = self.class.name.split('::').last "<#{class_name} group_values: #{@group_values}, thresholds: #{@thresholds},"\ " additional_properties: #{@additional_properties}>" end |