Class: Azure::ARM::Storage::Models::Usage
- Inherits:
-
Object
- Object
- Azure::ARM::Storage::Models::Usage
- Includes:
- MsRestAzure
- Defined in:
- lib/azure_mgmt_storage/models/usage.rb
Overview
Describes Storage Resource Usage.
Instance Attribute Summary collapse
-
#current_value ⇒ Integer
the subscription.
-
#limit ⇒ Integer
allocated in the subscription.
-
#name ⇒ UsageName
Gets the name of the type of usage.
-
#unit ⇒ UsageUnit
include: ‘Count’, ‘Bytes’, ‘Seconds’, ‘Percent’, ‘CountsPerSecond’, ‘BytesPerSecond’.
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
the subscription.
22 23 24 |
# File 'lib/azure_mgmt_storage/models/usage.rb', line 22 def current_value @current_value end |
#limit ⇒ Integer
allocated in the subscription.
26 27 28 |
# File 'lib/azure_mgmt_storage/models/usage.rb', line 26 def limit @limit end |
#name ⇒ UsageName
Returns Gets the name of the type of usage.
29 30 31 |
# File 'lib/azure_mgmt_storage/models/usage.rb', line 29 def name @name end |
#unit ⇒ UsageUnit
include: ‘Count’, ‘Bytes’, ‘Seconds’, ‘Percent’, ‘CountsPerSecond’, ‘BytesPerSecond’
18 19 20 |
# File 'lib/azure_mgmt_storage/models/usage.rb', line 18 def unit @unit end |
Class Method Details
.deserialize_object(object) ⇒ Usage
Deserializes given Ruby Hash into Model object.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/azure_mgmt_storage/models/usage.rb', line 74 def self.deserialize_object(object) return if object.nil? output_object = Usage.new deserialized_property = object['unit'] if (!deserialized_property.nil? && !deserialized_property.empty?) enum_is_valid = UsageUnit.constants.any? { |e| UsageUnit.const_get(e).to_s.downcase == deserialized_property.downcase } warn 'Enum UsageUnit does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid end 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.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/azure_mgmt_storage/models/usage.rb', line 47 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.
34 35 36 37 38 39 40 |
# File 'lib/azure_mgmt_storage/models/usage.rb', line 34 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 |