Class: OCI::DatabaseManagement::Models::AwrQueryResult

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/database_management/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

  • :query_key (String)

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



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
# File 'lib/oci/database_management/models/awr_query_result.rb', line 112

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

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

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

  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)


46
47
48
# File 'lib/oci/database_management/models/awr_query_result.rb', line 46

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)


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

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/database_management/models/awr_query_result.rb', line 30

def name
  @name
end

#query_keyString

The ID assigned to the query instance.

Returns:

  • (String)


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

def query_key
  @query_key
end

#versionString

The version of the query result.

Returns:

  • (String)


34
35
36
# File 'lib/oci/database_management/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.



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/oci/database_management/models/awr_query_result.rb', line 49

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'name',
    'version': :'version',
    'query_key': :'queryKey',
    '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.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/oci/database_management/models/awr_query_result.rb', line 79

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

  return 'OCI::DatabaseManagement::Models::AwrDbParameterChangeCollection' if type == 'AWRDB_DB_PARAMETER_CHANGE'
  return 'OCI::DatabaseManagement::Models::AwrDbCpuUsageCollection' if type == 'AWRDB_ASH_CPU_USAGE_SET'
  return 'OCI::DatabaseManagement::Models::AwrDbWaitEventBucketCollection' if type == 'AWRDB_EVENT_HISTOGRAM_SET'
  return 'OCI::DatabaseManagement::Models::AwrDbParameterCollection' if type == 'AWRDB_DB_PARAMETER_SET'
  return 'OCI::DatabaseManagement::Models::AwrDbSysstatCollection' if type == 'AWRDB_SYSSTAT_SET'
  return 'OCI::DatabaseManagement::Models::AwrDbTopWaitEventCollection' if type == 'AWRDB_TOP_EVENT_SET'
  return 'OCI::DatabaseManagement::Models::AwrDbSnapshotCollection' if type == 'AWRDB_SNAPSHOT_SET'
  return 'OCI::DatabaseManagement::Models::AwrDbCollection' if type == 'AWRDB_SET'
  return 'OCI::DatabaseManagement::Models::AwrDbSnapshotRangeCollection' if type == 'AWRDB_SNAPSHOT_RANGE_SET'
  return 'OCI::DatabaseManagement::Models::AwrDbReport' if type == 'AWRDB_DB_REPORT'
  return 'OCI::DatabaseManagement::Models::AwrDbMetricCollection' if type == 'AWRDB_METRICS_SET'
  return 'OCI::DatabaseManagement::Models::AwrDbWaitEventCollection' if type == 'AWRDB_EVENT_SET'
  return 'OCI::DatabaseManagement::Models::AwrDbSqlReport' if type == 'AWRDB_SQL_REPORT'

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

.swagger_typesObject

Attribute type mapping.



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/oci/database_management/models/awr_query_result.rb', line 62

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



156
157
158
159
160
161
162
163
164
165
# File 'lib/oci/database_management/models/awr_query_result.rb', line 156

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

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



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/oci/database_management/models/awr_query_result.rb', line 190

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


170
171
172
# File 'lib/oci/database_management/models/awr_query_result.rb', line 170

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



179
180
181
# File 'lib/oci/database_management/models/awr_query_result.rb', line 179

def hash
  [name, version, query_key, 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



223
224
225
226
227
228
229
230
231
232
# File 'lib/oci/database_management/models/awr_query_result.rb', line 223

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



217
218
219
# File 'lib/oci/database_management/models/awr_query_result.rb', line 217

def to_s
  to_hash.to_s
end