Class: OCI::Opsi::Models::HostCpuRecommendations

Inherits:
HostInsightHostRecommendations show all
Defined in:
lib/oci/opsi/models/host_cpu_recommendations.rb

Overview

Contains CPU recommendation.

Constant Summary collapse

BURSTABLE_ENUM =
[
  BURSTABLE_BASELINE_1_8 = 'BASELINE_1_8'.freeze,
  BURSTABLE_BASELINE_1_2 = 'BASELINE_1_2'.freeze,
  BURSTABLE_NO_RECOMMENDATION = 'NO_RECOMMENDATION'.freeze,
  BURSTABLE_DISABLE_BURSTABLE = 'DISABLE_BURSTABLE'.freeze,
  BURSTABLE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
UNUSED_INSTANCE_ENUM =
[
  UNUSED_INSTANCE_IN_USE = 'IN_USE'.freeze,
  UNUSED_INSTANCE_NOT_IN_USE = 'NOT_IN_USE'.freeze,
  UNUSED_INSTANCE_IS_NOT_DETERMINED = 'IS_NOT_DETERMINED'.freeze,
  UNUSED_INSTANCE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Constants inherited from HostInsightHostRecommendations

OCI::Opsi::Models::HostInsightHostRecommendations::METRIC_RECOMMENDATION_NAME_ENUM

Instance Attribute Summary collapse

Attributes inherited from HostInsightHostRecommendations

#metric_recommendation_name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from HostInsightHostRecommendations

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ HostCpuRecommendations

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :burstable (String)

    The value to assign to the #burstable property

  • :shape (String)

    The value to assign to the #shape property

  • :unused_instance (String)

    The value to assign to the #unused_instance property

  • :is_abandoned_instance (BOOLEAN)

    The value to assign to the #is_abandoned_instance property



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/oci/opsi/models/host_cpu_recommendations.rb', line 81

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  attributes['metricRecommendationName'] = 'HOST_CPU_RECOMMENDATIONS'

  super(attributes)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

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

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

  self.unused_instance = attributes[:'unusedInstance'] if attributes[:'unusedInstance']

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

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

  self.is_abandoned_instance = attributes[:'isAbandonedInstance'] unless attributes[:'isAbandonedInstance'].nil?
  self.is_abandoned_instance = false if is_abandoned_instance.nil? && !attributes.key?(:'isAbandonedInstance') # rubocop:disable Style/StringLiterals

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

  self.is_abandoned_instance = attributes[:'is_abandoned_instance'] unless attributes[:'is_abandoned_instance'].nil?
  self.is_abandoned_instance = false if is_abandoned_instance.nil? && !attributes.key?(:'isAbandonedInstance') && !attributes.key?(:'is_abandoned_instance') # rubocop:disable Style/StringLiterals
end

Instance Attribute Details

#burstableString

Show if OPSI recommends to convert an instance to a burstable instance and show recommended cpu baseline if positive recommendation.

Returns:

  • (String)


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

def burstable
  @burstable
end

#is_abandoned_instanceBOOLEAN

Identify if an instance is abandoned.

Returns:

  • (BOOLEAN)


43
44
45
# File 'lib/oci/opsi/models/host_cpu_recommendations.rb', line 43

def is_abandoned_instance
  @is_abandoned_instance
end

#shapeString

Show if OPSI recommends to change the shape of an instance and show recommended shape based on CPU utilization.

Returns:

  • (String)


35
36
37
# File 'lib/oci/opsi/models/host_cpu_recommendations.rb', line 35

def shape
  @shape
end

#unused_instanceString

Identify unused instances based on cpu, memory and network metrics.

Returns:

  • (String)


39
40
41
# File 'lib/oci/opsi/models/host_cpu_recommendations.rb', line 39

def unused_instance
  @unused_instance
end

Class Method Details

.attribute_mapObject

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



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

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'metric_recommendation_name': :'metricRecommendationName',
    'burstable': :'burstable',
    'shape': :'shape',
    'unused_instance': :'unusedInstance',
    'is_abandoned_instance': :'isAbandonedInstance'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/oci/opsi/models/host_cpu_recommendations.rb', line 59

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'metric_recommendation_name': :'String',
    'burstable': :'String',
    'shape': :'String',
    'unused_instance': :'String',
    'is_abandoned_instance': :'BOOLEAN'
    # 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
152
# File 'lib/oci/opsi/models/host_cpu_recommendations.rb', line 143

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

  self.class == other.class &&
    metric_recommendation_name == other.metric_recommendation_name &&
    burstable == other.burstable &&
    shape == other.shape &&
    unused_instance == other.unused_instance &&
    is_abandoned_instance == other.is_abandoned_instance
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



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

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


157
158
159
# File 'lib/oci/opsi/models/host_cpu_recommendations.rb', line 157

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



166
167
168
# File 'lib/oci/opsi/models/host_cpu_recommendations.rb', line 166

def hash
  [metric_recommendation_name, burstable, shape, unused_instance, is_abandoned_instance].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



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

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



204
205
206
# File 'lib/oci/opsi/models/host_cpu_recommendations.rb', line 204

def to_s
  to_hash.to_s
end