Skip to content
Open
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
250 changes: 250 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27149,6 +27149,156 @@ components:
$ref: "#/components/schemas/CustomDestinationResponseDefinition"
type: array
type: object
CustomForecastEntry:
description: A monthly entry of a custom budget forecast.
properties:
amount:
description: Forecast amount for the month.
example: 400
format: double
type: number
month:
description: Month the custom forecast entry applies to, in `YYYYMM` format.
example: 202501
format: int64
type: integer
tag_filters:
description: Tag filters that scope this custom forecast entry to specific resources.
items:
$ref: "#/components/schemas/CustomForecastEntryTagFilter"
type: array
required:
- month
- amount
- tag_filters
type: object
CustomForecastEntryTagFilter:
description: A tag filter that scopes a custom forecast entry to specific resource tags.
properties:
tag_key:
description: The tag key to filter on.
example: service
type: string
tag_value:
description: The tag value to filter on.
example: ec2
type: string
required:
- tag_key
- tag_value
type: object
CustomForecastResponse:
description: Response object containing the custom forecast for a budget.
properties:
data:
$ref: "#/components/schemas/CustomForecastResponseData"
required:
- data
type: object
CustomForecastResponseData:
description: Custom forecast resource wrapper in a response.
properties:
attributes:
$ref: "#/components/schemas/CustomForecastResponseDataAttributes"
id:
description: The unique identifier of the custom forecast.
example: 11111111-1111-1111-1111-111111111111
type: string
type:
$ref: "#/components/schemas/CustomForecastType"
required:
- id
- type
- attributes
type: object
CustomForecastResponseDataAttributes:
description: Attributes of a custom forecast.
properties:
budget_uid:
description: The UUID of the budget that this custom forecast belongs to.
example: 00000000-0000-0000-0000-000000000001
type: string
created_at:
description: Timestamp the custom forecast was created, in Unix milliseconds.
example: 1738258683590
format: int64
type: integer
created_by:
description: The id of the user that created the custom forecast.
example: 00000000-0a0a-0a0a-aaa0-00000000000a
type: string
entries:
description: Monthly custom forecast entries.
items:
$ref: "#/components/schemas/CustomForecastEntry"
type: array
updated_at:
description: Timestamp the custom forecast was last updated, in Unix milliseconds.
example: 1738258683590
format: int64
type: integer
updated_by:
description: The id of the user that last updated the custom forecast.
example: 00000000-0a0a-0a0a-aaa0-00000000000a
type: string
required:
- budget_uid
- created_at
- updated_at
- created_by
- updated_by
- entries
type: object
CustomForecastType:
default: custom_forecast
description: The type of the custom forecast resource. Must be `custom_forecast`.
enum:
- custom_forecast
example: custom_forecast
type: string
x-enum-varnames:
- CUSTOM_FORECAST
CustomForecastUpsertRequest:
description: Request body to upsert (create or replace) the custom forecast for a budget.
properties:
data:
$ref: "#/components/schemas/CustomForecastUpsertRequestData"
required:
- data
type: object
CustomForecastUpsertRequestData:
description: Custom forecast resource wrapper in an upsert request.
properties:
attributes:
$ref: "#/components/schemas/CustomForecastUpsertRequestDataAttributes"
id:
description: Unused on upsert; the resource is keyed by `budget_uid`. Send an empty string.
example: ""
type: string
type:
$ref: "#/components/schemas/CustomForecastType"
required:
- type
- attributes
type: object
CustomForecastUpsertRequestDataAttributes:
description: Attributes of a custom forecast upsert request.
properties:
budget_uid:
description: The UUID of the budget that this custom forecast belongs to.
example: 00000000-0000-0000-0000-000000000001
type: string
entries:
description: |-
Monthly custom forecast entries. An empty list deletes any existing
custom forecast for the budget.
items:
$ref: "#/components/schemas/CustomForecastEntry"
type: array
required:
- budget_uid
- entries
type: object
CustomFrameworkControl:
description: Framework Control.
properties:
Expand Down Expand Up @@ -123849,6 +123999,82 @@ paths:
summary: Validate CSV budget
tags:
- Cloud Cost Management
/api/v2/cost/budget/custom-forecast:
put:
description: |-
Create or replace the custom forecast for an existing budget.
Pass an empty `entries` list to delete the custom forecast for the budget.
operationId: UpsertCustomForecast
requestBody:
content:
application/json:
examples:
default:
value:
data:
attributes:
budget_uid: 00000000-0000-0000-0000-000000000001
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
id: ""
type: custom_forecast
schema:
$ref: "#/components/schemas/CustomForecastUpsertRequest"
required: true
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: Create or replace 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/budget/validate:
post:
description: Validate a budget configuration without creating or modifying it
Expand Down Expand Up @@ -123971,6 +124197,30 @@ paths:
summary: Get budget
tags:
- Cloud Cost Management
/api/v2/cost/budget/{budget_id}/custom-forecast:
delete:
description: Delete the custom forecast for a budget.
operationId: DeleteCustomForecast
parameters:
- $ref: "#/components/parameters/BudgetID"
responses:
"204":
description: No Content
"400":
$ref: "#/components/responses/BadRequestResponse"
"404":
$ref: "#/components/responses/NotFoundResponse"
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
security:
- apiKeyAuth: []
appKeyAuth: []
summary: Delete 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
8 changes: 8 additions & 0 deletions examples/v2/cloud-cost-management/DeleteCustomForecast.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Delete a budget's custom forecast returns "No Content" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.delete_custom_forecast".to_sym] = true
end
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
api_instance.delete_custom_forecast("budget_id")
30 changes: 30 additions & 0 deletions examples/v2/cloud-cost-management/UpsertCustomForecast.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Create or replace a budget's custom forecast returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.upsert_custom_forecast".to_sym] = true
end
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new

