diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 35263bfe95d..1a7253bae93 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -14099,6 +14099,13 @@ components: example: 202501 format: int64 type: integer + tags: + description: The tag keys used to group costs for the budget. + example: + - service + items: + type: string + type: array total_amount: description: The sum of all budget entries' amounts. example: 1000 diff --git a/examples/v2/cloud-cost-management/UpsertBudget.java b/examples/v2/cloud-cost-management/UpsertBudget.java index a75d4e0f66a..6e6a3af8fe3 100644 --- a/examples/v2/cloud-cost-management/UpsertBudget.java +++ b/examples/v2/cloud-cost-management/UpsertBudget.java @@ -51,6 +51,7 @@ public static void main(String[] args) { .name("my budget") .orgId(123L) .startMonth(202501L) + .tags(Collections.singletonList("service")) .totalAmount(1000.0) .updatedAt(1738258683590L) .updatedBy("00000000-0a0a-0a0a-aaa0-00000000000a")) diff --git a/src/main/java/com/datadog/api/client/v2/model/BudgetAttributes.java b/src/main/java/com/datadog/api/client/v2/model/BudgetAttributes.java index 465085ce263..4ef66120018 100644 --- a/src/main/java/com/datadog/api/client/v2/model/BudgetAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/BudgetAttributes.java @@ -32,6 +32,7 @@ BudgetAttributes.JSON_PROPERTY_NAME, BudgetAttributes.JSON_PROPERTY_ORG_ID, BudgetAttributes.JSON_PROPERTY_START_MONTH, + BudgetAttributes.JSON_PROPERTY_TAGS, BudgetAttributes.JSON_PROPERTY_TOTAL_AMOUNT, BudgetAttributes.JSON_PROPERTY_UPDATED_AT, BudgetAttributes.JSON_PROPERTY_UPDATED_BY @@ -76,6 +77,9 @@ public class BudgetAttributes { public static final String JSON_PROPERTY_START_MONTH = "start_month"; private Long startMonth; + public static final String JSON_PROPERTY_TAGS = "tags"; + private List tags = null; + public static final String JSON_PROPERTY_TOTAL_AMOUNT = "total_amount"; private Double totalAmount; @@ -364,6 +368,35 @@ public void setStartMonth(Long startMonth) { this.startMonth = startMonth; } + public BudgetAttributes tags(List tags) { + this.tags = tags; + return this; + } + + public BudgetAttributes addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * The tag keys used to group costs for the budget. + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + public BudgetAttributes totalAmount(Double totalAmount) { this.totalAmount = totalAmount; return this; @@ -495,6 +528,7 @@ public boolean equals(Object o) { && Objects.equals(this.name, budgetAttributes.name) && Objects.equals(this.orgId, budgetAttributes.orgId) && Objects.equals(this.startMonth, budgetAttributes.startMonth) + && Objects.equals(this.tags, budgetAttributes.tags) && Objects.equals(this.totalAmount, budgetAttributes.totalAmount) && Objects.equals(this.updatedAt, budgetAttributes.updatedAt) && Objects.equals(this.updatedBy, budgetAttributes.updatedBy) @@ -516,6 +550,7 @@ public int hashCode() { name, orgId, startMonth, + tags, totalAmount, updatedAt, updatedBy, @@ -538,6 +573,7 @@ public String toString() { sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" orgId: ").append(toIndentedString(orgId)).append("\n"); sb.append(" startMonth: ").append(toIndentedString(startMonth)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" totalAmount: ").append(toIndentedString(totalAmount)).append("\n"); sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); sb.append(" updatedBy: ").append(toIndentedString(updatedBy)).append("\n"); diff --git a/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature b/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature index aa7365ed633..fa084e1300b 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature @@ -107,21 +107,21 @@ Feature: Cloud Cost Management @generated @skip @team:DataDog/cloud-cost-management Scenario: Create or update a budget returns "Bad Request" response Given new "UpsertBudget" request - And body with value {"data": {"attributes": {"costs": {"actual": null, "amount": null, "forecast": null, "ootb_forecast": null}, "costs_unit": {"id": 42}, "created_at": 1738258683590, "created_by": "00000000-0a0a-0a0a-aaa0-00000000000a", "end_month": 202502, "entries": [{"costs": {"actual": null, "amount": null, "custom_forecast": null, "forecast": null, "ootb_forecast": null}, "tag_filters": [{}]}], "metrics_query": "aws.cost.amortized{service:ec2} by {service}", "name": "my budget", "org_id": 123, "start_month": 202501, "total_amount": 1000, "updated_at": 1738258683590, "updated_by": "00000000-0a0a-0a0a-aaa0-00000000000a"}, "id": "00000000-0a0a-0a0a-aaa0-00000000000a", "type": ""}} + And body with value {"data": {"attributes": {"costs": {"actual": null, "amount": null, "forecast": null, "ootb_forecast": null}, "costs_unit": {"id": 42}, "created_at": 1738258683590, "created_by": "00000000-0a0a-0a0a-aaa0-00000000000a", "end_month": 202502, "entries": [{"costs": {"actual": null, "amount": null, "custom_forecast": null, "forecast": null, "ootb_forecast": null}, "tag_filters": [{}]}], "metrics_query": "aws.cost.amortized{service:ec2} by {service}", "name": "my budget", "org_id": 123, "start_month": 202501, "tags": ["service"], "total_amount": 1000, "updated_at": 1738258683590, "updated_by": "00000000-0a0a-0a0a-aaa0-00000000000a"}, "id": "00000000-0a0a-0a0a-aaa0-00000000000a", "type": ""}} When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/cloud-cost-management Scenario: Create or update a budget returns "Not Found" response Given new "UpsertBudget" request - And body with value {"data": {"attributes": {"costs": {"actual": null, "amount": null, "forecast": null, "ootb_forecast": null}, "costs_unit": {"id": 42}, "created_at": 1738258683590, "created_by": "00000000-0a0a-0a0a-aaa0-00000000000a", "end_month": 202502, "entries": [{"costs": {"actual": null, "amount": null, "custom_forecast": null, "forecast": null, "ootb_forecast": null}, "tag_filters": [{}]}], "metrics_query": "aws.cost.amortized{service:ec2} by {service}", "name": "my budget", "org_id": 123, "start_month": 202501, "total_amount": 1000, "updated_at": 1738258683590, "updated_by": "00000000-0a0a-0a0a-aaa0-00000000000a"}, "id": "00000000-0a0a-0a0a-aaa0-00000000000a", "type": ""}} + And body with value {"data": {"attributes": {"costs": {"actual": null, "amount": null, "forecast": null, "ootb_forecast": null}, "costs_unit": {"id": 42}, "created_at": 1738258683590, "created_by": "00000000-0a0a-0a0a-aaa0-00000000000a", "end_month": 202502, "entries": [{"costs": {"actual": null, "amount": null, "custom_forecast": null, "forecast": null, "ootb_forecast": null}, "tag_filters": [{}]}], "metrics_query": "aws.cost.amortized{service:ec2} by {service}", "name": "my budget", "org_id": 123, "start_month": 202501, "tags": ["service"], "total_amount": 1000, "updated_at": 1738258683590, "updated_by": "00000000-0a0a-0a0a-aaa0-00000000000a"}, "id": "00000000-0a0a-0a0a-aaa0-00000000000a", "type": ""}} When the request is sent Then the response status is 404 Not Found @generated @skip @team:DataDog/cloud-cost-management Scenario: Create or update a budget returns "OK" response Given new "UpsertBudget" request - And body with value {"data": {"attributes": {"costs": {"actual": null, "amount": null, "forecast": null, "ootb_forecast": null}, "costs_unit": {"id": 42}, "created_at": 1738258683590, "created_by": "00000000-0a0a-0a0a-aaa0-00000000000a", "end_month": 202502, "entries": [{"costs": {"actual": null, "amount": null, "custom_forecast": null, "forecast": null, "ootb_forecast": null}, "tag_filters": [{}]}], "metrics_query": "aws.cost.amortized{service:ec2} by {service}", "name": "my budget", "org_id": 123, "start_month": 202501, "total_amount": 1000, "updated_at": 1738258683590, "updated_by": "00000000-0a0a-0a0a-aaa0-00000000000a"}, "id": "00000000-0a0a-0a0a-aaa0-00000000000a", "type": ""}} + And body with value {"data": {"attributes": {"costs": {"actual": null, "amount": null, "forecast": null, "ootb_forecast": null}, "costs_unit": {"id": 42}, "created_at": 1738258683590, "created_by": "00000000-0a0a-0a0a-aaa0-00000000000a", "end_month": 202502, "entries": [{"costs": {"actual": null, "amount": null, "custom_forecast": null, "forecast": null, "ootb_forecast": null}, "tag_filters": [{}]}], "metrics_query": "aws.cost.amortized{service:ec2} by {service}", "name": "my budget", "org_id": 123, "start_month": 202501, "tags": ["service"], "total_amount": 1000, "updated_at": 1738258683590, "updated_by": "00000000-0a0a-0a0a-aaa0-00000000000a"}, "id": "00000000-0a0a-0a0a-aaa0-00000000000a", "type": ""}} When the request is sent Then the response status is 200 OK