Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions examples/v2/cloud-cost-management/UpsertBudget.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<String> tags = null;

public static final String JSON_PROPERTY_TOTAL_AMOUNT = "total_amount";
private Double totalAmount;

Expand Down Expand Up @@ -364,6 +368,35 @@ public void setStartMonth(Long startMonth) {
this.startMonth = startMonth;
}

public BudgetAttributes tags(List<String> 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<String> getTags() {
return tags;
}

public void setTags(List<String> tags) {
this.tags = tags;
}

public BudgetAttributes totalAmount(Double totalAmount) {
this.totalAmount = totalAmount;
return this;
Expand Down Expand Up @@ -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)
Expand All @@ -516,6 +550,7 @@ public int hashCode() {
name,
orgId,
startMonth,
tags,
totalAmount,
updatedAt,
updatedBy,
Expand All @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading