Class: OCI::Monitoring::Models::SummarizeMetricsDataDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/monitoring/models/summarize_metrics_data_details.rb

Overview

The request details for retrieving aggregated data. Use the query and optional properties to filter the returned results.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SummarizeMetricsDataDetails

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :namespace (String)

    The value to assign to the #namespace property

  • :query (String)

    The value to assign to the #query property

  • :start_time (DateTime)

    The value to assign to the #start_time property

  • :end_time (DateTime)

    The value to assign to the #end_time property

  • :resolution (String)

    The value to assign to the #resolution property



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/oci/monitoring/models/summarize_metrics_data_details.rb', line 98

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

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

  self.start_time = attributes[:'startTime'] if attributes[:'startTime']

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

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

  self.end_time = attributes[:'endTime'] if attributes[:'endTime']

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

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

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

Instance Attribute Details

#end_timeDateTime

The end of the time range to use when searching for metric data points. Format is defined by RFC3339. The response excludes metric data points for the endTime. Default value: the timestamp representing when the call was sent.

Example: ‘2019-02-01T02:02:29.600Z`

Returns:

  • (DateTime)


48
49
50
# File 'lib/oci/monitoring/models/summarize_metrics_data_details.rb', line 48

def end_time
  @end_time
end

#namespaceString

[Required] The source service or application to use when searching for metric data points to aggregate.

Example: ‘oci_computeagent`

Returns:

  • (String)


16
17
18
# File 'lib/oci/monitoring/models/summarize_metrics_data_details.rb', line 16

def namespace
  @namespace
end

#queryString

[Required] The Monitoring Query Language (MQL) expression to use when searching for metric data points to aggregate. The query must specify a metric, statistic, and interval. Supported values for interval: ‘1m`-`60m` (also `1h`). You can optionally specify dimensions and grouping functions. Supported grouping functions: `grouping()`, `groupBy()`. For details about Monitoring Query Language (MQL), see [Monitoring Query Language (MQL) Reference](docs.cloud.oracle.com/iaas/Content/Monitoring/Reference/mql.htm). For available dimensions, review the metric definition for the supported service. See [Supported Services](docs.cloud.oracle.com/iaas/Content/Monitoring/Concepts/monitoringoverview.htm#SupportedServices).

Example: ‘CpuUtilization.sum()`

Returns:

  • (String)


30
31
32
# File 'lib/oci/monitoring/models/summarize_metrics_data_details.rb', line 30

def query
  @query
end

#resolutionString

The time between calculated aggregation windows. Use with the query interval to vary the frequency at which aggregated data points are returned. For example, use a query interval of 5 minutes with a resolution of 1 minute to retrieve five-minute aggregations at a one-minute frequency. The resolution must be equal or less than the interval in the query. The default resolution is 1m (one minute). Supported values: ‘1m`-`60m` (also `1h`).

Example: ‘5m`

Returns:

  • (String)


59
60
61
# File 'lib/oci/monitoring/models/summarize_metrics_data_details.rb', line 59

def resolution
  @resolution
end

#start_timeDateTime

The beginning of the time range to use when searching for metric data points. Format is defined by RFC3339. The response includes metric data points for the startTime. Default value: the timestamp 3 hours before the call was sent.

Example: ‘2019-02-01T01:02:29.600Z`

Returns:

  • (DateTime)


39
40
41
# File 'lib/oci/monitoring/models/summarize_metrics_data_details.rb', line 39

def start_time
  @start_time
end

Class Method Details

.attribute_mapObject

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



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/oci/monitoring/models/summarize_metrics_data_details.rb', line 62

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'namespace': :'namespace',
    'query': :'query',
    'start_time': :'startTime',
    'end_time': :'endTime',
    'resolution': :'resolution'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



75
76
77
78
79
80
81
82
83
84
85
# File 'lib/oci/monitoring/models/summarize_metrics_data_details.rb', line 75

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'namespace': :'String',
    'query': :'String',
    'start_time': :'DateTime',
    'end_time': :'DateTime',
    'resolution': :'String'
    # 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



130
131
132
133
134
135
136
137
138
139
# File 'lib/oci/monitoring/models/summarize_metrics_data_details.rb', line 130

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

  self.class == other.class &&
    namespace == other.namespace &&
    query == other.query &&
    start_time == other.start_time &&
    end_time == other.end_time &&
    resolution == other.resolution
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



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/oci/monitoring/models/summarize_metrics_data_details.rb', line 164

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


144
145
146
# File 'lib/oci/monitoring/models/summarize_metrics_data_details.rb', line 144

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



153
154
155
# File 'lib/oci/monitoring/models/summarize_metrics_data_details.rb', line 153

def hash
  [namespace, query, start_time, end_time, resolution].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



197
198
199
200
201
202
203
204
205
206
# File 'lib/oci/monitoring/models/summarize_metrics_data_details.rb', line 197

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



191
192
193
# File 'lib/oci/monitoring/models/summarize_metrics_data_details.rb', line 191

def to_s
  to_hash.to_s
end