diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 0057dd635b3c..6f80e4ca4b6b 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -38523,6 +38523,8 @@ components: properties: id: $ref: '#/components/schemas/MetricName' + relationships: + $ref: '#/components/schemas/MetricRelationships' type: $ref: '#/components/schemas/MetricType' type: object @@ -39298,6 +39300,12 @@ components: format: double type: number type: object + MetricRelationships: + description: Relationships to related metric objects. + properties: + metric_volumes: + $ref: '#/components/schemas/MetricVolumesRelationship' + type: object MetricResource: description: Metric resource. example: @@ -39741,6 +39749,33 @@ components: oneOf: - $ref: '#/components/schemas/MetricDistinctVolume' - $ref: '#/components/schemas/MetricIngestedIndexedVolume' + MetricVolumesInclude: + description: Comma-separated list of additional data to include in the response. + Allowed values are `metric_volumes`. + enum: + - metric_volumes + - generated_metric_attributes + type: string + x-enum-varnames: + - METRIC_VOLUMES + - GENERATED_METRIC_ATTRIBUTES + MetricVolumesRelationship: + description: Relationship to a metric's ingested and indexed volumes. + properties: + data: + $ref: '#/components/schemas/MetricVolumesRelationshipData' + type: object + MetricVolumesRelationshipData: + description: Relationship data for a metric's ingested and indexed volumes. + properties: + id: + $ref: '#/components/schemas/MetricName' + type: + $ref: '#/components/schemas/MetricIngestedIndexedVolumeType' + required: + - type + - id + type: object MetricVolumesResponse: description: Response object which includes a single metric's volume. properties: @@ -39787,6 +39822,12 @@ components: items: $ref: '#/components/schemas/MetricsAndMetricTagConfigurations' type: array + included: + description: Array of included metric volume objects. Only present when + `include=metric_volumes` is requested. + items: + $ref: '#/components/schemas/MetricIngestedIndexedVolume' + type: array links: $ref: '#/components/schemas/MetricsListResponseLinks' meta: @@ -91450,7 +91491,13 @@ paths: `next_cursor` value from the response as the new `page[cursor]` value. Once the `meta.pagination.next_cursor` value is null, all pages have been - retrieved.' + retrieved. + + Use the `include` query parameter to fetch additional data with the response. + When `include=metric_volumes` is specified, the response includes volume data + for each custom metric in the `included` array, with a corresponding `relationships` + link on each metric in `data`. Volume data is only returned for custom metrics. + All volume values represent a 1-hour timeframe.' operationId: ListTagConfigurations parameters: - description: Filter custom metrics that have configured tags. @@ -91532,6 +91579,16 @@ paths: required: false schema: type: boolean + - description: 'Comma-separated list of additional data to include in the response. + Allowed values: `metric_volumes`. When `metric_volumes` is specified, the + response includes volume data for each custom metric in the `included` array, + with a corresponding `relationships` link on each metric in `data`.' + example: metric_volumes + in: query + name: include + required: false + schema: + $ref: '#/components/schemas/MetricVolumesInclude' - description: 'The number of seconds of look back (from now) to apply to a filter[tag] or filter[queried] query. diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 32f3745ebfcb..25fdc5593327 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2824,6 +2824,7 @@ "filter_queried_window_seconds" => "Integer", "filter_tags" => "String", "filter_related_assets" => "Boolean", + "include" => "MetricVolumesInclude", "window_seconds" => "Integer", "page_size" => "Integer", "page_cursor" => "String", diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index d50fa5f2e08f..d32c316651a6 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3430,6 +3430,7 @@ def overrides "v2.metric_pagination_meta" => "MetricPaginationMeta", "v2.metric_payload" => "MetricPayload", "v2.metric_point" => "MetricPoint", + "v2.metric_relationships" => "MetricRelationships", "v2.metric_resource" => "MetricResource", "v2.metrics_aggregator" => "MetricsAggregator", "v2.metrics_and_metric_tag_configurations" => "MetricsAndMetricTagConfigurations", @@ -3462,6 +3463,9 @@ def overrides "v2.metric_tag_configuration_update_request" => "MetricTagConfigurationUpdateRequest", "v2.metric_type" => "MetricType", "v2.metric_volumes" => "MetricVolumes", + "v2.metric_volumes_include" => "MetricVolumesInclude", + "v2.metric_volumes_relationship" => "MetricVolumesRelationship", + "v2.metric_volumes_relationship_data" => "MetricVolumesRelationshipData", "v2.metric_volumes_response" => "MetricVolumesResponse", "v2.microsoft_sentinel_destination" => "MicrosoftSentinelDestination", "v2.microsoft_sentinel_destination_type" => "MicrosoftSentinelDestinationType", diff --git a/lib/datadog_api_client/v2/api/metrics_api.rb b/lib/datadog_api_client/v2/api/metrics_api.rb index 12bcdca5a387..445f99b00a3f 100644 --- a/lib/datadog_api_client/v2/api/metrics_api.rb +++ b/lib/datadog_api_client/v2/api/metrics_api.rb @@ -671,6 +671,7 @@ def list_tag_configurations(opts = {}) # Optionally, paginate by using the `page[cursor]` and/or `page[size]` query parameters. # To fetch the first page, pass in a query parameter with either a valid `page[size]` or an empty cursor like `page[cursor]=`. To fetch the next page, pass in the `next_cursor` value from the response as the new `page[cursor]` value. # Once the `meta.pagination.next_cursor` value is null, all pages have been retrieved. + # Use the `include` query parameter to fetch additional data with the response. When `include=metric_volumes` is specified, the response includes volume data for each custom metric in the `included` array, with a corresponding `relationships` link on each metric in `data`. Volume data is only returned for custom metrics. All volume values represent a 1-hour timeframe. # # @param opts [Hash] the optional parameters # @option opts [Boolean] :filter_configured Filter custom metrics that have configured tags. @@ -681,6 +682,7 @@ def list_tag_configurations(opts = {}) # @option opts [Integer] :filter_queried_window_seconds The number of seconds of look back (from now) used by the `filter[queried]` filter logic. Must be sent with `filter[queried]` and is only applied when `filter[queried]=true`. If `filter[queried]=false`, this parameter is ignored and default queried-window behavior applies. If `filter[queried]` is not provided, sending this parameter returns a 400. For example: `GET /api/v2/metrics?filter[queried]=true&filter[queried][window][seconds]=7776000`. # @option opts [String] :filter_tags Filter metrics that have been submitted with the given tags. Supports boolean and wildcard expressions. Can only be combined with the filter[queried] filter. # @option opts [Boolean] :filter_related_assets (Preview) Filter metrics that are used in dashboards, monitors, notebooks, SLOs. + # @option opts [MetricVolumesInclude] :include Comma-separated list of additional data to include in the response. Allowed values: `metric_volumes`. When `metric_volumes` is specified, the response includes volume data for each custom metric in the `included` array, with a corresponding `relationships` link on each metric in `data`. # @option opts [Integer] :window_seconds The number of seconds of look back (from now) to apply to a filter[tag] or filter[queried] query. Default value is 3600 (1 hour), maximum value is 5,184,000 (60 days). # @option opts [Integer] :page_size Maximum number of results returned. # @option opts [String] :page_cursor String to query the next page of results. This key is provided with each valid response from the API in `meta.pagination.next_cursor`. Once the `meta.pagination.next_cursor` key is null, all pages have been retrieved. @@ -700,6 +702,10 @@ def list_tag_configurations_with_http_info(opts = {}) if @api_client.config.client_side_validation && !opts[:'filter_queried_window_seconds'].nil? && opts[:'filter_queried_window_seconds'] < 0 fail ArgumentError, 'invalid value for "opts[:"filter_queried_window_seconds"]" when calling MetricsAPI.list_tag_configurations, must be greater than or equal to 0.' end + allowable_values = ['metric_volumes', 'generated_metric_attributes'] + if @api_client.config.client_side_validation && opts[:'include'] && !allowable_values.include?(opts[:'include']) + fail ArgumentError, "invalid value for \"include\", must be one of #{allowable_values}" + end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 10000 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling MetricsAPI.list_tag_configurations, must be smaller than or equal to 10000.' end @@ -719,6 +725,7 @@ def list_tag_configurations_with_http_info(opts = {}) query_params[:'filter[queried][window][seconds]'] = opts[:'filter_queried_window_seconds'] if !opts[:'filter_queried_window_seconds'].nil? query_params[:'filter[tags]'] = opts[:'filter_tags'] if !opts[:'filter_tags'].nil? query_params[:'filter[related_assets]'] = opts[:'filter_related_assets'] if !opts[:'filter_related_assets'].nil? + query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil? query_params[:'window[seconds]'] = opts[:'window_seconds'] if !opts[:'window_seconds'].nil? query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil? diff --git a/lib/datadog_api_client/v2/models/metric.rb b/lib/datadog_api_client/v2/models/metric.rb index aa06243d5df9..9f0a36208474 100644 --- a/lib/datadog_api_client/v2/models/metric.rb +++ b/lib/datadog_api_client/v2/models/metric.rb @@ -24,6 +24,9 @@ class Metric # The metric name for this resource. attr_accessor :id + # Relationships to related metric objects. + attr_accessor :relationships + # The metric resource type. attr_accessor :type @@ -34,6 +37,7 @@ class Metric def self.attribute_map { :'id' => :'id', + :'relationships' => :'relationships', :'type' => :'type' } end @@ -43,6 +47,7 @@ def self.attribute_map def self.openapi_types { :'id' => :'String', + :'relationships' => :'MetricRelationships', :'type' => :'MetricType' } end @@ -69,6 +74,10 @@ def initialize(attributes = {}) self.id = attributes[:'id'] end + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + if attributes.key?(:'type') self.type = attributes[:'type'] end @@ -101,6 +110,7 @@ def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && + relationships == o.relationships && type == o.type && additional_properties == o.additional_properties end @@ -109,7 +119,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [id, type, additional_properties].hash + [id, relationships, type, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/metric_relationships.rb b/lib/datadog_api_client/v2/models/metric_relationships.rb new file mode 100644 index 000000000000..918c907c1845 --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_relationships.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 + # Relationships to related metric objects. + class MetricRelationships + include BaseGenericModel + + # Relationship to a metric's ingested and indexed volumes. + attr_accessor :metric_volumes + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'metric_volumes' => :'metric_volumes' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'metric_volumes' => :'MetricVolumesRelationship' + } + 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::MetricRelationships` 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_volumes') + self.metric_volumes = attributes[:'metric_volumes'] + 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_volumes == o.metric_volumes && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [metric_volumes, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/metric_volumes_include.rb b/lib/datadog_api_client/v2/models/metric_volumes_include.rb new file mode 100644 index 000000000000..dde0d28d5d34 --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_volumes_include.rb @@ -0,0 +1,27 @@ +=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 + # Comma-separated list of additional data to include in the response. Allowed values are `metric_volumes`. + class MetricVolumesInclude + include BaseEnumModel + + METRIC_VOLUMES = "metric_volumes".freeze + GENERATED_METRIC_ATTRIBUTES = "generated_metric_attributes".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/metric_volumes_relationship.rb b/lib/datadog_api_client/v2/models/metric_volumes_relationship.rb new file mode 100644 index 000000000000..d59b8ea68f25 --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_volumes_relationship.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 + # Relationship to a metric's ingested and indexed volumes. + class MetricVolumesRelationship + include BaseGenericModel + + # Relationship data for a metric's ingested and indexed volumes. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'MetricVolumesRelationshipData' + } + 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::MetricVolumesRelationship` 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') + self.data = attributes[:'data'] + 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 && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/metric_volumes_relationship_data.rb b/lib/datadog_api_client/v2/models/metric_volumes_relationship_data.rb new file mode 100644 index 000000000000..d9ad0a5dcd75 --- /dev/null +++ b/lib/datadog_api_client/v2/models/metric_volumes_relationship_data.rb @@ -0,0 +1,144 @@ +=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 + # Relationship data for a metric's ingested and indexed volumes. + class MetricVolumesRelationshipData + include BaseGenericModel + + # The metric name for this resource. + attr_reader :id + + # The metric ingested and indexed volume type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'MetricIngestedIndexedVolumeType' + } + 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::MetricVolumesRelationshipData` 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + 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 && + 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 + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/metrics_and_metric_tag_configurations_response.rb b/lib/datadog_api_client/v2/models/metrics_and_metric_tag_configurations_response.rb index 8dbb2fb87161..b4fc5ac6f835 100644 --- a/lib/datadog_api_client/v2/models/metrics_and_metric_tag_configurations_response.rb +++ b/lib/datadog_api_client/v2/models/metrics_and_metric_tag_configurations_response.rb @@ -24,6 +24,9 @@ class MetricsAndMetricTagConfigurationsResponse # Array of metrics and metric tag configurations. attr_accessor :data + # Array of included metric volume objects. Only present when `include=metric_volumes` is requested. + attr_accessor :included + # Pagination links. Only present if pagination query parameters were provided. attr_accessor :links @@ -37,6 +40,7 @@ class MetricsAndMetricTagConfigurationsResponse def self.attribute_map { :'data' => :'data', + :'included' => :'included', :'links' => :'links', :'meta' => :'meta' } @@ -47,6 +51,7 @@ def self.attribute_map def self.openapi_types { :'data' => :'Array', + :'included' => :'Array', :'links' => :'MetricsListResponseLinks', :'meta' => :'MetricPaginationMeta' } @@ -76,6 +81,12 @@ def initialize(attributes = {}) end end + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + if attributes.key?(:'links') self.links = attributes[:'links'] end @@ -112,6 +123,7 @@ def ==(o) return true if self.equal?(o) self.class == o.class && data == o.data && + included == o.included && links == o.links && meta == o.meta && additional_properties == o.additional_properties @@ -121,7 +133,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [data, links, meta, additional_properties].hash + [data, included, links, meta, additional_properties].hash end end end