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
111 changes: 86 additions & 25 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70492,6 +70492,8 @@ components:
$ref: "#/components/schemas/ObservabilityPipelineTagCardinalityLimitProcessorPerMetricLimit"
maxItems: 100
type: array
tracking_mode:
$ref: "#/components/schemas/ObservabilityPipelineTagCardinalityLimitProcessorTrackingMode"
type:
$ref: "#/components/schemas/ObservabilityPipelineTagCardinalityLimitProcessorType"
value_limit:
Expand All @@ -70506,6 +70508,7 @@ components:
- type
- include
- limit_exceeded_action
- tracking_mode
- value_limit
- enabled
type: object
Expand All @@ -70520,6 +70523,16 @@ components:
x-enum-varnames:
- DROP_TAG
- DROP_EVENT
ObservabilityPipelineTagCardinalityLimitProcessorOverrideType:
description: How the override is applied. `limit_override` enforces a custom limit; `excluded` omits the metric or tag from cardinality tracking.
enum:
- limit_override
- excluded
example: limit_override
type: string
x-enum-varnames:
- LIMIT_OVERRIDE
- EXCLUDED
ObservabilityPipelineTagCardinalityLimitProcessorPerMetricLimit:
description: A cardinality override applied to a specific metric.
properties:
Expand All @@ -70529,65 +70542,63 @@ components:
description: The name of the metric this override applies to.
example: "system.cpu.user"
type: string
mode:
$ref: "#/components/schemas/ObservabilityPipelineTagCardinalityLimitProcessorPerMetricMode"
override_type:
$ref: "#/components/schemas/ObservabilityPipelineTagCardinalityLimitProcessorOverrideType"
per_tag_limits:
description: A list of per-tag cardinality overrides that apply within this metric. Must be omitted when `mode` is `excluded`.
description: A list of per-tag cardinality overrides that apply within this metric. Must be omitted when `override_type` is `excluded`.
items:
$ref: "#/components/schemas/ObservabilityPipelineTagCardinalityLimitProcessorPerTagLimit"
maxItems: 50
type: array
value_limit:
description: The maximum number of distinct tag value combinations allowed for this metric. Required when `mode` is `tracked`. Must be omitted when `mode` is `excluded`.
description: The maximum number of distinct tag value combinations allowed for this metric. Required when `override_type` is `limit_override`. Must be omitted when `override_type` is `excluded`.
example: 10000
format: int64
maximum: 1000000
minimum: 0
type: integer
required:
- metric_name
- mode
- override_type
type: object
ObservabilityPipelineTagCardinalityLimitProcessorPerMetricMode:
description: How the per-metric override is applied. `tracked` enforces a custom limit; `excluded` skips the metric entirely.
enum:
- tracked
- excluded
example: tracked
type: string
x-enum-varnames:
- TRACKED
- EXCLUDED
ObservabilityPipelineTagCardinalityLimitProcessorPerTagLimit:
description: A cardinality override for a specific tag key within a per-metric limit.
properties:
mode:
$ref: "#/components/schemas/ObservabilityPipelineTagCardinalityLimitProcessorPerTagMode"
override_type:
$ref: "#/components/schemas/ObservabilityPipelineTagCardinalityLimitProcessorOverrideType"
tag_key:
description: The tag key this override applies to.
example: "host"
type: string
value_limit:
description: The maximum number of distinct values allowed for this tag. Required when `mode` is `limit_override`. Must be omitted when `mode` is `excluded`.
description: The maximum number of distinct values allowed for this tag. Required when `override_type` is `limit_override`. Must be omitted when `override_type` is `excluded`.
example: 5000
format: int64
maximum: 1000000
minimum: 0
type: integer
required:
- tag_key
- override_type
type: object
ObservabilityPipelineTagCardinalityLimitProcessorTrackingMode:
description: Controls whether the processor uses exact or probabilistic tag tracking.
properties:
mode:
$ref: "#/components/schemas/ObservabilityPipelineTagCardinalityLimitProcessorTrackingModeMode"
required:
- mode
type: object
ObservabilityPipelineTagCardinalityLimitProcessorPerTagMode:
description: How the per-tag override is applied. `limit_override` enforces a custom limit on the tag; `excluded` skips the tag from cardinality tracking.
ObservabilityPipelineTagCardinalityLimitProcessorTrackingModeMode:
description: The cardinality tracking algorithm to use.
enum:
- limit_override
- excluded
example: limit_override
- exact_fingerprint
- probabilistic
example: exact_fingerprint
type: string
x-enum-varnames:
- LIMIT_OVERRIDE
- EXCLUDED
- EXACT_FINGERPRINT
- PROBABILISTIC
ObservabilityPipelineTagCardinalityLimitProcessorType:
default: tag_cardinality_limit
description: The processor type. The value must be `tag_cardinality_limit`.
Expand Down Expand Up @@ -127284,6 +127295,56 @@ paths:
x-unstable: |-
**Note**: This endpoint is in preview and is subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
get:
description: Get the custom forecast for a budget.
operationId: GetCustomForecast
parameters:
- $ref: "#/components/parameters/BudgetID"
responses:
"200":
content:
application/json:
examples:
default:
value:
data:
attributes:
budget_uid: 00000000-0000-0000-0000-000000000001
created_at: 1738258683590
created_by: 00000000-0a0a-0a0a-aaa0-00000000000a
entries:
- amount: 400
month: 202501
tag_filters:
- tag_key: service
tag_value: ec2
- amount: 450
month: 202502
tag_filters:
- tag_key: service
tag_value: ec2
updated_at: 1738258683590
updated_by: 00000000-0a0a-0a0a-aaa0-00000000000a
id: 11111111-1111-1111-1111-111111111111
type: custom_forecast
schema:
$ref: "#/components/schemas/CustomForecastResponse"
description: OK
"400":
$ref: "#/components/responses/BadRequestResponse"
"404":
$ref: "#/components/responses/NotFoundResponse"
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
security:
- apiKeyAuth: []
appKeyAuth: []
summary: Get a budget's custom forecast
tags:
- Cloud Cost Management
x-unstable: |-
**Note**: This endpoint is in preview and is subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
/api/v2/cost/budgets:
get:
description: List budgets.
Expand Down
25 changes: 25 additions & 0 deletions examples/v2/cloud-cost-management/GetCustomForecast.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Get a budget's custom forecast returns "OK" 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.model.CustomForecastResponse;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setUnstableOperationEnabled("v2.getCustomForecast", true);
CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

