Class: OCI::ApmTraces::Models::CustomMetric
- Inherits:
-
Object
- Object
- OCI::ApmTraces::Models::CustomMetric
- Defined in:
- lib/oci/apm_traces/models/custom_metric.rb
Overview
Definition of the Custom Metric.
Instance Attribute Summary collapse
-
#compartment ⇒ String
Compartment of the Monitoring Service.
-
#description ⇒ String
Description of the Custom Metric.
-
#is_anomaly_detection_enabled ⇒ BOOLEAN
Indicates whether anomaly Detection should be performed on the generated metric.
-
#is_metric_published ⇒ BOOLEAN
Used in conjunction with the dry run header.
-
#name ⇒ String
[Required] Name of the Custom Metric.
-
#namespace ⇒ String
Namespace in the Custom Metric.
-
#resource_group ⇒ String
Resource Group of the Custom Metric.
-
#unit ⇒ String
Unit in which the metric value is reported.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.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 = {}) ⇒ CustomMetric
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 = {}) ⇒ CustomMetric
Initializes the object
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 |
# File 'lib/oci/apm_traces/models/custom_metric.rb', line 102 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.namespace = attributes[:'namespace'] if attributes[:'namespace'] self.namespace = "oracle_apm_custom" if namespace.nil? && !attributes.key?(:'namespace') # rubocop:disable Style/StringLiterals self.name = attributes[:'name'] if attributes[:'name'] self.description = attributes[:'description'] if attributes[:'description'] 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.is_anomaly_detection_enabled = attributes[:'isAnomalyDetectionEnabled'] unless attributes[:'isAnomalyDetectionEnabled'].nil? raise 'You cannot provide both :isAnomalyDetectionEnabled and :is_anomaly_detection_enabled' if attributes.key?(:'isAnomalyDetectionEnabled') && attributes.key?(:'is_anomaly_detection_enabled') self.is_anomaly_detection_enabled = attributes[:'is_anomaly_detection_enabled'] unless attributes[:'is_anomaly_detection_enabled'].nil? self.compartment = attributes[:'compartment'] if attributes[:'compartment'] self.unit = attributes[:'unit'] if attributes[:'unit'] self.is_metric_published = attributes[:'isMetricPublished'] unless attributes[:'isMetricPublished'].nil? raise 'You cannot provide both :isMetricPublished and :is_metric_published' if attributes.key?(:'isMetricPublished') && attributes.key?(:'is_metric_published') self.is_metric_published = attributes[:'is_metric_published'] unless attributes[:'is_metric_published'].nil? end |
Instance Attribute Details
#compartment ⇒ String
Compartment of the Monitoring Service. It defaults to the APM domain's compartment if not specified. If specified, the necessary OCI policies should be set to allow APM to write to that compartment.
42 43 44 |
# File 'lib/oci/apm_traces/models/custom_metric.rb', line 42 def compartment @compartment end |
#description ⇒ String
Description of the Custom Metric.
26 27 28 |
# File 'lib/oci/apm_traces/models/custom_metric.rb', line 26 def description @description end |
#is_anomaly_detection_enabled ⇒ BOOLEAN
Indicates whether anomaly Detection should be performed on the generated metric.
36 37 38 |
# File 'lib/oci/apm_traces/models/custom_metric.rb', line 36 def is_anomaly_detection_enabled @is_anomaly_detection_enabled end |
#is_metric_published ⇒ BOOLEAN
Used in conjunction with the dry run header. When the dry run header is set and the isPublishMetric flag is set to true, the scheduled query is not created, but validations happen to check if the right OCI policies have been set to write to the specified namespace/compartment.
54 55 56 |
# File 'lib/oci/apm_traces/models/custom_metric.rb', line 54 def is_metric_published @is_metric_published end |
#name ⇒ String
[Required] Name of the Custom Metric.
21 22 23 |
# File 'lib/oci/apm_traces/models/custom_metric.rb', line 21 def name @name end |
#namespace ⇒ String
Namespace in the Custom Metric. It defaults to oracle_apm_custom if not specified. If specified, the necessary OCI policies should be set to allow APM to write to that namespace.
16 17 18 |
# File 'lib/oci/apm_traces/models/custom_metric.rb', line 16 def namespace @namespace end |
#resource_group ⇒ String
Resource Group of the Custom Metric.
31 32 33 |
# File 'lib/oci/apm_traces/models/custom_metric.rb', line 31 def resource_group @resource_group end |
#unit ⇒ String
Unit in which the metric value is reported. For example 'ms'.
47 48 49 |
# File 'lib/oci/apm_traces/models/custom_metric.rb', line 47 def unit @unit end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/oci/apm_traces/models/custom_metric.rb', line 57 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'namespace': :'namespace', 'name': :'name', 'description': :'description', 'resource_group': :'resourceGroup', 'is_anomaly_detection_enabled': :'isAnomalyDetectionEnabled', 'compartment': :'compartment', 'unit': :'unit', 'is_metric_published': :'isMetricPublished' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/oci/apm_traces/models/custom_metric.rb', line 73 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'namespace': :'String', 'name': :'String', 'description': :'String', 'resource_group': :'String', 'is_anomaly_detection_enabled': :'BOOLEAN', 'compartment': :'String', 'unit': :'String', 'is_metric_published': :'BOOLEAN' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/oci/apm_traces/models/custom_metric.rb', line 145 def ==(other) return true if equal?(other) self.class == other.class && namespace == other.namespace && name == other.name && description == other.description && resource_group == other.resource_group && is_anomaly_detection_enabled == other.is_anomaly_detection_enabled && compartment == other.compartment && unit == other.unit && is_metric_published == other.is_metric_published end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/oci/apm_traces/models/custom_metric.rb', line 182 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
162 163 164 |
# File 'lib/oci/apm_traces/models/custom_metric.rb', line 162 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
171 172 173 |
# File 'lib/oci/apm_traces/models/custom_metric.rb', line 171 def hash [namespace, name, description, resource_group, is_anomaly_detection_enabled, compartment, unit, is_metric_published].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
215 216 217 218 219 220 221 222 223 224 |
# File 'lib/oci/apm_traces/models/custom_metric.rb', line 215 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
209 210 211 |
# File 'lib/oci/apm_traces/models/custom_metric.rb', line 209 def to_s to_hash.to_s end |