|
| 1 | +=begin |
| 2 | +#Datadog API V2 Collection |
| 3 | +
|
| 4 | +#Collection of all Datadog Public endpoints. |
| 5 | +
|
| 6 | +The version of the OpenAPI document: 1.0 |
| 7 | +Contact: support@datadoghq.com |
| 8 | +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator |
| 9 | +
|
| 10 | + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. |
| 11 | + This product includes software developed at Datadog (https://www.datadoghq.com/). |
| 12 | + Copyright 2020-Present Datadog, Inc. |
| 13 | +
|
| 14 | +=end |
| 15 | + |
| 16 | +require 'date' |
| 17 | +require 'time' |
| 18 | + |
| 19 | +module DatadogAPIClient::V2 |
| 20 | + # The `generate_metrics` processor creates custom metrics from logs. |
| 21 | + # Metrics can be counters, gauges, or distributions and optionally grouped by log fields. |
| 22 | + # The generated metrics must be routed to a metrics destination using the input `<processor-id>.metrics`. |
| 23 | + # |
| 24 | + # **Supported pipeline types:** logs |
| 25 | + class ObservabilityPipelineGenerateMetricsV2Processor |
| 26 | + include BaseGenericModel |
| 27 | + |
| 28 | + # The display name for a component. |
| 29 | + attr_accessor :display_name |
| 30 | + |
| 31 | + # Indicates whether the processor is enabled. |
| 32 | + attr_reader :enabled |
| 33 | + |
| 34 | + # The unique identifier for this component. Used to reference this component in other parts of the pipeline. |
| 35 | + attr_reader :id |
| 36 | + |
| 37 | + # A Datadog search query used to determine which logs this processor targets. |
| 38 | + attr_accessor :include |
| 39 | + |
| 40 | + # Configuration for generating individual metrics. |
| 41 | + attr_accessor :metrics |
| 42 | + |
| 43 | + # The processor type. Always `generate_metrics`. |
| 44 | + attr_reader :type |
| 45 | + |
| 46 | + attr_accessor :additional_properties |
| 47 | + |
| 48 | + # Attribute mapping from ruby-style variable name to JSON key. |
| 49 | + # @!visibility private |
| 50 | + def self.attribute_map |
| 51 | + { |
| 52 | + :'display_name' => :'display_name', |
| 53 | + :'enabled' => :'enabled', |
| 54 | + :'id' => :'id', |
| 55 | + :'include' => :'include', |
| 56 | + :'metrics' => :'metrics', |
| 57 | + :'type' => :'type' |
| 58 | + } |
| 59 | + end |
| 60 | + |
| 61 | + # Attribute type mapping. |
| 62 | + # @!visibility private |
| 63 | + def self.openapi_types |
| 64 | + { |
| 65 | + :'display_name' => :'String', |
| 66 | + :'enabled' => :'Boolean', |
| 67 | + :'id' => :'String', |
| 68 | + :'include' => :'String', |
| 69 | + :'metrics' => :'Array<ObservabilityPipelineGeneratedMetric>', |
| 70 | + :'type' => :'ObservabilityPipelineGenerateMetricsV2ProcessorType' |
| 71 | + } |
| 72 | + end |
| 73 | + |
| 74 | + # Initializes the object |
| 75 | + # @param attributes [Hash] Model attributes in the form of hash |
| 76 | + # @!visibility private |
| 77 | + def initialize(attributes = {}) |
| 78 | + if (!attributes.is_a?(Hash)) |
| 79 | + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ObservabilityPipelineGenerateMetricsV2Processor` initialize method" |
| 80 | + end |
| 81 | + |
| 82 | + self.additional_properties = {} |
| 83 | + # check to see if the attribute exists and convert string to symbol for hash key |
| 84 | + attributes = attributes.each_with_object({}) { |(k, v), h| |
| 85 | + if (!self.class.attribute_map.key?(k.to_sym)) |
| 86 | + self.additional_properties[k.to_sym] = v |
| 87 | + else |
| 88 | + h[k.to_sym] = v |
| 89 | + end |
| 90 | + } |
| 91 | + |
| 92 | + if attributes.key?(:'display_name') |
| 93 | + self.display_name = attributes[:'display_name'] |
| 94 | + end |
| 95 | + |
| 96 | + if attributes.key?(:'enabled') |
| 97 | + self.enabled = attributes[:'enabled'] |
| 98 | + end |
| 99 | + |
| 100 | + if attributes.key?(:'id') |
| 101 | + self.id = attributes[:'id'] |
| 102 | + end |
| 103 | + |
| 104 | + if attributes.key?(:'include') |
| 105 | + self.include = attributes[:'include'] |
| 106 | + end |
| 107 | + |
| 108 | + if attributes.key?(:'metrics') |
| 109 | + if (value = attributes[:'metrics']).is_a?(Array) |
| 110 | + self.metrics = value |
| 111 | + end |
| 112 | + end |
| 113 | + |
| 114 | + if attributes.key?(:'type') |
| 115 | + self.type = attributes[:'type'] |
| 116 | + end |
| 117 | + end |
| 118 | + |
| 119 | + # Check to see if the all the properties in the model are valid |
| 120 | + # @return true if the model is valid |
| 121 | + # @!visibility private |
| 122 | + def valid? |
| 123 | + return false if @enabled.nil? |
| 124 | + return false if @id.nil? |
| 125 | + return false if @type.nil? |
| 126 | + true |
| 127 | + end |
| 128 | + |
| 129 | + # Custom attribute writer method with validation |
| 130 | + # @param enabled [Object] Object to be assigned |
| 131 | + # @!visibility private |
| 132 | + def enabled=(enabled) |
| 133 | + if enabled.nil? |
| 134 | + fail ArgumentError, 'invalid value for "enabled", enabled cannot be nil.' |
| 135 | + end |
| 136 | + @enabled = enabled |
| 137 | + end |
| 138 | + |
| 139 | + # Custom attribute writer method with validation |
| 140 | + # @param id [Object] Object to be assigned |
| 141 | + # @!visibility private |
| 142 | + def id=(id) |
| 143 | + if id.nil? |
| 144 | + fail ArgumentError, 'invalid value for "id", id cannot be nil.' |
| 145 | + end |
| 146 | + @id = id |
| 147 | + end |
| 148 | + |
| 149 | + # Custom attribute writer method with validation |
| 150 | + # @param type [Object] Object to be assigned |
| 151 | + # @!visibility private |
| 152 | + def type=(type) |
| 153 | + if type.nil? |
| 154 | + fail ArgumentError, 'invalid value for "type", type cannot be nil.' |
| 155 | + end |
| 156 | + @type = type |
| 157 | + end |
| 158 | + |
| 159 | + # Returns the object in the form of hash, with additionalProperties support. |
| 160 | + # @return [Hash] Returns the object in the form of hash |
| 161 | + # @!visibility private |
| 162 | + def to_hash |
| 163 | + hash = {} |
| 164 | + self.class.attribute_map.each_pair do |attr, param| |
| 165 | + value = self.send(attr) |
| 166 | + if value.nil? |
| 167 | + is_nullable = self.class.openapi_nullable.include?(attr) |
| 168 | + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) |
| 169 | + end |
| 170 | + |
| 171 | + hash[param] = _to_hash(value) |
| 172 | + end |
| 173 | + self.additional_properties.each_pair do |attr, value| |
| 174 | + hash[attr] = value |
| 175 | + end |
| 176 | + hash |
| 177 | + end |
| 178 | + |
| 179 | + # Checks equality by comparing each attribute. |
| 180 | + # @param o [Object] Object to be compared |
| 181 | + # @!visibility private |
| 182 | + def ==(o) |
| 183 | + return true if self.equal?(o) |
| 184 | + self.class == o.class && |
| 185 | + display_name == o.display_name && |
| 186 | + enabled == o.enabled && |
| 187 | + id == o.id && |
| 188 | + include == o.include && |
| 189 | + metrics == o.metrics && |
| 190 | + type == o.type && |
| 191 | + additional_properties == o.additional_properties |
| 192 | + end |
| 193 | + |
| 194 | + # Calculates hash code according to all attributes. |
| 195 | + # @return [Integer] Hash code |
| 196 | + # @!visibility private |
| 197 | + def hash |
| 198 | + [display_name, enabled, id, include, metrics, type, additional_properties].hash |
| 199 | + end |
| 200 | + end |
| 201 | +end |
0 commit comments