try {
CustomForecastResponse result = apiInstance.getCustomForecast("budget_id");
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CloudCostManagementApi#getCustomForecast");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
1 change: 1 addition & 0 deletions src/main/java/com/datadog/api/client/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,7 @@ public class ApiClient {
put("v2.getCommitmentsUtilizationTimeseries", false);
put("v2.getCostAnomaly", false);
put("v2.getCostTagMetadataCurrency", false);
put("v2.getCustomForecast", false);
put("v2.listCostAnomalies", false);
put("v2.listCostTagKeySources", false);
put("v2.listCostTagMetadata", false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6619,6 +6619,158 @@ public ApiResponse<CustomCostsFileGetResponse> getCustomCostsFileWithHttpInfo(St
new GenericType<CustomCostsFileGetResponse>() {});
}

/**
* Get a budget&#39;s custom forecast.
*
* <p>See {@link #getCustomForecastWithHttpInfo}.
*
* @param budgetId Budget id. (required)
* @return CustomForecastResponse
* @throws ApiException if fails to make API call
*/
public CustomForecastResponse getCustomForecast(String budgetId) throws ApiException {
return getCustomForecastWithHttpInfo(budgetId).getData();
}

/**
* Get a budget&#39;s custom forecast.
*
* <p>See {@link #getCustomForecastWithHttpInfoAsync}.
*
* @param budgetId Budget id. (required)
* @return CompletableFuture&lt;CustomForecastResponse&gt;
*/
public CompletableFuture<CustomForecastResponse> getCustomForecastAsync(String budgetId) {
return getCustomForecastWithHttpInfoAsync(budgetId)
.thenApply(
response -> {
return response.getData();
});
}

/**
* Get the custom forecast for a budget.
*
* @param budgetId Budget id. (required)
* @return ApiResponse&lt;CustomForecastResponse&gt;
* @throws ApiException if fails to make API call
* @http.response.details
* <table border="1">
* <caption>Response details</caption>
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
* <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr>
* <tr><td> 404 </td><td> Not Found </td><td> - </td></tr>
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
* </table>
*/
public ApiResponse<CustomForecastResponse> getCustomForecastWithHttpInfo(String budgetId)
throws ApiException {
// Check if unstable operation is enabled
String operationId = "getCustomForecast";
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
} else {
throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId));
}
Object localVarPostBody = null;

