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 =
[
  SORT_BY_NAMESPACE = 'NAMESPACE'.freeze,
  SORT_BY_NAME = 'NAME'.freeze,
  SORT_BY_RESOURCEGROUP = 'RESOURCEGROUP'.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

  • :resource_group (String)

    The value to assign to the #resource_group 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



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
154
155
156
157
158
159
160
161
162
163
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 124

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

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

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

  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\": \"ocid1.instance.region1.phx.exampleuniqueID\"

Returns:

  • (Hash<String, String>)


54
55
56
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 54

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. Supported fields: namespace, name, resourceGroup. If groupBy is used, then dimensionFilters is ignored.

Example - group by namespace: [ \"namespace\" ]

Returns:

  • (Array<String>)


64
65
66
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 64

def group_by
  @group_by
end

#nameString

The metric name to use when searching for metric definitions.

Example: CpuUtilization

Returns:

  • (String)


31
32
33
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 31

def name
  @name
end

#namespaceString

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

Example: oci_computeagent

Returns:

  • (String)


38
39
40
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 38

def namespace
  @namespace
end

#resource_groupString

Resource group that you want to match. A null value returns only metric data that has no resource groups. The specified resource group must exist in the definition of the posted metric. Only one resource group can be applied per metric. A valid resourceGroup value starts with an alphabetical character and includes only alphanumeric characters, periods (.), underscores (_), hyphens (-), and dollar signs ($).

Example: frontend-fleet

Returns:

  • (String)


46
47
48
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 46

def resource_group
  @resource_group
end

#sort_byString

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

Example: NAMESPACE

Returns:

  • (String)


71
72
73
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 71

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)


79
80
81
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 79

def sort_order
  @sort_order
end

Class Method Details

.attribute_mapObject

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



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

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

.swagger_typesObject

Attribute type mapping.



97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 97

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'String',
    'namespace': :'String',
    'resource_group': :'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



188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 188

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

  self.class == other.class &&
    name == other.name &&
    namespace == other.namespace &&
    resource_group == other.resource_group &&
    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



224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 224

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


204
205
206
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 204

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



213
214
215
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 213

def hash
  [name, namespace, resource_group, 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



257
258
259
260
261
262
263
264
265
266
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 257

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



251
252
253
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 251

def to_s
  to_hash.to_s
end