Class: OCI::StackMonitoring::Models::AgentExtensionHandlerMetricMappingDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/stack_monitoring/models/agent_extension_handler_metric_mapping_details.rb

Overview

Specific metric mapping configurations for Agent Extension Handlers.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AgentExtensionHandlerMetricMappingDetails

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/oci/stack_monitoring/models/agent_extension_handler_metric_mapping_details.rb', line 63

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

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

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

  self.telemetry_metric_name = attributes[:'telemetryMetricName'] if attributes[:'telemetryMetricName']

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

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

  self.is_skip_upload = attributes[:'isSkipUpload'] unless attributes[:'isSkipUpload'].nil?
  self.is_skip_upload = false if is_skip_upload.nil? && !attributes.key?(:'isSkipUpload') # rubocop:disable Style/StringLiterals

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

  self.is_skip_upload = attributes[:'is_skip_upload'] unless attributes[:'is_skip_upload'].nil?
  self.is_skip_upload = false if is_skip_upload.nil? && !attributes.key?(:'isSkipUpload') && !attributes.key?(:'is_skip_upload') # rubocop:disable Style/StringLiterals

  self.metric_upload_interval_in_seconds = attributes[:'metricUploadIntervalInSeconds'] if attributes[:'metricUploadIntervalInSeconds']

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

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

Instance Attribute Details

#collector_metric_nameString

[Required] Metric name as defined by the collector.

Returns:

  • (String)


13
14
15
# File 'lib/oci/stack_monitoring/models/agent_extension_handler_metric_mapping_details.rb', line 13

def collector_metric_name
  @collector_metric_name
end

#is_skip_uploadBOOLEAN

Is ignoring this metric.

Returns:

  • (BOOLEAN)


21
22
23
# File 'lib/oci/stack_monitoring/models/agent_extension_handler_metric_mapping_details.rb', line 21

def is_skip_upload
  @is_skip_upload
end

#metric_upload_interval_in_secondsInteger

Metric upload interval in seconds. Any metric sent by telegraf/collectd before the configured interval expires will be dropped.

Returns:

  • (Integer)


27
28
29
# File 'lib/oci/stack_monitoring/models/agent_extension_handler_metric_mapping_details.rb', line 27

def metric_upload_interval_in_seconds
  @metric_upload_interval_in_seconds
end

#telemetry_metric_nameString

Metric name to be upload to telemetry.

Returns:

  • (String)


17
18
19
# File 'lib/oci/stack_monitoring/models/agent_extension_handler_metric_mapping_details.rb', line 17

def telemetry_metric_name
  @telemetry_metric_name
end

Class Method Details

.attribute_mapObject

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



30
31
32
33
34
35
36
37
38
39
# File 'lib/oci/stack_monitoring/models/agent_extension_handler_metric_mapping_details.rb', line 30

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'collector_metric_name': :'collectorMetricName',
    'telemetry_metric_name': :'telemetryMetricName',
    'is_skip_upload': :'isSkipUpload',
    'metric_upload_interval_in_seconds': :'metricUploadIntervalInSeconds'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



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

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'collector_metric_name': :'String',
    'telemetry_metric_name': :'String',
    'is_skip_upload': :'BOOLEAN',
    'metric_upload_interval_in_seconds': :'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



103
104
105
106
107
108
109
110
111
# File 'lib/oci/stack_monitoring/models/agent_extension_handler_metric_mapping_details.rb', line 103

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

  self.class == other.class &&
    collector_metric_name == other.collector_metric_name &&
    telemetry_metric_name == other.telemetry_metric_name &&
    is_skip_upload == other.is_skip_upload &&
    metric_upload_interval_in_seconds == other.metric_upload_interval_in_seconds
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



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/oci/stack_monitoring/models/agent_extension_handler_metric_mapping_details.rb', line 136

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


116
117
118
# File 'lib/oci/stack_monitoring/models/agent_extension_handler_metric_mapping_details.rb', line 116

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



125
126
127
# File 'lib/oci/stack_monitoring/models/agent_extension_handler_metric_mapping_details.rb', line 125

def hash
  [collector_metric_name, telemetry_metric_name, is_skip_upload, metric_upload_interval_in_seconds].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



169
170
171
172
173
174
175
176
177
178
# File 'lib/oci/stack_monitoring/models/agent_extension_handler_metric_mapping_details.rb', line 169

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



163
164
165
# File 'lib/oci/stack_monitoring/models/agent_extension_handler_metric_mapping_details.rb', line 163

def to_s
  to_hash.to_s
end