Class: OCI::DataScience::Models::ScalingConfiguration
- Inherits:
-
Object
- Object
- OCI::DataScience::Models::ScalingConfiguration
- Defined in:
- lib/oci/data_science/models/scaling_configuration.rb
Overview
Scaling configuration for the metric expression rule.
This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class
Direct Known Subclasses
CustomExpressionQueryScalingConfiguration, PredefinedExpressionThresholdScalingConfiguration
Constant Summary collapse
- SCALING_CONFIGURATION_TYPE_ENUM =
[ SCALING_CONFIGURATION_TYPE_THRESHOLD = 'THRESHOLD'.freeze, SCALING_CONFIGURATION_TYPE_QUERY = 'QUERY'.freeze ].freeze
Instance Attribute Summary collapse
-
#instance_count_adjustment ⇒ Integer
The value is used for adjusting the count of instances by.
-
#pending_duration ⇒ String
The period of time that the condition defined in the alarm must persist before the alarm state changes from "OK" to "FIRING" or vice versa.
-
#scaling_configuration_type ⇒ String
[Required] The type of scaling configuration.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.get_subtype(object_hash) ⇒ Object
Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ ScalingConfiguration
constructor
Initializes the object.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ ScalingConfiguration
Initializes the object
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/oci/data_science/models/scaling_configuration.rb', line 87 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.scaling_configuration_type = attributes[:'scalingConfigurationType'] if attributes[:'scalingConfigurationType'] raise 'You cannot provide both :scalingConfigurationType and :scaling_configuration_type' if attributes.key?(:'scalingConfigurationType') && attributes.key?(:'scaling_configuration_type') self.scaling_configuration_type = attributes[:'scaling_configuration_type'] if attributes[:'scaling_configuration_type'] self.pending_duration = attributes[:'pendingDuration'] if attributes[:'pendingDuration'] self.pending_duration = "PT3M" if pending_duration.nil? && !attributes.key?(:'pendingDuration') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :pendingDuration and :pending_duration' if attributes.key?(:'pendingDuration') && attributes.key?(:'pending_duration') self.pending_duration = attributes[:'pending_duration'] if attributes[:'pending_duration'] self.pending_duration = "PT3M" if pending_duration.nil? && !attributes.key?(:'pendingDuration') && !attributes.key?(:'pending_duration') # rubocop:disable Style/StringLiterals self.instance_count_adjustment = attributes[:'instanceCountAdjustment'] if attributes[:'instanceCountAdjustment'] raise 'You cannot provide both :instanceCountAdjustment and :instance_count_adjustment' if attributes.key?(:'instanceCountAdjustment') && attributes.key?(:'instance_count_adjustment') self.instance_count_adjustment = attributes[:'instance_count_adjustment'] if attributes[:'instance_count_adjustment'] end |
Instance Attribute Details
#instance_count_adjustment ⇒ Integer
The value is used for adjusting the count of instances by.
38 39 40 |
# File 'lib/oci/data_science/models/scaling_configuration.rb', line 38 def instance_count_adjustment @instance_count_adjustment end |
#pending_duration ⇒ String
The period of time that the condition defined in the alarm must persist before the alarm state changes from "OK" to "FIRING" or vice versa. For example, a value of 5 minutes means that the alarm must persist in breaching the condition for five minutes before the alarm updates its state to "FIRING"; likewise, the alarm must persist in not breaching the condition for five minutes before the alarm updates its state to "OK."
The duration is specified as a string in ISO 8601 format (PT10M
for ten minutes or PT1H
for one hour). Minimum: PT3M. Maximum: PT1H. Default: PT3M.
33 34 35 |
# File 'lib/oci/data_science/models/scaling_configuration.rb', line 33 def pending_duration @pending_duration end |
#scaling_configuration_type ⇒ String
[Required] The type of scaling configuration.
21 22 23 |
# File 'lib/oci/data_science/models/scaling_configuration.rb', line 21 def scaling_configuration_type @scaling_configuration_type end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
41 42 43 44 45 46 47 48 49 |
# File 'lib/oci/data_science/models/scaling_configuration.rb', line 41 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'scaling_configuration_type': :'scalingConfigurationType', 'pending_duration': :'pendingDuration', 'instance_count_adjustment': :'instanceCountAdjustment' # rubocop:enable Style/SymbolLiteral } end |
.get_subtype(object_hash) ⇒ Object
Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.
67 68 69 70 71 72 73 74 75 |
# File 'lib/oci/data_science/models/scaling_configuration.rb', line 67 def self.get_subtype(object_hash) type = object_hash[:'scalingConfigurationType'] # rubocop:disable Style/SymbolLiteral return 'OCI::DataScience::Models::CustomExpressionQueryScalingConfiguration' if type == 'QUERY' return 'OCI::DataScience::Models::PredefinedExpressionThresholdScalingConfiguration' if type == 'THRESHOLD' # TODO: Log a warning when the subtype is not found. 'OCI::DataScience::Models::ScalingConfiguration' end |
.swagger_types ⇒ Object
Attribute type mapping.
52 53 54 55 56 57 58 59 60 |
# File 'lib/oci/data_science/models/scaling_configuration.rb', line 52 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'scaling_configuration_type': :'String', 'pending_duration': :'String', 'instance_count_adjustment': :'Integer' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
129 130 131 132 133 134 135 136 |
# File 'lib/oci/data_science/models/scaling_configuration.rb', line 129 def ==(other) return true if equal?(other) self.class == other.class && scaling_configuration_type == other.scaling_configuration_type && pending_duration == other.pending_duration && instance_count_adjustment == other.instance_count_adjustment end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/oci/data_science/models/scaling_configuration.rb', line 161 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
141 142 143 |
# File 'lib/oci/data_science/models/scaling_configuration.rb', line 141 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
150 151 152 |
# File 'lib/oci/data_science/models/scaling_configuration.rb', line 150 def hash [scaling_configuration_type, pending_duration, instance_count_adjustment].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
194 195 196 197 198 199 200 201 202 203 |
# File 'lib/oci/data_science/models/scaling_configuration.rb', line 194 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_s ⇒ String
Returns the string representation of the object
188 189 190 |
# File 'lib/oci/data_science/models/scaling_configuration.rb', line 188 def to_s to_hash.to_s end |