Skip to content

Commit a8d251e

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 3e5e865 of spec repo
1 parent 8c603c8 commit a8d251e

6 files changed

Lines changed: 258 additions & 0 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127092,6 +127092,56 @@ paths:
127092127092
x-unstable: |-
127093127093
**Note**: This endpoint is in preview and is subject to change.
127094127094
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
127095+
get:
127096+
description: Get the custom forecast for a budget.
127097+
operationId: GetCustomForecast
127098+
parameters:
127099+
- $ref: "#/components/parameters/BudgetID"
127100+
responses:
127101+
"200":
127102+
content:
127103+
application/json:
127104+
examples:
127105+
default:
127106+
value:
127107+
data:
127108+
attributes:
127109+
budget_uid: 00000000-0000-0000-0000-000000000001
127110+
created_at: 1738258683590
127111+
created_by: 00000000-0a0a-0a0a-aaa0-00000000000a
127112+
entries:
127113+
- amount: 400
127114+
month: 202501
127115+
tag_filters:
127116+
- tag_key: service
127117+
tag_value: ec2
127118+
- amount: 450
127119+
month: 202502
127120+
tag_filters:
127121+
- tag_key: service
127122+
tag_value: ec2
127123+
updated_at: 1738258683590
127124+
updated_by: 00000000-0a0a-0a0a-aaa0-00000000000a
127125+
id: 11111111-1111-1111-1111-111111111111
127126+
type: custom_forecast
127127+
schema:
127128+
$ref: "#/components/schemas/CustomForecastResponse"
127129+
description: OK
127130+
"400":
127131+
$ref: "#/components/responses/BadRequestResponse"
127132+
"404":
127133+
$ref: "#/components/responses/NotFoundResponse"
127134+
"429":
127135+
$ref: "#/components/responses/TooManyRequestsResponse"
127136+
security:
127137+
- apiKeyAuth: []
127138+
appKeyAuth: []
127139+
summary: Get a budget's custom forecast
127140+
tags:
127141+
- Cloud Cost Management
127142+
x-unstable: |-
127143+
**Note**: This endpoint is in preview and is subject to change.
127144+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
127095127145
/api/v2/cost/budgets:
127096127146
get:
127097127147
description: List budgets.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Get a budget's custom forecast returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.CloudCostManagementApi;
6+
import com.datadog.api.client.v2.model.CustomForecastResponse;
7+
8+
public class Example {
9+
public static void main(String[] args) {
10+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
11+
defaultClient.setUnstableOperationEnabled("v2.getCustomForecast", true);
12+
CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);
13+
14+
try {
15+
CustomForecastResponse result = apiInstance.getCustomForecast("budget_id");
16+
System.out.println(result);
17+
} catch (ApiException e) {
18+
System.err.println("Exception when calling CloudCostManagementApi#getCustomForecast");
19+
System.err.println("Status code: " + e.getCode());
20+
System.err.println("Reason: " + e.getResponseBody());
21+
System.err.println("Response headers: " + e.getResponseHeaders());
22+
e.printStackTrace();
23+
}
24+
}
25+
}

src/main/java/com/datadog/api/client/ApiClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,7 @@ public class ApiClient {
10041004
put("v2.getCommitmentsUtilizationTimeseries", false);
10051005
put("v2.getCostAnomaly", false);
10061006
put("v2.getCostTagMetadataCurrency", false);
1007+
put("v2.getCustomForecast", false);
10071008
put("v2.listCostAnomalies", false);
10081009
put("v2.listCostTagKeySources", false);
10091010
put("v2.listCostTagMetadata", false);

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

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6619,6 +6619,158 @@ public ApiResponse<CustomCostsFileGetResponse> getCustomCostsFileWithHttpInfo(St
66196619
new GenericType<CustomCostsFileGetResponse>() {});
66206620
}
66216621

