diff --git a/.generated-info b/.generated-info index 805e335d15f..e7fa87b6f54 100644 --- a/.generated-info +++ b/.generated-info @@ -1,4 +1,4 @@ { - "spec_repo_commit": "20279f4", - "generated": "2025-07-18 10:24:13.081" + "spec_repo_commit": "dc49df4", + "generated": "2025-07-18 13:58:47.478" } diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index ee3c8b9b971..8f845b4f20d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -23189,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: @@ -53610,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.java b/examples/v2/metrics/GetMetricTagCardinalityDetails.java new file mode 100644 index 00000000000..ca5426ee368 --- /dev/null +++ b/examples/v2/metrics/GetMetricTagCardinalityDetails.java @@ -0,0 +1,25 @@ +// Get tag key cardinality details returns "Success" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.MetricsApi; +import com.datadog.api.client.v2.model.MetricTagCardinalitiesResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + MetricsApi apiInstance = new MetricsApi(defaultClient); + + try { + MetricTagCardinalitiesResponse result = + apiInstance.getMetricTagCardinalityDetails("metric_name"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MetricsApi#getMetricTagCardinalityDetails"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/api/MetricsApi.java b/src/main/java/com/datadog/api/client/v2/api/MetricsApi.java index 86f3199e052..b345287e4b7 100644 --- a/src/main/java/com/datadog/api/client/v2/api/MetricsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/MetricsApi.java @@ -15,6 +15,7 @@ import com.datadog.api.client.v2.model.MetricEstimateResponse; import com.datadog.api.client.v2.model.MetricPayload; import com.datadog.api.client.v2.model.MetricSuggestedTagsAndAggregationsResponse; +import com.datadog.api.client.v2.model.MetricTagCardinalitiesResponse; import com.datadog.api.client.v2.model.MetricTagConfigurationCreateRequest; import com.datadog.api.client.v2.model.MetricTagConfigurationMetricTypeCategory; import com.datadog.api.client.v2.model.MetricTagConfigurationResponse; @@ -943,6 +944,152 @@ public ApiResponse estimateMetricsOutputSeriesWithHttpIn new GenericType() {}); } + /** + * Get tag key cardinality details. + * + *

