Class: Sendmux::Management::Generated::ResourceLimitSnapshot
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Sendmux::Management::Generated::ResourceLimitSnapshot
- Defined in:
- lib/sendmux_management_generated/models/resource_limit_snapshot.rb
Instance Attribute Summary collapse
-
#can_request_increase ⇒ Object
Returns the value of attribute can_request_increase.
-
#is_at_limit ⇒ Object
Returns the value of attribute is_at_limit.
-
#is_near_limit ⇒ Object
Returns the value of attribute is_near_limit.
-
#max_allowed ⇒ Object
Returns the value of attribute max_allowed.
-
#pending_request_id ⇒ Object
Returns the value of attribute pending_request_id.
-
#reserved ⇒ Object
Returns the value of attribute reserved.
-
#resource_type ⇒ Object
Returns the value of attribute resource_type.
-
#threshold_usage ⇒ Object
Returns the value of attribute threshold_usage.
-
#usage ⇒ Object
Returns the value of attribute usage.
-
#usage_ratio ⇒ Object
Returns the value of attribute usage_ratio.
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 = {}) ⇒ ResourceLimitSnapshot
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 = {}) ⇒ ResourceLimitSnapshot
Initializes the object
89 90 91 92 93 94 95 96 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 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 89 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Management::Generated::ResourceLimitSnapshot` 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 `Sendmux::Management::Generated::ResourceLimitSnapshot`. 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?(:'can_request_increase') self.can_request_increase = attributes[:'can_request_increase'] else self.can_request_increase = nil end if attributes.key?(:'is_at_limit') self.is_at_limit = attributes[:'is_at_limit'] else self.is_at_limit = nil end if attributes.key?(:'is_near_limit') self.is_near_limit = attributes[:'is_near_limit'] else self.is_near_limit = nil end if attributes.key?(:'max_allowed') self.max_allowed = attributes[:'max_allowed'] else self.max_allowed = nil end if attributes.key?(:'pending_request_id') self.pending_request_id = attributes[:'pending_request_id'] else self.pending_request_id = nil end if attributes.key?(:'reserved') self.reserved = attributes[:'reserved'] else self.reserved = nil end if attributes.key?(:'resource_type') self.resource_type = attributes[:'resource_type'] else self.resource_type = nil end if attributes.key?(:'threshold_usage') self.threshold_usage = attributes[:'threshold_usage'] else self.threshold_usage = nil end if attributes.key?(:'usage') self.usage = attributes[:'usage'] else self.usage = nil end if attributes.key?(:'usage_ratio') self.usage_ratio = attributes[:'usage_ratio'] else self.usage_ratio = nil end end |
Instance Attribute Details
#can_request_increase ⇒ Object
Returns the value of attribute can_request_increase.
18 19 20 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 18 def can_request_increase @can_request_increase end |
#is_at_limit ⇒ Object
Returns the value of attribute is_at_limit.
20 21 22 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 20 def is_at_limit @is_at_limit end |
#is_near_limit ⇒ Object
Returns the value of attribute is_near_limit.
22 23 24 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 22 def is_near_limit @is_near_limit end |
#max_allowed ⇒ Object
Returns the value of attribute max_allowed.
24 25 26 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 24 def max_allowed @max_allowed end |
#pending_request_id ⇒ Object
Returns the value of attribute pending_request_id.
26 27 28 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 26 def pending_request_id @pending_request_id end |
#reserved ⇒ Object
Returns the value of attribute reserved.
28 29 30 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 28 def reserved @reserved end |
#resource_type ⇒ Object
Returns the value of attribute resource_type.
30 31 32 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 30 def resource_type @resource_type end |
#threshold_usage ⇒ Object
Returns the value of attribute threshold_usage.
32 33 34 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 32 def threshold_usage @threshold_usage end |
#usage ⇒ Object
Returns the value of attribute usage.
34 35 36 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 34 def usage @usage end |
#usage_ratio ⇒ Object
Returns the value of attribute usage_ratio.
36 37 38 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 36 def usage_ratio @usage_ratio end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
55 56 57 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 55 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
60 61 62 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 60 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 39 def self.attribute_map { :'can_request_increase' => :'can_request_increase', :'is_at_limit' => :'is_at_limit', :'is_near_limit' => :'is_near_limit', :'max_allowed' => :'max_allowed', :'pending_request_id' => :'pending_request_id', :'reserved' => :'reserved', :'resource_type' => :'resource_type', :'threshold_usage' => :'threshold_usage', :'usage' => :'usage', :'usage_ratio' => :'usage_ratio' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 382 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
81 82 83 84 85 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 81 def self.openapi_nullable Set.new([ :'pending_request_id', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 65 def self.openapi_types { :'can_request_increase' => :'Boolean', :'is_at_limit' => :'Boolean', :'is_near_limit' => :'Boolean', :'max_allowed' => :'Integer', :'pending_request_id' => :'String', :'reserved' => :'Integer', :'resource_type' => :'String', :'threshold_usage' => :'Integer', :'usage' => :'Integer', :'usage_ratio' => :'Float' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 352 def ==(o) return true if self.equal?(o) self.class == o.class && can_request_increase == o.can_request_increase && is_at_limit == o.is_at_limit && is_near_limit == o.is_near_limit && max_allowed == o.max_allowed && pending_request_id == o.pending_request_id && reserved == o.reserved && resource_type == o.resource_type && threshold_usage == o.threshold_usage && usage == o.usage && usage_ratio == o.usage_ratio end |
#eql?(o) ⇒ Boolean
369 370 371 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 369 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
375 376 377 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 375 def hash [can_request_increase, is_at_limit, is_near_limit, max_allowed, pending_request_id, reserved, resource_type, threshold_usage, usage, usage_ratio].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 218 219 220 221 222 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 166 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @can_request_increase.nil? invalid_properties.push('invalid value for "can_request_increase", can_request_increase cannot be nil.') end if @is_at_limit.nil? invalid_properties.push('invalid value for "is_at_limit", is_at_limit cannot be nil.') end if @is_near_limit.nil? invalid_properties.push('invalid value for "is_near_limit", is_near_limit cannot be nil.') end if @max_allowed.nil? invalid_properties.push('invalid value for "max_allowed", max_allowed cannot be nil.') end if @max_allowed <= 0 invalid_properties.push('invalid value for "max_allowed", must be greater than 0.') end if @reserved.nil? invalid_properties.push('invalid value for "reserved", reserved cannot be nil.') end if @reserved < 0 invalid_properties.push('invalid value for "reserved", must be greater than or equal to 0.') end if @resource_type.nil? invalid_properties.push('invalid value for "resource_type", resource_type cannot be nil.') end if @threshold_usage.nil? invalid_properties.push('invalid value for "threshold_usage", threshold_usage cannot be nil.') end if @threshold_usage < 0 invalid_properties.push('invalid value for "threshold_usage", must be greater than or equal to 0.') end if @usage.nil? invalid_properties.push('invalid value for "usage", usage cannot be nil.') end if @usage < 0 invalid_properties.push('invalid value for "usage", must be greater than or equal to 0.') end if @usage_ratio.nil? invalid_properties.push('invalid value for "usage_ratio", usage_ratio cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
404 405 406 407 408 409 410 411 412 413 414 415 416 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 404 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
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/sendmux_management_generated/models/resource_limit_snapshot.rb', line 226 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @can_request_increase.nil? return false if @is_at_limit.nil? return false if @is_near_limit.nil? return false if @max_allowed.nil? return false if @max_allowed <= 0 return false if @reserved.nil? return false if @reserved < 0 return false if @resource_type.nil? return false if @threshold_usage.nil? return false if @threshold_usage < 0 return false if @usage.nil? return false if @usage < 0 return false if @usage_ratio.nil? true end |