diff --git a/.generated-info b/.generated-info index dd5463082c6..a4e38e6b354 100644 --- a/.generated-info +++ b/.generated-info @@ -1,4 +1,4 @@ { - "spec_repo_commit": "f2ae7eb", - "generated": "2025-07-17 19:53:16.203" + "spec_repo_commit": "dc49df4", + "generated": "2025-07-18 13:57:23.914" } diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 725b65b41ac..8f845b4f20d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -13911,14 +13911,21 @@ components: type: string type: object EntityV3APIVersion: - description: The schema version of entity type. The field is known as schema-version - in the previous version. + description: The version of the schema data that was used to populate this entity's + data. This could be via the API, Terraform, or YAML file in a repository. + The field is known as schema-version in the previous version. enum: - v3 + - v2.2 + - v2.1 + - v2 example: v3 type: string x-enum-varnames: - V3 + - V2_2 + - V2_1 + - V2 EntityV3DatadogCodeLocationItem: additionalProperties: false description: Code location item. @@ -23182,6 +23189,61 @@ components: type: string type: array type: object + MetricTagCardinalitiesData: + description: A list of tag cardinalities associated with the given metric. + items: + $ref: '#/components/schemas/MetricTagCardinality' + type: array + MetricTagCardinalitiesMeta: + description: Response metadata object. + properties: + metric_name: + description: 'The name of metric for which the tag cardinalities are returned. + + This matches the metric name provided in the request. + + ' + type: string + type: object + MetricTagCardinalitiesResponse: + description: 'Response object that includes an array of objects representing + the cardinality details of a metric''s tags. + + ' + properties: + data: + $ref: '#/components/schemas/MetricTagCardinalitiesData' + meta: + $ref: '#/components/schemas/MetricTagCardinalitiesMeta' + readOnly: true + type: object + MetricTagCardinality: + description: Object containing metadata and attributes related to a specific + tag key associated with the metric. + example: + attributes: + cardinality_delta: 25 + id: http.request.latency + type: tag_cardinality + properties: + attributes: + $ref: '#/components/schemas/MetricTagCardinalityAttributes' + id: + description: The name of the tag key. + type: string + type: + default: tag_cardinality + description: This describes the endpoint action. + type: string + type: object + MetricTagCardinalityAttributes: + description: An object containing properties related to the tag key + properties: + cardinality_delta: + description: This describes the recent change in the tag keys cardinality + format: int64 + type: integer + type: object MetricTagConfiguration: description: Object for a single metric tag configuration. example: @@ -53603,6 +53665,50 @@ paths: x-permission: operator: OPEN permissions: [] + /api/v2/metrics/{metric_name}/tag-cardinalities: + get: + description: Returns the cardinality details of tags for a specific metric. + operationId: GetMetricTagCardinalityDetails + parameters: + - $ref: '#/components/parameters/MetricName' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MetricTagCardinalitiesResponse' + description: Success + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Too Many Requests + summary: Get tag key cardinality details + tags: + - Metrics + x-permission: + operator: OR + permissions: + - metrics_read /api/v2/metrics/{metric_name}/tags: delete: description: 'Deletes a metric''s tag configuration. Can only be used with application diff --git a/examples/v2/metrics/GetMetricTagCardinalityDetails.rb b/examples/v2/metrics/GetMetricTagCardinalityDetails.rb new file mode 100644 index 00000000000..465eba65803 --- /dev/null +++ b/examples/v2/metrics/GetMetricTagCardinalityDetails.rb @@ -0,0 +1,5 @@ +# Get tag key cardinality details returns "Success" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::MetricsAPI.new +p api_instance.get_metric_tag_cardinality_details("metric_name") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index d9c5dbaf1c3..2f2ba8b275b 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2055,6 +2055,9 @@ "filter_pct" => "Boolean", "filter_timespan_h" => "Integer", }, + "v2.GetMetricTagCardinalityDetails" => { + "metric_name" => "String", + }, "v2.DeleteTagConfiguration" => { "metric_name" => "String", }, diff --git a/features/v2/metrics.feature b/features/v2/metrics.feature index e412ab01368..41e753dfb3f 100644 --- a/features/v2/metrics.feature +++ b/features/v2/metrics.feature @@ -152,6 +152,30 @@ Feature: Metrics Then the response status is 200 Success And the response "data[0].type" is equal to "manage_tags" + @generated @skip @team:DataDog/metrics-experience + Scenario: Get tag key cardinality details returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And new "GetMetricTagCardinalityDetails" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/metrics-experience + Scenario: Get tag key cardinality details returns "Not Found" response + Given a valid "appKeyAuth" key in the system + And new "GetMetricTagCardinalityDetails" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/metrics-experience + Scenario: Get tag key cardinality details returns "Success" response + Given a valid "appKeyAuth" key in the system + And new "GetMetricTagCardinalityDetails" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 Success + @generated @skip @team:DataDog/metrics-experience Scenario: List active tags and aggregations returns "Bad Request" response Given a valid "appKeyAuth" key in the system diff --git a/features/v2/undo.json b/features/v2/undo.json index abe0c0b370d..a75ff96853d 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1864,6 +1864,12 @@ "type": "safe" } }, + "GetMetricTagCardinalityDetails": { + "tag": "Metrics", + "undo": { + "type": "safe" + } + }, "DeleteTagConfiguration": { "tag": "Metrics", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 678a0a3f9c9..208aa67f012 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2340,6 +2340,10 @@ def overrides "v2.metric_suggested_tags_and_aggregations" => "MetricSuggestedTagsAndAggregations", "v2.metric_suggested_tags_and_aggregations_response" => "MetricSuggestedTagsAndAggregationsResponse", "v2.metric_suggested_tags_attributes" => "MetricSuggestedTagsAttributes", + "v2.metric_tag_cardinalities_meta" => "MetricTagCardinalitiesMeta", + "v2.metric_tag_cardinalities_response" => "MetricTagCardinalitiesResponse", + "v2.metric_tag_cardinality" => "MetricTagCardinality", + "v2.metric_tag_cardinality_attributes" => "MetricTagCardinalityAttributes", "v2.metric_tag_configuration" => "MetricTagConfiguration", "v2.metric_tag_configuration_attributes" => "MetricTagConfigurationAttributes", "v2.metric_tag_configuration_create_attributes" => "MetricTagConfigurationCreateAttributes", diff --git a/lib/datadog_api_client/v2/api/metrics_api.rb b/lib/datadog_api_client/v2/api/metrics_api.rb index 580cc1ea893..2caba29addd 100644 --- a/lib/datadog_api_client/v2/api/metrics_api.rb +++ b/lib/datadog_api_client/v2/api/metrics_api.rb @@ -395,6 +395,71 @@ def estimate_metrics_output_series_with_http_info(metric_name, opts = {}) return data, status_code, headers end + # Get tag key cardinality details. + # + # @see #get_metric_tag_cardinality_details_with_http_info + def get_metric_tag_cardinality_details(metric_name, opts = {}) + data, _status_code, _headers = get_metric_tag_cardinality_details_with_http_info(metric_name, opts) + data + end + + # Get tag key cardinality details. + # + # Returns the cardinality details of tags for a specific metric. + # + # @param metric_name [String] The name of the metric. + # @param opts [Hash] the optional parameters + # @return [Array<(MetricTagCardinalitiesResponse, Integer, Hash)>] MetricTagCardinalitiesResponse data, response status code and response headers + def get_metric_tag_cardinality_details_with_http_info(metric_name, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsAPI.get_metric_tag_cardinality_details ...' + end + # verify the required parameter 'metric_name' is set + if @api_client.config.client_side_validation && metric_name.nil? + fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsAPI.get_metric_tag_cardinality_details" + end + # resource path + local_var_path = '/api/v2/metrics/{metric_name}/tag-cardinalities'.sub('{metric_name}', CGI.escape(metric_name.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'MetricTagCardinalitiesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_metric_tag_cardinality_details, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MetricsAPI#get_metric_tag_cardinality_details\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # List active tags and aggregations. # # @see #list_active_metric_configurations_with_http_info diff --git a/lib/datadog_api_client/v2/models/entity_v3_api.rb b/lib/datadog_api_client/v2/models/entity_v3_api.rb index 41b741dc52a..27494757ce4 100644 --- a/lib/datadog_api_client/v2/models/entity_v3_api.rb +++ b/lib/datadog_api_client/v2/models/entity_v3_api.rb @@ -21,7 +21,7 @@ module DatadogAPIClient::V2 class EntityV3API include BaseGenericModel - # The schema version of entity type. The field is known as schema-version in the previous version. + # The version of the schema data that was used to populate this entity's data. This could be via the API, Terraform, or YAML file in a repository. The field is known as schema-version in the previous version. attr_reader :api_version # Datadog product integrations for the API entity. diff --git a/lib/datadog_api_client/v2/models/entity_v3_api_version.rb b/lib/datadog_api_client/v2/models/entity_v3_api_version.rb index 152114532d9..f18f6ef2436 100644 --- a/lib/datadog_api_client/v2/models/entity_v3_api_version.rb +++ b/lib/datadog_api_client/v2/models/entity_v3_api_version.rb @@ -17,10 +17,13 @@ require 'time' module DatadogAPIClient::V2 - # The schema version of entity type. The field is known as schema-version in the previous version. + # The version of the schema data that was used to populate this entity's data. This could be via the API, Terraform, or YAML file in a repository. The field is known as schema-version in the previous version. class EntityV3APIVersion include BaseEnumModel V3 = "v3".freeze + V2_2 = "v2.2".freeze + V2_1 = "v2.1".freeze + V2 = "v2".freeze end end diff --git a/lib/datadog_api_client/v2/models/entity_v3_datastore.rb b/lib/datadog_api_client/v2/models/entity_v3_datastore.rb index 1d158f349a9..7193bfee4d0 100644 --- a/lib/datadog_api_client/v2/models/entity_v3_datastore.rb +++ b/lib/datadog_api_client/v2/models/entity_v3_datastore.rb @@ -21,7 +21,7 @@ module DatadogAPIClient::V2 class EntityV3Datastore include BaseGenericModel - # The schema version of entity type. The field is known as schema-version in the previous version. + # The version of the schema data that was used to populate this entity's data. This could be via the API, Terraform, or YAML file in a repository. The field is known as schema-version in the previous version. attr_reader :api_version # Datadog product integrations for the datastore entity. diff --git a/lib/datadog_api_client/v2/models/entity_v3_queue.rb b/lib/datadog_api_client/v2/models/entity_v3_queue.rb index 2e227adb501..15d0c679cd7 100644 --- a/lib/datadog_api_client/v2/models/entity_v3_queue.rb +++ b/lib/datadog_api_client/v2/models/entity_v3_queue.rb @@ -21,7 +21,7 @@ module DatadogAPIClient::V2 class EntityV3Queue include BaseGenericModel - # The schema version of entity type. The field is known as schema-version in the previous version. + # The version of the schema data that was used to populate this entity's data. This could be via the API, Terraform, or YAML file in a repository. The field is known as schema-version in the previous version. attr_reader :api_version # Datadog product integrations for the datastore entity. diff --git a/lib/datadog_api_client/v2/models/entity_v3_service.rb b/lib/datadog_api_client/v2/models/entity_v3_service.rb index 13bb13cb8f9..a82513baee0 100644 --- a/lib/datadog_api_client/v2/models/entity_v3_service.rb +++ b/lib/datadog_api_client/v2/models/entity_v3_service.rb @@ -21,7 +21,7 @@ module DatadogAPIClient::V2 class EntityV3Service include BaseGenericModel - # The schema version of entity type. The field is known as schema-version in the previous version. + # The version of the schema data that was used to populate this entity's data. This could be via the API, Terraform, or YAML file in a repository. The field is known as schema-version in the previous version. attr_reader :api_version # Datadog product integrations for the service entity. diff --git a/lib/datadog_api_client/v2/models/entity_v3_system.rb b/lib/datadog_api_client/v2/models/entity_v3_system.rb index 0c57ad7b2f6..f618a1862ba 100644 --- a/lib/datadog_api_client/v2/models/entity_v3_system.rb +++ b/lib/datadog_api_client/v2/models/entity_v3_system.rb @@ -21,7 +21,7 @@ module DatadogAPIClient::V2 class EntityV3System include BaseGenericModel - # The schema version of entity type. The field is known as schema-version in the previous version. + # The version of the schema data that was used to populate this entity's data. This could be via the API, Terraform, or YAML file in a repository. The field is known as schema-version in the previous version. attr_reader :api_version # Datadog product integrations for the service entity. diff --git a/lib/datadog_api_client/v2/models/metric_tag_cardinalities_meta.rb b/lib/datadog_api_client/v2/models/metric_tag_cardinalities_meta.rb new file mode 100644 index 00000000000..06905a8c340 --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_tag_cardinalities_meta.rb @@ -0,0 +1,107 @@ +=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 + # Response metadata object. + class MetricTagCardinalitiesMeta + include BaseGenericModel + + # The name of metric for which the tag cardinalities are returned. + # This matches the metric name provided in the request. + # + attr_accessor :metric_name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'metric_name' => :'metric_name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'metric_name' => :'String' + } + 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::MetricTagCardinalitiesMeta` 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?(:'metric_name') + self.metric_name = attributes[:'metric_name'] + 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 && + metric_name == o.metric_name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [metric_name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/metric_tag_cardinalities_response.rb b/lib/datadog_api_client/v2/models/metric_tag_cardinalities_response.rb new file mode 100644 index 00000000000..0c145b2b182 --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_tag_cardinalities_response.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 + # Response object that includes an array of objects representing the cardinality details of a metric's tags. + class MetricTagCardinalitiesResponse + include BaseGenericModel + + # A list of tag cardinalities associated with the given metric. + attr_accessor :data + + # Response metadata object. + attr_accessor :meta + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'meta' => :'MetricTagCardinalitiesMeta' + } + 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::MetricTagCardinalitiesResponse` 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?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + 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 && + data == o.data && + meta == o.meta && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, meta, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/metric_tag_cardinality.rb b/lib/datadog_api_client/v2/models/metric_tag_cardinality.rb new file mode 100644 index 00000000000..6be1659bc10 --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_tag_cardinality.rb @@ -0,0 +1,125 @@ +=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 + # Object containing metadata and attributes related to a specific tag key associated with the metric. + class MetricTagCardinality + include BaseGenericModel + + # An object containing properties related to the tag key + attr_accessor :attributes + + # The name of the tag key. + attr_accessor :id + + # This describes the endpoint action. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'MetricTagCardinalityAttributes', + :'id' => :'String', + :'type' => :'String' + } + 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::MetricTagCardinality` 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?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + 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 && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/metric_tag_cardinality_attributes.rb b/lib/datadog_api_client/v2/models/metric_tag_cardinality_attributes.rb new file mode 100644 index 00000000000..e1a3d5a89e3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_tag_cardinality_attributes.rb @@ -0,0 +1,105 @@ +=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 + # An object containing properties related to the tag key + class MetricTagCardinalityAttributes + include BaseGenericModel + + # This describes the recent change in the tag keys cardinality + attr_accessor :cardinality_delta + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'cardinality_delta' => :'cardinality_delta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'cardinality_delta' => :'Integer' + } + 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::MetricTagCardinalityAttributes` 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?(:'cardinality_delta') + self.cardinality_delta = attributes[:'cardinality_delta'] + 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 && + cardinality_delta == o.cardinality_delta && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [cardinality_delta, additional_properties].hash + end + end +end