Class: Shipeasy::Admin::Generated::ListAlertRulesResponseInner
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Shipeasy::Admin::Generated::ListAlertRulesResponseInner
- Defined in:
- lib/shipeasy_admin/models/list_alert_rules_response_inner.rb
Overview
One metric-threshold alert rule.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#comparator ⇒ Object
How the metric value is compared to the threshold (gt/gte/lt/lte).
-
#created_at ⇒ Object
ISO-8601 timestamp of creation.
-
#enabled ⇒ Object
Whether the rule is evaluated by the cron.
-
#id ⇒ Object
Stable opaque alert-rule id.
-
#metric_id ⇒ Object
Id of the metric the rule evaluates.
-
#metric_name ⇒ Object
Display name of the bound metric, or
nullif the metric no longer exists. -
#name ⇒ Object
Human label for the rule.
-
#notify ⇒ Object
Returns the value of attribute notify.
-
#severity ⇒ Object
Severity of the raised alert.
-
#threshold ⇒ Object
Threshold the metric value is compared against.
-
#updated_at ⇒ Object
ISO-8601 timestamp of the last update.
-
#window_hours ⇒ Object
Lookback window (hours) the metric is aggregated over.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ ListAlertRulesResponseInner
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ ListAlertRulesResponseInner
Initializes the object
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 132 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Shipeasy::Admin::Generated::ListAlertRulesResponseInner` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Shipeasy::Admin::Generated::ListAlertRulesResponseInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] else self.id = nil end if attributes.key?(:'name') self.name = attributes[:'name'] else self.name = nil end if attributes.key?(:'metric_id') self.metric_id = attributes[:'metric_id'] else self.metric_id = nil end if attributes.key?(:'metric_name') self.metric_name = attributes[:'metric_name'] else self.metric_name = nil end if attributes.key?(:'comparator') self.comparator = attributes[:'comparator'] else self.comparator = nil end if attributes.key?(:'threshold') self.threshold = attributes[:'threshold'] else self.threshold = nil end if attributes.key?(:'window_hours') self.window_hours = attributes[:'window_hours'] else self.window_hours = nil end if attributes.key?(:'severity') self.severity = attributes[:'severity'] else self.severity = nil end if attributes.key?(:'enabled') self.enabled = attributes[:'enabled'] else self.enabled = nil end if attributes.key?(:'notify') self.notify = attributes[:'notify'] else self.notify = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] else self.created_at = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] else self.updated_at = nil end end |
Instance Attribute Details
#comparator ⇒ Object
How the metric value is compared to the threshold (gt/gte/lt/lte).
32 33 34 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 32 def comparator @comparator end |
#created_at ⇒ Object
ISO-8601 timestamp of creation.
49 50 51 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 49 def created_at @created_at end |
#enabled ⇒ Object
Whether the rule is evaluated by the cron.
44 45 46 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 44 def enabled @enabled end |
#id ⇒ Object
Stable opaque alert-rule id.
20 21 22 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 20 def id @id end |
#metric_id ⇒ Object
Id of the metric the rule evaluates. Immutable after create.
26 27 28 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 26 def metric_id @metric_id end |
#metric_name ⇒ Object
Display name of the bound metric, or null if the metric no longer exists.
29 30 31 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 29 def metric_name @metric_name end |
#name ⇒ Object
Human label for the rule.
23 24 25 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 23 def name @name end |
#notify ⇒ Object
Returns the value of attribute notify.
46 47 48 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 46 def notify @notify end |
#severity ⇒ Object
Severity of the raised alert.
41 42 43 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 41 def severity @severity end |
#threshold ⇒ Object
Threshold the metric value is compared against.
35 36 37 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 35 def threshold @threshold end |
#updated_at ⇒ Object
ISO-8601 timestamp of the last update.
52 53 54 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 52 def updated_at @updated_at end |
#window_hours ⇒ Object
Lookback window (hours) the metric is aggregated over.
38 39 40 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 38 def window_hours @window_hours end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
95 96 97 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 95 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
100 101 102 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 100 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 77 def self.attribute_map { :'id' => :'id', :'name' => :'name', :'metric_id' => :'metricId', :'metric_name' => :'metricName', :'comparator' => :'comparator', :'threshold' => :'threshold', :'window_hours' => :'windowHours', :'severity' => :'severity', :'enabled' => :'enabled', :'notify' => :'notify', :'created_at' => :'createdAt', :'updated_at' => :'updatedAt' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 440 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
123 124 125 126 127 128 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 123 def self.openapi_nullable Set.new([ :'metric_name', :'notify', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 105 def self.openapi_types { :'id' => :'String', :'name' => :'String', :'metric_id' => :'String', :'metric_name' => :'String', :'comparator' => :'String', :'threshold' => :'Float', :'window_hours' => :'Integer', :'severity' => :'String', :'enabled' => :'Boolean', :'notify' => :'NotificationTarget', :'created_at' => :'String', :'updated_at' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 408 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && name == o.name && metric_id == o.metric_id && metric_name == o.metric_name && comparator == o.comparator && threshold == o.threshold && window_hours == o.window_hours && severity == o.severity && enabled == o.enabled && notify == o.notify && created_at == o.created_at && updated_at == o.updated_at end |
#eql?(o) ⇒ Boolean
427 428 429 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 427 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
433 434 435 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 433 def hash [id, name, metric_id, metric_name, comparator, threshold, window_hours, severity, enabled, notify, created_at, updated_at].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 221 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @metric_id.nil? invalid_properties.push('invalid value for "metric_id", metric_id cannot be nil.') end if @comparator.nil? invalid_properties.push('invalid value for "comparator", comparator cannot be nil.') end if @threshold.nil? invalid_properties.push('invalid value for "threshold", threshold cannot be nil.') end if @window_hours.nil? invalid_properties.push('invalid value for "window_hours", window_hours cannot be nil.') end if @window_hours > 9007199254740991 invalid_properties.push('invalid value for "window_hours", must be smaller than or equal to 9007199254740991.') end if @window_hours < -9007199254740991 invalid_properties.push('invalid value for "window_hours", must be greater than or equal to -9007199254740991.') end if @severity.nil? invalid_properties.push('invalid value for "severity", severity cannot be nil.') end if @enabled.nil? invalid_properties.push('invalid value for "enabled", enabled cannot be nil.') end if @created_at.nil? invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') end if @updated_at.nil? invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
462 463 464 465 466 467 468 469 470 471 472 473 474 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 462 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/shipeasy_admin/models/list_alert_rules_response_inner.rb', line 277 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @id.nil? return false if @name.nil? return false if @metric_id.nil? return false if @comparator.nil? comparator_validator = EnumAttributeValidator.new('String', ["gt", "gte", "lt", "lte"]) return false unless comparator_validator.valid?(@comparator) return false if @threshold.nil? return false if @window_hours.nil? return false if @window_hours > 9007199254740991 return false if @window_hours < -9007199254740991 return false if @severity.nil? severity_validator = EnumAttributeValidator.new('String', ["danger", "warn", "info"]) return false unless severity_validator.valid?(@severity) return false if @enabled.nil? return false if @created_at.nil? return false if @updated_at.nil? true end |