Class: OCI::OciControlCenter::Models::SummarizedMetricData

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/oci_control_center/models/summarized_metric_data.rb

Overview

The recorded metric value at a specific timestamp.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SummarizedMetricData

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



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
# File 'lib/oci/oci_control_center/models/summarized_metric_data.rb', line 74

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.sample_time = attributes[:'sampleTime'] if attributes[:'sampleTime']

  raise 'You cannot provide both :sampleTime and :sample_time' if attributes.key?(:'sampleTime') && attributes.key?(:'sample_time')

  self.sample_time = attributes[:'sample_time'] if attributes[:'sample_time']

  self.resolution = attributes[:'resolution'] if attributes[:'resolution']

  self.dimensions = attributes[:'dimensions'] if attributes[:'dimensions']

  self.aggregation_method = attributes[:'aggregationMethod'] if attributes[:'aggregationMethod']

  raise 'You cannot provide both :aggregationMethod and :aggregation_method' if attributes.key?(:'aggregationMethod') && attributes.key?(:'aggregation_method')

  self.aggregation_method = attributes[:'aggregation_method'] if attributes[:'aggregation_method']

  self.aggregated_value = attributes[:'aggregatedValue'] if attributes[:'aggregatedValue']

  raise 'You cannot provide both :aggregatedValue and :aggregated_value' if attributes.key?(:'aggregatedValue') && attributes.key?(:'aggregated_value')

  self.aggregated_value = attributes[:'aggregated_value'] if attributes[:'aggregated_value']
end

Instance Attribute Details

#aggregated_valueFloat

The aggregated metric value for the specified request.

Returns:

  • (Float)


35
36
37
# File 'lib/oci/oci_control_center/models/summarized_metric_data.rb', line 35

def aggregated_value
  @aggregated_value
end

#aggregation_methodString

The aggregation method used for aggregating the metric values. The aggregation method depends on the metric itself.

Returns:

  • (String)


30
31
32
# File 'lib/oci/oci_control_center/models/summarized_metric_data.rb', line 30

def aggregation_method
  @aggregation_method
end

#dimensionsHash<String, OCI::OciControlCenter::Models::DimensionValue>

Qualifiers provided in the definition of the returned metric. Available dimensions vary by metric namespace.



25
26
27
# File 'lib/oci/oci_control_center/models/summarized_metric_data.rb', line 25

def dimensions
  @dimensions
end

#resolutionString

The duration over which the metric data is aggregated. Supported values: 1m-60m, 1h-24h, 1d.

Returns:

  • (String)


20
21
22
# File 'lib/oci/oci_control_center/models/summarized_metric_data.rb', line 20

def resolution
  @resolution
end

#sample_timeDateTime

The time at which the metric data was recorded.

Returns:

  • (DateTime)


15
16
17
# File 'lib/oci/oci_control_center/models/summarized_metric_data.rb', line 15

def sample_time
  @sample_time
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/oci/oci_control_center/models/summarized_metric_data.rb', line 38

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'sample_time': :'sampleTime',
    'resolution': :'resolution',
    'dimensions': :'dimensions',
    'aggregation_method': :'aggregationMethod',
    'aggregated_value': :'aggregatedValue'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/oci/oci_control_center/models/summarized_metric_data.rb', line 51

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'sample_time': :'DateTime',
    'resolution': :'String',
    'dimensions': :'Hash<String, OCI::OciControlCenter::Models::DimensionValue>',
    'aggregation_method': :'String',
    'aggregated_value': :'Float'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



110
111
112
113
114
115
116
117
118
119
# File 'lib/oci/oci_control_center/models/summarized_metric_data.rb', line 110

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    sample_time == other.sample_time &&
    resolution == other.resolution &&
    dimensions == other.dimensions &&
    aggregation_method == other.aggregation_method &&
    aggregated_value == other.aggregated_value
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/oci/oci_control_center/models/summarized_metric_data.rb', line 144

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

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


124
125
126
# File 'lib/oci/oci_control_center/models/summarized_metric_data.rb', line 124

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



133
134
135
# File 'lib/oci/oci_control_center/models/summarized_metric_data.rb', line 133

def hash
  [sample_time, resolution, dimensions, aggregation_method, aggregated_value].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



177
178
179
180
181
182
183
184
185
186
# File 'lib/oci/oci_control_center/models/summarized_metric_data.rb', line 177

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



171
172
173
# File 'lib/oci/oci_control_center/models/summarized_metric_data.rb', line 171

def to_s
  to_hash.to_s
end