Skip to content

Commit 3e472d1

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add OpenAPI for Cloud Cost Management custom forecast endpoints (#1773)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 53fb736 commit 3e472d1

18 files changed

Lines changed: 1696 additions & 0 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27158,6 +27158,156 @@ components:
2715827158
$ref: "#/components/schemas/CustomDestinationResponseDefinition"
2715927159
type: array
2716027160
type: object
27161+
CustomForecastEntry:
27162+
description: A monthly entry of a custom budget forecast.
27163+
properties:
27164+
amount:
27165+
description: Forecast amount for the month.
27166+
example: 400
27167+
format: double
27168+
type: number
27169+
month:
27170+
description: Month the custom forecast entry applies to, in `YYYYMM` format.
27171+
example: 202501
27172+
format: int64
27173+
type: integer
27174+
tag_filters:
27175+
description: Tag filters that scope this custom forecast entry to specific resources.
27176+
items:
27177+
$ref: "#/components/schemas/CustomForecastEntryTagFilter"
27178+
type: array
27179+
required:
27180+
- month
27181+
- amount
27182+
- tag_filters
27183+
type: object
27184+
CustomForecastEntryTagFilter:
27185+
description: A tag filter that scopes a custom forecast entry to specific resource tags.
27186+
properties:
27187+
tag_key:
27188+
description: The tag key to filter on.
27189+
example: service
27190+
type: string
27191+
tag_value:
27192+
description: The tag value to filter on.
27193+
example: ec2
27194+
type: string
27195+
required:
27196+
- tag_key
27197+
- tag_value
27198+
type: object
27199+
CustomForecastResponse:
27200+
description: Response object containing the custom forecast for a budget.
27201+
properties:
27202+
data:
27203+
$ref: "#/components/schemas/CustomForecastResponseData"
27204+
required:
27205+
- data
27206+
type: object
27207+
CustomForecastResponseData:
27208+
description: Custom forecast resource wrapper in a response.
27209+
properties:
27210+
attributes:
27211+
$ref: "#/components/schemas/CustomForecastResponseDataAttributes"
27212+
id:
27213+
description: The unique identifier of the custom forecast.
27214+
example: 11111111-1111-1111-1111-111111111111
27215+
type: string
27216+
type:
27217+
$ref: "#/components/schemas/CustomForecastType"
27218+
required:
27219+
- id
27220+
- type
27221+
- attributes
27222+
type: object
27223+
CustomForecastResponseDataAttributes:
27224+
description: Attributes of a custom forecast.
27225+
properties:
27226+
budget_uid:
27227+
description: The UUID of the budget that this custom forecast belongs to.
27228+
example: 00000000-0000-0000-0000-000000000001
27229+
type: string
27230+
created_at:
27231+
description: Timestamp the custom forecast was created, in Unix milliseconds.
27232+
example: 1738258683590
27233+
format: int64
27234+
type: integer
27235+
created_by:
27236+
description: The id of the user that created the custom forecast.
27237+
example: 00000000-0a0a-0a0a-aaa0-00000000000a
27238+
type: string
27239+
entries:
27240+
description: Monthly custom forecast entries.
27241+
items:
27242+
$ref: "#/components/schemas/CustomForecastEntry"
27243+
type: array
27244+
updated_at:
27245+
description: Timestamp the custom forecast was last updated, in Unix milliseconds.
27246+
example: 1738258683590
27247+
format: int64
27248+
type: integer
27249+
updated_by:
27250+
description: The id of the user that last updated the custom forecast.
27251+
example: 00000000-0a0a-0a0a-aaa0-00000000000a
27252+
type: string
27253+
required:
27254+
- budget_uid
27255+
- created_at
27256+
- updated_at
27257+
- created_by
27258+
- updated_by
27259+
- entries
27260+
type: object
27261+
CustomForecastType:
27262+
default: custom_forecast
27263+
description: The type of the custom forecast resource. Must be `custom_forecast`.
27264+
enum:
27265+
- custom_forecast
27266+
example: custom_forecast
27267+
type: string
27268+
x-enum-varnames:
27269+
- CUSTOM_FORECAST
27270+
CustomForecastUpsertRequest:
27271+
description: Request body to upsert (create or replace) the custom forecast for a budget.
27272+
properties:
27273+
data:
27274+
$ref: "#/components/schemas/CustomForecastUpsertRequestData"
27275+
required:
27276+
- data
27277+
type: object
27278+
CustomForecastUpsertRequestData:
27279+
description: Custom forecast resource wrapper in an upsert request.
27280+
properties:
27281+
attributes:
27282+
$ref: "#/components/schemas/CustomForecastUpsertRequestDataAttributes"
27283+
id:
27284+
description: Unused on upsert; the resource is keyed by `budget_uid`. Send an empty string.
27285+
example: ""
27286+
type: string
27287+
type:
27288+
$ref: "#/components/schemas/CustomForecastType"
27289+
required:
27290+
- type
27291+
- attributes
27292+
type: object
27293+
CustomForecastUpsertRequestDataAttributes:
27294+
description: Attributes of a custom forecast upsert request.
27295+
properties:
27296+
budget_uid:
27297+
description: The UUID of the budget that this custom forecast belongs to.
27298+
example: 00000000-0000-0000-0000-000000000001
27299+
type: string
27300+
entries:
27301+
description: |-
27302+
Monthly custom forecast entries. An empty list deletes any existing
27303+
custom forecast for the budget.
27304+
items:
27305+
$ref: "#/components/schemas/CustomForecastEntry"
27306+
type: array
27307+
required:
27308+
- budget_uid
27309+
- entries
27310+
type: object
2716127311
CustomFrameworkControl:
2716227312
description: Framework Control.
2716327313
properties:
@@ -124191,6 +124341,82 @@ paths:
124191124341
summary: Validate CSV budget
124192124342
tags:
124193124343
- Cloud Cost Management
124344+
/api/v2/cost/budget/custom-forecast:
124345+
put:
124346+
description: |-
124347+
Create or replace the custom forecast for an existing budget.
124348+
Pass an empty `entries` list to delete the custom forecast for the budget.
124349+
operationId: UpsertCustomForecast
124350+
requestBody:
124351+
content:
124352+
application/json:
124353+
examples:
124354+
default:
124355+
value:
124356+
data:
124357+
attributes:
124358+
budget_uid: 00000000-0000-0000-0000-000000000001
124359+
entries:
124360+
- amount: 400
124361+
month: 202501
124362+
tag_filters:
124363+
- tag_key: service
124364+
tag_value: ec2
124365+
- amount: 450
124366+
month: 202502
124367+
tag_filters:
124368+
- tag_key: service
124369+
tag_value: ec2
124370+
id: ""
124371+
type: custom_forecast
124372+
schema:
124373+
$ref: "#/components/schemas/CustomForecastUpsertRequest"
124374+
required: true
124375+
responses:
124376+
"200":
124377+
content:
124378+
application/json:
124379+
examples:
124380+
default:
124381+
value:
124382+
data:
124383+
attributes:
124384+
budget_uid: 00000000-0000-0000-0000-000000000001
124385+
created_at: 1738258683590
124386+
created_by: 00000000-0a0a-0a0a-aaa0-00000000000a
124387+
entries:
124388+
- amount: 400
124389+
month: 202501
124390+
tag_filters:
124391+
- tag_key: service
124392+
tag_value: ec2
124393+
- amount: 450
124394+
month: 202502
124395+
tag_filters:
124396+
- tag_key: service
124397+
tag_value: ec2
124398+
updated_at: 1738258683590
124399+
updated_by: 00000000-0a0a-0a0a-aaa0-00000000000a
124400+
id: 11111111-1111-1111-1111-111111111111
124401+
type: custom_forecast
124402+
schema:
124403+
$ref: "#/components/schemas/CustomForecastResponse"
124404+
description: OK
124405+
"400":
124406+
$ref: "#/components/responses/BadRequestResponse"
124407+
"404":
124408+
$ref: "#/components/responses/NotFoundResponse"
124409+
"429":
124410+
$ref: "#/components/responses/TooManyRequestsResponse"
124411+
security:
124412+
- apiKeyAuth: []
124413+
appKeyAuth: []
124414+
summary: Create or replace a budget's custom forecast
124415+
tags:
124416+
- Cloud Cost Management
124417+
x-unstable: |-
124418+
**Note**: This endpoint is in preview and is subject to change.
124419+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
124194124420
/api/v2/cost/budget/validate:
124195124421
post:
124196124422
description: Validate a budget configuration without creating or modifying it
@@ -124313,6 +124539,30 @@ paths:
124313124539
summary: Get budget
124314124540
tags:
124315124541
- Cloud Cost Management
124542+
/api/v2/cost/budget/{budget_id}/custom-forecast:
124543+
delete:
124544+
description: Delete the custom forecast for a budget.
124545+
operationId: DeleteCustomForecast
124546+
parameters:
124547+
- $ref: "#/components/parameters/BudgetID"
124548+
responses:
124549+
"204":
124550+
description: No Content
124551+
"400":
124552+
$ref: "#/components/responses/BadRequestResponse"
124553+
"404":
124554+
$ref: "#/components/responses/NotFoundResponse"
124555+
"429":
124556+
$ref: "#/components/responses/TooManyRequestsResponse"
124557+
security:
124558+
- apiKeyAuth: []
124559+
appKeyAuth: []
124560+
summary: Delete a budget's custom forecast
124561+
tags:
124562+
- Cloud Cost Management
124563+
x-unstable: |-
124564+
**Note**: This endpoint is in preview and is subject to change.
124565+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
124316124566
/api/v2/cost/budgets:
124317124567
get:
124318124568
description: List budgets.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Delete a budget's custom forecast returns "No Content" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
let mut configuration = datadog::Configuration::new();
8+
configuration.set_unstable_operation_enabled("v2.DeleteCustomForecast", true);
9+
let api = CloudCostManagementAPI::with_config(configuration);
10+
let resp = api.delete_custom_forecast("budget_id".to_string()).await;
11+
if let Ok(value) = resp {
12+
println!("{:#?}", value);
13+
} else {
14+
println!("{:#?}", resp.unwrap_err());
15+
}
16+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Create or replace a budget's custom forecast returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
4+
use datadog_api_client::datadogV2::model::CustomForecastEntry;
5+
use datadog_api_client::datadogV2::model::CustomForecastEntryTagFilter;
6+
use datadog_api_client::datadogV2::model::CustomForecastType;
7+
use datadog_api_client::datadogV2::model::CustomForecastUpsertRequest;
8+
use datadog_api_client::datadogV2::model::CustomForecastUpsertRequestData;
9+
use datadog_api_client::datadogV2::model::CustomForecastUpsertRequestDataAttributes;
10+
11+
#[tokio::main]
12+
async fn main() {
13+
let body = CustomForecastUpsertRequest::new(
14+
CustomForecastUpsertRequestData::new(
15+
CustomForecastUpsertRequestDataAttributes::new(
16+
"00000000-0000-0000-0000-000000000001".to_string(),
17+
vec![CustomForecastEntry::new(
18+
400.0,
19+
202501,
20+
vec![CustomForecastEntryTagFilter::new(
21+
"service".to_string(),
22+
"ec2".to_string(),
23+
)],
24+
)],
25+
),
26+
CustomForecastType::CUSTOM_FORECAST,
27+
)
28+
.id("".to_string()),
29+
);
30+
let mut configuration = datadog::Configuration::new();
31+
configuration.set_unstable_operation_enabled("v2.UpsertCustomForecast", true);
32+
let api = CloudCostManagementAPI::with_config(configuration);
33+
let resp = api.upsert_custom_forecast(body).await;
34+
if let Ok(value) = resp {
35+
println!("{:#?}", value);
36+
} else {
37+
println!("{:#?}", resp.unwrap_err());
38+
}
39+
}

src/datadog/configuration.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ impl Default for Configuration {
485485
("v2.get_code_coverage_branch_summary".to_owned(), false),
486486
("v2.get_code_coverage_commit_summary".to_owned(), false),
487487
("v2.get_rule_based_view".to_owned(), false),
488+
("v2.delete_custom_forecast".to_owned(), false),
488489
("v2.get_commitments_commitment_list".to_owned(), false),
489490
("v2.get_commitments_coverage_scalar".to_owned(), false),
490491
("v2.get_commitments_coverage_timeseries".to_owned(), false),
@@ -508,6 +509,7 @@ impl Default for Configuration {
508509
("v2.list_cost_tag_metadata_months".to_owned(), false),
509510
("v2.list_cost_tag_metadata_orchestrators".to_owned(), false),
510511
("v2.search_cost_recommendations".to_owned(), false),
512+
("v2.upsert_custom_forecast".to_owned(), false),
511513
("v2.create_ownership_feedback".to_owned(), false),
512514
("v2.get_ownership_evidence".to_owned(), false),
513515
("v2.get_ownership_inference".to_owned(), false),

0 commit comments

Comments
 (0)