Class: ApiReference::CreateSubscriptionAlertRequestParams
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::CreateSubscriptionAlertRequestParams
- Defined in:
- lib/api_reference/models/create_subscription_alert_request_params.rb
Overview
CreateSubscriptionAlertRequestParams Model.
Instance Attribute Summary collapse
-
#currency ⇒ String
The case sensitive currency or custom pricing unit to use for grouped cost alerts.
-
#grouping_keys ⇒ Array[String]
The property keys to group cost alerts by.
-
#metric_id ⇒ String
The metric to track usage for.
-
#price_filters ⇒ Array[PriceFilter]
Filters to scope which prices are included in grouped cost alert evaluation.
-
#threshold_overrides ⇒ Array[ThresholdOverrideParams]
Per-group threshold overrides.
-
#thresholds ⇒ Array[Threshold]
The thresholds that define the values at which the alert will be triggered.
-
#type ⇒ Type7
The type of alert to create.
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(thresholds:, type:, metric_id: SKIP, grouping_keys: SKIP, currency: SKIP, price_filters: SKIP, threshold_overrides: SKIP) ⇒ CreateSubscriptionAlertRequestParams
constructor
A new instance of CreateSubscriptionAlertRequestParams.
-
#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(thresholds:, type:, metric_id: SKIP, grouping_keys: SKIP, currency: SKIP, price_filters: SKIP, threshold_overrides: SKIP) ⇒ CreateSubscriptionAlertRequestParams
Returns a new instance of CreateSubscriptionAlertRequestParams.
84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/api_reference/models/create_subscription_alert_request_params.rb', line 84 def initialize(thresholds:, type:, metric_id: SKIP, grouping_keys: SKIP, currency: SKIP, price_filters: SKIP, threshold_overrides: SKIP) @thresholds = thresholds @type = type @metric_id = metric_id unless metric_id == SKIP @grouping_keys = grouping_keys unless grouping_keys == SKIP @currency = currency unless currency == SKIP @price_filters = price_filters unless price_filters == SKIP @threshold_overrides = threshold_overrides unless threshold_overrides == SKIP end |
Instance Attribute Details
#currency ⇒ String
The case sensitive currency or custom pricing unit to use for grouped cost alerts. Required when grouping_keys is set.
33 34 35 |
# File 'lib/api_reference/models/create_subscription_alert_request_params.rb', line 33 def currency @currency end |
#grouping_keys ⇒ Array[String]
The property keys to group cost alerts by. Only applicable for cost_exceeded alerts.
28 29 30 |
# File 'lib/api_reference/models/create_subscription_alert_request_params.rb', line 28 def grouping_keys @grouping_keys end |
#metric_id ⇒ String
The metric to track usage for.
23 24 25 |
# File 'lib/api_reference/models/create_subscription_alert_request_params.rb', line 23 def metric_id @metric_id end |
#price_filters ⇒ Array[PriceFilter]
Filters to scope which prices are included in grouped cost alert evaluation. Supports filtering by price_id, item_id, or price_type with includes/excludes operators. Only applicable when grouping_keys is set.
39 40 41 |
# File 'lib/api_reference/models/create_subscription_alert_request_params.rb', line 39 def price_filters @price_filters end |
#threshold_overrides ⇒ Array[ThresholdOverrideParams]
Per-group threshold overrides. Each override maps a specific combination of grouping_keys values to a list of thresholds that fully replaces the default thresholds for that group. An empty thresholds list silences the group. Groups without an override use the default thresholds. Only applicable when grouping_keys is set.
47 48 49 |
# File 'lib/api_reference/models/create_subscription_alert_request_params.rb', line 47 def threshold_overrides @threshold_overrides end |
#thresholds ⇒ Array[Threshold]
The thresholds that define the values at which the alert will be triggered.
15 16 17 |
# File 'lib/api_reference/models/create_subscription_alert_request_params.rb', line 15 def thresholds @thresholds end |
#type ⇒ Type7
The type of alert to create. This must be a valid alert type.
19 20 21 |
# File 'lib/api_reference/models/create_subscription_alert_request_params.rb', line 19 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/api_reference/models/create_subscription_alert_request_params.rb', line 97 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # 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') type = hash.key?('type') ? hash['type'] : nil metric_id = hash.key?('metric_id') ? hash['metric_id'] : SKIP grouping_keys = hash.key?('grouping_keys') ? hash['grouping_keys'] : SKIP currency = hash.key?('currency') ? hash['currency'] : SKIP # Parameter is an array, so we need to iterate through it price_filters = nil unless hash['price_filters'].nil? price_filters = [] hash['price_filters'].each do |structure| price_filters << (PriceFilter.from_hash(structure) if structure) end end price_filters = SKIP unless hash.key?('price_filters') # Parameter is an array, so we need to iterate through it threshold_overrides = nil unless hash['threshold_overrides'].nil? threshold_overrides = [] hash['threshold_overrides'].each do |structure| threshold_overrides << (ThresholdOverrideParams.from_hash(structure) if structure) end end threshold_overrides = SKIP unless hash.key?('threshold_overrides') # Create object from extracted values. CreateSubscriptionAlertRequestParams.new(thresholds: thresholds, type: type, metric_id: metric_id, grouping_keys: grouping_keys, currency: currency, price_filters: price_filters, threshold_overrides: threshold_overrides) end |
.names ⇒ Object
A mapping from model property names to API property names.
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/api_reference/models/create_subscription_alert_request_params.rb', line 50 def self.names @_hash = {} if @_hash.nil? @_hash['thresholds'] = 'thresholds' @_hash['type'] = 'type' @_hash['metric_id'] = 'metric_id' @_hash['grouping_keys'] = 'grouping_keys' @_hash['currency'] = 'currency' @_hash['price_filters'] = 'price_filters' @_hash['threshold_overrides'] = 'threshold_overrides' @_hash end |
.nullables ⇒ Object
An array for nullable fields
74 75 76 77 78 79 80 81 82 |
# File 'lib/api_reference/models/create_subscription_alert_request_params.rb', line 74 def self.nullables %w[ metric_id grouping_keys currency price_filters threshold_overrides ] end |
.optionals ⇒ Object
An array for optional fields
63 64 65 66 67 68 69 70 71 |
# File 'lib/api_reference/models/create_subscription_alert_request_params.rb', line 63 def self.optionals %w[ metric_id grouping_keys currency price_filters threshold_overrides ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
155 156 157 158 159 160 161 |
# File 'lib/api_reference/models/create_subscription_alert_request_params.rb', line 155 def inspect class_name = self.class.name.split('::').last "<#{class_name} thresholds: #{@thresholds.inspect}, type: #{@type.inspect}, metric_id:"\ " #{@metric_id.inspect}, grouping_keys: #{@grouping_keys.inspect}, currency:"\ " #{@currency.inspect}, price_filters: #{@price_filters.inspect}, threshold_overrides:"\ " #{@threshold_overrides.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
147 148 149 150 151 152 |
# File 'lib/api_reference/models/create_subscription_alert_request_params.rb', line 147 def to_s class_name = self.class.name.split('::').last "<#{class_name} thresholds: #{@thresholds}, type: #{@type}, metric_id: #{@metric_id},"\ " grouping_keys: #{@grouping_keys}, currency: #{@currency}, price_filters:"\ " #{@price_filters}, threshold_overrides: #{@threshold_overrides}>" end |