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 @@ -29597,6 +29597,10 @@ components:
CustomCostsFileMetadata:
description: Schema of a Custom Costs metadata.
properties:
ai_provider:
description: Whether the Custom Costs file contains the costs of an AI provider.
example: false
type: boolean
billed_cost:
description: Total cost in the cost file.
example: 100.50
Expand Down Expand Up @@ -29646,6 +29650,10 @@ components:
CustomCostsFileMetadataWithContent:
description: Schema of a cost file's metadata.
properties:
ai_provider:
description: Whether the Custom Costs file contains the costs of an AI provider.
example: false
type: boolean
billed_cost:
description: Total cost in the cost file.
example: 100.50
Expand Down Expand Up @@ -162449,6 +162457,7 @@ paths:
value:
data:
- attributes:
ai_provider: false
billed_cost: 100.5
billing_currency: USD
charge_period:
Expand Down Expand Up @@ -162496,6 +162505,14 @@ paths:
put:
description: Upload a Custom Costs file.
operationId: UploadCustomCostsFile
parameters:
- description: Whether the uploaded file contains the costs of an AI provider.
in: query
name: ai_provider
required: false
schema:
default: false
type: boolean
requestBody:
content:
application/json:
Expand All @@ -162519,6 +162536,7 @@ paths:
value:
data:
attributes:
ai_provider: false
billed_cost: 100.5
billing_currency: USD
charge_period:
Expand Down Expand Up @@ -162607,6 +162625,7 @@ paths:
value:
data:
attributes:
ai_provider: false
billed_cost: 100.5
billing_currency: USD
charge_period:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Upload Custom Costs file marked as an AI provider file returns "Accepted" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.api.CloudCostManagementApi.UploadCustomCostsFileOptionalParameters;
import com.datadog.api.client.v2.model.CustomCostsFileLineItem;
import com.datadog.api.client.v2.model.CustomCostsFileUploadResponse;
import java.util.Collections;
import java.util.List;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

List<CustomCostsFileLineItem> body =
Collections.singletonList(
new CustomCostsFileLineItem()
.providerName("my_ai_provider")
.chargePeriodStart("2026-10-01")
.chargePeriodEnd("2026-10-31")
.chargeDescription("my_description")
.billedCost(250.0)
.billingCurrency("USD"));

try {
CustomCostsFileUploadResponse result =
apiInstance.uploadCustomCostsFile(
body, new UploadCustomCostsFileOptionalParameters().aiProvider(true));
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CloudCostManagementApi#uploadCustomCostsFile");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12823,6 +12823,23 @@ public CompletableFuture<ApiResponse<UnitCostResponse>> updateUnitCostWithHttpIn
new GenericType<UnitCostResponse>() {});
}

/** Manage optional parameters to uploadCustomCostsFile. */
public static class UploadCustomCostsFileOptionalParameters {
private Boolean aiProvider;

/**
* Set aiProvider.
*
* @param aiProvider Whether the uploaded file contains the costs of an AI provider. (optional,
* default to false)
* @return UploadCustomCostsFileOptionalParameters
*/
public UploadCustomCostsFileOptionalParameters aiProvider(Boolean aiProvider) {
this.aiProvider = aiProvider;
return this;
}
}

/**
* Upload Custom Costs file.
*
Expand All @@ -12834,7 +12851,8 @@ public CompletableFuture<ApiResponse<UnitCostResponse>> updateUnitCostWithHttpIn
*/
public CustomCostsFileUploadResponse uploadCustomCostsFile(List<CustomCostsFileLineItem> body)
throws ApiException {
return uploadCustomCostsFileWithHttpInfo(body).getData();
return uploadCustomCostsFileWithHttpInfo(body, new UploadCustomCostsFileOptionalParameters())
.getData();
}

/**
Expand All @@ -12847,7 +12865,42 @@ public CustomCostsFileUploadResponse uploadCustomCostsFile(List<CustomCostsFileL
*/
public CompletableFuture<CustomCostsFileUploadResponse> uploadCustomCostsFileAsync(
List<CustomCostsFileLineItem> body) {
return uploadCustomCostsFileWithHttpInfoAsync(body)
return uploadCustomCostsFileWithHttpInfoAsync(
body, new UploadCustomCostsFileOptionalParameters())
.thenApply(
response -> {
return response.getData();
});
}

/**
* Upload Custom Costs file.
*
* <p>See {@link #uploadCustomCostsFileWithHttpInfo}.
*
* @param body (required)
* @param parameters Optional parameters for the request.
* @return CustomCostsFileUploadResponse
* @throws ApiException if fails to make API call
*/
public CustomCostsFileUploadResponse uploadCustomCostsFile(
List<CustomCostsFileLineItem> body, UploadCustomCostsFileOptionalParameters parameters)
throws ApiException {
return uploadCustomCostsFileWithHttpInfo(body, parameters).getData();
}

