Class: OCI::Opsi::Models::SqlInsightThresholds

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

Overview

Inventory details.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SqlInsightThresholds

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/oci/opsi/models/sql_insight_thresholds.rb', line 95

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.degradation_in_pct = attributes[:'degradationInPct'] if attributes[:'degradationInPct']
  self.degradation_in_pct = 20 if degradation_in_pct.nil? && !attributes.key?(:'degradationInPct') # rubocop:disable Style/StringLiterals

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

  self.degradation_in_pct = attributes[:'degradation_in_pct'] if attributes[:'degradation_in_pct']
  self.degradation_in_pct = 20 if degradation_in_pct.nil? && !attributes.key?(:'degradationInPct') && !attributes.key?(:'degradation_in_pct') # rubocop:disable Style/StringLiterals

  self.variability = attributes[:'variability'] if attributes[:'variability']
  self.variability = 1.66 if variability.nil? && !attributes.key?(:'variability') # rubocop:disable Style/StringLiterals

  self.inefficiency_in_pct = attributes[:'inefficiencyInPct'] if attributes[:'inefficiencyInPct']
  self.inefficiency_in_pct = 20 if inefficiency_in_pct.nil? && !attributes.key?(:'inefficiencyInPct') # rubocop:disable Style/StringLiterals

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

  self.inefficiency_in_pct = attributes[:'inefficiency_in_pct'] if attributes[:'inefficiency_in_pct']
  self.inefficiency_in_pct = 20 if inefficiency_in_pct.nil? && !attributes.key?(:'inefficiencyInPct') && !attributes.key?(:'inefficiency_in_pct') # rubocop:disable Style/StringLiterals

  self.increase_in_io_in_pct = attributes[:'increaseInIOInPct'] if attributes[:'increaseInIOInPct']
  self.increase_in_io_in_pct = 50 if increase_in_io_in_pct.nil? && !attributes.key?(:'increaseInIOInPct') # rubocop:disable Style/StringLiterals

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

  self.increase_in_io_in_pct = attributes[:'increase_in_io_in_pct'] if attributes[:'increase_in_io_in_pct']
  self.increase_in_io_in_pct = 50 if increase_in_io_in_pct.nil? && !attributes.key?(:'increaseInIOInPct') && !attributes.key?(:'increase_in_io_in_pct') # rubocop:disable Style/StringLiterals

  self.increase_in_cpu_in_pct = attributes[:'increaseInCPUInPct'] if attributes[:'increaseInCPUInPct']
  self.increase_in_cpu_in_pct = 50 if increase_in_cpu_in_pct.nil? && !attributes.key?(:'increaseInCPUInPct') # rubocop:disable Style/StringLiterals

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

  self.increase_in_cpu_in_pct = attributes[:'increase_in_cpu_in_pct'] if attributes[:'increase_in_cpu_in_pct']
  self.increase_in_cpu_in_pct = 50 if increase_in_cpu_in_pct.nil? && !attributes.key?(:'increaseInCPUInPct') && !attributes.key?(:'increase_in_cpu_in_pct') # rubocop:disable Style/StringLiterals

  self.increase_in_inefficient_wait_in_pct = attributes[:'increaseInInefficientWaitInPct'] if attributes[:'increaseInInefficientWaitInPct']
  self.increase_in_inefficient_wait_in_pct = 50 if increase_in_inefficient_wait_in_pct.nil? && !attributes.key?(:'increaseInInefficientWaitInPct') # rubocop:disable Style/StringLiterals

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

  self.increase_in_inefficient_wait_in_pct = attributes[:'increase_in_inefficient_wait_in_pct'] if attributes[:'increase_in_inefficient_wait_in_pct']
  self.increase_in_inefficient_wait_in_pct = 50 if increase_in_inefficient_wait_in_pct.nil? && !attributes.key?(:'increaseInInefficientWaitInPct') && !attributes.key?(:'increase_in_inefficient_wait_in_pct') # rubocop:disable Style/StringLiterals

  self.improved_in_pct = attributes[:'improvedInPct'] if attributes[:'improvedInPct']
  self.improved_in_pct = 20 if improved_in_pct.nil? && !attributes.key?(:'improvedInPct') # rubocop:disable Style/StringLiterals

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

  self.improved_in_pct = attributes[:'improved_in_pct'] if attributes[:'improved_in_pct']
  self.improved_in_pct = 20 if improved_in_pct.nil? && !attributes.key?(:'improvedInPct') && !attributes.key?(:'improved_in_pct') # rubocop:disable Style/StringLiterals
end

Instance Attribute Details

#degradation_in_pctInteger

[Required] Degradation Percent Threshold is used to derive degrading SQLs.

