Class: OCI::ManagementAgent::Models::PrometheusEmitterDataSource

Inherits:
DataSource
  • Object
show all
Defined in:
lib/oci/management_agent/models/prometheus_emitter_data_source.rb

Overview

A Prometheus data source.

Constant Summary

Constants inherited from DataSource

DataSource::STATE_ENUM, DataSource::TYPE_ENUM

Instance Attribute Summary collapse

Attributes inherited from DataSource

#compartment_id, #key, #name, #state, #time_created, #time_updated, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DataSource

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ PrometheusEmitterDataSource

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :key (String)

    The value to assign to the #key proprety

  • :name (String)

    The value to assign to the #name proprety

  • :compartment_id (String)

    The value to assign to the #compartment_id proprety

  • :state (String)

    The value to assign to the #state proprety

  • :time_created (DateTime)

    The value to assign to the #time_created proprety

  • :time_updated (DateTime)

    The value to assign to the #time_updated proprety

  • :url (String)

    The value to assign to the #url property

  • :namespace (String)

    The value to assign to the #namespace property

  • :allow_metrics (String)

    The value to assign to the #allow_metrics property

  • :proxy_url (String)

    The value to assign to the #proxy_url property

  • :connection_timeout (Integer)

    The value to assign to the #connection_timeout property

  • :read_timeout (Integer)

    The value to assign to the #read_timeout property

  • :read_data_limit (Integer)

    The value to assign to the #read_data_limit property

  • :schedule_mins (Integer)

    The value to assign to the #schedule_mins property

  • :resource_group (String)

    The value to assign to the #resource_group property

  • :metric_dimensions (Array<OCI::ManagementAgent::Models::MetricDimension>)

    The value to assign to the #metric_dimensions property



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/oci/management_agent/models/prometheus_emitter_data_source.rb', line 125

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

  attributes['type'] = 'PROMETHEUS_EMITTER'

  super(attributes)

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

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

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

  self.allow_metrics = attributes[:'allowMetrics'] if attributes[:'allowMetrics']
  self.allow_metrics = "*" if allow_metrics.nil? && !attributes.key?(:'allowMetrics') # rubocop:disable Style/StringLiterals

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

  self.allow_metrics = attributes[:'allow_metrics'] if attributes[:'allow_metrics']
  self.allow_metrics = "*" if allow_metrics.nil? && !attributes.key?(:'allowMetrics') && !attributes.key?(:'allow_metrics') # rubocop:disable Style/StringLiterals

  self.proxy_url = attributes[:'proxyUrl'] if attributes[:'proxyUrl']

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

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

  self.connection_timeout = attributes[:'connectionTimeout'] if attributes[:'connectionTimeout']

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

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

  self.read_timeout = attributes[:'readTimeout'] if attributes[:'readTimeout']

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

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

  self.read_data_limit = attributes[:'readDataLimit'] if attributes[:'readDataLimit']

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

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

  self.schedule_mins = attributes[:'scheduleMins'] if attributes[:'scheduleMins']

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

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

  self.resource_group = attributes[:'resourceGroup'] if attributes[:'resourceGroup']

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

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

  self.metric_dimensions = attributes[:'metricDimensions'] if attributes[:'metricDimensions']

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

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

Instance Attribute Details

#allow_metricsString

Comma separated metric name list. The complete set of desired scraped metrics. Use this property to limit the set of metrics uploaded if required.

Returns:

  • (String)


23
24
25
# File 'lib/oci/management_agent/models/prometheus_emitter_data_source.rb', line 23

def allow_metrics
  @allow_metrics
end

#connection_timeoutInteger

Number in milliseconds. The timeout for connecting to the Prometheus Exporter's endpoint.

Returns:

  • (Integer)


31
32
33
# File 'lib/oci/management_agent/models/prometheus_emitter_data_source.rb', line 31

def connection_timeout
  @connection_timeout
end

#metric_dimensionsArray<OCI::ManagementAgent::Models::MetricDimension>

The names of other user-supplied properties expressed as fixed values to be used as dimensions for every uploaded datapoint.



51
52
53
# File 'lib/oci/management_agent/models/prometheus_emitter_data_source.rb', line 51

def metric_dimensions
  @metric_dimensions
end

#namespaceString

[Required] The OCI monitoring namespace to which scraped metrics should be uploaded.

Returns:

  • (String)


19
20
21
# File 'lib/oci/management_agent/models/prometheus_emitter_data_source.rb', line 19

def namespace
  @namespace
end

#proxy_urlString

The url of the network proxy that provides access to the Prometheus Exporter's endpoint (url required property).

