Class: OCI::CloudMigrations::Models::PeakResourceAssessmentStrategy

Inherits:
ResourceAssessmentStrategy show all
Defined in:
lib/oci/cloud_migrations/models/peak_resource_assessment_strategy.rb

Overview

Peak usage based strategy.

Constant Summary collapse

METRIC_TYPE_ENUM =
[
  METRIC_TYPE_AUTO = 'AUTO'.freeze,
  METRIC_TYPE_HISTORICAL = 'HISTORICAL'.freeze,
  METRIC_TYPE_RUNTIME = 'RUNTIME'.freeze,
  METRIC_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
METRIC_TIME_WINDOW_ENUM =
[
  METRIC_TIME_WINDOW_1D = '1d'.freeze,
  METRIC_TIME_WINDOW_7D = '7d'.freeze,
  METRIC_TIME_WINDOW_30D = '30d'.freeze,
  METRIC_TIME_WINDOW_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Constants inherited from ResourceAssessmentStrategy

ResourceAssessmentStrategy::RESOURCE_TYPE_ENUM, ResourceAssessmentStrategy::STRATEGY_TYPE_ENUM

Instance Attribute Summary collapse

Attributes inherited from ResourceAssessmentStrategy

#resource_type, #strategy_type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ResourceAssessmentStrategy

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ PeakResourceAssessmentStrategy

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :resource_type (String)

    The value to assign to the #resource_type proprety

  • :adjustment_multiplier (Float)

    The value to assign to the #adjustment_multiplier property

  • :metric_type (String)

    The value to assign to the #metric_type property

  • :metric_time_window (String)

    The value to assign to the #metric_time_window property



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/oci/cloud_migrations/models/peak_resource_assessment_strategy.rb', line 75

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

  attributes['strategyType'] = 'PEAK'

  super(attributes)

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

  self.adjustment_multiplier = attributes[:'adjustmentMultiplier'] if attributes[:'adjustmentMultiplier']

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

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

  self.metric_type = attributes[:'metricType'] if attributes[:'metricType']

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

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

  self.metric_time_window = attributes[:'metricTimeWindow'] if attributes[:'metricTimeWindow']

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

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

Instance Attribute Details

#adjustment_multiplierFloat

The real resource usage is multiplied to this number before making any recommendation.

Returns:

  • (Float)


29
30
31
# File 'lib/oci/cloud_migrations/models/peak_resource_assessment_strategy.rb', line 29

def adjustment_multiplier
  @adjustment_multiplier
end

#metric_time_windowString

The current state of the migration plan.

Returns:

  • (String)


37
38
39
# File 'lib/oci/cloud_migrations/models/peak_resource_assessment_strategy.rb', line 37

def metric_time_window
  @metric_time_window
end

#metric_typeString

The current state of the migration plan.

Returns:

  • (String)


33
34
35
# File 'lib/oci/cloud_migrations/models/peak_resource_assessment_strategy.rb', line 33

def metric_type
  @metric_type
end

Class Method Details

.attribute_mapObject

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



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/oci/cloud_migrations/models/peak_resource_assessment_strategy.rb', line 40

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'resource_type': :'resourceType',
    'strategy_type': :'strategyType',
    'adjustment_multiplier': :'adjustmentMultiplier',
    'metric_type': :'metricType',
    'metric_time_window': :'metricTimeWindow'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



53
54
55
56
57
58
59
60
61
62
63
# File 'lib/oci/cloud_migrations/models/peak_resource_assessment_strategy.rb', line 53

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'resource_type': :'String',
    'strategy_type': :'String',
    'adjustment_multiplier': :'Float',
    'metric_type': :'String',
    'metric_time_window': :'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



137
138
139
140
141
142
143
144
145
146
# File 'lib/oci/cloud_migrations/models/peak_resource_assessment_strategy.rb', line 137

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

  self.class == other.class &&
    resource_type == other.resource_type &&
    strategy_type == other.strategy_type &&
    adjustment_multiplier == other.adjustment_multiplier &&
    metric_type == other.metric_type &&
    metric_time_window == other.metric_time_window
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



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/oci/cloud_migrations/models/peak_resource_assessment_strategy.rb', line 171

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


151
152
153
# File 'lib/oci/cloud_migrations/models/peak_resource_assessment_strategy.rb', line 151

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



160
161
162
# File 'lib/oci/cloud_migrations/models/peak_resource_assessment_strategy.rb', line 160

def hash
  [resource_type, strategy_type, adjustment_multiplier, metric_type, metric_time_window].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



204
205
206
207
208
209
210
211
212
213
# File 'lib/oci/cloud_migrations/models/peak_resource_assessment_strategy.rb', line 204

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



198
199
200
# File 'lib/oci/cloud_migrations/models/peak_resource_assessment_strategy.rb', line 198

def to_s
  to_hash.to_s
end