Class: OCI::LogAnalytics::Models::LogAnalyticsMetric

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/log_analytics/models/log_analytics_metric.rb

Overview

LogAnalyticsMetric

Constant Summary collapse

METRIC_TYPE_ENUM =
[
  METRIC_TYPE_COUNT = 'COUNT'.freeze,
  METRIC_TYPE_SUM = 'SUM'.freeze,
  METRIC_TYPE_AVERAGE = 'AVERAGE'.freeze,
  METRIC_TYPE_COUNT_DISTRIBUTION = 'COUNT_DISTRIBUTION'.freeze,
  METRIC_TYPE_SUM_DISTRIBUTION = 'SUM_DISTRIBUTION'.freeze,
  METRIC_TYPE_AVERAGE_DISTRIBUTION = 'AVERAGE_DISTRIBUTION'.freeze,
  METRIC_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
OPERATOR_ENUM =
[
  OPERATOR_CONTAINS_IGNORE_CASE = 'CONTAINS_IGNORE_CASE'.freeze,
  OPERATOR_IN_IGNORE_CASE = 'IN_IGNORE_CASE'.freeze,
  OPERATOR_EQUAL_IGNORE_CASE = 'EQUAL_IGNORE_CASE'.freeze,
  OPERATOR_NOT_NULL = 'NOT_NULL'.freeze,
  OPERATOR_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ LogAnalyticsMetric

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :aggregation_field (String)

    The value to assign to the #aggregation_field property

  • :bucket_metadata (String)

    The value to assign to the #bucket_metadata property

  • :clock_period (String)

    The value to assign to the #clock_period property

  • :description (String)

    The value to assign to the #description property

  • :edit_version (Integer)

    The value to assign to the #edit_version property

  • :field_name (String)

    The value to assign to the #field_name property

  • :field_values (Array<String>)

    The value to assign to the #field_values property

  • :grouping_field (String)

    The value to assign to the #grouping_field property

  • :is_enabled (BOOLEAN)

    The value to assign to the #is_enabled property

  • :is_system (BOOLEAN)

    The value to assign to the #is_system property

  • :display_name (String)

    The value to assign to the #display_name property

  • :metric_reference (Integer)

    The value to assign to the #metric_reference property

  • :name (String)

    The value to assign to the #name property

  • :metric_type (String)

    The value to assign to the #metric_type property

  • :is_metric_source_enabled (BOOLEAN)

    The value to assign to the #is_metric_source_enabled property

  • :operator (String)

    The value to assign to the #operator property

  • :sources (Array<OCI::LogAnalytics::Models::LogAnalyticsSource>)

    The value to assign to the #sources property

  • :entity_type (String)

    The value to assign to the #entity_type property

  • :time_updated (DateTime)

    The value to assign to the #time_updated property

  • :unit_type (String)

    The value to assign to the #unit_type property

  • :is_user_customized (BOOLEAN)

    The value to assign to the #is_user_customized property



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 206

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

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

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

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

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

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

  self.clock_period = attributes[:'clockPeriod'] if attributes[:'clockPeriod']

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

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

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

  self.edit_version = attributes[:'editVersion'] if attributes[:'editVersion']

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

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

  self.field_name = attributes[:'fieldName'] if attributes[:'fieldName']

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

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

  self.field_values = attributes[:'fieldValues'] if attributes[:'fieldValues']

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

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

  self.grouping_field = attributes[:'groupingField'] if attributes[:'groupingField']

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

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

  self.is_enabled = attributes[:'isEnabled'] unless attributes[:'isEnabled'].nil?

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

  self.is_enabled = attributes[:'is_enabled'] unless attributes[:'is_enabled'].nil?

  self.is_system = attributes[:'isSystem'] unless attributes[:'isSystem'].nil?

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

  self.is_system = attributes[:'is_system'] unless attributes[:'is_system'].nil?

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

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

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

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

  self.metric_type = attributes[:'metricType'] if attributes[:'metricType']
  self.metric_type = "COUNT" if metric_type.nil? && !attributes.key?(:'metricType') # rubocop:disable Style/StringLiterals

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

  self.metric_type = attributes[:'metric_type'] if attributes[:'metric_type']
  self.metric_type = "COUNT" if metric_type.nil? && !attributes.key?(:'metricType') && !attributes.key?(:'metric_type') # rubocop:disable Style/StringLiterals

  self.is_metric_source_enabled = attributes[:'isMetricSourceEnabled'] unless attributes[:'isMetricSourceEnabled'].nil?

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

  self.is_metric_source_enabled = attributes[:'is_metric_source_enabled'] unless attributes[:'is_metric_source_enabled'].nil?

  self.operator = attributes[:'operator'] if attributes[:'operator']
  self.operator = "CONTAINS_IGNORE_CASE" if operator.nil? && !attributes.key?(:'operator') # rubocop:disable Style/StringLiterals

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

  self.entity_type = attributes[:'entityType'] if attributes[:'entityType']

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

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

  self.time_updated = attributes[:'timeUpdated'] if attributes[:'timeUpdated']

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

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

  self.unit_type = attributes[:'unitType'] if attributes[:'unitType']

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

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

  self.is_user_customized = attributes[:'isUserCustomized'] unless attributes[:'isUserCustomized'].nil?

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

  self.is_user_customized = attributes[:'is_user_customized'] unless attributes[:'is_user_customized'].nil?
end

Instance Attribute Details

#aggregation_fieldString

The aggregation field.

Returns:

  • (String)


32
33
34
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 32

def aggregation_field
  @aggregation_field
end

#bucket_metadataString

The bucket metadata.

Returns:

  • (String)


36
37
38
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 36

def 
  @bucket_metadata
end

#clock_periodString

The clock period.

Returns:

  • (String)


40
41
42
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 40

def clock_period
  @clock_period
end

#descriptionString

The metric description.

Returns:

  • (String)


44
45
46
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 44

def description
  @description
end

#display_nameString

The metric display name.

Returns:

  • (String)


75
76
77
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 75

def display_name
  @display_name
end

#edit_versionInteger

The metric edit version.

Returns:

  • (Integer)


48
49
50
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 48

def edit_version
  @edit_version
end

#entity_typeString

The entity type.

Returns:

  • (String)


106
107
108
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 106

def entity_type
  @entity_type
end

#field_nameString

The field name.

Returns:

  • (String)


52
53
54
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 52

def field_name
  @field_name
end

#field_valuesArray<String>

The field values.

Returns:

  • (Array<String>)


56
57
58
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 56

def field_values
  @field_values
end

#grouping_fieldString

The grouping fields.

Returns:

  • (String)


60
61
62
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 60

def grouping_field
  @grouping_field
end

#is_enabledBOOLEAN

A flag inidcating whether or not the metric is enabled.

Returns:

  • (BOOLEAN)


65
66
67
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 65

def is_enabled
  @is_enabled
end

#is_metric_source_enabledBOOLEAN

A flag specifying whether or not the metric source is enabled.

Returns:

  • (BOOLEAN)


94
95
96
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 94

def is_metric_source_enabled
  @is_metric_source_enabled
end

#is_systemBOOLEAN

The system flag. A value of false denotes a custom, or user defined object. A value of true denotes a built in object.

Returns:

  • (BOOLEAN)


71
72
73
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 71

def is_system
  @is_system
end

#is_user_customizedBOOLEAN

A flag specifying whether or not this is a custom (user defined) metric.

Returns:

  • (BOOLEAN)


119
120
121
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 119

def is_user_customized
  @is_user_customized
end

#metric_referenceInteger

The metric unique identifier.

Returns:

  • (Integer)


79
80
81
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 79

def metric_reference
  @metric_reference
end

#metric_typeString

The metric type, specifying the type of aggreation to perform. Default value is COUNT.

Returns:

  • (String)


89
90
91
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 89

def metric_type
  @metric_type
end

#nameString

The metric name.

Returns:

  • (String)


83
84
85
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 83

def name
  @name
end

#operatorString

The metric operator.

Returns:

  • (String)


98
99
100
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 98

def operator
  @operator
end

#sourcesArray<OCI::LogAnalytics::Models::LogAnalyticsSource>

The metric sources.



102
103
104
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 102

def sources
  @sources
end

#time_updatedDateTime

The last updated date.

Returns:

  • (DateTime)


110
111
112
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 110

def time_updated
  @time_updated
end

#unit_typeString

The unit type.

Returns:

  • (String)


114
115
116
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 114

def unit_type
  @unit_type
end

Class Method Details

.attribute_mapObject

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



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
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 122

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'aggregation_field': :'aggregationField',
    'bucket_metadata': :'bucketMetadata',
    'clock_period': :'clockPeriod',
    'description': :'description',
    'edit_version': :'editVersion',
    'field_name': :'fieldName',
    'field_values': :'fieldValues',
    'grouping_field': :'groupingField',
    'is_enabled': :'isEnabled',
    'is_system': :'isSystem',
    'display_name': :'displayName',
    'metric_reference': :'metricReference',
    'name': :'name',
    'metric_type': :'metricType',
    'is_metric_source_enabled': :'isMetricSourceEnabled',
    'operator': :'operator',
    'sources': :'sources',
    'entity_type': :'entityType',
    'time_updated': :'timeUpdated',
    'unit_type': :'unitType',
    'is_user_customized': :'isUserCustomized'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 151

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'aggregation_field': :'String',
    'bucket_metadata': :'String',
    'clock_period': :'String',
    'description': :'String',
    'edit_version': :'Integer',
    'field_name': :'String',
    'field_values': :'Array<String>',
    'grouping_field': :'String',
    'is_enabled': :'BOOLEAN',
    'is_system': :'BOOLEAN',
    'display_name': :'String',
    'metric_reference': :'Integer',
    'name': :'String',
    'metric_type': :'String',
    'is_metric_source_enabled': :'BOOLEAN',
    'operator': :'String',
    'sources': :'Array<OCI::LogAnalytics::Models::LogAnalyticsSource>',
    'entity_type': :'String',
    'time_updated': :'DateTime',
    'unit_type': :'String',
    'is_user_customized': :'BOOLEAN'
    # 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



359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 359

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

  self.class == other.class &&
    aggregation_field == other.aggregation_field &&
     == other. &&
    clock_period == other.clock_period &&
    description == other.description &&
    edit_version == other.edit_version &&
    field_name == other.field_name &&
    field_values == other.field_values &&
    grouping_field == other.grouping_field &&
    is_enabled == other.is_enabled &&
    is_system == other.is_system &&
    display_name == other.display_name &&
    metric_reference == other.metric_reference &&
    name == other.name &&
    metric_type == other.metric_type &&
    is_metric_source_enabled == other.is_metric_source_enabled &&
    operator == other.operator &&
    sources == other.sources &&
    entity_type == other.entity_type &&
    time_updated == other.time_updated &&
    unit_type == other.unit_type &&
    is_user_customized == other.is_user_customized
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



409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 409

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


389
390
391
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 389

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



398
399
400
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 398

def hash
  [aggregation_field, , clock_period, description, edit_version, field_name, field_values, grouping_field, is_enabled, is_system, display_name, metric_reference, name, metric_type, is_metric_source_enabled, operator, sources, entity_type, time_updated, unit_type, is_user_customized].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



442
443
444
445
446
447
448
449
450
451
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 442

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



436
437
438
# File 'lib/oci/log_analytics/models/log_analytics_metric.rb', line 436

def to_s
  to_hash.to_s
end