Class: OCI::StackMonitoring::Models::Metric
- Inherits:
- 
      Object
      
        - Object
- OCI::StackMonitoring::Models::Metric
 
- Defined in:
- lib/oci/stack_monitoring/models/metric.rb
Overview
Details of a metric which is part of this metric extension
Constant Summary collapse
- DATA_TYPE_ENUM =
- [ DATA_TYPE_STRING = 'STRING'.freeze, DATA_TYPE_NUMBER = 'NUMBER'.freeze, DATA_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze 
- METRIC_CATEGORY_ENUM =
- [ METRIC_CATEGORY_LOAD = 'LOAD'.freeze, METRIC_CATEGORY_UTILIZATION = 'UTILIZATION'.freeze, METRIC_CATEGORY_CAPACITY = 'CAPACITY'.freeze, METRIC_CATEGORY_AVAILABILITY = 'AVAILABILITY'.freeze, METRIC_CATEGORY_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze 
Instance Attribute Summary collapse
- 
  
    
      #compute_expression  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Compute Expression to calculate the value of this metric. 
- 
  
    
      #data_type  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    [Required] Data type of value of this metric. 
- 
  
    
      #display_name  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Display name of the metric. 
- 
  
    
      #is_dimension  ⇒ BOOLEAN 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Current metric need to be included as dimension or not. 
- 
  
    
      #is_hidden  ⇒ BOOLEAN 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Flag to marks whether a metric has to be uploaded or not. 
- 
  
    
      #metric_category  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Metric category. 
- 
  
    
      #name  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    [Required] Name of the metric. 
- 
  
    
      #unit  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Unit of metric value. 
Class Method Summary collapse
- 
  
    
      .attribute_map  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Attribute mapping from ruby-style variable name to JSON key. 
- 
  
    
      .swagger_types  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Attribute type mapping. 
Instance Method Summary collapse
- 
  
    
      #==(other)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Checks equality by comparing each attribute. 
- 
  
    
      #build_from_hash(attributes)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Builds the object from hash. 
- #eql?(other) ⇒ Boolean
- 
  
    
      #hash  ⇒ Fixnum 
    
    
  
  
  
  
  
  
  
  
  
    Calculates hash code according to all attributes. 
- 
  
    
      #initialize(attributes = {})  ⇒ Metric 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    Initializes the object. 
- 
  
    
      #to_hash  ⇒ Hash 
    
    
  
  
  
  
  
  
  
  
  
    Returns the object in the form of hash. 
- 
  
    
      #to_s  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    Returns the string representation of the object. 
Constructor Details
#initialize(attributes = {}) ⇒ Metric
Initializes the object
| 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 | # File 'lib/oci/stack_monitoring/models/metric.rb', line 104 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } self.name = attributes[:'name'] if attributes[:'name'] self.display_name = attributes[:'displayName'] if attributes[:'displayName'] raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name') self.display_name = attributes[:'display_name'] if attributes[:'display_name'] self.is_dimension = attributes[:'isDimension'] unless attributes[:'isDimension'].nil? self.is_dimension = false if is_dimension.nil? && !attributes.key?(:'isDimension') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :isDimension and :is_dimension' if attributes.key?(:'isDimension') && attributes.key?(:'is_dimension') self.is_dimension = attributes[:'is_dimension'] unless attributes[:'is_dimension'].nil? self.is_dimension = false if is_dimension.nil? && !attributes.key?(:'isDimension') && !attributes.key?(:'is_dimension') # rubocop:disable Style/StringLiterals self.compute_expression = attributes[:'computeExpression'] if attributes[:'computeExpression'] raise 'You cannot provide both :computeExpression and :compute_expression' if attributes.key?(:'computeExpression') && attributes.key?(:'compute_expression') self.compute_expression = attributes[:'compute_expression'] if attributes[:'compute_expression'] self.data_type = attributes[:'dataType'] if attributes[:'dataType'] raise 'You cannot provide both :dataType and :data_type' if attributes.key?(:'dataType') && attributes.key?(:'data_type') self.data_type = attributes[:'data_type'] if attributes[:'data_type'] self.is_hidden = attributes[:'isHidden'] unless attributes[:'isHidden'].nil? self.is_hidden = false if is_hidden.nil? && !attributes.key?(:'isHidden') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :isHidden and :is_hidden' if attributes.key?(:'isHidden') && attributes.key?(:'is_hidden') self.is_hidden = attributes[:'is_hidden'] unless attributes[:'is_hidden'].nil? self.is_hidden = false if is_hidden.nil? && !attributes.key?(:'isHidden') && !attributes.key?(:'is_hidden') # rubocop:disable Style/StringLiterals self.metric_category = attributes[:'metricCategory'] if attributes[:'metricCategory'] raise 'You cannot provide both :metricCategory and :metric_category' if attributes.key?(:'metricCategory') && attributes.key?(:'metric_category') self.metric_category = attributes[:'metric_category'] if attributes[:'metric_category'] self.unit = attributes[:'unit'] if attributes[:'unit'] end | 
Instance Attribute Details
#compute_expression ⇒ String
Compute Expression to calculate the value of this metric
| 40 41 42 | # File 'lib/oci/stack_monitoring/models/metric.rb', line 40 def compute_expression @compute_expression end | 
#data_type ⇒ String
[Required] Data type of value of this metric
| 44 45 46 | # File 'lib/oci/stack_monitoring/models/metric.rb', line 44 def data_type @data_type end | 
#display_name ⇒ String
Display name of the metric.
| 32 33 34 | # File 'lib/oci/stack_monitoring/models/metric.rb', line 32 def display_name @display_name end | 
#is_dimension ⇒ BOOLEAN
Current metric need to be included as dimension or not
| 36 37 38 | # File 'lib/oci/stack_monitoring/models/metric.rb', line 36 def is_dimension @is_dimension end | 
#is_hidden ⇒ BOOLEAN
Flag to marks whether a metric has to be uploaded or not. When isHidden = false -> Metric is uploaded, isHidden = true -> Metric is NOT uploaded
| 48 49 50 | # File 'lib/oci/stack_monitoring/models/metric.rb', line 48 def is_hidden @is_hidden end | 
#metric_category ⇒ String
Metric category
| 52 53 54 | # File 'lib/oci/stack_monitoring/models/metric.rb', line 52 def metric_category @metric_category end | 
#name ⇒ String
[Required] Name of the metric.
| 28 29 30 | # File 'lib/oci/stack_monitoring/models/metric.rb', line 28 def name @name end | 
#unit ⇒ String
Unit of metric value
| 56 57 58 | # File 'lib/oci/stack_monitoring/models/metric.rb', line 56 def unit @unit end | 
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
| 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | # File 'lib/oci/stack_monitoring/models/metric.rb', line 59 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'name': :'name', 'display_name': :'displayName', 'is_dimension': :'isDimension', 'compute_expression': :'computeExpression', 'data_type': :'dataType', 'is_hidden': :'isHidden', 'metric_category': :'metricCategory', 'unit': :'unit' # rubocop:enable Style/SymbolLiteral } end | 
.swagger_types ⇒ Object
Attribute type mapping.
| 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | # File 'lib/oci/stack_monitoring/models/metric.rb', line 75 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'name': :'String', 'display_name': :'String', 'is_dimension': :'BOOLEAN', 'compute_expression': :'String', 'data_type': :'String', 'is_hidden': :'BOOLEAN', 'metric_category': :'String', 'unit': :'String' # rubocop:enable Style/SymbolLiteral } end | 
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
| 188 189 190 191 192 193 194 195 196 197 198 199 200 | # File 'lib/oci/stack_monitoring/models/metric.rb', line 188 def ==(other) return true if equal?(other) self.class == other.class && name == other.name && display_name == other.display_name && is_dimension == other.is_dimension && compute_expression == other.compute_expression && data_type == other.data_type && is_hidden == other.is_hidden && metric_category == other.metric_category && unit == other.unit end | 
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
| 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | # File 'lib/oci/stack_monitoring/models/metric.rb', line 225 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) public_method("#{key}=").call( attributes[self.class.attribute_map[key]] .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? public_method("#{key}=").call( OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]) ) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end | 
#eql?(other) ⇒ Boolean
| 205 206 207 | # File 'lib/oci/stack_monitoring/models/metric.rb', line 205 def eql?(other) self == other end | 
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
| 214 215 216 | # File 'lib/oci/stack_monitoring/models/metric.rb', line 214 def hash [name, display_name, is_dimension, compute_expression, data_type, is_hidden, metric_category, unit].hash end | 
#to_hash ⇒ Hash
Returns the object in the form of hash
| 258 259 260 261 262 263 264 265 266 267 | # File 'lib/oci/stack_monitoring/models/metric.rb', line 258 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = public_method(attr).call next if value.nil? && !instance_variable_defined?("@#{attr}") hash[param] = _to_hash(value) end hash end | 
#to_s ⇒ String
Returns the string representation of the object
| 252 253 254 | # File 'lib/oci/stack_monitoring/models/metric.rb', line 252 def to_s to_hash.to_s end |