diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 868df7a504f..4fdcee015f4 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -112932,6 +112932,10 @@ components: properties: attributes: $ref: "#/components/schemas/ScalarFormulaResponseAtrributes" + id: + description: The identifier of the scalar response resource. + example: "0" + type: string type: $ref: "#/components/schemas/ScalarFormulaResponseType" type: object @@ -140283,24 +140287,29 @@ components: properties: family: description: Unit family, allows for conversion between units of the same family, for scaling. - example: time + example: percentage type: string + id: + description: The identifier of the unit. + example: 17 + format: int64 + type: integer name: - description: Unit name - example: minute + description: Unit name. + example: percent type: string plural: description: Plural form of the unit name. - example: minutes + example: percent type: string scale_factor: description: Factor for scaling between units of the same family. - example: 60.0 + example: 1.0 format: double type: number short_name: description: Abbreviation of the unit. - example: min + example: "%" type: string type: object UnitCostCreateRequest: diff --git a/src/main/java/com/datadog/api/client/v2/model/ScalarResponse.java b/src/main/java/com/datadog/api/client/v2/model/ScalarResponse.java index d2a1203a92a..2565f8d951c 100644 --- a/src/main/java/com/datadog/api/client/v2/model/ScalarResponse.java +++ b/src/main/java/com/datadog/api/client/v2/model/ScalarResponse.java @@ -17,7 +17,11 @@ import java.util.Objects; /** A message containing the response to a scalar query. */ -@JsonPropertyOrder({ScalarResponse.JSON_PROPERTY_ATTRIBUTES, ScalarResponse.JSON_PROPERTY_TYPE}) +@JsonPropertyOrder({ + ScalarResponse.JSON_PROPERTY_ATTRIBUTES, + ScalarResponse.JSON_PROPERTY_ID, + ScalarResponse.JSON_PROPERTY_TYPE +}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class ScalarResponse { @@ -25,6 +29,9 @@ public class ScalarResponse { public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; private ScalarFormulaResponseAtrributes attributes; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + public static final String JSON_PROPERTY_TYPE = "type"; private ScalarFormulaResponseType type = ScalarFormulaResponseType.SCALAR_RESPONSE; @@ -53,6 +60,27 @@ public void setAttributes(ScalarFormulaResponseAtrributes attributes) { } } + public ScalarResponse id(String id) { + this.id = id; + return this; + } + + /** + * The identifier of the scalar response resource. + * + * @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 ScalarResponse type(ScalarFormulaResponseType type) { this.type = type; this.unparsed |= !type.isValid(); @@ -135,13 +163,14 @@ public boolean equals(Object o) { } ScalarResponse scalarResponse = (ScalarResponse) o; return Objects.equals(this.attributes, scalarResponse.attributes) + && Objects.equals(this.id, scalarResponse.id) && Objects.equals(this.type, scalarResponse.type) && Objects.equals(this.additionalProperties, scalarResponse.additionalProperties); } @Override public int hashCode() { - return Objects.hash(attributes, type, additionalProperties); + return Objects.hash(attributes, id, type, additionalProperties); } @Override @@ -149,6 +178,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ScalarResponse {\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)) diff --git a/src/main/java/com/datadog/api/client/v2/model/Unit.java b/src/main/java/com/datadog/api/client/v2/model/Unit.java index 0665bba9c2f..a0c714fecaa 100644 --- a/src/main/java/com/datadog/api/client/v2/model/Unit.java +++ b/src/main/java/com/datadog/api/client/v2/model/Unit.java @@ -19,6 +19,7 @@ /** Object containing the metric unit family, scale factor, name, and short name. */ @JsonPropertyOrder({ Unit.JSON_PROPERTY_FAMILY, + Unit.JSON_PROPERTY_ID, Unit.JSON_PROPERTY_NAME, Unit.JSON_PROPERTY_PLURAL, Unit.JSON_PROPERTY_SCALE_FACTOR, @@ -31,6 +32,9 @@ public class Unit { public static final String JSON_PROPERTY_FAMILY = "family"; private String family; + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + public static final String JSON_PROPERTY_NAME = "name"; private String name; @@ -64,13 +68,34 @@ public void setFamily(String family) { this.family = family; } + public Unit id(Long id) { + this.id = id; + return this; + } + + /** + * The identifier of the unit. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + public Unit name(String name) { this.name = name; return this; } /** - * Unit name + * Unit name. * * @return name */ @@ -205,6 +230,7 @@ public boolean equals(Object o) { } Unit unit = (Unit) o; return Objects.equals(this.family, unit.family) + && Objects.equals(this.id, unit.id) && Objects.equals(this.name, unit.name) && Objects.equals(this.plural, unit.plural) && Objects.equals(this.scaleFactor, unit.scaleFactor) @@ -214,7 +240,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(family, name, plural, scaleFactor, shortName, additionalProperties); + return Objects.hash(family, id, name, plural, scaleFactor, shortName, additionalProperties); } @Override @@ -222,6 +248,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Unit {\n"); sb.append(" family: ").append(toIndentedString(family)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" plural: ").append(toIndentedString(plural)).append("\n"); sb.append(" scaleFactor: ").append(toIndentedString(scaleFactor)).append("\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 2350a4b1c45..a3d09cbdffe 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 @@ -695,6 +695,7 @@ Feature: Metrics When the request is sent Then the response status is 200 OK And the response "data.type" is equal to "scalar_response" + And the response "data" has field "id" And the response "data.attributes.columns[0].name" is equal to "a" @skip-validation @team:ddoghq/timeseries-query diff --git a/src/test/resources/generated-test/test-server-data/v2/metrics.json b/src/test/resources/generated-test/test-server-data/v2/metrics.json index 173fcac09c4..b28832500ad 100644 --- a/src/test/resources/generated-test/test-server-data/v2/metrics.json +++ b/src/test/resources/generated-test/test-server-data/v2/metrics.json @@ -2301,7 +2301,7 @@ }, { "feature": "Metrics", - "frozen_at": "2024-03-25T19:28:00.854Z", + "frozen_at": "2026-10-22T15:05:21.723Z", "interactions": [ { "request": { @@ -2319,7 +2319,7 @@ } } ], - "from": 1711391280000, + "from": 1792677921000, "queries": [ { "aggregator": "avg", @@ -2328,7 +2328,7 @@ "query": "avg:system.cpu.user{*}" } ], - "to": 1711394880000 + "to": 1792681521000 }, "type": "scalar_request" } @@ -2342,10 +2342,10 @@ "response": { "body": { "encoding": "text", - "value": "{\"data\":{\"type\":\"scalar_response\",\"attributes\":{\"columns\":[{\"values\":[6.368151928283307],\"name\":\"a\",\"meta\":{\"unit\":[{\"short_name\":\"%\",\"id\":17,\"plural\":\"percent\",\"name\":\"percent\",\"family\":\"percentage\",\"scale_factor\":1.0},null]},\"type\":\"number\"}]}}}" + "value": "{\"data\":{\"id\":\"0\",\"type\":\"scalar_response\",\"attributes\":{\"columns\":[{\"name\":\"a\",\"values\":[0.5286438660222104],\"type\":\"number\",\"meta\":{\"unit\":[{\"family\":\"percentage\",\"name\":\"percent\",\"plural\":\"percent\",\"scale_factor\":1.0,\"short_name\":\"%\",\"id\":17},null]}}]}}}" }, "headers": { - "content-type": "application/json" + "content-type": "application/vnd.api+json" }, "reason": "OK", "status": 200