Class: OCI::DataScience::Models::TargetCustomExpressionQueryScalingConfiguration

Inherits:
TargetScalingConfiguration show all
Defined in:
lib/oci/data_science/models/target_custom_expression_query_scaling_configuration.rb

Overview

The scaling configuration for the custom expression query for the workload.

Constant Summary

Constants inherited from TargetScalingConfiguration

OCI::DataScience::Models::TargetScalingConfiguration::TARGET_SCALING_CONFIGURATION_TYPE_ENUM

Instance Attribute Summary collapse

Attributes inherited from TargetScalingConfiguration

#target_scaling_configuration_type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TargetScalingConfiguration

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ TargetCustomExpressionQueryScalingConfiguration

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :query (String)

    The value to assign to the #query property

  • :threshold (Float)

    The value to assign to the #threshold property

  • :metric_namespace (String)

    The value to assign to the #metric_namespace property



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/oci/data_science/models/target_custom_expression_query_scaling_configuration.rb', line 68

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

  attributes['targetScalingConfigurationType'] = 'QUERY'

  super(attributes)

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

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

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

  self.metric_namespace = attributes[:'metricNamespace'] if attributes[:'metricNamespace']

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

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

Instance Attribute Details

#metric_namespaceString

Namespace to read the metrics from. Default value will be service metric namespace.

Returns:

  • (String)


33
34
35
# File 'lib/oci/data_science/models/target_custom_expression_query_scaling_configuration.rb', line 33

def metric_namespace
  @metric_namespace
end

#queryString

[Required] The Monitoring Query Language (MQL) expression to evaluate for the alarm. The Alarms feature of the Monitoring service interprets results for each returned time series as Boolean values, where zero represents false and a non-zero value represents true. A true value means that the trigger rule condition has been met. The query must specify a metric, statistic, interval, and trigger rule (threshold or absence). Supported values for interval: 1m-60m (also 1h). You can optionally specify dimensions and grouping functions. Supported grouping functions: grouping(), groupBy(). Example of threshold alarm: CPUUtilization[1m]{resourceId = \"Model_Deployment_OCID\"}.grouping().mean() < 25 CPUUtilization[1m]{resourceId = \"Model_Deployment_OCID\"}.grouping().mean() > 75

Returns:

  • (String)


25
26
27
# File 'lib/oci/data_science/models/target_custom_expression_query_scaling_configuration.rb', line 25

def query
  @query
end

#thresholdFloat

[Required] A metric value at which the scaling operation will be triggered.

Returns:

  • (Float)


29
30
31
# File 'lib/oci/data_science/models/target_custom_expression_query_scaling_configuration.rb', line 29

def threshold
  @threshold
end

Class Method Details

.attribute_mapObject

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



36
37
38
39
40
41
42
43
44
45
# File 'lib/oci/data_science/models/target_custom_expression_query_scaling_configuration.rb', line 36

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'target_scaling_configuration_type': :'targetScalingConfigurationType',
    'query': :'query',
    'threshold': :'threshold',
    'metric_namespace': :'metricNamespace'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



48
49
50
51
52
53
54
55
56
57
# File 'lib/oci/data_science/models/target_custom_expression_query_scaling_configuration.rb', line 48

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'target_scaling_configuration_type': :'String',
    'query': :'String',
    'threshold': :'Float',
    'metric_namespace': :'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



96
97
98
99
100
101
102
103
104
# File 'lib/oci/data_science/models/target_custom_expression_query_scaling_configuration.rb', line 96

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

  self.class == other.class &&
    target_scaling_configuration_type == other.target_scaling_configuration_type &&
    query == other.query &&
    threshold == other.threshold &&
    metric_namespace == other.metric_namespace
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



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/oci/data_science/models/target_custom_expression_query_scaling_configuration.rb', line 129

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


109
110
111
# File 'lib/oci/data_science/models/target_custom_expression_query_scaling_configuration.rb', line 109

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



118
119
120
# File 'lib/oci/data_science/models/target_custom_expression_query_scaling_configuration.rb', line 118

def hash
  [target_scaling_configuration_type, query, threshold, metric_namespace].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



162
163
164
165
166
167
168
169
170
171
# File 'lib/oci/data_science/models/target_custom_expression_query_scaling_configuration.rb', line 162

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



156
157
158
# File 'lib/oci/data_science/models/target_custom_expression_query_scaling_configuration.rb', line 156

def to_s
  to_hash.to_s
end