See {@link #getMetricTagCardinalityDetailsWithHttpInfo}. + * + * @param metricName The name of the metric. (required) + * @return MetricTagCardinalitiesResponse + * @throws ApiException if fails to make API call + */ + public MetricTagCardinalitiesResponse getMetricTagCardinalityDetails(String metricName) + throws ApiException { + return getMetricTagCardinalityDetailsWithHttpInfo(metricName).getData(); + } + + /** + * Get tag key cardinality details. + * + *

See {@link #getMetricTagCardinalityDetailsWithHttpInfoAsync}. + * + * @param metricName The name of the metric. (required) + * @return CompletableFuture<MetricTagCardinalitiesResponse> + */ + public CompletableFuture getMetricTagCardinalityDetailsAsync( + String metricName) { + return getMetricTagCardinalityDetailsWithHttpInfoAsync(metricName) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Returns the cardinality details of tags for a specific metric. + * + * @param metricName The name of the metric. (required) + * @return ApiResponse<MetricTagCardinalitiesResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 Success -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too Many Requests -
+ */ + public ApiResponse getMetricTagCardinalityDetailsWithHttpInfo( + String metricName) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'metricName' is set + if (metricName == null) { + throw new ApiException( + 400, + "Missing the required parameter 'metricName' when calling" + + " getMetricTagCardinalityDetails"); + } + // create path and map variables + String localVarPath = + "/api/v2/metrics/{metric_name}/tag-cardinalities" + .replaceAll( + "\\{" + "metric_name" + "\\}", apiClient.escapeString(metricName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.MetricsApi.getMetricTagCardinalityDetails", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get tag key cardinality details. + * + *

See {@link #getMetricTagCardinalityDetailsWithHttpInfo}. + * + * @param metricName The name of the metric. (required) + * @return CompletableFuture<ApiResponse<MetricTagCardinalitiesResponse>> + */ + public CompletableFuture> + getMetricTagCardinalityDetailsWithHttpInfoAsync(String metricName) { + Object localVarPostBody = null; + + // verify the required parameter 'metricName' is set + if (metricName == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'metricName' when calling" + + " getMetricTagCardinalityDetails")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/metrics/{metric_name}/tag-cardinalities" + .replaceAll( + "\\{" + "metric_name" + "\\}", apiClient.escapeString(metricName.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.MetricsApi.getMetricTagCardinalityDetails", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** Manage optional parameters to listActiveMetricConfigurations. */ public static class ListActiveMetricConfigurationsOptionalParameters { private Long windowSeconds; diff --git a/src/main/java/com/datadog/api/client/v2/model/MetricTagCardinalitiesMeta.java b/src/main/java/com/datadog/api/client/v2/model/MetricTagCardinalitiesMeta.java new file mode 100644 index 00000000000..e9d5d530e4a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MetricTagCardinalitiesMeta.java @@ -0,0 +1,137 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response metadata object. */ +@JsonPropertyOrder({MetricTagCardinalitiesMeta.JSON_PROPERTY_METRIC_NAME}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MetricTagCardinalitiesMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_METRIC_NAME = "metric_name"; + private String metricName; + + public MetricTagCardinalitiesMeta metricName(String metricName) { + this.metricName = metricName; + return this; + } + + /** + * The name of metric for which the tag cardinalities are returned. This matches the metric name + * provided in the request. + * + * @return metricName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_METRIC_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMetricName() { + return metricName; + } + + public void setMetricName(String metricName) { + this.metricName = metricName; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return MetricTagCardinalitiesMeta + */ + @JsonAnySetter + public MetricTagCardinalitiesMeta putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this MetricTagCardinalitiesMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MetricTagCardinalitiesMeta metricTagCardinalitiesMeta = (MetricTagCardinalitiesMeta) o; + return Objects.equals(this.metricName, metricTagCardinalitiesMeta.metricName) + && Objects.equals( + this.additionalProperties, metricTagCardinalitiesMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(metricName, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MetricTagCardinalitiesMeta {\n"); + sb.append(" metricName: ").append(toIndentedString(metricName)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/MetricTagCardinalitiesResponse.java b/src/main/java/com/datadog/api/client/v2/model/MetricTagCardinalitiesResponse.java new file mode 100644 index 00000000000..cd50b99dd26 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MetricTagCardinalitiesResponse.java @@ -0,0 +1,184 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * Response object that includes an array of objects representing the cardinality details of a + * metric's tags. + */ +@JsonPropertyOrder({ + MetricTagCardinalitiesResponse.JSON_PROPERTY_DATA, + MetricTagCardinalitiesResponse.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MetricTagCardinalitiesResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = null; + + public static final String JSON_PROPERTY_META = "meta"; + private MetricTagCardinalitiesMeta meta; + + public MetricTagCardinalitiesResponse data(List data) { + this.data = data; + for (MetricTagCardinality item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public MetricTagCardinalitiesResponse addDataItem(MetricTagCardinality dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * A list of tag cardinalities associated with the given metric. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public MetricTagCardinalitiesResponse meta(MetricTagCardinalitiesMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Response metadata object. + * + * @return meta + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public MetricTagCardinalitiesMeta getMeta() { + return meta; + } + + public void setMeta(MetricTagCardinalitiesMeta meta) { + this.meta = meta; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return MetricTagCardinalitiesResponse + */ + @JsonAnySetter + public MetricTagCardinalitiesResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this MetricTagCardinalitiesResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MetricTagCardinalitiesResponse metricTagCardinalitiesResponse = + (MetricTagCardinalitiesResponse) o; + return Objects.equals(this.data, metricTagCardinalitiesResponse.data) + && Objects.equals(this.meta, metricTagCardinalitiesResponse.meta) + && Objects.equals( + this.additionalProperties, metricTagCardinalitiesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MetricTagCardinalitiesResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/MetricTagCardinality.java b/src/main/java/com/datadog/api/client/v2/model/MetricTagCardinality.java new file mode 100644 index 00000000000..89326a3f9e1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MetricTagCardinality.java @@ -0,0 +1,195 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * Object containing metadata and attributes related to a specific tag key associated with the + * metric. + */ +@JsonPropertyOrder({ + MetricTagCardinality.JSON_PROPERTY_ATTRIBUTES, + MetricTagCardinality.JSON_PROPERTY_ID, + MetricTagCardinality.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MetricTagCardinality { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private MetricTagCardinalityAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "tag_cardinality"; + + public MetricTagCardinality attributes(MetricTagCardinalityAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * An object containing properties related to the tag key + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public MetricTagCardinalityAttributes getAttributes() { + return attributes; + } + + public void setAttributes(MetricTagCardinalityAttributes attributes) { + this.attributes = attributes; + } + + public MetricTagCardinality id(String id) { + this.id = id; + return this; + } + + /** + * The name of the tag key. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public MetricTagCardinality type(String type) { + this.type = type; + return this; + } + + /** + * This describes the endpoint action. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return MetricTagCardinality + */ + @JsonAnySetter + public MetricTagCardinality putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this MetricTagCardinality object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MetricTagCardinality metricTagCardinality = (MetricTagCardinality) o; + return Objects.equals(this.attributes, metricTagCardinality.attributes) + && Objects.equals(this.id, metricTagCardinality.id) + && Objects.equals(this.type, metricTagCardinality.type) + && Objects.equals(this.additionalProperties, metricTagCardinality.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MetricTagCardinality {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/MetricTagCardinalityAttributes.java b/src/main/java/com/datadog/api/client/v2/model/MetricTagCardinalityAttributes.java new file mode 100644 index 00000000000..bb86c0583b9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MetricTagCardinalityAttributes.java @@ -0,0 +1,137 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** An object containing properties related to the tag key */ +@JsonPropertyOrder({MetricTagCardinalityAttributes.JSON_PROPERTY_CARDINALITY_DELTA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MetricTagCardinalityAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CARDINALITY_DELTA = "cardinality_delta"; + private Long cardinalityDelta; + + public MetricTagCardinalityAttributes cardinalityDelta(Long cardinalityDelta) { + this.cardinalityDelta = cardinalityDelta; + return this; + } + + /** + * This describes the recent change in the tag keys cardinality + * + * @return cardinalityDelta + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CARDINALITY_DELTA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getCardinalityDelta() { + return cardinalityDelta; + } + + public void setCardinalityDelta(Long cardinalityDelta) { + this.cardinalityDelta = cardinalityDelta; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return MetricTagCardinalityAttributes + */ + @JsonAnySetter + public MetricTagCardinalityAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this MetricTagCardinalityAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MetricTagCardinalityAttributes metricTagCardinalityAttributes = + (MetricTagCardinalityAttributes) o; + return Objects.equals(this.cardinalityDelta, metricTagCardinalityAttributes.cardinalityDelta) + && Objects.equals( + this.additionalProperties, metricTagCardinalityAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(cardinalityDelta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MetricTagCardinalityAttributes {\n"); + sb.append(" cardinalityDelta: ").append(toIndentedString(cardinalityDelta)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/metrics.feature b/src/test/resources/com/datadog/api/client/v2/api/metrics.feature index e412ab01368..41e753dfb3f 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/metrics.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index abe0c0b370d..a75ff96853d 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -1864,6 +1864,12 @@ "type": "safe" } }, + "GetMetricTagCardinalityDetails": { + "tag": "Metrics", + "undo": { + "type": "safe" + } + }, "DeleteTagConfiguration": { "tag": "Metrics", "undo": {