diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9b5a962d1755..b6f217878453 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -33935,6 +33935,21 @@ components: format: int64 type: integer type: object + DeviceTagsBySource: + description: Tags associated with a device from a specific source. + properties: + source: + description: The source of the tags. + example: user + type: string + tags: + description: The list of tags for the source. + example: ["tag:test", "tag:testbis"] + items: + description: A tag string in `key:value` format. + type: string + type: array + type: object DevicesListData: description: The devices list data properties: @@ -63468,6 +63483,12 @@ components: ListTagsResponseDataAttributes: description: The definition of ListTagsResponseDataAttributes object. properties: + by_source: + description: The list of device tags grouped by source. + items: + $ref: "#/components/schemas/DeviceTagsBySource" + readOnly: true + type: array tags: description: The list of tags example: ["tag:test", "tag:testbis"] @@ -173995,6 +174016,20 @@ paths: content: application/json: examples: + by_source: + value: + data: + attributes: + by_source: + - source: user + tags: + - "tag:test" + - "tag:testbis" + - source: snmp + tags: + - "device_ip:1.2.3.4" + id: foiwf7rgw38fh + type: tags default: value: data: diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 105d969ef8bb..fdb149918ee2 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3036,6 +3036,7 @@ def overrides "v2.device_attributes" => "DeviceAttributes", "v2.device_attributes_interface_statuses" => "DeviceAttributesInterfaceStatuses", "v2.devices_list_data" => "DevicesListData", + "v2.device_tags_by_source" => "DeviceTagsBySource", "v2.dns_metric_key" => "DnsMetricKey", "v2.domain_allowlist" => "DomainAllowlist", "v2.domain_allowlist_attributes" => "DomainAllowlistAttributes", diff --git a/lib/datadog_api_client/v2/models/device_tags_by_source.rb b/lib/datadog_api_client/v2/models/device_tags_by_source.rb new file mode 100644 index 000000000000..74f54fdf67d5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/device_tags_by_source.rb @@ -0,0 +1,117 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Tags associated with a device from a specific source. + class DeviceTagsBySource + include BaseGenericModel + + # The source of the tags. + attr_accessor :source + + # The list of tags for the source. + attr_accessor :tags + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'source' => :'source', + :'tags' => :'tags' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'source' => :'String', + :'tags' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DeviceTagsBySource` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'source') + self.source = attributes[:'source'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + source == o.source && + tags == o.tags && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [source, tags, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/list_tags_response_data_attributes.rb b/lib/datadog_api_client/v2/models/list_tags_response_data_attributes.rb index 4474d70504bd..db14060fd0d5 100644 --- a/lib/datadog_api_client/v2/models/list_tags_response_data_attributes.rb +++ b/lib/datadog_api_client/v2/models/list_tags_response_data_attributes.rb @@ -21,6 +21,9 @@ module DatadogAPIClient::V2 class ListTagsResponseDataAttributes include BaseGenericModel + # The list of device tags grouped by source. + attr_accessor :by_source + # The list of tags attr_accessor :tags @@ -30,6 +33,7 @@ class ListTagsResponseDataAttributes # @!visibility private def self.attribute_map { + :'by_source' => :'by_source', :'tags' => :'tags' } end @@ -38,6 +42,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { + :'by_source' => :'Array', :'tags' => :'Array' } end @@ -60,6 +65,12 @@ def initialize(attributes = {}) end } + if attributes.key?(:'by_source') + if (value = attributes[:'by_source']).is_a?(Array) + self.by_source = value + end + end + if attributes.key?(:'tags') if (value = attributes[:'tags']).is_a?(Array) self.tags = value @@ -93,6 +104,7 @@ def to_hash def ==(o) return true if self.equal?(o) self.class == o.class && + by_source == o.by_source && tags == o.tags && additional_properties == o.additional_properties end @@ -101,7 +113,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [tags, additional_properties].hash + [by_source, tags, additional_properties].hash end end end