Class: OCI::GenerativeAi::Models::ScalingConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/generative_ai/models/scaling_config.rb

Overview

The auto scaling configuration for the Hosted Application. Defines the minimum and maximum number of replicas. When unspecified, the service applies service-defined default scaling values.

Constant Summary collapse

SCALING_TYPE_ENUM =
[
  SCALING_TYPE_CPU = 'CPU'.freeze,
  SCALING_TYPE_MEMORY = 'MEMORY'.freeze,
  SCALING_TYPE_CONCURRENCY = 'CONCURRENCY'.freeze,
  SCALING_TYPE_REQUESTS_PER_SECOND = 'REQUESTS_PER_SECOND'.freeze,
  SCALING_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ScalingConfig

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



94
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
# File 'lib/oci/generative_ai/models/scaling_config.rb', line 94

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

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

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

  self.max_replica = attributes[:'maxReplica'] if attributes[:'maxReplica']

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

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

  self.scaling_type = attributes[:'scalingType'] if attributes[:'scalingType']
  self.scaling_type = "REQUESTS_PER_SECOND" if scaling_type.nil? && !attributes.key?(:'scalingType') # rubocop:disable Style/StringLiterals

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

  self.scaling_type = attributes[:'scaling_type'] if attributes[:'scaling_type']
  self.scaling_type = "REQUESTS_PER_SECOND" if scaling_type.nil? && !attributes.key?(:'scalingType') && !attributes.key?(:'scaling_type') # rubocop:disable Style/StringLiterals

  self.target_cpu_threshold = attributes[:'targetCpuThreshold'] if attributes[:'targetCpuThreshold']

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

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

  self.target_memory_threshold = attributes[:'targetMemoryThreshold'] if attributes[:'targetMemoryThreshold']

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

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

  self.target_concurrency_threshold = attributes[:'targetConcurrencyThreshold'] if attributes[:'targetConcurrencyThreshold']

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

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

  self.target_rps_threshold = attributes[:'targetRpsThreshold'] if attributes[:'targetRpsThreshold']

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

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

Instance Attribute Details

#max_replicaInteger

Maximum number of replicas allowed.

Returns:

  • (Integer)


29
30
31
# File 'lib/oci/generative_ai/models/scaling_config.rb', line 29

def max_replica
  @max_replica
end

#min_replicaInteger

Minimum number of replicas to keep running.

Returns:

  • (Integer)


25
26
27
# File 'lib/oci/generative_ai/models/scaling_config.rb', line 25

def min_replica
  @min_replica
end

#scaling_typeString

[Required] scaling type for application.

Returns:

  • (String)


33
34
35
# File 'lib/oci/generative_ai/models/scaling_config.rb', line 33

def scaling_type
  @scaling_type
end

#target_concurrency_thresholdInteger

number of simultaneous requests that can be processed by each replica.

Returns:

  • (Integer)


45
46
47
# File 'lib/oci/generative_ai/models/scaling_config.rb', line 45

def target_concurrency_threshold
  @target_concurrency_threshold
end

#target_cpu_thresholdInteger

Scale up if average CPU utilization exceeds this threshold.

Returns:

  • (Integer)


37
38
39
# File 'lib/oci/generative_ai/models/scaling_config.rb', line 37

def target_cpu_threshold
  @target_cpu_threshold
end

#target_memory_thresholdInteger

Scale up if average memory utilization exceeds this threshold.

Returns:

  • (Integer)


41
42
43
# File 'lib/oci/generative_ai/models/scaling_config.rb', line 41

def target_memory_threshold
  @target_memory_threshold
end

#target_rps_thresholdInteger

requests-per-second per replica of an application.

Returns:

  • (Integer)


49
50
51
# File 'lib/oci/generative_ai/models/scaling_config.rb', line 49

def target_rps_threshold
  @target_rps_threshold
end

Class Method Details

.attribute_mapObject

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



52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/oci/generative_ai/models/scaling_config.rb', line 52

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'min_replica': :'minReplica',
    'max_replica': :'maxReplica',
    'scaling_type': :'scalingType',
    'target_cpu_threshold': :'targetCpuThreshold',
    'target_memory_threshold': :'targetMemoryThreshold',
    'target_concurrency_threshold': :'targetConcurrencyThreshold',
    'target_rps_threshold': :'targetRpsThreshold'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/oci/generative_ai/models/scaling_config.rb', line 67

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'min_replica': :'Integer',
    'max_replica': :'Integer',
    'scaling_type': :'String',
    'target_cpu_threshold': :'Integer',
    'target_memory_threshold': :'Integer',
    'target_concurrency_threshold': :'Integer',
    'target_rps_threshold': :'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



165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/oci/generative_ai/models/scaling_config.rb', line 165

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

  self.class == other.class &&
    min_replica == other.min_replica &&
    max_replica == other.max_replica &&
    scaling_type == other.scaling_type &&
    target_cpu_threshold == other.target_cpu_threshold &&
    target_memory_threshold == other.target_memory_threshold &&
    target_concurrency_threshold == other.target_concurrency_threshold &&
    target_rps_threshold == other.target_rps_threshold
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



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/oci/generative_ai/models/scaling_config.rb', line 201

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


181
182
183
# File 'lib/oci/generative_ai/models/scaling_config.rb', line 181

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



190
191
192
# File 'lib/oci/generative_ai/models/scaling_config.rb', line 190

def hash
  [min_replica, max_replica, scaling_type, target_cpu_threshold, target_memory_threshold, target_concurrency_threshold, target_rps_threshold].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



234
235
236
237
238
239
240
241
242
243
# File 'lib/oci/generative_ai/models/scaling_config.rb', line 234

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



228
229
230
# File 'lib/oci/generative_ai/models/scaling_config.rb', line 228

def to_s
  to_hash.to_s
end