/**
* Upload Custom Costs file.
*
* <p>See {@link #uploadCustomCostsFileWithHttpInfoAsync}.
*
* @param body (required)
* @param parameters Optional parameters for the request.
* @return CompletableFuture&lt;CustomCostsFileUploadResponse&gt;
*/
public CompletableFuture<CustomCostsFileUploadResponse> uploadCustomCostsFileAsync(
List<CustomCostsFileLineItem> body, UploadCustomCostsFileOptionalParameters parameters) {
return uploadCustomCostsFileWithHttpInfoAsync(body, parameters)
.thenApply(
response -> {
return response.getData();
Expand All @@ -12858,6 +12911,7 @@ public CompletableFuture<CustomCostsFileUploadResponse> uploadCustomCostsFileAsy
* Upload a Custom Costs file.
*
* @param body (required)
* @param parameters Optional parameters for the request.
* @return ApiResponse&lt;CustomCostsFileUploadResponse&gt;
* @throws ApiException if fails to make API call
* @http.response.details
Expand All @@ -12871,24 +12925,29 @@ public CompletableFuture<CustomCostsFileUploadResponse> uploadCustomCostsFileAsy
* </table>
*/
public ApiResponse<CustomCostsFileUploadResponse> uploadCustomCostsFileWithHttpInfo(
List<CustomCostsFileLineItem> body) throws ApiException {
List<CustomCostsFileLineItem> body, UploadCustomCostsFileOptionalParameters parameters)
throws ApiException {
Object localVarPostBody = body;

// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(
400, "Missing the required parameter 'body' when calling uploadCustomCostsFile");
}
Boolean aiProvider = parameters.aiProvider;
// create path and map variables
String localVarPath = "/api/v2/cost/custom_costs";

List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();

localVarQueryParams.addAll(apiClient.parameterToPairs("", "ai_provider", aiProvider));

Invocation.Builder builder =
apiClient.createBuilder(
"v2.CloudCostManagementApi.uploadCustomCostsFile",
localVarPath,
new ArrayList<Pair>(),
localVarQueryParams,
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"application/json"},
Expand All @@ -12910,10 +12969,12 @@ public ApiResponse<CustomCostsFileUploadResponse> uploadCustomCostsFileWithHttpI
* <p>See {@link #uploadCustomCostsFileWithHttpInfo}.
*
* @param body (required)
* @param parameters Optional parameters for the request.
* @return CompletableFuture&lt;ApiResponse&lt;CustomCostsFileUploadResponse&gt;&gt;
*/
public CompletableFuture<ApiResponse<CustomCostsFileUploadResponse>>
uploadCustomCostsFileWithHttpInfoAsync(List<CustomCostsFileLineItem> body) {
uploadCustomCostsFileWithHttpInfoAsync(
List<CustomCostsFileLineItem> body, UploadCustomCostsFileOptionalParameters parameters) {
Object localVarPostBody = body;

// verify the required parameter 'body' is set
Expand All @@ -12925,18 +12986,22 @@ public ApiResponse<CustomCostsFileUploadResponse> uploadCustomCostsFileWithHttpI
400, "Missing the required parameter 'body' when calling uploadCustomCostsFile"));
return result;
}
Boolean aiProvider = parameters.aiProvider;
// create path and map variables
String localVarPath = "/api/v2/cost/custom_costs";

List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();

localVarQueryParams.addAll(apiClient.parameterToPairs("", "ai_provider", aiProvider));

Invocation.Builder builder;
try {
builder =
apiClient.createBuilder(
"v2.CloudCostManagementApi.uploadCustomCostsFile",
localVarPath,
new ArrayList<Pair>(),
localVarQueryParams,
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"application/json"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

/** Schema of a Custom Costs metadata. */
@JsonPropertyOrder({
CustomCostsFileMetadata.JSON_PROPERTY_AI_PROVIDER,
CustomCostsFileMetadata.JSON_PROPERTY_BILLED_COST,
CustomCostsFileMetadata.JSON_PROPERTY_BILLING_CURRENCY,
CustomCostsFileMetadata.JSON_PROPERTY_CHARGE_PERIOD,
Expand All @@ -33,6 +34,9 @@
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
public class CustomCostsFileMetadata {
@JsonIgnore public boolean unparsed = false;
public static final String JSON_PROPERTY_AI_PROVIDER = "ai_provider";
private Boolean aiProvider;

public static final String JSON_PROPERTY_BILLED_COST = "billed_cost";
private Double billedCost;

Expand All @@ -57,6 +61,27 @@ public class CustomCostsFileMetadata {
public static final String JSON_PROPERTY_UPLOADED_BY = "uploaded_by";
private CustomCostsUser uploadedBy;

public CustomCostsFileMetadata aiProvider(Boolean aiProvider) {
this.aiProvider = aiProvider;
return this;
}

/**
* Whether the Custom Costs file contains the costs of an AI provider.
*
* @return aiProvider
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_AI_PROVIDER)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Boolean getAiProvider() {
return aiProvider;
}

public void setAiProvider(Boolean aiProvider) {
this.aiProvider = aiProvider;
}

public CustomCostsFileMetadata billedCost(Double billedCost) {
this.billedCost = billedCost;
return this;
Expand Down Expand Up @@ -297,7 +322,8 @@ public boolean equals(Object o) {
return false;
}
CustomCostsFileMetadata customCostsFileMetadata = (CustomCostsFileMetadata) o;
return Objects.equals(this.billedCost, customCostsFileMetadata.billedCost)
return Objects.equals(this.aiProvider, customCostsFileMetadata.aiProvider)
&& Objects.equals(this.billedCost, customCostsFileMetadata.billedCost)
&& Objects.equals(this.billingCurrency, customCostsFileMetadata.billingCurrency)
&& Objects.equals(this.chargePeriod, customCostsFileMetadata.chargePeriod)
&& Objects.equals(this.name, customCostsFileMetadata.name)
Expand All @@ -311,6 +337,7 @@ public boolean equals(Object o) {
@Override
public int hashCode() {
return Objects.hash(
aiProvider,
billedCost,
billingCurrency,
chargePeriod,
Expand All @@ -326,6 +353,7 @@ public int hashCode() {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CustomCostsFileMetadata {\n");
sb.append(" aiProvider: ").append(toIndentedString(aiProvider)).append("\n");
sb.append(" billedCost: ").append(toIndentedString(billedCost)).append("\n");
sb.append(" billingCurrency: ").append(toIndentedString(billingCurrency)).append("\n");
sb.append(" chargePeriod: ").append(toIndentedString(chargePeriod)).append("\n");
Expand Down
Loading
Loading