body = DatadogAPIClient::V2::CustomForecastUpsertRequest.new({
data: DatadogAPIClient::V2::CustomForecastUpsertRequestData.new({
attributes: DatadogAPIClient::V2::CustomForecastUpsertRequestDataAttributes.new({
budget_uid: "00000000-0000-0000-0000-000000000001",
entries: [
DatadogAPIClient::V2::CustomForecastEntry.new({
amount: 400,
month: 202501,
tag_filters: [
DatadogAPIClient::V2::CustomForecastEntryTagFilter.new({
tag_key: "service",
tag_value: "ec2",
}),
],
}),
],
}),
id: "",
type: DatadogAPIClient::V2::CustomForecastType::CUSTOM_FORECAST,
}),
})
p api_instance.upsert_custom_forecast(body)
6 changes: 6 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2699,6 +2699,9 @@
"v2.UpsertBudget" => {
"body" => "BudgetWithEntries",
},
"v2.UpsertCustomForecast" => {
"body" => "CustomForecastUpsertRequest",
},
"v2.ValidateBudget" => {
"body" => "BudgetValidationRequest",
},
Expand All @@ -2708,6 +2711,9 @@
"v2.GetBudget" => {
"budget_id" => "String",
},
"v2.DeleteCustomForecast" => {
"budget_id" => "String",
},
"v2.GetCommitmentsCommitmentList" => {
"provider" => "CommitmentsProvider",
"product" => "String",
Expand Down
48 changes: 48 additions & 0 deletions features/v2/cloud_cost_management.feature
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,30 @@ Feature: Cloud Cost Management
And the response "data.type" is equal to "arbitrary_rule"
And the response "data.attributes.rule_name" is equal to "example-arbitrary-cost-rule"

@generated @skip @team:DataDog/cloud-cost-management
Scenario: Create or replace a budget's custom forecast returns "Bad Request" response
Given operation "UpsertCustomForecast" enabled
And new "UpsertCustomForecast" request
And body with value {"data": {"attributes": {"budget_uid": "00000000-0000-0000-0000-000000000001", "entries": [{"amount": 400, "month": 202501, "tag_filters": [{"tag_key": "service", "tag_value": "ec2"}]}]}, "id": "", "type": "custom_forecast"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/cloud-cost-management
Scenario: Create or replace a budget's custom forecast returns "Not Found" response
Given operation "UpsertCustomForecast" enabled
And new "UpsertCustomForecast" request
And body with value {"data": {"attributes": {"budget_uid": "00000000-0000-0000-0000-000000000001", "entries": [{"amount": 400, "month": 202501, "tag_filters": [{"tag_key": "service", "tag_value": "ec2"}]}]}, "id": "", "type": "custom_forecast"}}
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/cloud-cost-management
Scenario: Create or replace a budget's custom forecast returns "OK" response
Given operation "UpsertCustomForecast" enabled
And new "UpsertCustomForecast" request
And body with value {"data": {"attributes": {"budget_uid": "00000000-0000-0000-0000-000000000001", "entries": [{"amount": 400, "month": 202501, "tag_filters": [{"tag_key": "service", "tag_value": "ec2"}]}]}, "id": "", "type": "custom_forecast"}}
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/cloud-cost-management
Scenario: Create or update a budget returns "Bad Request" response
Given new "UpsertBudget" request
Expand Down Expand Up @@ -211,6 +235,30 @@ Feature: Cloud Cost Management
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/cloud-cost-management
Scenario: Delete a budget's custom forecast returns "Bad Request" response
Given operation "DeleteCustomForecast" enabled
And new "DeleteCustomForecast" request
And request contains "budget_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/cloud-cost-management
Scenario: Delete a budget's custom forecast returns "No Content" response
Given operation "DeleteCustomForecast" enabled
And new "DeleteCustomForecast" request
And request contains "budget_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 204 No Content

@generated @skip @team:DataDog/cloud-cost-management
Scenario: Delete a budget's custom forecast returns "Not Found" response
Given operation "DeleteCustomForecast" enabled
And new "DeleteCustomForecast" request
And request contains "budget_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/cloud-cost-management
Scenario: Delete budget returns "No Content" response
Given new "DeleteBudget" request
Expand Down
Loading
Loading