Class: Azure::ARM::Compute::Models::Usage
- Inherits:
-
Object
- Object
- Azure::ARM::Compute::Models::Usage
- Includes:
- MsRestAzure
- Defined in:
- lib/azure_mgmt_compute/models/usage.rb
Overview
Describes Compute Resource Usage.
Instance Attribute Summary collapse
-
#current_value ⇒ Integer
Gets or sets the current value of the usage.
-
#limit ⇒ Integer
Gets or sets the limit of usage.
-
#name ⇒ UsageName
Gets or sets the name of the type of usage.
-
#unit ⇒ String
measurement.
Class Method Summary collapse
-
.deserialize_object(object) ⇒ Usage
Deserializes given Ruby Hash into Model object.
-
.serialize_object(object) ⇒ Hash
Serializes given Model object into Ruby Hash.
Instance Method Summary collapse
-
#validate ⇒ Object
Validate the object.
Instance Attribute Details
#current_value ⇒ Integer
Returns Gets or sets the current value of the usage.
20 21 22 |
# File 'lib/azure_mgmt_compute/models/usage.rb', line 20 def current_value @current_value end |
#limit ⇒ Integer
Returns Gets or sets the limit of usage.
23 24 25 |
# File 'lib/azure_mgmt_compute/models/usage.rb', line 23 def limit @limit end |
#name ⇒ UsageName
Returns Gets or sets the name of the type of usage.
26 27 28 |
# File 'lib/azure_mgmt_compute/models/usage.rb', line 26 def name @name end |
#unit ⇒ String
measurement.
17 18 19 |
# File 'lib/azure_mgmt_compute/models/usage.rb', line 17 def unit @unit end |
Class Method Details
.deserialize_object(object) ⇒ Usage
Deserializes given Ruby Hash into Model object.
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/azure_mgmt_compute/models/usage.rb', line 71 def self.deserialize_object(object) return if object.nil? output_object = Usage.new deserialized_property = object['unit'] output_object.unit = deserialized_property deserialized_property = object['currentValue'] deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? output_object.current_value = deserialized_property deserialized_property = object['limit'] deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? output_object.limit = deserialized_property deserialized_property = object['name'] unless deserialized_property.nil? deserialized_property = UsageName.deserialize_object(deserialized_property) end output_object.name = deserialized_property output_object end |
.serialize_object(object) ⇒ Hash
Serializes given Model object into Ruby Hash.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/azure_mgmt_compute/models/usage.rb', line 44 def self.serialize_object(object) object.validate output_object = {} serialized_property = object.unit output_object['unit'] = serialized_property unless serialized_property.nil? serialized_property = object.current_value output_object['currentValue'] = serialized_property unless serialized_property.nil? serialized_property = object.limit output_object['limit'] = serialized_property unless serialized_property.nil? serialized_property = object.name unless serialized_property.nil? serialized_property = UsageName.serialize_object(serialized_property) end output_object['name'] = serialized_property unless serialized_property.nil? output_object end |
Instance Method Details
#validate ⇒ Object
Validate the object. Throws ValidationError if validation fails.
31 32 33 34 35 36 37 |
# File 'lib/azure_mgmt_compute/models/usage.rb', line 31 def validate fail MsRest::ValidationError, 'property unit is nil' if @unit.nil? fail MsRest::ValidationError, 'property current_value is nil' if @current_value.nil? fail MsRest::ValidationError, 'property limit is nil' if @limit.nil? fail MsRest::ValidationError, 'property name is nil' if @name.nil? @name.validate unless @name.nil? end |