Returns:

  • (String)


27
28
29
# File 'lib/oci/management_agent/models/prometheus_emitter_data_source.rb', line 27

def proxy_url
  @proxy_url
end

#read_data_limitInteger

Number in kilobytes. The limit on the data being sent, not to exceed the agent's fixed limit of 400 (KB).

Returns:

  • (Integer)


39
40
41
# File 'lib/oci/management_agent/models/prometheus_emitter_data_source.rb', line 39

def read_data_limit
  @read_data_limit
end

#read_timeoutInteger

Number in milliseconds. The timeout for reading the response from the Prometheus Exporter's endpoint.

Returns:

  • (Integer)


35
36
37
# File 'lib/oci/management_agent/models/prometheus_emitter_data_source.rb', line 35

def read_timeout
  @read_timeout
end

#resource_groupString

OCI monitoring resource group to assign the metric to.

Returns:

  • (String)


47
48
49
# File 'lib/oci/management_agent/models/prometheus_emitter_data_source.rb', line 47

def resource_group
  @resource_group
end

#schedule_minsInteger

Number in minutes. The scraping occurs at the specified interval.

Returns:

  • (Integer)


43
44
45
# File 'lib/oci/management_agent/models/prometheus_emitter_data_source.rb', line 43

def schedule_mins
  @schedule_mins
end

#urlString

[Required] The url through which the Prometheus Exporter publishes its metrics. (http only)

Returns:

  • (String)


15
16
17
# File 'lib/oci/management_agent/models/prometheus_emitter_data_source.rb', line 15

def url
  @url
end

Class Method Details

.attribute_mapObject

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



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/oci/management_agent/models/prometheus_emitter_data_source.rb', line 54

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'key': :'key',
    'type': :'type',
    'name': :'name',
    'compartment_id': :'compartmentId',
    'state': :'state',
    'time_created': :'timeCreated',
    'time_updated': :'timeUpdated',
    'url': :'url',
    'namespace': :'namespace',
    'allow_metrics': :'allowMetrics',
    'proxy_url': :'proxyUrl',
    'connection_timeout': :'connectionTimeout',
    'read_timeout': :'readTimeout',
    'read_data_limit': :'readDataLimit',
    'schedule_mins': :'scheduleMins',
    'resource_group': :'resourceGroup',
    'metric_dimensions': :'metricDimensions'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/oci/management_agent/models/prometheus_emitter_data_source.rb', line 79

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'key': :'String',
    'type': :'String',
    'name': :'String',
    'compartment_id': :'String',
    'state': :'String',
    'time_created': :'DateTime',
    'time_updated': :'DateTime',
    'url': :'String',
    'namespace': :'String',
    'allow_metrics': :'String',
    'proxy_url': :'String',
    'connection_timeout': :'Integer',
    'read_timeout': :'Integer',
    'read_data_limit': :'Integer',
    'schedule_mins': :'Integer',
    'resource_group': :'String',
    'metric_dimensions': :'Array<OCI::ManagementAgent::Models::MetricDimension>'
    # 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



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/oci/management_agent/models/prometheus_emitter_data_source.rb', line 197

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

  self.class == other.class &&
    key == other.key &&
    type == other.type &&
    name == other.name &&
    compartment_id == other.compartment_id &&
    state == other.state &&
    time_created == other.time_created &&
    time_updated == other.time_updated &&
    url == other.url &&
    namespace == other.namespace &&
    allow_metrics == other.allow_metrics &&
    proxy_url == other.proxy_url &&
    connection_timeout == other.connection_timeout &&
    read_timeout == other.read_timeout &&
    read_data_limit == other.read_data_limit &&
    schedule_mins == other.schedule_mins &&
    resource_group == other.resource_group &&
    metric_dimensions == other.metric_dimensions
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



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/oci/management_agent/models/prometheus_emitter_data_source.rb', line 243

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


223
224
225
# File 'lib/oci/management_agent/models/prometheus_emitter_data_source.rb', line 223

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



232
233
234
# File 'lib/oci/management_agent/models/prometheus_emitter_data_source.rb', line 232

def hash
  [key, type, name, compartment_id, state, time_created, time_updated, url, namespace, allow_metrics, proxy_url, connection_timeout, read_timeout, read_data_limit, schedule_mins, resource_group, metric_dimensions].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



276
277
278
279
280
281
282
283
284
285
# File 'lib/oci/management_agent/models/prometheus_emitter_data_source.rb', line 276

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



270
271
272
# File 'lib/oci/management_agent/models/prometheus_emitter_data_source.rb', line 270

def to_s
  to_hash.to_s
end