class OCI::DatabaseManagement::Models::DatabaseHomeMetricDefinition

The response containing the CPU, Storage, Wait, DB Time, and Memory metrics for a specific database.

Attributes

activity_time_series_metrics[RW]

[Required] A list of the active session metrics for CPU and Wait time for a specific database. @return [Array<OCI::DatabaseManagement::Models::ActivityTimeSeriesMetrics>]

db_storage_aggregate_metrics[RW]

This attribute is required. @return [OCI::DatabaseManagement::Models::DatabaseStorageAggregateMetrics]

db_time_aggregate_metrics[RW]

This attribute is required. @return [OCI::DatabaseManagement::Models::DatabaseTimeAggregateMetrics]

io_aggregate_metrics[RW]

This attribute is required. @return [OCI::DatabaseManagement::Models::DatabaseIOAggregateMetrics]

memory_aggregate_metrics[RW]

This attribute is required. @return [OCI::DatabaseManagement::Models::MemoryAggregateMetrics]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/oci/database_management/models/database_home_metric_definition.rb, line 31
def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'activity_time_series_metrics': :'activityTimeSeriesMetrics',
    'db_time_aggregate_metrics': :'dbTimeAggregateMetrics',
    'io_aggregate_metrics': :'ioAggregateMetrics',
    'memory_aggregate_metrics': :'memoryAggregateMetrics',
    'db_storage_aggregate_metrics': :'dbStorageAggregateMetrics'
    # rubocop:enable Style/SymbolLiteral
  }
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash @option attributes [Array<OCI::DatabaseManagement::Models::ActivityTimeSeriesMetrics>] :activity_time_series_metrics The value to assign to the {#activity_time_series_metrics} property @option attributes [OCI::DatabaseManagement::Models::DatabaseTimeAggregateMetrics] :db_time_aggregate_metrics The value to assign to the {#db_time_aggregate_metrics} property @option attributes [OCI::DatabaseManagement::Models::DatabaseIOAggregateMetrics] :io_aggregate_metrics The value to assign to the {#io_aggregate_metrics} property @option attributes [OCI::DatabaseManagement::Models::MemoryAggregateMetrics] :memory_aggregate_metrics The value to assign to the {#memory_aggregate_metrics} property @option attributes [OCI::DatabaseManagement::Models::DatabaseStorageAggregateMetrics] :db_storage_aggregate_metrics The value to assign to the {#db_storage_aggregate_metrics} property

# File lib/oci/database_management/models/database_home_metric_definition.rb, line 67
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.activity_time_series_metrics = attributes[:'activityTimeSeriesMetrics'] if attributes[:'activityTimeSeriesMetrics']

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

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

  self.db_time_aggregate_metrics = attributes[:'dbTimeAggregateMetrics'] if attributes[:'dbTimeAggregateMetrics']

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

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

  self.io_aggregate_metrics = attributes[:'ioAggregateMetrics'] if attributes[:'ioAggregateMetrics']

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

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

  self.memory_aggregate_metrics = attributes[:'memoryAggregateMetrics'] if attributes[:'memoryAggregateMetrics']

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

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

  self.db_storage_aggregate_metrics = attributes[:'dbStorageAggregateMetrics'] if attributes[:'dbStorageAggregateMetrics']

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

  self.db_storage_aggregate_metrics = attributes[:'db_storage_aggregate_metrics'] if attributes[:'db_storage_aggregate_metrics']
end
swagger_types() click to toggle source

Attribute type mapping.

# File lib/oci/database_management/models/database_home_metric_definition.rb, line 44
def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'activity_time_series_metrics': :'Array<OCI::DatabaseManagement::Models::ActivityTimeSeriesMetrics>',
    'db_time_aggregate_metrics': :'OCI::DatabaseManagement::Models::DatabaseTimeAggregateMetrics',
    'io_aggregate_metrics': :'OCI::DatabaseManagement::Models::DatabaseIOAggregateMetrics',
    'memory_aggregate_metrics': :'OCI::DatabaseManagement::Models::MemoryAggregateMetrics',
    'db_storage_aggregate_metrics': :'OCI::DatabaseManagement::Models::DatabaseStorageAggregateMetrics'
    # rubocop:enable Style/SymbolLiteral
  }
end

Public Instance Methods

==(other) click to toggle source

Checks equality by comparing each attribute. @param [Object] other the other object to be compared

# File lib/oci/database_management/models/database_home_metric_definition.rb, line 111
def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    activity_time_series_metrics == other.activity_time_series_metrics &&
    db_time_aggregate_metrics == other.db_time_aggregate_metrics &&
    io_aggregate_metrics == other.io_aggregate_metrics &&
    memory_aggregate_metrics == other.memory_aggregate_metrics &&
    db_storage_aggregate_metrics == other.db_storage_aggregate_metrics
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/oci/database_management/models/database_home_metric_definition.rb, line 145
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) click to toggle source

@see the `==` method @param [Object] other the other object to be compared

# File lib/oci/database_management/models/database_home_metric_definition.rb, line 125
def eql?(other)
  self == other
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Fixnum] Hash code

# File lib/oci/database_management/models/database_home_metric_definition.rb, line 134
def hash
  [activity_time_series_metrics, db_time_aggregate_metrics, io_aggregate_metrics, memory_aggregate_metrics, db_storage_aggregate_metrics].hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/oci/database_management/models/database_home_metric_definition.rb, line 178
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_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/oci/database_management/models/database_home_metric_definition.rb, line 172
def to_s
  to_hash.to_s
end

Private Instance Methods

_to_hash(value) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# File lib/oci/database_management/models/database_home_metric_definition.rb, line 195
def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end