6622+
/**
6623+
* Get a budget&#39;s custom forecast.
6624+
*
6625+
* <p>See {@link #getCustomForecastWithHttpInfo}.
6626+
*
6627+
* @param budgetId Budget id. (required)
6628+
* @return CustomForecastResponse
6629+
* @throws ApiException if fails to make API call
6630+
*/
6631+
public CustomForecastResponse getCustomForecast(String budgetId) throws ApiException {
6632+
return getCustomForecastWithHttpInfo(budgetId).getData();
6633+
}
6634+
6635+
/**
6636+
* Get a budget&#39;s custom forecast.
6637+
*
6638+
* <p>See {@link #getCustomForecastWithHttpInfoAsync}.
6639+
*
6640+
* @param budgetId Budget id. (required)
6641+
* @return CompletableFuture&lt;CustomForecastResponse&gt;
6642+
*/
6643+
public CompletableFuture<CustomForecastResponse> getCustomForecastAsync(String budgetId) {
6644+
return getCustomForecastWithHttpInfoAsync(budgetId)
6645+
.thenApply(
6646+
response -> {
6647+
return response.getData();
6648+
});
6649+
}
6650+
6651+
/**
6652+
* Get the custom forecast for a budget.
6653+
*
6654+
* @param budgetId Budget id. (required)
6655+
* @return ApiResponse&lt;CustomForecastResponse&gt;
6656+
* @throws ApiException if fails to make API call
6657+
* @http.response.details
6658+
* <table border="1">
6659+
* <caption>Response details</caption>
6660+
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
6661+
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
6662+
* <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr>
6663+
* <tr><td> 404 </td><td> Not Found </td><td> - </td></tr>
6664+
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
6665+
* </table>
6666+
*/
6667+
public ApiResponse<CustomForecastResponse> getCustomForecastWithHttpInfo(String budgetId)
6668+
throws ApiException {
6669+
// Check if unstable operation is enabled
6670+
String operationId = "getCustomForecast";
6671+
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
6672+
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
6673+
} else {
6674+
throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId));
6675+
}
6676+
Object localVarPostBody = null;
6677+
6678+
// verify the required parameter 'budgetId' is set
6679+
if (budgetId == null) {
6680+
throw new ApiException(
6681+
400, "Missing the required parameter 'budgetId' when calling getCustomForecast");
6682+
}
6683+
// create path and map variables
6684+
String localVarPath =
6685+
"/api/v2/cost/budget/{budget_id}/custom-forecast"
6686+
.replaceAll("\\{" + "budget_id" + "\\}", apiClient.escapeString(budgetId.toString()));
6687+
6688+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
6689+
6690+
Invocation.Builder builder =
6691+
apiClient.createBuilder(
6692+
"v2.CloudCostManagementApi.getCustomForecast",
6693+
localVarPath,
6694+
new ArrayList<Pair>(),
6695+
localVarHeaderParams,
6696+
new HashMap<String, String>(),
6697+
new String[] {"application/json"},
6698+
new String[] {"apiKeyAuth", "appKeyAuth"});
6699+
return apiClient.invokeAPI(
6700+
"GET",
6701+
builder,
6702+
localVarHeaderParams,
6703+
new String[] {},
6704+
localVarPostBody,
6705+
new HashMap<String, Object>(),
6706+
false,
6707+
new GenericType<CustomForecastResponse>() {});
6708+
}
6709+
6710+
/**
6711+
* Get a budget&#39;s custom forecast.
6712+
*
6713+
* <p>See {@link #getCustomForecastWithHttpInfo}.
6714+
*
6715+
* @param budgetId Budget id. (required)
6716+
* @return CompletableFuture&lt;ApiResponse&lt;CustomForecastResponse&gt;&gt;
6717+
*/
6718+
public CompletableFuture<ApiResponse<CustomForecastResponse>> getCustomForecastWithHttpInfoAsync(
6719+
String budgetId) {
6720+
// Check if unstable operation is enabled
6721+
String operationId = "getCustomForecast";
6722+
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
6723+
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
6724+
} else {
6725+
CompletableFuture<ApiResponse<CustomForecastResponse>> result = new CompletableFuture<>();
6726+
result.completeExceptionally(
6727+
new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)));
6728+
return result;
6729+
}
6730+
Object localVarPostBody = null;
6731+
6732+
// verify the required parameter 'budgetId' is set
6733+
if (budgetId == null) {
6734+
CompletableFuture<ApiResponse<CustomForecastResponse>> result = new CompletableFuture<>();
6735+
result.completeExceptionally(
6736+
new ApiException(
6737+
400, "Missing the required parameter 'budgetId' when calling getCustomForecast"));
6738+
return result;
6739+
}
6740+
// create path and map variables
6741+
String localVarPath =
6742+
"/api/v2/cost/budget/{budget_id}/custom-forecast"
6743+
.replaceAll("\\{" + "budget_id" + "\\}", apiClient.escapeString(budgetId.toString()));
6744+
6745+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
6746+
6747+
Invocation.Builder builder;
6748+
try {
6749+
builder =
6750+
apiClient.createBuilder(
6751+
"v2.CloudCostManagementApi.getCustomForecast",
6752+
localVarPath,
6753+
new ArrayList<Pair>(),
6754+
localVarHeaderParams,
6755+
new HashMap<String, String>(),
6756+
new String[] {"application/json"},
6757+
new String[] {"apiKeyAuth", "appKeyAuth"});
6758+
} catch (ApiException ex) {
6759+
CompletableFuture<ApiResponse<CustomForecastResponse>> result = new CompletableFuture<>();
6760+
result.completeExceptionally(ex);
6761+
return result;
6762+
}
6763+
return apiClient.invokeAPIAsync(
6764+
"GET",
6765+
builder,
6766+
localVarHeaderParams,
6767+
new String[] {},
6768+
localVarPostBody,
6769+
new HashMap<String, Object>(),
6770+
false,
6771+
new GenericType<CustomForecastResponse>() {});
6772+
}
6773+
66226774
/**
66236775
* Get a tag pipeline ruleset.
66246776
*

src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,30 @@ Feature: Cloud Cost Management
375375
When the request is sent
376376
Then the response status is 404 Not Found
377377

378+
@generated @skip @team:DataDog/cloud-cost-management
379+
Scenario: Get a budget's custom forecast returns "Bad Request" response
380+
Given operation "GetCustomForecast" enabled
381+
And new "GetCustomForecast" request
382+
And request contains "budget_id" parameter from "REPLACE.ME"
383+
When the request is sent
384+
Then the response status is 400 Bad Request
385+
386+
@generated @skip @team:DataDog/cloud-cost-management
387+
Scenario: Get a budget's custom forecast returns "Not Found" response
388+
Given operation "GetCustomForecast" enabled
389+
And new "GetCustomForecast" request
390+
And request contains "budget_id" parameter from "REPLACE.ME"
391+
When the request is sent
392+
Then the response status is 404 Not Found
393+
394+
@generated @skip @team:DataDog/cloud-cost-management
395+
Scenario: Get a budget's custom forecast returns "OK" response
396+
Given operation "GetCustomForecast" enabled
397+
And new "GetCustomForecast" request
398+
And request contains "budget_id" parameter from "REPLACE.ME"
399+
When the request is sent
400+
Then the response status is 200 OK
401+
378402
@replay-only @team:DataDog/cloud-cost-management
379403
Scenario: Get a tag pipeline ruleset returns "OK" response
380404
Given new "GetTagPipelinesRuleset" request

src/test/resources/com/datadog/api/client/v2/api/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,6 +1785,12 @@
17851785
"type": "idempotent"
17861786
}
17871787
},
1788+
"GetCustomForecast": {
1789+
"tag": "Cloud Cost Management",
1790+
"undo": {
1791+
"type": "safe"
1792+
}
1793+
},
17881794
"ListBudgets": {
17891795
"tag": "Cloud Cost Management",
17901796
"undo": {

0 commit comments

Comments
 (0)