Skip to content

Add budgeting endpoints #2163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-04-28 14:00:44.336287",
"spec_repo_commit": "8964dc24"
"regenerated": "2025-04-28 16:43:07.901172",
"spec_repo_commit": "d92beeeb"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-04-28 14:00:44.352223",
"spec_repo_commit": "8964dc24"
"regenerated": "2025-04-28 16:43:07.916963",
"spec_repo_commit": "d92beeeb"
}
}
}
247 changes: 247 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@ components:
required: true
schema:
type: string
BudgetID:
description: Budget id.
in: path
name: budget_id
required: true
schema:
type: string
CaseIDPathParameter:
description: Case's UUID or key
example: f98a5a5b-e0ff-45d4-b2f5-afe6e74de504
Expand Down Expand Up @@ -4664,6 +4671,135 @@ components:
data:
$ref: '#/components/schemas/BillingDimensionsMappingBody'
type: object
Budget:
description: A budget.
properties:
attributes:
$ref: '#/components/schemas/BudgetAttributes'
id:
description: The id of the budget.
type: string
type:
description: The type of the object, must be `budget`.
type: string
type: object
BudgetArray:
description: An array of budgets.
example:
data:
- attributes:
created_at: 1741011342772
created_by: user1
end_month: 202502
metrics_query: aws.cost.amortized{service:ec2} by {service}
name: my budget
org_id: 123
start_month: 202501
total_amount: 1000
updated_at: 1741011342772
updated_by: user2
id: 00000000-0a0a-0a0a-aaa0-00000000000a
type: budget
properties:
data:
description: The `BudgetArray` `data`.
items:
$ref: '#/components/schemas/Budget'
type: array
type: object
BudgetAttributes:
description: The attributes of a budget.
properties:
created_at:
description: The timestamp when the budget was created.
example: 1738258683590
format: int64
type: integer
created_by:
description: The id of the user that created the budget.
example: 00000000-0a0a-0a0a-aaa0-00000000000a
type: string
end_month:
description: The month when the budget ends.
example: 202502
format: int64
type: integer
entries:
description: The entries of the budget.
items:
$ref: '#/components/schemas/BudgetEntry'
type: array
metrics_query:
description: The cost query used to track against the budget.
example: aws.cost.amortized{service:ec2} by {service}
type: string
name:
description: The name of the budget.
example: my budget
type: string
org_id:
description: The id of the org the budget belongs to.
example: 123
format: int64
type: integer
start_month:
description: The month when the budget starts.
example: 202501
format: int64
type: integer
total_amount:
description: The sum of all budget entries' amounts.
example: 1000
format: double
type: number
updated_at:
description: The timestamp when the budget was last updated.
example: 1738258683590
format: int64
type: integer
updated_by:
description: The id of the user that created the budget.
example: 00000000-0a0a-0a0a-aaa0-00000000000a
type: string
type: object
BudgetEntry:
description: The entry of a budget.
properties:
amount:
description: The `amount` of the budget entry.
example: 500
format: double
type: number
month:
description: The `month` of the budget entry.
example: 202501
format: int64
type: integer
tag_filters:
description: The `tag_filters` of the budget entry.
items:
$ref: '#/components/schemas/TagFilter'
type: array
type: object
BudgetWithEntries:
description: The definition of the `BudgetWithEntries` object.
properties:
data:
$ref: '#/components/schemas/BudgetWithEntriesData'
type: object
BudgetWithEntriesData:
description: A budget and all its entries.
properties:
attributes:
$ref: '#/components/schemas/BudgetAttributes'
id:
description: The `BudgetWithEntriesData` `id`.
example: 00000000-0a0a-0a0a-aaa0-00000000000a
type: string
type:
description: The type of the object, must be `budget`.
type: string
type: object
BulkMuteFindingsRequest:
description: The new bulk mute finding request.
properties:
Expand Down Expand Up @@ -34059,6 +34195,18 @@ components:
format: double
type: number
type: object
TagFilter:
description: Tag filter for the budget's entries.
properties:
tag_key:
description: The key of the tag.
example: service
type: string
tag_value:
description: The value of the tag.
example: ec2
type: string
type: object
TagsEventAttribute:
description: Array of tags associated with your event.
example:
Expand Down Expand Up @@ -40412,6 +40560,105 @@ paths:
operator: OR
permissions:
- cloud_cost_management_write
/api/v2/cost/budget:
put:
description: Create a new budget or update an existing one.
operationId: UpsertBudget
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/BudgetWithEntries'
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/BudgetWithEntries'
description: OK
'400':
$ref: '#/components/responses/BadRequestResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- cloud_cost_management_write
summary: Create or update a budget
tags:
- Cloud Cost Management
/api/v2/cost/budget/{budget_id}:
delete:
description: Delete a budget.
operationId: DeleteBudget
parameters:
- $ref: '#/components/parameters/BudgetID'
responses:
'204':
description: No Content
'400':
$ref: '#/components/responses/BadRequestResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- cloud_cost_management_write
summary: Delete a budget
tags:
- Cloud Cost Management
get:
description: Get a budget.
operationId: GetBudget
parameters:
- $ref: '#/components/parameters/BudgetID'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/BudgetWithEntries'
description: OK
'400':
$ref: '#/components/responses/BadRequestResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- cloud_cost_management_read
summary: Get a budget
tags:
- Cloud Cost Management
/api/v2/cost/budgets:
get:
description: List budgets.
operationId: ListBudgets
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/BudgetArray'
description: OK
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- cloud_cost_management_read
summary: List budgets
tags:
- Cloud Cost Management
/api/v2/cost/custom_costs:
get:
description: List the Custom Costs files.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"2025-04-28T11:45:34.874Z"
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"log": {
"_recordingName": "Cloud Cost Management/Delete a budget returns \"Bad Request\" response",
"creator": {
"comment": "persister:fs",
"name": "Polly.JS",
"version": "6.0.5"
},
"entries": [
{
"_id": "f761ae0f2dfa651270812812b935bfb2",
"_order": 0,
"cache": {},
"request": {
"bodySize": 0,
"cookies": [],
"headers": [
{
"_fromType": "array",
"name": "accept",
"value": "*/*"
}
],
"headersSize": 496,
"httpVersion": "HTTP/1.1",
"method": "DELETE",
"queryString": [],
"url": "https://api.datadoghq.com/api/v2/cost/budget/1"
},
"response": {
"bodySize": 79,
"content": {
"mimeType": "application/vnd.api+json",
"size": 79,
"text": "{\"errors\":[{\"status\":\"400\",\"title\":\"Bad Request\",\"detail\":\"invalid budgetId\"}]}"
},
"cookies": [],
"headers": [
{
"name": "content-type",
"value": "application/vnd.api+json"
}
],
"headersSize": 524,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 400,
"statusText": "Bad Request"
},
"startedDateTime": "2025-04-28T11:45:34.878Z",
"time": 377
}
],
"pages": [],
"version": "1.2"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"2025-04-28T11:45:35.263Z"
Loading