Class: OCI::Opsi::Models::AwrQueryResult

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/opsi/models/awr_query_result.rb

Overview

The AWR query result. This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class

Constant Summary collapse

AWR_RESULT_TYPE_ENUM =
[
  AWR_RESULT_TYPE_AWRDB_SET = 'AWRDB_SET'.freeze,
  AWR_RESULT_TYPE_AWRDB_SNAPSHOT_RANGE_SET = 'AWRDB_SNAPSHOT_RANGE_SET'.freeze,
  AWR_RESULT_TYPE_AWRDB_SNAPSHOT_SET = 'AWRDB_SNAPSHOT_SET'.freeze,
  AWR_RESULT_TYPE_AWRDB_METRICS_SET = 'AWRDB_METRICS_SET'.freeze,
  AWR_RESULT_TYPE_AWRDB_SYSSTAT_SET = 'AWRDB_SYSSTAT_SET'.freeze,
  AWR_RESULT_TYPE_AWRDB_TOP_EVENT_SET = 'AWRDB_TOP_EVENT_SET'.freeze,
  AWR_RESULT_TYPE_AWRDB_EVENT_SET = 'AWRDB_EVENT_SET'.freeze,
  AWR_RESULT_TYPE_AWRDB_EVENT_HISTOGRAM = 'AWRDB_EVENT_HISTOGRAM'.freeze,
  AWR_RESULT_TYPE_AWRDB_DB_PARAMETER_SET = 'AWRDB_DB_PARAMETER_SET'.freeze,
  AWR_RESULT_TYPE_AWRDB_DB_PARAMETER_CHANGE = 'AWRDB_DB_PARAMETER_CHANGE'.freeze,
  AWR_RESULT_TYPE_AWRDB_ASH_CPU_USAGE_SET = 'AWRDB_ASH_CPU_USAGE_SET'.freeze,
  AWR_RESULT_TYPE_AWRDB_DB_REPORT = 'AWRDB_DB_REPORT'.freeze,
  AWR_RESULT_TYPE_AWRDB_SQL_REPORT = 'AWRDB_SQL_REPORT'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AwrQueryResult

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

  • :version (String)

    The value to assign to the #version property

  • :db_query_time_in_secs (Float)

    The value to assign to the #db_query_time_in_secs property

  • :awr_result_type (String)

    The value to assign to the #awr_result_type property



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/oci/opsi/models/awr_query_result.rb', line 105

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

  self.db_query_time_in_secs = attributes[:'dbQueryTimeInSecs'] if attributes[:'dbQueryTimeInSecs']

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

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

  self.awr_result_type = attributes[:'awrResultType'] if attributes[:'awrResultType']

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

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

Instance Attribute Details

#awr_result_typeString

[Required] The result type of AWR query.

Returns:

  • (String)


42
43
44
# File 'lib/oci/opsi/models/awr_query_result.rb', line 42

def awr_result_type
  @awr_result_type
end

#db_query_time_in_secsFloat

The time taken to query the database tier (in seconds).

Returns:

  • (Float)


38
39
40
# File 'lib/oci/opsi/models/awr_query_result.rb', line 38

def db_query_time_in_secs
  @db_query_time_in_secs
end

#nameString

[Required] The name of the query result.

Returns:

  • (String)


30
31
32
# File 'lib/oci/opsi/models/awr_query_result.rb', line 30

def name
  @name
end

#versionString

The version of the query result.

Returns:

  • (String)


34
35
36
# File 'lib/oci/opsi/models/awr_query_result.rb', line 34

def version
  @version
end

Class Method Details

.attribute_mapObject

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



45
46
47
48
49
50
51
52
53
54
# File 'lib/oci/opsi/models/awr_query_result.rb', line 45

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'name',
    'version': :'version',
    'db_query_time_in_secs': :'dbQueryTimeInSecs',
    'awr_result_type': :'awrResultType'
    # rubocop:enable Style/SymbolLiteral
  }
end

.get_subtype(object_hash) ⇒ Object

Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/oci/opsi/models/awr_query_result.rb', line 73

def self.get_subtype(object_hash)
  type = object_hash[:'awrResultType'] # rubocop:disable Style/SymbolLiteral

  return 'OCI::Opsi::Models::AwrDatabaseCpuUsageCollection' if type == 'AWRDB_ASH_CPU_USAGE_SET'
  return 'OCI::Opsi::Models::AwrDatabaseParameterCollection' if type == 'AWRDB_DB_PARAMETER_SET'
  return 'OCI::Opsi::Models::AwrDatabaseWaitEventBucketCollection' if type == 'AWRDB_EVENT_HISTOGRAM_SET'
  return 'OCI::Opsi::Models::AwrDatabaseSnapshotRangeCollection' if type == 'AWRDB_SNAPSHOT_RANGE_SET'
  return 'OCI::Opsi::Models::AwrDatabaseSnapshotCollection' if type == 'AWRDB_SNAPSHOT_SET'
  return 'OCI::Opsi::Models::AwrDatabaseSysstatCollection' if type == 'AWRDB_SYSSTAT_SET'
  return 'OCI::Opsi::Models::AwrDatabaseMetricCollection' if type == 'AWRDB_METRICS_SET'
  return 'OCI::Opsi::Models::AwrDatabaseWaitEventCollection' if type == 'AWRDB_EVENT_SET'
  return 'OCI::Opsi::Models::AwrDatabaseCollection' if type == 'AWRDB_SET'
  return 'OCI::Opsi::Models::AwrDatabaseTopWaitEventCollection' if type == 'AWRDB_TOP_EVENT_SET'
  return 'OCI::Opsi::Models::AwrDatabaseParameterChangeCollection' if type == 'AWRDB_DB_PARAMETER_CHANGE'
  return 'OCI::Opsi::Models::AwrDatabaseReport' if type == 'AWRDB_DB_REPORT'
  return 'OCI::Opsi::Models::AwrDatabaseSqlReport' if type == 'AWRDB_SQL_REPORT'

  # TODO: Log a warning when the subtype is not found.
  'OCI::Opsi::Models::AwrQueryResult'
end

.swagger_typesObject

Attribute type mapping.



57
58
59
60
61
62
63
64
65
66
# File 'lib/oci/opsi/models/awr_query_result.rb', line 57

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



143
144
145
146
147
148
149
150
151
# File 'lib/oci/opsi/models/awr_query_result.rb', line 143

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

  self.class == other.class &&
    name == other.name &&
    version == other.version &&
    db_query_time_in_secs == other.db_query_time_in_secs &&
    awr_result_type == other.awr_result_type
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



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/oci/opsi/models/awr_query_result.rb', line 176

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


156
157
158
# File 'lib/oci/opsi/models/awr_query_result.rb', line 156

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



165
166
167
# File 'lib/oci/opsi/models/awr_query_result.rb', line 165

def hash
  [name, version, db_query_time_in_secs, awr_result_type].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



209
210
211
212
213
214
215
216
217
218
# File 'lib/oci/opsi/models/awr_query_result.rb', line 209

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



203
204
205
# File 'lib/oci/opsi/models/awr_query_result.rb', line 203

def to_s
  to_hash.to_s
end