diff --git a/.apigentools-info b/.apigentools-info index 41edd6955292..c8169bf7718d 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-04-29 18:57:42.214394", - "spec_repo_commit": "d1252b21" + "regenerated": "2025-04-30 13:01:42.239612", + "spec_repo_commit": "ca363d75" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-04-29 18:57:42.231162", - "spec_repo_commit": "d1252b21" + "regenerated": "2025-04-30 13:01:42.255302", + "spec_repo_commit": "ca363d75" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index dd3346b50b3a..d86f5ef23ca9 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -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 @@ -4720,6 +4727,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: @@ -36898,6 +37034,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: @@ -43463,6 +43611,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. diff --git a/cassettes/v2/Cloud-Cost-Management_4135329986/Delete-a-budget-returns-Bad-Request-response_2827839134/frozen.json b/cassettes/v2/Cloud-Cost-Management_4135329986/Delete-a-budget-returns-Bad-Request-response_2827839134/frozen.json new file mode 100644 index 000000000000..a390dde3cc6c --- /dev/null +++ b/cassettes/v2/Cloud-Cost-Management_4135329986/Delete-a-budget-returns-Bad-Request-response_2827839134/frozen.json @@ -0,0 +1 @@ +"2025-04-28T11:45:34.874Z" diff --git a/cassettes/v2/Cloud-Cost-Management_4135329986/Delete-a-budget-returns-Bad-Request-response_2827839134/recording.har b/cassettes/v2/Cloud-Cost-Management_4135329986/Delete-a-budget-returns-Bad-Request-response_2827839134/recording.har new file mode 100644 index 000000000000..eb8a10e5ef1b --- /dev/null +++ b/cassettes/v2/Cloud-Cost-Management_4135329986/Delete-a-budget-returns-Bad-Request-response_2827839134/recording.har @@ -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" + } +} diff --git a/cassettes/v2/Cloud-Cost-Management_4135329986/Get-a-budget-returns-Not-Found-response_2110812368/frozen.json b/cassettes/v2/Cloud-Cost-Management_4135329986/Get-a-budget-returns-Not-Found-response_2110812368/frozen.json new file mode 100644 index 000000000000..a2c2c10479b8 --- /dev/null +++ b/cassettes/v2/Cloud-Cost-Management_4135329986/Get-a-budget-returns-Not-Found-response_2110812368/frozen.json @@ -0,0 +1 @@ +"2025-04-28T11:45:35.263Z" diff --git a/cassettes/v2/Cloud-Cost-Management_4135329986/Get-a-budget-returns-Not-Found-response_2110812368/recording.har b/cassettes/v2/Cloud-Cost-Management_4135329986/Get-a-budget-returns-Not-Found-response_2110812368/recording.har new file mode 100644 index 000000000000..a646f544cc6a --- /dev/null +++ b/cassettes/v2/Cloud-Cost-Management_4135329986/Get-a-budget-returns-Not-Found-response_2110812368/recording.har @@ -0,0 +1,57 @@ +{ + "log": { + "_recordingName": "Cloud Cost Management/Get a budget returns \"Not Found\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "3ae9efe656040503bf3bc22cbaf6310f", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + } + ], + "headersSize": 538, + "httpVersion": "HTTP/1.1", + "method": "GET", + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/cost/budget/9d055d22-0a0a-0a0a-aaa0-00000000000a" + }, + "response": { + "bodySize": 49, + "content": { + "mimeType": "application/vnd.api+json", + "size": 49, + "text": "{\"errors\":[{\"status\":\"404\",\"title\":\"Not Found\"}]}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 524, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 404, + "statusText": "Not Found" + }, + "startedDateTime": "2025-04-28T11:45:35.265Z", + "time": 303 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/cassettes/v2/Cloud-Cost-Management_4135329986/List-budgets-returns-OK-response_710209345/frozen.json b/cassettes/v2/Cloud-Cost-Management_4135329986/List-budgets-returns-OK-response_710209345/frozen.json new file mode 100644 index 000000000000..32c8d22d2259 --- /dev/null +++ b/cassettes/v2/Cloud-Cost-Management_4135329986/List-budgets-returns-OK-response_710209345/frozen.json @@ -0,0 +1 @@ +"2025-04-28T11:45:35.577Z" diff --git a/cassettes/v2/Cloud-Cost-Management_4135329986/List-budgets-returns-OK-response_710209345/recording.har b/cassettes/v2/Cloud-Cost-Management_4135329986/List-budgets-returns-OK-response_710209345/recording.har new file mode 100644 index 000000000000..dabdf649f01a --- /dev/null +++ b/cassettes/v2/Cloud-Cost-Management_4135329986/List-budgets-returns-OK-response_710209345/recording.har @@ -0,0 +1,57 @@ +{ + "log": { + "_recordingName": "Cloud Cost Management/List budgets returns \"OK\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "0d6b0bed4406902cb1d539c0d55a50e9", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + } + ], + "headersSize": 504, + "httpVersion": "HTTP/1.1", + "method": "GET", + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/cost/budgets" + }, + "response": { + "bodySize": 7870, + "content": { + "mimeType": "application/vnd.api+json", + "size": 7870, + "text": "{\"data\":[{\"id\":\"3fba18e7-0067-491a-9308-3f73c8e2c575\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745571497036,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745571497036,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"57238082-4cc2-45a6-9064-22043737ed7c\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745583730189,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745583730189,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"f916baf2-02a4-4160-82b6-db389e4b43be\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745574561009,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745574561009,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"851ed069-23ab-441a-b8f3-8a5773403b3e\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745577123330,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745577123330,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"59073cc2-2478-421a-82a1-d79a5da28dda\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745577169183,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745577169183,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"5f349d8d-d387-4e15-afff-4782431e15d7\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745577608689,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745577608689,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"15ab22ba-5518-4e0c-9e06-a7f7bf2678bd\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745577943069,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745577943069,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"b18dc99d-1a12-469d-bd32-6bd98a6e5acb\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745577421488,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745577421488,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"8f569dc8-aea1-485d-a1c3-abc157c99a93\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745579211960,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745579211960,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"f3994f9b-dd15-43ea-a841-728d531eb11b\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745579361284,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745579361284,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"cb9fb4a9-c0df-4e4d-9835-3d210363d0bb\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745577992084,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745577992084,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"ff79e81b-1e6f-4a98-9500-91700fec0c2b\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745579291324,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745579291324,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"891f1139-fd93-499e-bad9-00409f61c565\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745586407929,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745586407929,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"85731223-6603-4639-9e01-b973f1ec9a24\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745579613007,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745579613007,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"affbf979-ed21-422f-a2eb-f8edcab237ff\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745579759927,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745579759927,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"651e9d4a-87aa-43c2-83ce-ec256e5cfea4\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745579644284,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745579644284,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"4abf19e6-9e97-4a76-bc33-3fc3a12c802c\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745580084222,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745580084222,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"fdf6d71d-30b3-4e5e-a644-2045be260b56\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745580326048,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745580326048,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"1c232ea0-94a4-442f-b618-5340a066f629\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745581289211,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745581289211,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},{\"id\":\"fc600e23-ebd1-454c-b863-d4be67481c65\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745580744852,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745580744852,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}]}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 532, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2025-04-28T11:45:35.579Z", + "time": 127 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/cassettes/v2/Cloud-Cost-Management_4135329986/Update-if-exists-or-create-a-new-budget-returns-Bad-Request-response_3373517382/frozen.json b/cassettes/v2/Cloud-Cost-Management_4135329986/Update-if-exists-or-create-a-new-budget-returns-Bad-Request-response_3373517382/frozen.json new file mode 100644 index 000000000000..842215108deb --- /dev/null +++ b/cassettes/v2/Cloud-Cost-Management_4135329986/Update-if-exists-or-create-a-new-budget-returns-Bad-Request-response_3373517382/frozen.json @@ -0,0 +1 @@ +"2025-04-28T11:19:55.670Z" diff --git a/cassettes/v2/Cloud-Cost-Management_4135329986/Update-if-exists-or-create-a-new-budget-returns-Bad-Request-response_3373517382/recording.har b/cassettes/v2/Cloud-Cost-Management_4135329986/Update-if-exists-or-create-a-new-budget-returns-Bad-Request-response_3373517382/recording.har new file mode 100644 index 000000000000..41a0eb97dfea --- /dev/null +++ b/cassettes/v2/Cloud-Cost-Management_4135329986/Update-if-exists-or-create-a-new-budget-returns-Bad-Request-response_3373517382/recording.har @@ -0,0 +1,67 @@ +{ + "log": { + "_recordingName": "Cloud Cost Management/Update if exists, or create a new budget returns \"Bad Request\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "35bacf9eb61f42cfc279172a4117e507", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 26, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 556, + "httpVersion": "HTTP/1.1", + "method": "PUT", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{}}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/cost/budget" + }, + "response": { + "bodySize": 103, + "content": { + "mimeType": "application/vnd.api+json", + "size": 103, + "text": "{\"errors\":[{\"status\":\"400\",\"title\":\"Bad Request\",\"detail\":\"got type \\\"\\\" expected one of \\\"budget\\\"\"}]}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 400, + "statusText": "Bad Request" + }, + "startedDateTime": "2025-04-28T11:19:55.673Z", + "time": 126 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/cassettes/v2/Cloud-Cost-Management_4135329986/Update-if-exists-or-create-a-new-budget-returns-Not-Found-response_3783055245/frozen.json b/cassettes/v2/Cloud-Cost-Management_4135329986/Update-if-exists-or-create-a-new-budget-returns-Not-Found-response_3783055245/frozen.json new file mode 100644 index 000000000000..103bfd86fd02 --- /dev/null +++ b/cassettes/v2/Cloud-Cost-Management_4135329986/Update-if-exists-or-create-a-new-budget-returns-Not-Found-response_3783055245/frozen.json @@ -0,0 +1 @@ +"2025-04-28T11:19:55.806Z" diff --git a/cassettes/v2/Cloud-Cost-Management_4135329986/Update-if-exists-or-create-a-new-budget-returns-Not-Found-response_3783055245/recording.har b/cassettes/v2/Cloud-Cost-Management_4135329986/Update-if-exists-or-create-a-new-budget-returns-Not-Found-response_3783055245/recording.har new file mode 100644 index 000000000000..bcbde88a7855 --- /dev/null +++ b/cassettes/v2/Cloud-Cost-Management_4135329986/Update-if-exists-or-create-a-new-budget-returns-Not-Found-response_3783055245/recording.har @@ -0,0 +1,67 @@ +{ + "log": { + "_recordingName": "Cloud Cost Management/Update if exists, or create a new budget returns \"Not Found\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "148ba35c0db118f899fbda67881a9eec", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 410, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 557, + "httpVersion": "HTTP/1.1", + "method": "PUT", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"end_month\":202502,\"entries\":[{\"amount\":500,\"month\":202501,\"tag_filters\":[{\"tag_key\":\"service\",\"tag_value\":\"ec2\"}]},{\"amount\":500,\"month\":202502,\"tag_filters\":[{\"tag_key\":\"service\",\"tag_value\":\"ec2\"}]}],\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"start_month\":202501,\"tags\":[\"service\"]},\"id\":\"00000000-0a0a-0a0a-aaa0-00000000000a\",\"type\":\"budget\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/cost/budget" + }, + "response": { + "bodySize": 91, + "content": { + "mimeType": "application/vnd.api+json", + "size": 91, + "text": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"failed to upsert budget: budget not found\"}]}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 524, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 404, + "statusText": "Not Found" + }, + "startedDateTime": "2025-04-28T11:19:55.808Z", + "time": 389 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/cassettes/v2/Cloud-Cost-Management_4135329986/Update-if-exists-or-create-a-new-budget-returns-OK-response_4086323788/frozen.json b/cassettes/v2/Cloud-Cost-Management_4135329986/Update-if-exists-or-create-a-new-budget-returns-OK-response_4086323788/frozen.json new file mode 100644 index 000000000000..a3c2a73ec9b7 --- /dev/null +++ b/cassettes/v2/Cloud-Cost-Management_4135329986/Update-if-exists-or-create-a-new-budget-returns-OK-response_4086323788/frozen.json @@ -0,0 +1 @@ +"2025-04-28T11:19:56.204Z" diff --git a/cassettes/v2/Cloud-Cost-Management_4135329986/Update-if-exists-or-create-a-new-budget-returns-OK-response_4086323788/recording.har b/cassettes/v2/Cloud-Cost-Management_4135329986/Update-if-exists-or-create-a-new-budget-returns-OK-response_4086323788/recording.har new file mode 100644 index 000000000000..9e48d090ad0f --- /dev/null +++ b/cassettes/v2/Cloud-Cost-Management_4135329986/Update-if-exists-or-create-a-new-budget-returns-OK-response_4086323788/recording.har @@ -0,0 +1,104 @@ +{ + "log": { + "_recordingName": "Cloud Cost Management/Update if exists, or create a new budget returns \"OK\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "4bd39306b23fcbbdcff43cccf8e49278", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 347, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 557, + "httpVersion": "HTTP/1.1", + "method": "PUT", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"end_month\":202502,\"entries\":[{\"amount\":500,\"month\":202501,\"tag_filters\":[{\"tag_key\":\"service\",\"tag_value\":\"ec2\"}]},{\"amount\":500,\"month\":202502,\"tag_filters\":[{\"tag_key\":\"service\",\"tag_value\":\"ec2\"}]}],\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"start_month\":202501},\"type\":\"budget\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/cost/budget" + }, + "response": { + "bodySize": 585, + "content": { + "mimeType": "application/vnd.api+json", + "size": 585, + "text": "{\"data\":{\"id\":\"041ec283-154d-4427-987b-113f806e73f0\",\"type\":\"budget\",\"attributes\":{\"created_at\":1745839196458,\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"end_month\":202502,\"entries\":[{\"month\":202501,\"amount\":500,\"tag_filters\":[{\"tag_key\":\"service\",\"tag_value\":\"ec2\"}]},{\"month\":202502,\"amount\":500,\"tag_filters\":[{\"tag_key\":\"service\",\"tag_value\":\"ec2\"}]}],\"metrics_query\":\"aws.cost.amortized{service:ec2} by {service}\",\"name\":\"my budget\",\"org_id\":321813,\"start_month\":202501,\"total_amount\":1000,\"updated_at\":1745839196458,\"updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 525, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2025-04-28T11:19:56.206Z", + "time": 327 + }, + { + "_id": "96f9312517df55cde8dee88b25d3ecfd", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "*/*" + } + ], + "headersSize": 531, + "httpVersion": "HTTP/1.1", + "method": "DELETE", + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/cost/budget/041ec283-154d-4427-987b-113f806e73f0" + }, + "response": { + "bodySize": 0, + "content": { + "mimeType": "text/plain", + "size": 0 + }, + "cookies": [], + "headers": [], + "headersSize": 464, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 204, + "statusText": "No Content" + }, + "startedDateTime": "2025-04-28T11:19:56.541Z", + "time": 329 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/examples/v2/cloud-cost-management/DeleteBudget.ts b/examples/v2/cloud-cost-management/DeleteBudget.ts new file mode 100644 index 000000000000..661bc5cf080e --- /dev/null +++ b/examples/v2/cloud-cost-management/DeleteBudget.ts @@ -0,0 +1,21 @@ +/** + * Delete a budget returns "No Content" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.CloudCostManagementApi(configuration); + +const params: v2.CloudCostManagementApiDeleteBudgetRequest = { + budgetId: "budget_id", +}; + +apiInstance + .deleteBudget(params) + .then((data: any) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/cloud-cost-management/GetBudget.ts b/examples/v2/cloud-cost-management/GetBudget.ts new file mode 100644 index 000000000000..0297bd8215ba --- /dev/null +++ b/examples/v2/cloud-cost-management/GetBudget.ts @@ -0,0 +1,21 @@ +/** + * Get a budget returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.CloudCostManagementApi(configuration); + +const params: v2.CloudCostManagementApiGetBudgetRequest = { + budgetId: "budget_id", +}; + +apiInstance + .getBudget(params) + .then((data: v2.BudgetWithEntries) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/cloud-cost-management/ListBudgets.ts b/examples/v2/cloud-cost-management/ListBudgets.ts new file mode 100644 index 000000000000..05801c38522d --- /dev/null +++ b/examples/v2/cloud-cost-management/ListBudgets.ts @@ -0,0 +1,17 @@ +/** + * List budgets returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.CloudCostManagementApi(configuration); + +apiInstance + .listBudgets() + .then((data: v2.BudgetArray) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/cloud-cost-management/UpsertBudget.ts b/examples/v2/cloud-cost-management/UpsertBudget.ts new file mode 100644 index 000000000000..8c87fb0eae1d --- /dev/null +++ b/examples/v2/cloud-cost-management/UpsertBudget.ts @@ -0,0 +1,49 @@ +/** + * Create or update a budget returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.CloudCostManagementApi(configuration); + +const params: v2.CloudCostManagementApiUpsertBudgetRequest = { + body: { + data: { + attributes: { + createdAt: 1738258683590, + createdBy: "00000000-0a0a-0a0a-aaa0-00000000000a", + endMonth: 202502, + entries: [ + { + amount: 500, + month: 202501, + tagFilters: [ + { + tagKey: "service", + tagValue: "ec2", + }, + ], + }, + ], + metricsQuery: "aws.cost.amortized{service:ec2} by {service}", + name: "my budget", + orgId: 123, + startMonth: 202501, + totalAmount: 1000, + updatedAt: 1738258683590, + updatedBy: "00000000-0a0a-0a0a-aaa0-00000000000a", + }, + id: "00000000-0a0a-0a0a-aaa0-00000000000a", + }, + }, +}; + +apiInstance + .upsertBudget(params) + .then((data: v2.BudgetWithEntries) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/features/support/scenarios_model_mapping.ts b/features/support/scenarios_model_mapping.ts index c5de17b90d45..b52dbd20db92 100644 --- a/features/support/scenarios_model_mapping.ts +++ b/features/support/scenarios_model_mapping.ts @@ -4015,6 +4015,30 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { }, "operationResponseType": "AzureUCConfigPairsResponse", }, + "v2.UpsertBudget": { + "body": { + "type": "BudgetWithEntries", + "format": "", + }, + "operationResponseType": "BudgetWithEntries", + }, + "v2.DeleteBudget": { + "budgetId": { + "type": "string", + "format": "", + }, + "operationResponseType": "void", + }, + "v2.GetBudget": { + "budgetId": { + "type": "string", + "format": "", + }, + "operationResponseType": "BudgetWithEntries", + }, + "v2.ListBudgets": { + "operationResponseType": "BudgetArray", + }, "v2.ListCustomCostsFiles": { "operationResponseType": "CustomCostsFileListResponse", }, diff --git a/features/v2/cloud_cost_management.feature b/features/v2/cloud_cost_management.feature index d6c84a584eb8..4c318851014b 100644 --- a/features/v2/cloud_cost_management.feature +++ b/features/v2/cloud_cost_management.feature @@ -43,6 +43,27 @@ Feature: Cloud Cost Management Then the response status is 200 OK And the response "data.attributes.configs[0].account_id" is equal to "1234abcd-1234-abcd-1234-1234abcd1234" + @generated @skip @team:Datadog/cloud-cost-management + Scenario: Create or update a budget returns "Bad Request" response + Given new "UpsertBudget" request + And body with value {"data": {"attributes": {"created_at": 1738258683590, "created_by": "00000000-0a0a-0a0a-aaa0-00000000000a", "end_month": 202502, "entries": [{"amount": 500, "month": 202501, "tag_filters": [{"tag_key": "service", "tag_value": "ec2"}]}], "metrics_query": "aws.cost.amortized{service:ec2} by {service}", "name": "my budget", "org_id": 123, "start_month": 202501, "total_amount": 1000, "updated_at": 1738258683590, "updated_by": "00000000-0a0a-0a0a-aaa0-00000000000a"}, "id": "00000000-0a0a-0a0a-aaa0-00000000000a"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:Datadog/cloud-cost-management + Scenario: Create or update a budget returns "Not Found" response + Given new "UpsertBudget" request + And body with value {"data": {"attributes": {"created_at": 1738258683590, "created_by": "00000000-0a0a-0a0a-aaa0-00000000000a", "end_month": 202502, "entries": [{"amount": 500, "month": 202501, "tag_filters": [{"tag_key": "service", "tag_value": "ec2"}]}], "metrics_query": "aws.cost.amortized{service:ec2} by {service}", "name": "my budget", "org_id": 123, "start_month": 202501, "total_amount": 1000, "updated_at": 1738258683590, "updated_by": "00000000-0a0a-0a0a-aaa0-00000000000a"}, "id": "00000000-0a0a-0a0a-aaa0-00000000000a"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:Datadog/cloud-cost-management + Scenario: Create or update a budget returns "OK" response + Given new "UpsertBudget" request + And body with value {"data": {"attributes": {"created_at": 1738258683590, "created_by": "00000000-0a0a-0a0a-aaa0-00000000000a", "end_month": 202502, "entries": [{"amount": 500, "month": 202501, "tag_filters": [{"tag_key": "service", "tag_value": "ec2"}]}], "metrics_query": "aws.cost.amortized{service:ec2} by {service}", "name": "my budget", "org_id": 123, "start_month": 202501, "total_amount": 1000, "updated_at": 1738258683590, "updated_by": "00000000-0a0a-0a0a-aaa0-00000000000a"}, "id": "00000000-0a0a-0a0a-aaa0-00000000000a"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:Datadog/cloud-cost-management Scenario: Delete Cloud Cost Management AWS CUR config returns "Bad Request" response Given new "DeleteCostAWSCURConfig" request @@ -99,6 +120,20 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 204 No Content + @team:Datadog/cloud-cost-management + Scenario: Delete a budget returns "Bad Request" response + Given new "DeleteBudget" request + And request contains "budget_id" parameter with value "1" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:Datadog/cloud-cost-management + Scenario: Delete a budget returns "No Content" response + Given new "DeleteBudget" request + And request contains "budget_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + @replay-only @team:Datadog/cloud-cost-management Scenario: Get Custom Costs File returns "OK" response Given new "GetCustomCostsFile" request @@ -115,6 +150,27 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 200 OK + @generated @skip @team:Datadog/cloud-cost-management + Scenario: Get a budget returns "Bad Request" response + Given new "GetBudget" request + And request contains "budget_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @team:Datadog/cloud-cost-management + Scenario: Get a budget returns "Not Found" response + Given new "GetBudget" request + And request contains "budget_id" parameter with value "9d055d22-0a0a-0a0a-aaa0-00000000000a" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:Datadog/cloud-cost-management + Scenario: Get a budget returns "OK" response + Given new "GetBudget" request + And request contains "budget_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @replay-only @team:Datadog/cloud-cost-management Scenario: List Cloud Cost Management AWS CUR configs returns "OK" response Given new "ListCostAWSCURConfigs" request @@ -142,6 +198,12 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 200 OK + @team:Datadog/cloud-cost-management + Scenario: List budgets returns "OK" response + Given new "ListBudgets" request + When the request is sent + Then the response status is 200 OK + @replay-only @team:Datadog/cloud-cost-management Scenario: Update Cloud Cost Management AWS CUR config returns "OK" response Given new "UpdateCostAWSCURConfig" request diff --git a/features/v2/undo.json b/features/v2/undo.json index 4aba315c34eb..c1daab38525e 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -608,6 +608,37 @@ "type": "idempotent" } }, + "UpsertBudget": { + "tag": "Cloud Cost Management", + "undo": { + "operationId": "DeleteBudget", + "parameters": [ + { + "name": "budget_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteBudget": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, + "GetBudget": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, + "ListBudgets": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, "ListCustomCostsFiles": { "tag": "Cloud Cost Management", "undo": { diff --git a/packages/datadog-api-client-v2/apis/CloudCostManagementApi.ts b/packages/datadog-api-client-v2/apis/CloudCostManagementApi.ts index d1adda4a4f21..b51eee62cffe 100644 --- a/packages/datadog-api-client-v2/apis/CloudCostManagementApi.ts +++ b/packages/datadog-api-client-v2/apis/CloudCostManagementApi.ts @@ -25,6 +25,8 @@ import { AzureUCConfigPairsResponse } from "../models/AzureUCConfigPairsResponse import { AzureUCConfigPatchRequest } from "../models/AzureUCConfigPatchRequest"; import { AzureUCConfigPostRequest } from "../models/AzureUCConfigPostRequest"; import { AzureUCConfigsResponse } from "../models/AzureUCConfigsResponse"; +import { BudgetArray } from "../models/BudgetArray"; +import { BudgetWithEntries } from "../models/BudgetWithEntries"; import { CustomCostsFileGetResponse } from "../models/CustomCostsFileGetResponse"; import { CustomCostsFileLineItem } from "../models/CustomCostsFileLineItem"; import { CustomCostsFileListResponse } from "../models/CustomCostsFileListResponse"; @@ -115,6 +117,40 @@ export class CloudCostManagementApiRequestFactory extends BaseAPIRequestFactory return requestContext; } + public async deleteBudget( + budgetId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'budgetId' is not null or undefined + if (budgetId === null || budgetId === undefined) { + throw new RequiredError("budgetId", "deleteBudget"); + } + + // Path Params + const localVarPath = "/api/v2/cost/budget/{budget_id}".replace( + "{budget_id}", + encodeURIComponent(String(budgetId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.CloudCostManagementApi.deleteBudget") + .makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "AuthZ", + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + public async deleteCostAWSCURConfig( cloudAccountId: string, _options?: Configuration @@ -219,6 +255,40 @@ export class CloudCostManagementApiRequestFactory extends BaseAPIRequestFactory return requestContext; } + public async getBudget( + budgetId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'budgetId' is not null or undefined + if (budgetId === null || budgetId === undefined) { + throw new RequiredError("budgetId", "getBudget"); + } + + // Path Params + const localVarPath = "/api/v2/cost/budget/{budget_id}".replace( + "{budget_id}", + encodeURIComponent(String(budgetId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.CloudCostManagementApi.getBudget") + .makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "AuthZ", + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + public async getCustomCostsFile( fileId: string, _options?: Configuration @@ -253,6 +323,29 @@ export class CloudCostManagementApiRequestFactory extends BaseAPIRequestFactory return requestContext; } + public async listBudgets(_options?: Configuration): Promise { + const _config = _options || this.configuration; + + // Path Params + const localVarPath = "/api/v2/cost/budgets"; + + // Make Request Context + const requestContext = _config + .getServer("v2.CloudCostManagementApi.listBudgets") + .makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "AuthZ", + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + public async listCostAWSCURConfigs( _options?: Configuration ): Promise { @@ -473,6 +566,48 @@ export class CloudCostManagementApiRequestFactory extends BaseAPIRequestFactory return requestContext; } + + public async upsertBudget( + body: BudgetWithEntries, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "upsertBudget"); + } + + // Path Params + const localVarPath = "/api/v2/cost/budget"; + + // Make Request Context + const requestContext = _config + .getServer("v2.CloudCostManagementApi.upsertBudget") + .makeRequestContext(localVarPath, HttpMethod.PUT); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(body, "BudgetWithEntries", ""), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "AuthZ", + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } } export class CloudCostManagementApiResponseProcessor { @@ -600,6 +735,58 @@ export class CloudCostManagementApiResponseProcessor { ); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteBudget + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteBudget(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 204) { + return; + } + if (response.httpStatusCode === 400 || response.httpStatusCode === 429) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: void = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "void", + "" + ) as void; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -768,6 +955,68 @@ export class CloudCostManagementApiResponseProcessor { ); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getBudget + * @throws ApiException if the response code was not in [200, 299] + */ + public async getBudget( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: BudgetWithEntries = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "BudgetWithEntries" + ) as BudgetWithEntries; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: BudgetWithEntries = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "BudgetWithEntries", + "" + ) as BudgetWithEntries; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -826,6 +1075,62 @@ export class CloudCostManagementApiResponseProcessor { ); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to listBudgets + * @throws ApiException if the response code was not in [200, 299] + */ + public async listBudgets(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: BudgetArray = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "BudgetArray" + ) as BudgetArray; + return body; + } + if (response.httpStatusCode === 429) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: BudgetArray = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "BudgetArray", + "" + ) as BudgetArray; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -1177,6 +1482,68 @@ export class CloudCostManagementApiResponseProcessor { 'Unknown API Status Code!\nBody: "' + body + '"' ); } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to upsertBudget + * @throws ApiException if the response code was not in [200, 299] + */ + public async upsertBudget( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: BudgetWithEntries = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "BudgetWithEntries" + ) as BudgetWithEntries; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: BudgetWithEntries = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "BudgetWithEntries", + "" + ) as BudgetWithEntries; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } } export interface CloudCostManagementApiCreateCostAWSCURConfigRequest { @@ -1193,6 +1560,14 @@ export interface CloudCostManagementApiCreateCostAzureUCConfigsRequest { body: AzureUCConfigPostRequest; } +export interface CloudCostManagementApiDeleteBudgetRequest { + /** + * Budget id. + * @type string + */ + budgetId: string; +} + export interface CloudCostManagementApiDeleteCostAWSCURConfigRequest { /** * Cloud Account id. @@ -1217,6 +1592,14 @@ export interface CloudCostManagementApiDeleteCustomCostsFileRequest { fileId: string; } +export interface CloudCostManagementApiGetBudgetRequest { + /** + * Budget id. + * @type string + */ + budgetId: string; +} + export interface CloudCostManagementApiGetCustomCostsFileRequest { /** * File ID. @@ -1256,6 +1639,13 @@ export interface CloudCostManagementApiUploadCustomCostsFileRequest { body: Array; } +export interface CloudCostManagementApiUpsertBudgetRequest { + /** + * @type BudgetWithEntries + */ + body: BudgetWithEntries; +} + export class CloudCostManagementApi { private requestFactory: CloudCostManagementApiRequestFactory; private responseProcessor: CloudCostManagementApiResponseProcessor; @@ -1317,6 +1707,27 @@ export class CloudCostManagementApi { }); } + /** + * Delete a budget. + * @param param The request object + */ + public deleteBudget( + param: CloudCostManagementApiDeleteBudgetRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.deleteBudget( + param.budgetId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.deleteBudget(responseContext); + }); + }); + } + /** * Archive a Cloud Cost Management Account. * @param param The request object @@ -1382,6 +1793,27 @@ export class CloudCostManagementApi { }); } + /** + * Get a budget. + * @param param The request object + */ + public getBudget( + param: CloudCostManagementApiGetBudgetRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.getBudget( + param.budgetId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.getBudget(responseContext); + }); + }); + } + /** * Fetch the specified Custom Costs file. * @param param The request object @@ -1403,6 +1835,21 @@ export class CloudCostManagementApi { }); } + /** + * List budgets. + * @param param The request object + */ + public listBudgets(options?: Configuration): Promise { + const requestContextPromise = this.requestFactory.listBudgets(options); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.listBudgets(responseContext); + }); + }); + } + /** * List the AWS CUR configs. * @param param The request object @@ -1523,4 +1970,25 @@ export class CloudCostManagementApi { }); }); } + + /** + * Create a new budget or update an existing one. + * @param param The request object + */ + public upsertBudget( + param: CloudCostManagementApiUpsertBudgetRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.upsertBudget( + param.body, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.upsertBudget(responseContext); + }); + }); + } } diff --git a/packages/datadog-api-client-v2/index.ts b/packages/datadog-api-client-v2/index.ts index 157d1456eaa1..eedff37ca28b 100644 --- a/packages/datadog-api-client-v2/index.ts +++ b/packages/datadog-api-client-v2/index.ts @@ -137,13 +137,16 @@ export { export { CloudCostManagementApiCreateCostAWSCURConfigRequest, CloudCostManagementApiCreateCostAzureUCConfigsRequest, + CloudCostManagementApiDeleteBudgetRequest, CloudCostManagementApiDeleteCostAWSCURConfigRequest, CloudCostManagementApiDeleteCostAzureUCConfigRequest, CloudCostManagementApiDeleteCustomCostsFileRequest, + CloudCostManagementApiGetBudgetRequest, CloudCostManagementApiGetCustomCostsFileRequest, CloudCostManagementApiUpdateCostAWSCURConfigRequest, CloudCostManagementApiUpdateCostAzureUCConfigsRequest, CloudCostManagementApiUploadCustomCostsFileRequest, + CloudCostManagementApiUpsertBudgetRequest, CloudCostManagementApi, } from "./apis/CloudCostManagementApi"; @@ -960,6 +963,12 @@ export { BillingDimensionsMappingBodyItemAttributes } from "./models/BillingDime export { BillingDimensionsMappingBodyItemAttributesEndpointsItems } from "./models/BillingDimensionsMappingBodyItemAttributesEndpointsItems"; export { BillingDimensionsMappingBodyItemAttributesEndpointsItemsStatus } from "./models/BillingDimensionsMappingBodyItemAttributesEndpointsItemsStatus"; export { BillingDimensionsMappingResponse } from "./models/BillingDimensionsMappingResponse"; +export { Budget } from "./models/Budget"; +export { BudgetArray } from "./models/BudgetArray"; +export { BudgetAttributes } from "./models/BudgetAttributes"; +export { BudgetEntry } from "./models/BudgetEntry"; +export { BudgetWithEntries } from "./models/BudgetWithEntries"; +export { BudgetWithEntriesData } from "./models/BudgetWithEntriesData"; export { BulkMuteFindingsRequest } from "./models/BulkMuteFindingsRequest"; export { BulkMuteFindingsRequestAttributes } from "./models/BulkMuteFindingsRequestAttributes"; export { BulkMuteFindingsRequestData } from "./models/BulkMuteFindingsRequestData"; @@ -2981,6 +2990,7 @@ export { StateVariableType } from "./models/StateVariableType"; export { Step } from "./models/Step"; export { StepDisplay } from "./models/StepDisplay"; export { StepDisplayBounds } from "./models/StepDisplayBounds"; +export { TagFilter } from "./models/TagFilter"; export { Team } from "./models/Team"; export { TeamAttributes } from "./models/TeamAttributes"; export { TeamCreate } from "./models/TeamCreate"; diff --git a/packages/datadog-api-client-v2/models/Budget.ts b/packages/datadog-api-client-v2/models/Budget.ts new file mode 100644 index 000000000000..3f71ef90aae4 --- /dev/null +++ b/packages/datadog-api-client-v2/models/Budget.ts @@ -0,0 +1,69 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { BudgetAttributes } from "./BudgetAttributes"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * A budget. + */ +export class Budget { + /** + * The attributes of a budget. + */ + "attributes"?: BudgetAttributes; + /** + * The id of the budget. + */ + "id"?: string; + /** + * The type of the object, must be `budget`. + */ + "type"?: string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "BudgetAttributes", + }, + id: { + baseName: "id", + type: "string", + }, + type: { + baseName: "type", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "any", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return Budget.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/BudgetArray.ts b/packages/datadog-api-client-v2/models/BudgetArray.ts new file mode 100644 index 000000000000..cad4a1f781a5 --- /dev/null +++ b/packages/datadog-api-client-v2/models/BudgetArray.ts @@ -0,0 +1,53 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { Budget } from "./Budget"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * An array of budgets. + */ +export class BudgetArray { + /** + * The `BudgetArray` `data`. + */ + "data"?: Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "any", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return BudgetArray.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/BudgetAttributes.ts b/packages/datadog-api-client-v2/models/BudgetAttributes.ts new file mode 100644 index 000000000000..8daf4bc674e5 --- /dev/null +++ b/packages/datadog-api-client-v2/models/BudgetAttributes.ts @@ -0,0 +1,139 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { BudgetEntry } from "./BudgetEntry"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The attributes of a budget. + */ +export class BudgetAttributes { + /** + * The timestamp when the budget was created. + */ + "createdAt"?: number; + /** + * The id of the user that created the budget. + */ + "createdBy"?: string; + /** + * The month when the budget ends. + */ + "endMonth"?: number; + /** + * The entries of the budget. + */ + "entries"?: Array; + /** + * The cost query used to track against the budget. + */ + "metricsQuery"?: string; + /** + * The name of the budget. + */ + "name"?: string; + /** + * The id of the org the budget belongs to. + */ + "orgId"?: number; + /** + * The month when the budget starts. + */ + "startMonth"?: number; + /** + * The sum of all budget entries' amounts. + */ + "totalAmount"?: number; + /** + * The timestamp when the budget was last updated. + */ + "updatedAt"?: number; + /** + * The id of the user that created the budget. + */ + "updatedBy"?: string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + createdAt: { + baseName: "created_at", + type: "number", + format: "int64", + }, + createdBy: { + baseName: "created_by", + type: "string", + }, + endMonth: { + baseName: "end_month", + type: "number", + format: "int64", + }, + entries: { + baseName: "entries", + type: "Array", + }, + metricsQuery: { + baseName: "metrics_query", + type: "string", + }, + name: { + baseName: "name", + type: "string", + }, + orgId: { + baseName: "org_id", + type: "number", + format: "int64", + }, + startMonth: { + baseName: "start_month", + type: "number", + format: "int64", + }, + totalAmount: { + baseName: "total_amount", + type: "number", + format: "double", + }, + updatedAt: { + baseName: "updated_at", + type: "number", + format: "int64", + }, + updatedBy: { + baseName: "updated_by", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "any", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return BudgetAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/BudgetEntry.ts b/packages/datadog-api-client-v2/models/BudgetEntry.ts new file mode 100644 index 000000000000..e7abd3559c1b --- /dev/null +++ b/packages/datadog-api-client-v2/models/BudgetEntry.ts @@ -0,0 +1,71 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { TagFilter } from "./TagFilter"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The entry of a budget. + */ +export class BudgetEntry { + /** + * The `amount` of the budget entry. + */ + "amount"?: number; + /** + * The `month` of the budget entry. + */ + "month"?: number; + /** + * The `tag_filters` of the budget entry. + */ + "tagFilters"?: Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + amount: { + baseName: "amount", + type: "number", + format: "double", + }, + month: { + baseName: "month", + type: "number", + format: "int64", + }, + tagFilters: { + baseName: "tag_filters", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "any", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return BudgetEntry.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/BudgetWithEntries.ts b/packages/datadog-api-client-v2/models/BudgetWithEntries.ts new file mode 100644 index 000000000000..03a27e7e4ec4 --- /dev/null +++ b/packages/datadog-api-client-v2/models/BudgetWithEntries.ts @@ -0,0 +1,53 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { BudgetWithEntriesData } from "./BudgetWithEntriesData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The definition of the `BudgetWithEntries` object. + */ +export class BudgetWithEntries { + /** + * A budget and all its entries. + */ + "data"?: BudgetWithEntriesData; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "BudgetWithEntriesData", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "any", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return BudgetWithEntries.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/BudgetWithEntriesData.ts b/packages/datadog-api-client-v2/models/BudgetWithEntriesData.ts new file mode 100644 index 000000000000..a91504e5ed45 --- /dev/null +++ b/packages/datadog-api-client-v2/models/BudgetWithEntriesData.ts @@ -0,0 +1,69 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { BudgetAttributes } from "./BudgetAttributes"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * A budget and all its entries. + */ +export class BudgetWithEntriesData { + /** + * The attributes of a budget. + */ + "attributes"?: BudgetAttributes; + /** + * The `BudgetWithEntriesData` `id`. + */ + "id"?: string; + /** + * The type of the object, must be `budget`. + */ + "type"?: string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "BudgetAttributes", + }, + id: { + baseName: "id", + type: "string", + }, + type: { + baseName: "type", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "any", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return BudgetWithEntriesData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/ObjectSerializer.ts b/packages/datadog-api-client-v2/models/ObjectSerializer.ts index c00a0a3a4bee..08858f82e4e9 100644 --- a/packages/datadog-api-client-v2/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v2/models/ObjectSerializer.ts @@ -187,6 +187,12 @@ import { BillingDimensionsMappingBodyItem } from "./BillingDimensionsMappingBody import { BillingDimensionsMappingBodyItemAttributes } from "./BillingDimensionsMappingBodyItemAttributes"; import { BillingDimensionsMappingBodyItemAttributesEndpointsItems } from "./BillingDimensionsMappingBodyItemAttributesEndpointsItems"; import { BillingDimensionsMappingResponse } from "./BillingDimensionsMappingResponse"; +import { Budget } from "./Budget"; +import { BudgetArray } from "./BudgetArray"; +import { BudgetAttributes } from "./BudgetAttributes"; +import { BudgetEntry } from "./BudgetEntry"; +import { BudgetWithEntries } from "./BudgetWithEntries"; +import { BudgetWithEntriesData } from "./BudgetWithEntriesData"; import { BulkMuteFindingsRequest } from "./BulkMuteFindingsRequest"; import { BulkMuteFindingsRequestAttributes } from "./BulkMuteFindingsRequestAttributes"; import { BulkMuteFindingsRequestData } from "./BulkMuteFindingsRequestData"; @@ -1706,6 +1712,7 @@ import { StateVariableProperties } from "./StateVariableProperties"; import { Step } from "./Step"; import { StepDisplay } from "./StepDisplay"; import { StepDisplayBounds } from "./StepDisplayBounds"; +import { TagFilter } from "./TagFilter"; import { Team } from "./Team"; import { TeamAttributes } from "./TeamAttributes"; import { TeamCreate } from "./TeamCreate"; @@ -3342,6 +3349,12 @@ const typeMap: { [index: string]: any } = { BillingDimensionsMappingBodyItemAttributesEndpointsItems: BillingDimensionsMappingBodyItemAttributesEndpointsItems, BillingDimensionsMappingResponse: BillingDimensionsMappingResponse, + Budget: Budget, + BudgetArray: BudgetArray, + BudgetAttributes: BudgetAttributes, + BudgetEntry: BudgetEntry, + BudgetWithEntries: BudgetWithEntries, + BudgetWithEntriesData: BudgetWithEntriesData, BulkMuteFindingsRequest: BulkMuteFindingsRequest, BulkMuteFindingsRequestAttributes: BulkMuteFindingsRequestAttributes, BulkMuteFindingsRequestData: BulkMuteFindingsRequestData, @@ -5134,6 +5147,7 @@ const typeMap: { [index: string]: any } = { Step: Step, StepDisplay: StepDisplay, StepDisplayBounds: StepDisplayBounds, + TagFilter: TagFilter, Team: Team, TeamAttributes: TeamAttributes, TeamCreate: TeamCreate, diff --git a/packages/datadog-api-client-v2/models/TagFilter.ts b/packages/datadog-api-client-v2/models/TagFilter.ts new file mode 100644 index 000000000000..dd9af59dc0bc --- /dev/null +++ b/packages/datadog-api-client-v2/models/TagFilter.ts @@ -0,0 +1,60 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Tag filter for the budget's entries. + */ +export class TagFilter { + /** + * The key of the tag. + */ + "tagKey"?: string; + /** + * The value of the tag. + */ + "tagValue"?: string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + tagKey: { + baseName: "tag_key", + type: "string", + }, + tagValue: { + baseName: "tag_value", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "any", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return TagFilter.attributeTypeMap; + } + + public constructor() {} +}