|
| 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 | + |
| 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 `datadog_tags` processor includes or excludes specific Datadog tags in your logs. |
| 21 | + class ObservabilityPipelineDatadogTagsProcessor |
| 22 | + include BaseGenericModel |
| 23 | + |
| 24 | + # The action to take on tags with matching keys. |
| 25 | + attr_reader :action |
| 26 | + |
| 27 | + # The unique identifier for this component. Used to reference this component in other parts of the pipeline (for example, as the `input` to downstream components). |
| 28 | + attr_reader :id |
| 29 | + |
| 30 | + # A Datadog search query used to determine which logs this processor targets. |
| 31 | + attr_reader :include |
| 32 | + |
| 33 | + # A list of component IDs whose output is used as the `input` for this component. |
| 34 | + attr_reader :inputs |
| 35 | + |
| 36 | + # A list of tag keys. |
| 37 | + attr_reader :keys |
| 38 | + |
| 39 | + # The processing mode. |
| 40 | + attr_reader :mode |
| 41 | + |
| 42 | + # The processor type. The value should always be `datadog_tags`. |
| 43 | + attr_reader :type |
| 44 | + |
| 45 | + attr_accessor :additional_properties |
| 46 | + |
| 47 | + # Attribute mapping from ruby-style variable name to JSON key. |
| 48 | + # @!visibility private |
| 49 | + def self.attribute_map |
| 50 | + { |
| 51 | + :'action' => :'action', |
| 52 | + :'id' => :'id', |
| 53 | + :'include' => :'include', |
| 54 | + :'inputs' => :'inputs', |
| 55 | + :'keys' => :'keys', |
| 56 | + :'mode' => :'mode', |
| 57 | + :'type' => :'type' |
| 58 | + } |
| 59 | + end |
| 60 | + |
| 61 | + # Attribute type mapping. |
| 62 | + # @!visibility private |
| 63 | + def self.openapi_types |
| 64 | + { |
| 65 | + :'action' => :'ObservabilityPipelineDatadogTagsProcessorAction', |
| 66 | + :'id' => :'String', |
| 67 | + :'include' => :'String', |
| 68 | + :'inputs' => :'Array<String>', |
| 69 | + :'keys' => :'Array<String>', |
| 70 | + :'mode' => :'ObservabilityPipelineDatadogTagsProcessorMode', |
| 71 | + :'type' => :'ObservabilityPipelineDatadogTagsProcessorType' |
| 72 | + } |
| 73 | + end |
| 74 | + |
| 75 | + # Initializes the object |
| 76 | + # @param attributes [Hash] Model attributes in the form of hash |
| 77 | + # @!visibility private |
| 78 | + def initialize(attributes = {}) |
| 79 | + if (!attributes.is_a?(Hash)) |
| 80 | + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ObservabilityPipelineDatadogTagsProcessor` initialize method" |
| 81 | + end |
| 82 | + |
| 83 | + self.additional_properties = {} |
| 84 | + # check to see if the attribute exists and convert string to symbol for hash key |
| 85 | + attributes = attributes.each_with_object({}) { |(k, v), h| |
| 86 | + if (!self.class.attribute_map.key?(k.to_sym)) |
| 87 | + self.additional_properties[k.to_sym] = v |
| 88 | + else |
| 89 | + h[k.to_sym] = v |
| 90 | + end |
| 91 | + } |
| 92 | + |
| 93 | + if attributes.key?(:'action') |
| 94 | + self.action = attributes[:'action'] |
| 95 | + end |
| 96 | + |
| 97 | + if attributes.key?(:'id') |
| 98 | + self.id = attributes[:'id'] |
| 99 | + end |
| 100 | + |
| 101 | + if attributes.key?(:'include') |
| 102 | + self.include = attributes[:'include'] |
| 103 | + end |
| 104 | + |
| 105 | + if attributes.key?(:'inputs') |
| 106 | + if (value = attributes[:'inputs']).is_a?(Array) |
| 107 | + self.inputs = value |
| 108 | + end |
| 109 | + end |
| 110 | + |
| 111 | + if attributes.key?(:'keys') |
| 112 | + if (value = attributes[:'keys']).is_a?(Array) |
| 113 | + self.keys = value |
| 114 | + end |
| 115 | + end |
| 116 | + |
| 117 | + if attributes.key?(:'mode') |
| 118 | + self.mode = attributes[:'mode'] |
| 119 | + end |
| 120 | + |
| 121 | + if attributes.key?(:'type') |
| 122 | + self.type = attributes[:'type'] |
| 123 | + end |
| 124 | + end |
| 125 | + |
| 126 | + # Check to see if the all the properties in the model are valid |
| 127 | + # @return true if the model is valid |
| 128 | + # @!visibility private |
| 129 | + def valid? |
| 130 | + return false if @action.nil? |
| 131 | + return false if @id.nil? |
| 132 | + return false if @include.nil? |
| 133 | + return false if @inputs.nil? |
| 134 | + return false if @keys.nil? |
| 135 | + return false if @mode.nil? |
| 136 | + return false if @type.nil? |
| 137 | + true |
| 138 | + end |
| 139 | + |
| 140 | + # Custom attribute writer method with validation |
| 141 | + # @param action [Object] Object to be assigned |
| 142 | + # @!visibility private |
| 143 | + def action=(action) |
| 144 | + if action.nil? |
| 145 | + fail ArgumentError, 'invalid value for "action", action cannot be nil.' |
| 146 | + end |
| 147 | + @action = action |
| 148 | + end |
| 149 | + |
| 150 | + # Custom attribute writer method with validation |
| 151 | + # @param id [Object] Object to be assigned |
| 152 | + # @!visibility private |
| 153 | + def id=(id) |
| 154 | + if id.nil? |
| 155 | + fail ArgumentError, 'invalid value for "id", id cannot be nil.' |
| 156 | + end |
| 157 | + @id = id |
| 158 | + end |
| 159 | + |
| 160 | + # Custom attribute writer method with validation |
| 161 | + # @param include [Object] Object to be assigned |
| 162 | + # @!visibility private |
| 163 | + def include=(include) |
| 164 | + if include.nil? |
| 165 | + fail ArgumentError, 'invalid value for "include", include cannot be nil.' |
| 166 | + end |
| 167 | + @include = include |
| 168 | + end |
| 169 | + |
| 170 | + # Custom attribute writer method with validation |
| 171 | + # @param inputs [Object] Object to be assigned |
| 172 | + # @!visibility private |
| 173 | + def inputs=(inputs) |
| 174 | + if inputs.nil? |
| 175 | + fail ArgumentError, 'invalid value for "inputs", inputs cannot be nil.' |
| 176 | + end |
| 177 | + @inputs = inputs |
| 178 | + end |
| 179 | + |
| 180 | + # Custom attribute writer method with validation |
| 181 | + # @param keys [Object] Object to be assigned |
| 182 | + # @!visibility private |
| 183 | + def keys=(keys) |
| 184 | + if keys.nil? |
| 185 | + fail ArgumentError, 'invalid value for "keys", keys cannot be nil.' |
| 186 | + end |
| 187 | + @keys = keys |
| 188 | + end |
| 189 | + |
| 190 | + # Custom attribute writer method with validation |
| 191 | + # @param mode [Object] Object to be assigned |
| 192 | + # @!visibility private |
| 193 | + def mode=(mode) |
| 194 | + if mode.nil? |
| 195 | + fail ArgumentError, 'invalid value for "mode", mode cannot be nil.' |
| 196 | + end |
| 197 | + @mode = mode |
| 198 | + end |
| 199 | + |
| 200 | + # Custom attribute writer method with validation |
| 201 | + # @param type [Object] Object to be assigned |
| 202 | + # @!visibility private |
| 203 | + def type=(type) |
| 204 | + if type.nil? |
| 205 | + fail ArgumentError, 'invalid value for "type", type cannot be nil.' |
| 206 | + end |
| 207 | + @type = type |
| 208 | + end |
| 209 | + |
| 210 | + # Returns the object in the form of hash, with additionalProperties support. |
| 211 | + # @return [Hash] Returns the object in the form of hash |
| 212 | + # @!visibility private |
| 213 | + def to_hash |
| 214 | + hash = {} |
| 215 | + self.class.attribute_map.each_pair do |attr, param| |
| 216 | + value = self.send(attr) |
| 217 | + if value.nil? |
| 218 | + is_nullable = self.class.openapi_nullable.include?(attr) |
| 219 | + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) |
| 220 | + end |
| 221 | + |
| 222 | + hash[param] = _to_hash(value) |
| 223 | + end |
| 224 | + self.additional_properties.each_pair do |attr, value| |
| 225 | + hash[attr] = value |
| 226 | + end |
| 227 | + hash |
| 228 | + end |
| 229 | + |
| 230 | + # Checks equality by comparing each attribute. |
| 231 | + # @param o [Object] Object to be compared |
| 232 | + # @!visibility private |
| 233 | + def ==(o) |
| 234 | + return true if self.equal?(o) |
| 235 | + self.class == o.class && |
| 236 | + action == o.action && |
| 237 | + id == o.id && |
| 238 | + include == o.include && |
| 239 | + inputs == o.inputs && |
| 240 | + keys == o.keys && |
| 241 | + mode == o.mode && |
| 242 | + type == o.type && |
| 243 | + additional_properties == o.additional_properties |
| 244 | + end |
| 245 | + |
| 246 | + # Calculates hash code according to all attributes. |
| 247 | + # @return [Integer] Hash code |
| 248 | + # @!visibility private |
| 249 | + def hash |
| 250 | + [action, id, include, inputs, keys, mode, type, additional_properties].hash |
| 251 | + end |
| 252 | + end |
| 253 | +end |
0 commit comments