// verify the required parameter 'budgetId' is set
if (budgetId == null) {
throw new ApiException(
400, "Missing the required parameter 'budgetId' when calling getCustomForecast");
}
// create path and map variables
String localVarPath =
"/api/v2/cost/budget/{budget_id}/custom-forecast"
.replaceAll("\\{" + "budget_id" + "\\}", apiClient.escapeString(budgetId.toString()));

Map<String, String> localVarHeaderParams = new HashMap<String, String>();

Invocation.Builder builder =
apiClient.createBuilder(
"v2.CloudCostManagementApi.getCustomForecast",
localVarPath,
new ArrayList<Pair>(),
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"application/json"},
new String[] {"apiKeyAuth", "appKeyAuth"});
return apiClient.invokeAPI(
"GET",
builder,
localVarHeaderParams,
new String[] {},
localVarPostBody,
new HashMap<String, Object>(),
false,
new GenericType<CustomForecastResponse>() {});
}

/**
* Get a budget&#39;s custom forecast.
*
* <p>See {@link #getCustomForecastWithHttpInfo}.
*
* @param budgetId Budget id. (required)
* @return CompletableFuture&lt;ApiResponse&lt;CustomForecastResponse&gt;&gt;
*/
public CompletableFuture<ApiResponse<CustomForecastResponse>> getCustomForecastWithHttpInfoAsync(
String budgetId) {
// Check if unstable operation is enabled
String operationId = "getCustomForecast";
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
} else {
CompletableFuture<ApiResponse<CustomForecastResponse>> result = new CompletableFuture<>();
result.completeExceptionally(
new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)));
return result;
}
Object localVarPostBody = null;

// verify the required parameter 'budgetId' is set
if (budgetId == null) {
CompletableFuture<ApiResponse<CustomForecastResponse>> result = new CompletableFuture<>();
result.completeExceptionally(
new ApiException(
400, "Missing the required parameter 'budgetId' when calling getCustomForecast"));
return result;
}
// create path and map variables
String localVarPath =
"/api/v2/cost/budget/{budget_id}/custom-forecast"
.replaceAll("\\{" + "budget_id" + "\\}", apiClient.escapeString(budgetId.toString()));

Map<String, String> localVarHeaderParams = new HashMap<String, String>();

Invocation.Builder builder;
try {
builder =
apiClient.createBuilder(
"v2.CloudCostManagementApi.getCustomForecast",
localVarPath,
new ArrayList<Pair>(),
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"application/json"},
new String[] {"apiKeyAuth", "appKeyAuth"});
} catch (ApiException ex) {
CompletableFuture<ApiResponse<CustomForecastResponse>> result = new CompletableFuture<>();
result.completeExceptionally(ex);
return result;
}
return apiClient.invokeAPIAsync(
"GET",
builder,
localVarHeaderParams,
new String[] {},
localVarPostBody,
new HashMap<String, Object>(),
false,
new GenericType<CustomForecastResponse>() {});
}

/**
* Get a tag pipeline ruleset.
*
Expand Down
Loading
Loading