Class: OCI::CloudMigrations::Models::PercentileResourceAssessmentStrategy

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

Overview

The strategy based on percentile usage.

Constant Summary collapse

PERCENTILE_ENUM =
[
  PERCENTILE_P50 = 'P50'.freeze,
  PERCENTILE_P90 = 'P90'.freeze,
  PERCENTILE_P95 = 'P95'.freeze,
  PERCENTILE_P99 = 'P99'.freeze,
  PERCENTILE_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 = {}) ⇒ PercentileResourceAssessmentStrategy

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

  • :percentile (String)

    The value to assign to the #percentile property

  • :adjustment_multiplier (Float)

    The value to assign to the #adjustment_multiplier property

  • :metric_time_window (String)

    The value to assign to the #metric_time_window property



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

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

  attributes['strategyType'] = 'PERCENTILE'

  super(attributes)

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

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

  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_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)


34
35
36
# File 'lib/oci/cloud_migrations/models/percentile_resource_assessment_strategy.rb', line 34

def adjustment_multiplier
  @adjustment_multiplier
end

#metric_time_windowString

The current state of the migration plan.

Returns:

  • (String)


38
39
40
# File 'lib/oci/cloud_migrations/models/percentile_resource_assessment_strategy.rb', line 38

def metric_time_window
  @metric_time_window
end

#percentileString

[Required] Percentile value

Returns:

  • (String)


30
31
32
# File 'lib/oci/cloud_migrations/models/percentile_resource_assessment_strategy.rb', line 30

def percentile
  @percentile
end

Class Method Details

.attribute_mapObject

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



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

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

.swagger_typesObject

Attribute type mapping.



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

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



134
135
136
137
138
139
140
141
142
143
# File 'lib/oci/cloud_migrations/models/percentile_resource_assessment_strategy.rb', line 134

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

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



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

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


148
149
150
# File 'lib/oci/cloud_migrations/models/percentile_resource_assessment_strategy.rb', line 148

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



157
158
159
# File 'lib/oci/cloud_migrations/models/percentile_resource_assessment_strategy.rb', line 157

def hash
  [resource_type, strategy_type, percentile, adjustment_multiplier, 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



201
202
203
204
205
206
207
208
209
210
# File 'lib/oci/cloud_migrations/models/percentile_resource_assessment_strategy.rb', line 201

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



195
196
197
# File 'lib/oci/cloud_migrations/models/percentile_resource_assessment_strategy.rb', line 195

def to_s
  to_hash.to_s
end