Returns:

  • (Integer)


14
15
16
# File 'lib/oci/opsi/models/sql_insight_thresholds.rb', line 14

def degradation_in_pct
  @degradation_in_pct
end

#improved_in_pctInteger

[Required] Improved Percent Threshold is used to derive improving SQLs.

Returns:

  • (Integer)


50
51
52
# File 'lib/oci/opsi/models/sql_insight_thresholds.rb', line 50

def improved_in_pct
  @improved_in_pct
end

#increase_in_cpu_in_pctInteger

[Required] PctIncreaseInCPU is used for deriving insights for SQLs which are degrading or variant or inefficient. And these SQLs should also have increasing change in CPU Time beyond threshold. Insights are derived using linear regression.

Returns:

  • (Integer)


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

def increase_in_cpu_in_pct
  @increase_in_cpu_in_pct
end

#increase_in_inefficient_wait_in_pctInteger

[Required] PctIncreaseInIO is used for deriving insights for SQLs which are degrading or variant or inefficient. And these SQLs should also have increasing change in Other Wait Time beyond threshold. Insights are derived using linear regression.

Returns:

  • (Integer)


45
46
47
# File 'lib/oci/opsi/models/sql_insight_thresholds.rb', line 45

def increase_in_inefficient_wait_in_pct
  @increase_in_inefficient_wait_in_pct
end

#increase_in_io_in_pctInteger

[Required] PctIncreaseInIO is used for deriving insights for SQLs which are degrading or variant or inefficient. And these SQLs should also have increasing change in IO Time beyond threshold. Insights are derived using linear regression.

Returns:

  • (Integer)


31
32
33
# File 'lib/oci/opsi/models/sql_insight_thresholds.rb', line 31

def increase_in_io_in_pct
  @increase_in_io_in_pct
end

#inefficiency_in_pctInteger

[Required] Inefficiency Percent Threshold is used to derive inefficient SQLs.

Returns:

  • (Integer)


24
25
26
# File 'lib/oci/opsi/models/sql_insight_thresholds.rb', line 24

def inefficiency_in_pct
  @inefficiency_in_pct
end

#variabilityFloat

[Required] Variability Percent Threshold is used to derive variant SQLs.

Returns:

  • (Float)


19
20
21
# File 'lib/oci/opsi/models/sql_insight_thresholds.rb', line 19

def variability
  @variability
end

Class Method Details

.attribute_mapObject

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



53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/oci/opsi/models/sql_insight_thresholds.rb', line 53

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'degradation_in_pct': :'degradationInPct',
    'variability': :'variability',
    'inefficiency_in_pct': :'inefficiencyInPct',
    'increase_in_io_in_pct': :'increaseInIOInPct',
    'increase_in_cpu_in_pct': :'increaseInCPUInPct',
    'increase_in_inefficient_wait_in_pct': :'increaseInInefficientWaitInPct',
    'improved_in_pct': :'improvedInPct'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/oci/opsi/models/sql_insight_thresholds.rb', line 68

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'degradation_in_pct': :'Integer',
    'variability': :'Float',
    'inefficiency_in_pct': :'Integer',
    'increase_in_io_in_pct': :'Integer',
    'increase_in_cpu_in_pct': :'Integer',
    'increase_in_inefficient_wait_in_pct': :'Integer',
    'improved_in_pct': :'Integer'
    # 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



160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/oci/opsi/models/sql_insight_thresholds.rb', line 160

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

  self.class == other.class &&
    degradation_in_pct == other.degradation_in_pct &&
    variability == other.variability &&
    inefficiency_in_pct == other.inefficiency_in_pct &&
    increase_in_io_in_pct == other.increase_in_io_in_pct &&
    increase_in_cpu_in_pct == other.increase_in_cpu_in_pct &&
    increase_in_inefficient_wait_in_pct == other.increase_in_inefficient_wait_in_pct &&
    improved_in_pct == other.improved_in_pct
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



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/oci/opsi/models/sql_insight_thresholds.rb', line 196

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


176
177
178
# File 'lib/oci/opsi/models/sql_insight_thresholds.rb', line 176

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



185
186
187
# File 'lib/oci/opsi/models/sql_insight_thresholds.rb', line 185

def hash
  [degradation_in_pct, variability, inefficiency_in_pct, increase_in_io_in_pct, increase_in_cpu_in_pct, increase_in_inefficient_wait_in_pct, improved_in_pct].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



229
230
231
232
233
234
235
236
237
238
# File 'lib/oci/opsi/models/sql_insight_thresholds.rb', line 229

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



223
224
225
# File 'lib/oci/opsi/models/sql_insight_thresholds.rb', line 223

def to_s
  to_hash.to_s
end