Skip to content
Merged
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
19 changes: 19 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 Expand Up @@ -14261,6 +14268,8 @@ components:
properties:
data:
$ref: "#/components/schemas/BudgetWithEntriesData"
meta:
$ref: "#/components/schemas/BudgetWithEntriesMeta"
type: object
BudgetWithEntriesData:
description: A budget and all its entries.
Expand Down Expand Up @@ -14390,6 +14399,16 @@ components:
type: string
x-enum-varnames:
- BUDGET
BudgetWithEntriesMeta:
description: Additional information about errors encountered while retrieving budget cost data.
properties:
error:
description: A user-facing explanation of why budget cost data could not be retrieved.
example: ""
type: string
required:
- error
type: object
BulkDeleteAppsDatastoreItemsRequest:
description: Request to delete items from a datastore.
properties:
Expand Down
5 changes: 4 additions & 1 deletion examples/v2/cloud-cost-management/UpsertBudget.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.datadog.api.client.v2.model.BudgetWithEntriesDataAttributesEntriesItems;
import com.datadog.api.client.v2.model.BudgetWithEntriesDataAttributesEntriesItemsCosts;
import com.datadog.api.client.v2.model.BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems;
import com.datadog.api.client.v2.model.BudgetWithEntriesMeta;
import java.util.Collections;

public class Example {
Expand Down Expand Up @@ -51,11 +52,13 @@ 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"))
.id("00000000-0a0a-0a0a-aaa0-00000000000a")
.type(""));
.type(""))
.meta(new BudgetWithEntriesMeta().error(""));

try {
BudgetWithEntries result = apiInstance.upsertBudget(body);
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 @@ -17,14 +17,17 @@
import java.util.Objects;

/** The definition of the <code>BudgetWithEntries</code> object. */
@JsonPropertyOrder({BudgetWithEntries.JSON_PROPERTY_DATA})
@JsonPropertyOrder({BudgetWithEntries.JSON_PROPERTY_DATA, BudgetWithEntries.JSON_PROPERTY_META})
@jakarta.annotation.Generated(
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
public class BudgetWithEntries {
@JsonIgnore public boolean unparsed = false;
public static final String JSON_PROPERTY_DATA = "data";
private BudgetWithEntriesData data;

public static final String JSON_PROPERTY_META = "meta";
private BudgetWithEntriesMeta meta;

public BudgetWithEntries data(BudgetWithEntriesData data) {
this.data = data;
this.unparsed |= data.unparsed;
Expand All @@ -50,6 +53,31 @@ public void setData(BudgetWithEntriesData data) {
}
}

public BudgetWithEntries meta(BudgetWithEntriesMeta meta) {
this.meta = meta;
this.unparsed |= meta.unparsed;
return this;
}

/**
* Additional information about errors encountered while retrieving budget cost data.
*
* @return meta
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_META)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public BudgetWithEntriesMeta getMeta() {
return meta;
}

public void setMeta(BudgetWithEntriesMeta meta) {
this.meta = meta;
if (meta != null) {
this.unparsed |= meta.unparsed;
}
}

/**
* A container for additional, undeclared properties. This is a holder for any undeclared
* properties as specified with the 'additionalProperties' keyword in the OAS document.
Expand Down Expand Up @@ -107,19 +135,21 @@ public boolean equals(Object o) {
}
BudgetWithEntries budgetWithEntries = (BudgetWithEntries) o;
return Objects.equals(this.data, budgetWithEntries.data)
&& Objects.equals(this.meta, budgetWithEntries.meta)
&& Objects.equals(this.additionalProperties, budgetWithEntries.additionalProperties);
}

@Override
public int hashCode() {
return Objects.hash(data, additionalProperties);
return Objects.hash(data, meta, additionalProperties);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class BudgetWithEntries {\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");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
/*
* 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.JsonCreator;
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;

/** Additional information about errors encountered while retrieving budget cost data. */
@JsonPropertyOrder({BudgetWithEntriesMeta.JSON_PROPERTY_ERROR})
@jakarta.annotation.Generated(
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
public class BudgetWithEntriesMeta {
@JsonIgnore public boolean unparsed = false;
public static final String JSON_PROPERTY_ERROR = "error";
private String error;

public BudgetWithEntriesMeta() {}

@JsonCreator
public BudgetWithEntriesMeta(
@JsonProperty(required = true, value = JSON_PROPERTY_ERROR) String error) {
this.error = error;
}

public BudgetWithEntriesMeta error(String error) {
this.error = error;
return this;
}

/**
* A user-facing explanation of why budget cost data could not be retrieved.
*
* @return error
*/
@JsonProperty(JSON_PROPERTY_ERROR)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getError() {
return error;
}

public void setError(String error) {
this.error = error;
}

/**
* 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<String, Object> 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 BudgetWithEntriesMeta
*/
@JsonAnySetter
public BudgetWithEntriesMeta putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<String, Object>();
}
this.additionalProperties.put(key, value);
return this;
}

/**
* Return the additional (undeclared) property.
*
* @return The additional properties
*/
@JsonAnyGetter
public Map<String, Object> 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 BudgetWithEntriesMeta object is equal to o. */
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
BudgetWithEntriesMeta budgetWithEntriesMeta = (BudgetWithEntriesMeta) o;
return Objects.equals(this.error, budgetWithEntriesMeta.error)
&& Objects.equals(this.additionalProperties, budgetWithEntriesMeta.additionalProperties);
}

@Override
public int hashCode() {
return Objects.hash(error, additionalProperties);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class BudgetWithEntriesMeta {\n");
sb.append(" error: ").append(toIndentedString(error)).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 ");
}
}
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": ""}, "meta": {"error": ""}}
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": ""}, "meta": {"error": ""}}
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": ""}, "meta": {"error": ""}}
When the request is sent
Then the response status is 200 OK

Expand Down
Loading