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



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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/oci/monitoring/models/list_metrics_details.rb', line 123

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": "<var><instance_OCID></var>" }

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.

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

Returns:

  • (Array<String>)


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

def group_by
  @group_by
end

#nameString

The metric name to use when searching for metric definitions.

Example: CpuUtilization

Returns:

  • (String)


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

def name
  @name
end

#namespaceString

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

Example: oci_computeagent

Returns:

  • (String)


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

def namespace
  @namespace
end

#resource_groupString

Resource group that you want to use as a filter. 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 ($). Avoid entering confidential information.

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)


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

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)


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

def sort_order
  @sort_order
end

Class Method Details

.attribute_mapObject

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



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

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.



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

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



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

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



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

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


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

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



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

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



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

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



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

def to_s
  to_hash.to_s
end