Class: Azure::ARM::Web::Models::ResourceMetric
- Inherits:
-
Object
- Object
- Azure::ARM::Web::Models::ResourceMetric
- Includes:
- MsRestAzure
- Defined in:
- lib/azure_mgmt_web/models/resource_metric.rb
Overview
Object representing a metric for any resource
Instance Attribute Summary collapse
-
#end_time ⇒ DateTime
Metric end time.
-
#metric_values ⇒ Array<ResourceMetricValue>
Metric values.
-
#name ⇒ ResourceMetricName
Name of metric.
-
#properties ⇒ Array<KeyValuePairStringString>
Properties.
-
#resource_id ⇒ String
Metric resource Id.
-
#start_time ⇒ DateTime
Metric start time.
-
#time_grain ⇒ String
Metric granularity.
-
#unit ⇒ String
Metric unit.
Class Method Summary collapse
-
.deserialize_object(object) ⇒ ResourceMetric
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
#end_time ⇒ DateTime
Returns Metric end time.
28 29 30 |
# File 'lib/azure_mgmt_web/models/resource_metric.rb', line 28 def end_time @end_time end |
#metric_values ⇒ Array<ResourceMetricValue>
Returns Metric values.
34 35 36 |
# File 'lib/azure_mgmt_web/models/resource_metric.rb', line 34 def metric_values @metric_values end |
#name ⇒ ResourceMetricName
Returns Name of metric.
16 17 18 |
# File 'lib/azure_mgmt_web/models/resource_metric.rb', line 16 def name @name end |
#properties ⇒ Array<KeyValuePairStringString>
Returns Properties.
37 38 39 |
# File 'lib/azure_mgmt_web/models/resource_metric.rb', line 37 def properties @properties end |
#resource_id ⇒ String
Returns Metric resource Id.
31 32 33 |
# File 'lib/azure_mgmt_web/models/resource_metric.rb', line 31 def resource_id @resource_id end |
#start_time ⇒ DateTime
Returns Metric start time.
25 26 27 |
# File 'lib/azure_mgmt_web/models/resource_metric.rb', line 25 def start_time @start_time end |
#time_grain ⇒ String
Returns Metric granularity. E.g PT1H, PT5M, P1D.
22 23 24 |
# File 'lib/azure_mgmt_web/models/resource_metric.rb', line 22 def time_grain @time_grain end |
#unit ⇒ String
Returns Metric unit.
19 20 21 |
# File 'lib/azure_mgmt_web/models/resource_metric.rb', line 19 def unit @unit end |
Class Method Details
.deserialize_object(object) ⇒ ResourceMetric
Deserializes given Ruby Hash into Model object.
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 163 164 165 166 167 168 |
# File 'lib/azure_mgmt_web/models/resource_metric.rb', line 114 def self.deserialize_object(object) return if object.nil? output_object = ResourceMetric.new deserialized_property = object['name'] unless deserialized_property.nil? deserialized_property = ResourceMetricName.deserialize_object(deserialized_property) end output_object.name = deserialized_property deserialized_property = object['unit'] output_object.unit = deserialized_property deserialized_property = object['timeGrain'] output_object.time_grain = deserialized_property deserialized_property = object['startTime'] deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? output_object.start_time = deserialized_property deserialized_property = object['endTime'] deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? output_object.end_time = deserialized_property deserialized_property = object['resourceId'] output_object.resource_id = deserialized_property deserialized_property = object['metricValues'] unless deserialized_property.nil? deserialized_array = [] deserialized_property.each do |element2| unless element2.nil? element2 = ResourceMetricValue.deserialize_object(element2) end deserialized_array.push(element2) end deserialized_property = deserialized_array end output_object.metric_values = deserialized_property deserialized_property = object['properties'] unless deserialized_property.nil? deserialized_array = [] deserialized_property.each do |element3| unless element3.nil? element3 = KeyValuePairStringString.deserialize_object(element3) end deserialized_array.push(element3) end deserialized_property = deserialized_array end output_object.properties = deserialized_property output_object end |
.serialize_object(object) ⇒ Hash
Serializes given Model object into Ruby Hash.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 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 101 102 103 104 105 106 107 |
# File 'lib/azure_mgmt_web/models/resource_metric.rb', line 53 def self.serialize_object(object) object.validate output_object = {} serialized_property = object.name unless serialized_property.nil? serialized_property = ResourceMetricName.serialize_object(serialized_property) end output_object['name'] = serialized_property unless serialized_property.nil? serialized_property = object.unit output_object['unit'] = serialized_property unless serialized_property.nil? serialized_property = object.time_grain output_object['timeGrain'] = serialized_property unless serialized_property.nil? serialized_property = object.start_time serialized_property = serialized_property.new_offset(0).strftime('%FT%TZ') output_object['startTime'] = serialized_property unless serialized_property.nil? serialized_property = object.end_time serialized_property = serialized_property.new_offset(0).strftime('%FT%TZ') output_object['endTime'] = serialized_property unless serialized_property.nil? serialized_property = object.resource_id output_object['resourceId'] = serialized_property unless serialized_property.nil? serialized_property = object.metric_values unless serialized_property.nil? serializedArray = [] serialized_property.each do |element| unless element.nil? element = ResourceMetricValue.serialize_object(element) end serializedArray.push(element) end serialized_property = serializedArray end output_object['metricValues'] = serialized_property unless serialized_property.nil? serialized_property = object.properties unless serialized_property.nil? serializedArray = [] serialized_property.each do |element1| unless element1.nil? element1 = KeyValuePairStringString.serialize_object(element1) end serializedArray.push(element1) end serialized_property = serializedArray end output_object['properties'] = serialized_property unless serialized_property.nil? output_object end |
Instance Method Details
#validate ⇒ Object
Validate the object. Throws ValidationError if validation fails.
42 43 44 45 46 |
# File 'lib/azure_mgmt_web/models/resource_metric.rb', line 42 def validate @name.validate unless @name.nil? @metric_values.each{ |e| e.validate if e.respond_to?(:validate) } unless @metric_values.nil? @properties.each{ |e| e.validate if e.respond_to?(:validate) } unless @properties.nil? end |