Skip to content

Commit 3ec493c

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add cost_aggregation parameter to GetEstimatedCostByOrg (#3645)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 5fea3c9 commit 3ec493c

File tree

3 files changed

+89
-0
lines changed

3 files changed

+89
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13902,6 +13902,13 @@ components:
1390213902
data:
1390313903
$ref: "#/components/schemas/ConvertJobResultsToSignalsData"
1390413904
type: object
13905+
CostAggregationType:
13906+
description: "Controls how costs are aggregated when using `start_date`. The `cumulative` option returns month-to-date running totals."
13907+
enum:
13908+
- cumulative
13909+
type: string
13910+
x-enum-varnames:
13911+
- CUMULATIVE
1390513912
CostAttributionAggregates:
1390613913
description: An array of available aggregates.
1390713914
items:
@@ -108698,6 +108705,12 @@ paths:
108698108705
schema:
108699108706
format: date-time
108700108707
type: string
108708+
- description: "Controls how costs are aggregated when using `start_date`. The `cumulative` option returns month-to-date running totals."
108709+
in: query
108710+
name: cost_aggregation
108711+
required: false
108712+
schema:
108713+
$ref: "#/components/schemas/CostAggregationType"
108701108714
- description: "Boolean to specify whether to include accounts connected to the current account as partner customers in the Datadog partner network program. Defaults to `false`."
108702108715
in: query
108703108716
name: include_connected_accounts

src/main/java/com/datadog/api/client/v2/api/UsageMeteringApi.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.datadog.api.client.Pair;
77
import com.datadog.api.client.v2.model.ActiveBillingDimensionsResponse;
88
import com.datadog.api.client.v2.model.BillingDimensionsMappingResponse;
9+
import com.datadog.api.client.v2.model.CostAggregationType;
910
import com.datadog.api.client.v2.model.CostByOrgResponse;
1011
import com.datadog.api.client.v2.model.HourlyUsageResponse;
1112
import com.datadog.api.client.v2.model.MonthlyCostAttributionResponse;
@@ -595,6 +596,7 @@ public static class GetEstimatedCostByOrgOptionalParameters {
595596
private OffsetDateTime endMonth;
596597
private OffsetDateTime startDate;
597598
private OffsetDateTime endDate;
599+
private CostAggregationType costAggregation;
598600
private Boolean includeConnectedAccounts;
599601

600602
/**
@@ -662,6 +664,19 @@ public GetEstimatedCostByOrgOptionalParameters endDate(OffsetDateTime endDate) {
662664
return this;
663665
}
664666

667+
/**
668+
* Set costAggregation.
669+
*
670+
* @param costAggregation Controls how costs are aggregated when using <code>start_date</code>.
671+
* The <code>cumulative</code> option returns month-to-date running totals. (optional)
672+
* @return GetEstimatedCostByOrgOptionalParameters
673+
*/
674+
public GetEstimatedCostByOrgOptionalParameters costAggregation(
675+
CostAggregationType costAggregation) {
676+
this.costAggregation = costAggregation;
677+
return this;
678+
}
679+
665680
/**
666681
* Set includeConnectedAccounts.
667682
*
@@ -767,6 +782,7 @@ public ApiResponse<CostByOrgResponse> getEstimatedCostByOrgWithHttpInfo(
767782
OffsetDateTime endMonth = parameters.endMonth;
768783
OffsetDateTime startDate = parameters.startDate;
769784
OffsetDateTime endDate = parameters.endDate;
785+
CostAggregationType costAggregation = parameters.costAggregation;
770786
Boolean includeConnectedAccounts = parameters.includeConnectedAccounts;
771787
// create path and map variables
772788
String localVarPath = "/api/v2/usage/estimated_cost";
@@ -779,6 +795,7 @@ public ApiResponse<CostByOrgResponse> getEstimatedCostByOrgWithHttpInfo(
779795
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_month", endMonth));
780796
localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_date", startDate));
781797
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_date", endDate));
798+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cost_aggregation", costAggregation));
782799
localVarQueryParams.addAll(
783800
apiClient.parameterToPairs("", "include_connected_accounts", includeConnectedAccounts));
784801

@@ -818,6 +835,7 @@ public CompletableFuture<ApiResponse<CostByOrgResponse>> getEstimatedCostByOrgWi
818835
OffsetDateTime endMonth = parameters.endMonth;
819836
OffsetDateTime startDate = parameters.startDate;
820837
OffsetDateTime endDate = parameters.endDate;
838+
CostAggregationType costAggregation = parameters.costAggregation;
821839
Boolean includeConnectedAccounts = parameters.includeConnectedAccounts;
822840
// create path and map variables
823841
String localVarPath = "/api/v2/usage/estimated_cost";
@@ -830,6 +848,7 @@ public CompletableFuture<ApiResponse<CostByOrgResponse>> getEstimatedCostByOrgWi
830848
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_month", endMonth));
831849
localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_date", startDate));
832850
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_date", endDate));
851+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cost_aggregation", costAggregation));
833852
localVarQueryParams.addAll(
834853
apiClient.parameterToPairs("", "include_connected_accounts", includeConnectedAccounts));
835854

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
3+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
* Copyright 2019-Present Datadog, Inc.
5+
*/
6+
7+
package com.datadog.api.client.v2.model;
8+
9+
import com.datadog.api.client.ModelEnum;
10+
import com.fasterxml.jackson.annotation.JsonCreator;
11+
import com.fasterxml.jackson.core.JsonGenerator;
12+
import com.fasterxml.jackson.core.JsonProcessingException;
13+
import com.fasterxml.jackson.databind.SerializerProvider;
14+
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
15+
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
16+
import java.io.IOException;
17+
import java.util.Arrays;
18+
import java.util.HashSet;
19+
import java.util.Set;
20+
21+
/**
22+
* Controls how costs are aggregated when using <code>start_date</code>. The <code>cumulative</code>
23+
* option returns month-to-date running totals.
24+
*/
25+
@JsonSerialize(using = CostAggregationType.CostAggregationTypeSerializer.class)
26+
public class CostAggregationType extends ModelEnum<String> {
27+
28+
private static final Set<String> allowedValues = new HashSet<String>(Arrays.asList("cumulative"));
29+
30+
public static final CostAggregationType CUMULATIVE = new CostAggregationType("cumulative");
31+
32+
CostAggregationType(String value) {
33+
super(value, allowedValues);
34+
}
35+
36+
public static class CostAggregationTypeSerializer extends StdSerializer<CostAggregationType> {
37+
public CostAggregationTypeSerializer(Class<CostAggregationType> t) {
38+
super(t);
39+
}
40+
41+
public CostAggregationTypeSerializer() {
42+
this(null);
43+
}
44+
45+
@Override
46+
public void serialize(
47+
CostAggregationType value, JsonGenerator jgen, SerializerProvider provider)
48+
throws IOException, JsonProcessingException {
49+
jgen.writeObject(value.value);
50+
}
51+
}
52+
53+
@JsonCreator
54+
public static CostAggregationType fromValue(String value) {
55+
return new CostAggregationType(value);
56+
}
57+
}

0 commit comments

Comments
 (0)