Class: OCI::Monitoring::Models::ListMetricsDetails

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

Overview

The request details for retrieving metric definitions. Specify optional properties to filter the returned results. Use an asterisk ("*") as a wildcard character, placed anywhere in the string. For example, to search for all metrics with names that begin with "disk", specify "name" as "disk*". If no properties are specified, then all metric definitions within the request scope are returned.

Constant Summary collapse

SORT_BY_ENUM =

rubocop:disable Metrics/LineLength

[
  SORT_BY_NAMESPACE = 'NAMESPACE'.freeze,
  SORT_BY_NAME = 'NAME'.freeze
].freeze
SORT_ORDER_ENUM =
[
  SORT_ORDER_ASC = 'ASC'.freeze,
  SORT_ORDER_DESC = 'DESC'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ListMetricsDetails

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :name (String)

    The value to assign to the #name property

  • :namespace (String)

    The value to assign to the #namespace property

  • :dimension_filters (Hash<String, String>)

    The value to assign to the #dimension_filters property

  • :group_by (Array<String>)

    The value to assign to the #group_by property

  • :sort_by (String)

    The value to assign to the #sort_by property

  • :sort_order (String)

    The value to assign to the #sort_order property



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
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 109

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

  self.dimension_filters = attributes[:'dimensionFilters'] if attributes[:'dimensionFilters']

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

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

  self.group_by = attributes[:'groupBy'] if attributes[:'groupBy']

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

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

  self.sort_by = attributes[:'sortBy'] if attributes[:'sortBy']

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

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

  self.sort_order = attributes[:'sortOrder'] if attributes[:'sortOrder']

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

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

Instance Attribute Details

#dimension_filtersHash<String, String>

Qualifiers that you want to use when searching for metric definitions. Available dimensions vary by metric namespace. Each dimension takes the form of a key-value pair.

Example: { "resourceId": "<var>&lt;instance_OCID&gt;</var>" }

Returns:

  • (Hash<String, String>)


43
44
45
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 43

def dimension_filters
  @dimension_filters
end

#group_byArray<String>

Group metrics by these fields in the response. For example, to list all metric namespaces available in a compartment, groupBy the "namespace" field.

Example - group by namespace and resource: ‘[ "namespace", "resourceId" ]`

Returns:

  • (Array<String>)


52
53
54
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 52

def group_by
  @group_by
end

#nameString

The metric name to use when searching for metric definitions.

Example: ‘CpuUtilization`

Returns:

  • (String)


28
29
30
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 28

def name
  @name
end

#namespaceString

The source service or application to use when searching for metric definitions.

Example: ‘oci_computeagent`

Returns:

  • (String)


35
36
37
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 35

def namespace
  @namespace
end

#sort_byString

The field to use when sorting returned metric definitions. Only one sorting level is provided.

Example: ‘NAMESPACE`

Returns:

  • (String)


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

def sort_by
  @sort_by
end

#sort_orderString

The sort order to use when sorting returned metric definitions. Ascending (ASC) or descending (DESC).

Example: ‘ASC`

Returns:

  • (String)


67
68
69
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 67

def sort_order
  @sort_order
end

Class Method Details

.attribute_mapObject

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



70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 70

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'name',
    'namespace': :'namespace',
    'dimension_filters': :'dimensionFilters',
    'group_by': :'groupBy',
    'sort_by': :'sortBy',
    'sort_order': :'sortOrder'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 84

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'String',
    'namespace': :'String',
    'dimension_filters': :'Hash<String, String>',
    'group_by': :'Array<String>',
    'sort_by': :'String',
    'sort_order': :'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



171
172
173
174
175
176
177
178
179
180
181
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 171

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

  self.class == other.class &&
    name == other.name &&
    namespace == other.namespace &&
    dimension_filters == other.dimension_filters &&
    group_by == other.group_by &&
    sort_by == other.sort_by &&
    sort_order == other.sort_order
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



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 206

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


186
187
188
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 186

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



195
196
197
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 195

def hash
  [name, namespace, dimension_filters, group_by, sort_by, sort_order].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



239
240
241
242
243
244
245
246
247
248
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 239

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



233
234
235
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 233

def to_s
  to_hash.to_s
end