From 125af2b4a2e46979022ee5f318acfb013449a6e6 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 30 Apr 2025 13:03:29 +0000 Subject: [PATCH] Regenerate client from commit ca363d75 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 247 +++++++++ .../cloud-cost-management/DeleteBudget.java | 22 + .../v2/cloud-cost-management/GetBudget.java | 24 + .../v2/cloud-cost-management/ListBudgets.java | 24 + .../cloud-cost-management/UpsertBudget.java | 57 ++ .../client/v2/api/CloudCostManagementApi.java | 505 ++++++++++++++++++ .../datadog/api/client/v2/model/Budget.java | 192 +++++++ .../api/client/v2/model/BudgetArray.java | 149 ++++++ .../api/client/v2/model/BudgetAttributes.java | 433 +++++++++++++++ .../api/client/v2/model/BudgetEntry.java | 205 +++++++ .../client/v2/model/BudgetWithEntries.java | 136 +++++ .../v2/model/BudgetWithEntriesData.java | 192 +++++++ .../api/client/v2/model/TagFilter.java | 161 ++++++ ...budget_returns_Bad_Request_response.freeze | 1 + ...a_budget_returns_Bad_Request_response.json | 28 + ...a_budget_returns_Not_Found_response.freeze | 1 + ...t_a_budget_returns_Not_Found_response.json | 28 + .../List_budgets_returns_OK_response.freeze | 1 + .../v2/List_budgets_returns_OK_response.json | 28 + ...budget_returns_Bad_Request_response.freeze | 1 + ...w_budget_returns_Bad_Request_response.json | 32 ++ ...w_budget_returns_Not_Found_response.freeze | 1 + ...new_budget_returns_Not_Found_response.json | 32 ++ ...te_a_new_budget_returns_OK_response.freeze | 1 + ...eate_a_new_budget_returns_OK_response.json | 53 ++ .../v2/api/cloud_cost_management.feature | 62 +++ .../com/datadog/api/client/v2/api/undo.json | 31 ++ 28 files changed, 2651 insertions(+), 4 deletions(-) create mode 100644 examples/v2/cloud-cost-management/DeleteBudget.java create mode 100644 examples/v2/cloud-cost-management/GetBudget.java create mode 100644 examples/v2/cloud-cost-management/ListBudgets.java create mode 100644 examples/v2/cloud-cost-management/UpsertBudget.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/Budget.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/BudgetArray.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/BudgetAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/BudgetEntry.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/BudgetWithEntries.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/BudgetWithEntriesData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TagFilter.java create mode 100644 src/test/resources/cassettes/features/v2/Delete_a_budget_returns_Bad_Request_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Delete_a_budget_returns_Bad_Request_response.json create mode 100644 src/test/resources/cassettes/features/v2/Get_a_budget_returns_Not_Found_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Get_a_budget_returns_Not_Found_response.json create mode 100644 src/test/resources/cassettes/features/v2/List_budgets_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/List_budgets_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_Bad_Request_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_Bad_Request_response.json create mode 100644 src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_Not_Found_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_Not_Found_response.json create mode 100644 src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_OK_response.json diff --git a/.apigentools-info b/.apigentools-info index b77514e1155..031e1a6bf14 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:45.399045", - "spec_repo_commit": "d1252b21" + "regenerated": "2025-04-30 13:01:33.893107", + "spec_repo_commit": "ca363d75" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-04-29 18:57:45.414992", - "spec_repo_commit": "d1252b21" + "regenerated": "2025-04-30 13:01:33.909646", + "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 dd3346b50b3..d86f5ef23ca 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/examples/v2/cloud-cost-management/DeleteBudget.java b/examples/v2/cloud-cost-management/DeleteBudget.java new file mode 100644 index 00000000000..83b92696b74 --- /dev/null +++ b/examples/v2/cloud-cost-management/DeleteBudget.java @@ -0,0 +1,22 @@ +// Delete a budget returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CloudCostManagementApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient); + + try { + apiInstance.deleteBudget("budget_id"); + } catch (ApiException e) { + System.err.println("Exception when calling CloudCostManagementApi#deleteBudget"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/cloud-cost-management/GetBudget.java b/examples/v2/cloud-cost-management/GetBudget.java new file mode 100644 index 00000000000..7a90e99f98e --- /dev/null +++ b/examples/v2/cloud-cost-management/GetBudget.java @@ -0,0 +1,24 @@ +// Get a budget returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CloudCostManagementApi; +import com.datadog.api.client.v2.model.BudgetWithEntries; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient); + + try { + BudgetWithEntries result = apiInstance.getBudget("budget_id"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CloudCostManagementApi#getBudget"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/cloud-cost-management/ListBudgets.java b/examples/v2/cloud-cost-management/ListBudgets.java new file mode 100644 index 00000000000..8cc13f20fac --- /dev/null +++ b/examples/v2/cloud-cost-management/ListBudgets.java @@ -0,0 +1,24 @@ +// List budgets returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CloudCostManagementApi; +import com.datadog.api.client.v2.model.BudgetArray; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient); + + try { + BudgetArray result = apiInstance.listBudgets(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CloudCostManagementApi#listBudgets"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/cloud-cost-management/UpsertBudget.java b/examples/v2/cloud-cost-management/UpsertBudget.java new file mode 100644 index 00000000000..ef6db0fbd4c --- /dev/null +++ b/examples/v2/cloud-cost-management/UpsertBudget.java @@ -0,0 +1,57 @@ +// Create or update a budget returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CloudCostManagementApi; +import com.datadog.api.client.v2.model.BudgetAttributes; +import com.datadog.api.client.v2.model.BudgetEntry; +import com.datadog.api.client.v2.model.BudgetWithEntries; +import com.datadog.api.client.v2.model.BudgetWithEntriesData; +import com.datadog.api.client.v2.model.TagFilter; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient); + + BudgetWithEntries body = + new BudgetWithEntries() + .data( + new BudgetWithEntriesData() + .attributes( + new BudgetAttributes() + .createdAt(1738258683590L) + .createdBy("00000000-0a0a-0a0a-aaa0-00000000000a") + .endMonth(202502L) + .entries( + Collections.singletonList( + new BudgetEntry() + .amount(500.0) + .month(202501L) + .tagFilters( + Collections.singletonList( + new TagFilter() + .tagKey("service") + .tagValue("ec2"))))) + .metricsQuery("aws.cost.amortized{service:ec2} by {service}") + .name("my budget") + .orgId(123L) + .startMonth(202501L) + .totalAmount(1000.0) + .updatedAt(1738258683590L) + .updatedBy("00000000-0a0a-0a0a-aaa0-00000000000a")) + .id("00000000-0a0a-0a0a-aaa0-00000000000a")); + + try { + BudgetWithEntries result = apiInstance.upsertBudget(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CloudCostManagementApi#upsertBudget"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/api/CloudCostManagementApi.java b/src/main/java/com/datadog/api/client/v2/api/CloudCostManagementApi.java index e4bf733f56c..9c638813dab 100644 --- a/src/main/java/com/datadog/api/client/v2/api/CloudCostManagementApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/CloudCostManagementApi.java @@ -12,6 +12,8 @@ import com.datadog.api.client.v2.model.AzureUCConfigPatchRequest; import com.datadog.api.client.v2.model.AzureUCConfigPostRequest; import com.datadog.api.client.v2.model.AzureUCConfigsResponse; +import com.datadog.api.client.v2.model.BudgetArray; +import com.datadog.api.client.v2.model.BudgetWithEntries; import com.datadog.api.client.v2.model.CustomCostsFileGetResponse; import com.datadog.api.client.v2.model.CustomCostsFileLineItem; import com.datadog.api.client.v2.model.CustomCostsFileListResponse; @@ -321,6 +323,137 @@ public ApiResponse createCostAzureUCConfigsWithHttpI new GenericType() {}); } + /** + * Delete a budget. + * + *

See {@link #deleteBudgetWithHttpInfo}. + * + * @param budgetId Budget id. (required) + * @throws ApiException if fails to make API call + */ + public void deleteBudget(String budgetId) throws ApiException { + deleteBudgetWithHttpInfo(budgetId); + } + + /** + * Delete a budget. + * + *

See {@link #deleteBudgetWithHttpInfoAsync}. + * + * @param budgetId Budget id. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteBudgetAsync(String budgetId) { + return deleteBudgetWithHttpInfoAsync(budgetId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete a budget. + * + * @param budgetId Budget id. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
429 Too many requests -
+ */ + public ApiResponse deleteBudgetWithHttpInfo(String budgetId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'budgetId' is set + if (budgetId == null) { + throw new ApiException( + 400, "Missing the required parameter 'budgetId' when calling deleteBudget"); + } + // create path and map variables + String localVarPath = + "/api/v2/cost/budget/{budget_id}" + .replaceAll("\\{" + "budget_id" + "\\}", apiClient.escapeString(budgetId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.deleteBudget", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete a budget. + * + *

See {@link #deleteBudgetWithHttpInfo}. + * + * @param budgetId Budget id. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteBudgetWithHttpInfoAsync(String budgetId) { + Object localVarPostBody = null; + + // verify the required parameter 'budgetId' is set + if (budgetId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'budgetId' when calling deleteBudget")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/cost/budget/{budget_id}" + .replaceAll("\\{" + "budget_id" + "\\}", apiClient.escapeString(budgetId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.deleteBudget", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + /** * Delete Cloud Cost Management AWS CUR config. * @@ -735,6 +868,140 @@ public CompletableFuture> deleteCustomCostsFileWithHttpInfoAsy null); } + /** + * Get a budget. + * + *

See {@link #getBudgetWithHttpInfo}. + * + * @param budgetId Budget id. (required) + * @return BudgetWithEntries + * @throws ApiException if fails to make API call + */ + public BudgetWithEntries getBudget(String budgetId) throws ApiException { + return getBudgetWithHttpInfo(budgetId).getData(); + } + + /** + * Get a budget. + * + *

See {@link #getBudgetWithHttpInfoAsync}. + * + * @param budgetId Budget id. (required) + * @return CompletableFuture<BudgetWithEntries> + */ + public CompletableFuture getBudgetAsync(String budgetId) { + return getBudgetWithHttpInfoAsync(budgetId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a budget. + * + * @param budgetId Budget id. (required) + * @return ApiResponse<BudgetWithEntries> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getBudgetWithHttpInfo(String budgetId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'budgetId' is set + if (budgetId == null) { + throw new ApiException( + 400, "Missing the required parameter 'budgetId' when calling getBudget"); + } + // create path and map variables + String localVarPath = + "/api/v2/cost/budget/{budget_id}" + .replaceAll("\\{" + "budget_id" + "\\}", apiClient.escapeString(budgetId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.getBudget", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a budget. + * + *

See {@link #getBudgetWithHttpInfo}. + * + * @param budgetId Budget id. (required) + * @return CompletableFuture<ApiResponse<BudgetWithEntries>> + */ + public CompletableFuture> getBudgetWithHttpInfoAsync( + String budgetId) { + Object localVarPostBody = null; + + // verify the required parameter 'budgetId' is set + if (budgetId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'budgetId' when calling getBudget")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/cost/budget/{budget_id}" + .replaceAll("\\{" + "budget_id" + "\\}", apiClient.escapeString(budgetId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.getBudget", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Get Custom Costs file. * @@ -869,6 +1136,114 @@ public ApiResponse getCustomCostsFileWithHttpInfo(St new GenericType() {}); } + /** + * List budgets. + * + *

See {@link #listBudgetsWithHttpInfo}. + * + * @return BudgetArray + * @throws ApiException if fails to make API call + */ + public BudgetArray listBudgets() throws ApiException { + return listBudgetsWithHttpInfo().getData(); + } + + /** + * List budgets. + * + *

See {@link #listBudgetsWithHttpInfoAsync}. + * + * @return CompletableFuture<BudgetArray> + */ + public CompletableFuture listBudgetsAsync() { + return listBudgetsWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List budgets. + * + * @return ApiResponse<BudgetArray> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
429 Too many requests -
+ */ + public ApiResponse listBudgetsWithHttpInfo() throws ApiException { + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/cost/budgets"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.listBudgets", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List budgets. + * + *

See {@link #listBudgetsWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<BudgetArray>> + */ + public CompletableFuture> listBudgetsWithHttpInfoAsync() { + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/cost/budgets"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.listBudgets", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * List Cloud Cost Management AWS CUR configs. * @@ -1664,4 +2039,134 @@ public ApiResponse uploadCustomCostsFileWithHttpI false, new GenericType() {}); } + + /** + * Create or update a budget. + * + *

See {@link #upsertBudgetWithHttpInfo}. + * + * @param body (required) + * @return BudgetWithEntries + * @throws ApiException if fails to make API call + */ + public BudgetWithEntries upsertBudget(BudgetWithEntries body) throws ApiException { + return upsertBudgetWithHttpInfo(body).getData(); + } + + /** + * Create or update a budget. + * + *

See {@link #upsertBudgetWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<BudgetWithEntries> + */ + public CompletableFuture upsertBudgetAsync(BudgetWithEntries body) { + return upsertBudgetWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a new budget or update an existing one. + * + * @param body (required) + * @return ApiResponse<BudgetWithEntries> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse upsertBudgetWithHttpInfo(BudgetWithEntries body) + throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling upsertBudget"); + } + // create path and map variables + String localVarPath = "/api/v2/cost/budget"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.upsertBudget", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create or update a budget. + * + *

See {@link #upsertBudgetWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<BudgetWithEntries>> + */ + public CompletableFuture> upsertBudgetWithHttpInfoAsync( + BudgetWithEntries body) { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(400, "Missing the required parameter 'body' when calling upsertBudget")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/cost/budget"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CloudCostManagementApi.upsertBudget", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/Budget.java b/src/main/java/com/datadog/api/client/v2/model/Budget.java new file mode 100644 index 00000000000..ebc50e41a7d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/Budget.java @@ -0,0 +1,192 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A budget. */ +@JsonPropertyOrder({ + Budget.JSON_PROPERTY_ATTRIBUTES, + Budget.JSON_PROPERTY_ID, + Budget.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class Budget { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private BudgetAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public Budget attributes(BudgetAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of a budget. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public BudgetAttributes getAttributes() { + return attributes; + } + + public void setAttributes(BudgetAttributes attributes) { + this.attributes = attributes; + } + + public Budget id(String id) { + this.id = id; + return this; + } + + /** + * The id of the budget. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Budget type(String type) { + this.type = type; + return this; + } + + /** + * The type of the object, must be budget. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return Budget + */ + @JsonAnySetter + public Budget putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this Budget object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Budget budget = (Budget) o; + return Objects.equals(this.attributes, budget.attributes) + && Objects.equals(this.id, budget.id) + && Objects.equals(this.type, budget.type) + && Objects.equals(this.additionalProperties, budget.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Budget {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/BudgetArray.java b/src/main/java/com/datadog/api/client/v2/model/BudgetArray.java new file mode 100644 index 00000000000..f9f6cae7b7e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/BudgetArray.java @@ -0,0 +1,149 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** An array of budgets. */ +@JsonPropertyOrder({BudgetArray.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class BudgetArray { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = null; + + public BudgetArray data(List data) { + this.data = data; + for (Budget item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public BudgetArray addDataItem(Budget dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * The BudgetArray data. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return BudgetArray + */ + @JsonAnySetter + public BudgetArray putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this BudgetArray object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BudgetArray budgetArray = (BudgetArray) o; + return Objects.equals(this.data, budgetArray.data) + && Objects.equals(this.additionalProperties, budgetArray.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BudgetArray {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/BudgetAttributes.java b/src/main/java/com/datadog/api/client/v2/model/BudgetAttributes.java new file mode 100644 index 00000000000..8ac06a191f7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/BudgetAttributes.java @@ -0,0 +1,433 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The attributes of a budget. */ +@JsonPropertyOrder({ + BudgetAttributes.JSON_PROPERTY_CREATED_AT, + BudgetAttributes.JSON_PROPERTY_CREATED_BY, + BudgetAttributes.JSON_PROPERTY_END_MONTH, + BudgetAttributes.JSON_PROPERTY_ENTRIES, + BudgetAttributes.JSON_PROPERTY_METRICS_QUERY, + BudgetAttributes.JSON_PROPERTY_NAME, + BudgetAttributes.JSON_PROPERTY_ORG_ID, + BudgetAttributes.JSON_PROPERTY_START_MONTH, + BudgetAttributes.JSON_PROPERTY_TOTAL_AMOUNT, + BudgetAttributes.JSON_PROPERTY_UPDATED_AT, + BudgetAttributes.JSON_PROPERTY_UPDATED_BY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class BudgetAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private Long createdAt; + + public static final String JSON_PROPERTY_CREATED_BY = "created_by"; + private String createdBy; + + public static final String JSON_PROPERTY_END_MONTH = "end_month"; + private Long endMonth; + + public static final String JSON_PROPERTY_ENTRIES = "entries"; + private List entries = null; + + public static final String JSON_PROPERTY_METRICS_QUERY = "metrics_query"; + private String metricsQuery; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_ORG_ID = "org_id"; + private Long orgId; + + public static final String JSON_PROPERTY_START_MONTH = "start_month"; + private Long startMonth; + + public static final String JSON_PROPERTY_TOTAL_AMOUNT = "total_amount"; + private Double totalAmount; + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private Long updatedAt; + + public static final String JSON_PROPERTY_UPDATED_BY = "updated_by"; + private String updatedBy; + + public BudgetAttributes createdAt(Long createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The timestamp when the budget was created. + * + * @return createdAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Long createdAt) { + this.createdAt = createdAt; + } + + public BudgetAttributes createdBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * The id of the user that created the budget. + * + * @return createdBy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public BudgetAttributes endMonth(Long endMonth) { + this.endMonth = endMonth; + return this; + } + + /** + * The month when the budget ends. + * + * @return endMonth + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_END_MONTH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getEndMonth() { + return endMonth; + } + + public void setEndMonth(Long endMonth) { + this.endMonth = endMonth; + } + + public BudgetAttributes entries(List entries) { + this.entries = entries; + for (BudgetEntry item : entries) { + this.unparsed |= item.unparsed; + } + return this; + } + + public BudgetAttributes addEntriesItem(BudgetEntry entriesItem) { + if (this.entries == null) { + this.entries = new ArrayList<>(); + } + this.entries.add(entriesItem); + this.unparsed |= entriesItem.unparsed; + return this; + } + + /** + * The entries of the budget. + * + * @return entries + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENTRIES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getEntries() { + return entries; + } + + public void setEntries(List entries) { + this.entries = entries; + } + + public BudgetAttributes metricsQuery(String metricsQuery) { + this.metricsQuery = metricsQuery; + return this; + } + + /** + * The cost query used to track against the budget. + * + * @return metricsQuery + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_METRICS_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMetricsQuery() { + return metricsQuery; + } + + public void setMetricsQuery(String metricsQuery) { + this.metricsQuery = metricsQuery; + } + + public BudgetAttributes name(String name) { + this.name = name; + return this; + } + + /** + * The name of the budget. + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public BudgetAttributes orgId(Long orgId) { + this.orgId = orgId; + return this; + } + + /** + * The id of the org the budget belongs to. + * + * @return orgId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ORG_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getOrgId() { + return orgId; + } + + public void setOrgId(Long orgId) { + this.orgId = orgId; + } + + public BudgetAttributes startMonth(Long startMonth) { + this.startMonth = startMonth; + return this; + } + + /** + * The month when the budget starts. + * + * @return startMonth + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_START_MONTH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getStartMonth() { + return startMonth; + } + + public void setStartMonth(Long startMonth) { + this.startMonth = startMonth; + } + + public BudgetAttributes totalAmount(Double totalAmount) { + this.totalAmount = totalAmount; + return this; + } + + /** + * The sum of all budget entries' amounts. + * + * @return totalAmount + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOTAL_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Double getTotalAmount() { + return totalAmount; + } + + public void setTotalAmount(Double totalAmount) { + this.totalAmount = totalAmount; + } + + public BudgetAttributes updatedAt(Long updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The timestamp when the budget was last updated. + * + * @return updatedAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Long updatedAt) { + this.updatedAt = updatedAt; + } + + public BudgetAttributes updatedBy(String updatedBy) { + this.updatedBy = updatedBy; + return this; + } + + /** + * The id of the user that created the budget. + * + * @return updatedBy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_UPDATED_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return BudgetAttributes + */ + @JsonAnySetter + public BudgetAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this BudgetAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BudgetAttributes budgetAttributes = (BudgetAttributes) o; + return Objects.equals(this.createdAt, budgetAttributes.createdAt) + && Objects.equals(this.createdBy, budgetAttributes.createdBy) + && Objects.equals(this.endMonth, budgetAttributes.endMonth) + && Objects.equals(this.entries, budgetAttributes.entries) + && Objects.equals(this.metricsQuery, budgetAttributes.metricsQuery) + && Objects.equals(this.name, budgetAttributes.name) + && Objects.equals(this.orgId, budgetAttributes.orgId) + && Objects.equals(this.startMonth, budgetAttributes.startMonth) + && Objects.equals(this.totalAmount, budgetAttributes.totalAmount) + && Objects.equals(this.updatedAt, budgetAttributes.updatedAt) + && Objects.equals(this.updatedBy, budgetAttributes.updatedBy) + && Objects.equals(this.additionalProperties, budgetAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + createdBy, + endMonth, + entries, + metricsQuery, + name, + orgId, + startMonth, + totalAmount, + updatedAt, + updatedBy, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BudgetAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" endMonth: ").append(toIndentedString(endMonth)).append("\n"); + sb.append(" entries: ").append(toIndentedString(entries)).append("\n"); + sb.append(" metricsQuery: ").append(toIndentedString(metricsQuery)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" orgId: ").append(toIndentedString(orgId)).append("\n"); + sb.append(" startMonth: ").append(toIndentedString(startMonth)).append("\n"); + sb.append(" totalAmount: ").append(toIndentedString(totalAmount)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" updatedBy: ").append(toIndentedString(updatedBy)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/BudgetEntry.java b/src/main/java/com/datadog/api/client/v2/model/BudgetEntry.java new file mode 100644 index 00000000000..445b8d6b305 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/BudgetEntry.java @@ -0,0 +1,205 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The entry of a budget. */ +@JsonPropertyOrder({ + BudgetEntry.JSON_PROPERTY_AMOUNT, + BudgetEntry.JSON_PROPERTY_MONTH, + BudgetEntry.JSON_PROPERTY_TAG_FILTERS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class BudgetEntry { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AMOUNT = "amount"; + private Double amount; + + public static final String JSON_PROPERTY_MONTH = "month"; + private Long month; + + public static final String JSON_PROPERTY_TAG_FILTERS = "tag_filters"; + private List tagFilters = null; + + public BudgetEntry amount(Double amount) { + this.amount = amount; + return this; + } + + /** + * The amount of the budget entry. + * + * @return amount + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AMOUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Double getAmount() { + return amount; + } + + public void setAmount(Double amount) { + this.amount = amount; + } + + public BudgetEntry month(Long month) { + this.month = month; + return this; + } + + /** + * The month of the budget entry. + * + * @return month + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MONTH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getMonth() { + return month; + } + + public void setMonth(Long month) { + this.month = month; + } + + public BudgetEntry tagFilters(List tagFilters) { + this.tagFilters = tagFilters; + for (TagFilter item : tagFilters) { + this.unparsed |= item.unparsed; + } + return this; + } + + public BudgetEntry addTagFiltersItem(TagFilter tagFiltersItem) { + if (this.tagFilters == null) { + this.tagFilters = new ArrayList<>(); + } + this.tagFilters.add(tagFiltersItem); + this.unparsed |= tagFiltersItem.unparsed; + return this; + } + + /** + * The tag_filters of the budget entry. + * + * @return tagFilters + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAG_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTagFilters() { + return tagFilters; + } + + public void setTagFilters(List tagFilters) { + this.tagFilters = tagFilters; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return BudgetEntry + */ + @JsonAnySetter + public BudgetEntry putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this BudgetEntry object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BudgetEntry budgetEntry = (BudgetEntry) o; + return Objects.equals(this.amount, budgetEntry.amount) + && Objects.equals(this.month, budgetEntry.month) + && Objects.equals(this.tagFilters, budgetEntry.tagFilters) + && Objects.equals(this.additionalProperties, budgetEntry.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(amount, month, tagFilters, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BudgetEntry {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" month: ").append(toIndentedString(month)).append("\n"); + sb.append(" tagFilters: ").append(toIndentedString(tagFilters)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/BudgetWithEntries.java b/src/main/java/com/datadog/api/client/v2/model/BudgetWithEntries.java new file mode 100644 index 00000000000..f967793a80c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/BudgetWithEntries.java @@ -0,0 +1,136 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of the BudgetWithEntries object. */ +@JsonPropertyOrder({BudgetWithEntries.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class BudgetWithEntries { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private BudgetWithEntriesData data; + + public BudgetWithEntries data(BudgetWithEntriesData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A budget and all its entries. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public BudgetWithEntriesData getData() { + return data; + } + + public void setData(BudgetWithEntriesData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return BudgetWithEntries + */ + @JsonAnySetter + public BudgetWithEntries putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this BudgetWithEntries object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BudgetWithEntries budgetWithEntries = (BudgetWithEntries) o; + return Objects.equals(this.data, budgetWithEntries.data) + && Objects.equals(this.additionalProperties, budgetWithEntries.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BudgetWithEntries {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/BudgetWithEntriesData.java b/src/main/java/com/datadog/api/client/v2/model/BudgetWithEntriesData.java new file mode 100644 index 00000000000..c5ffedb84a7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/BudgetWithEntriesData.java @@ -0,0 +1,192 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A budget and all its entries. */ +@JsonPropertyOrder({ + BudgetWithEntriesData.JSON_PROPERTY_ATTRIBUTES, + BudgetWithEntriesData.JSON_PROPERTY_ID, + BudgetWithEntriesData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class BudgetWithEntriesData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private BudgetAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public BudgetWithEntriesData attributes(BudgetAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of a budget. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public BudgetAttributes getAttributes() { + return attributes; + } + + public void setAttributes(BudgetAttributes attributes) { + this.attributes = attributes; + } + + public BudgetWithEntriesData id(String id) { + this.id = id; + return this; + } + + /** + * The BudgetWithEntriesData id. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public BudgetWithEntriesData type(String type) { + this.type = type; + return this; + } + + /** + * The type of the object, must be budget. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return BudgetWithEntriesData + */ + @JsonAnySetter + public BudgetWithEntriesData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this BudgetWithEntriesData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BudgetWithEntriesData budgetWithEntriesData = (BudgetWithEntriesData) o; + return Objects.equals(this.attributes, budgetWithEntriesData.attributes) + && Objects.equals(this.id, budgetWithEntriesData.id) + && Objects.equals(this.type, budgetWithEntriesData.type) + && Objects.equals(this.additionalProperties, budgetWithEntriesData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BudgetWithEntriesData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TagFilter.java b/src/main/java/com/datadog/api/client/v2/model/TagFilter.java new file mode 100644 index 00000000000..fc56a18c5b1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TagFilter.java @@ -0,0 +1,161 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Tag filter for the budget's entries. */ +@JsonPropertyOrder({TagFilter.JSON_PROPERTY_TAG_KEY, TagFilter.JSON_PROPERTY_TAG_VALUE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TagFilter { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_TAG_KEY = "tag_key"; + private String tagKey; + + public static final String JSON_PROPERTY_TAG_VALUE = "tag_value"; + private String tagValue; + + public TagFilter tagKey(String tagKey) { + this.tagKey = tagKey; + return this; + } + + /** + * The key of the tag. + * + * @return tagKey + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAG_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTagKey() { + return tagKey; + } + + public void setTagKey(String tagKey) { + this.tagKey = tagKey; + } + + public TagFilter tagValue(String tagValue) { + this.tagValue = tagValue; + return this; + } + + /** + * The value of the tag. + * + * @return tagValue + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAG_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTagValue() { + return tagValue; + } + + public void setTagValue(String tagValue) { + this.tagValue = tagValue; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return TagFilter + */ + @JsonAnySetter + public TagFilter putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this TagFilter object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TagFilter tagFilter = (TagFilter) o; + return Objects.equals(this.tagKey, tagFilter.tagKey) + && Objects.equals(this.tagValue, tagFilter.tagValue) + && Objects.equals(this.additionalProperties, tagFilter.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(tagKey, tagValue, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagFilter {\n"); + sb.append(" tagKey: ").append(toIndentedString(tagKey)).append("\n"); + sb.append(" tagValue: ").append(toIndentedString(tagValue)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/cassettes/features/v2/Delete_a_budget_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Delete_a_budget_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..e8c5ba9a55b --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_a_budget_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-04-28T11:45:34.874Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_a_budget_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Delete_a_budget_returns_Bad_Request_response.json new file mode 100644 index 00000000000..a25b9536cdf --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_a_budget_returns_Bad_Request_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/cost/budget/1", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"400\",\"title\":\"Bad Request\",\"detail\":\"invalid budgetId\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "f761ae0f-2dfa-6512-7081-2812b935bfb2" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_budget_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Get_a_budget_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..c5afe1be6b1 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_budget_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-04-28T11:45:35.263Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_budget_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Get_a_budget_returns_Not_Found_response.json new file mode 100644 index 00000000000..c113cf7dce5 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_budget_returns_Not_Found_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/cost/budget/9d055d22-0a0a-0a0a-aaa0-00000000000a", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"404\",\"title\":\"Not Found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "3ae9efe6-5604-0503-bf3b-c22cbaf6310f" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/List_budgets_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/List_budgets_returns_OK_response.freeze new file mode 100644 index 00000000000..934d4786d1d --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_budgets_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-04-28T11:45:35.577Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/List_budgets_returns_OK_response.json b/src/test/resources/cassettes/features/v2/List_budgets_returns_OK_response.json new file mode 100644 index 00000000000..5c4208b45a7 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_budgets_returns_OK_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/cost/budgets", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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\"}}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "0d6b0bed-4406-902c-b1d5-39c0d55a50e9" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..80edb05b384 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-04-28T11:19:55.670Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_Bad_Request_response.json new file mode 100644 index 00000000000..dfe2c073801 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_Bad_Request_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{}}}" + }, + "headers": {}, + "method": "PUT", + "path": "/api/v2/cost/budget", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"400\",\"title\":\"Bad Request\",\"detail\":\"got type \\\"\\\" expected one of \\\"budget\\\"\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "35bacf9e-b61f-42cf-c279-172a4117e507" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..2592ae96cc5 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-04-28T11:19:55.806Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_Not_Found_response.json new file mode 100644 index 00000000000..ef6f5134885 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_Not_Found_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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\"}}" + }, + "headers": {}, + "method": "PUT", + "path": "/api/v2/cost/budget", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"failed to upsert budget: budget not found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "148ba35c-0db1-18f8-99fb-da67881a9eec" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_OK_response.freeze new file mode 100644 index 00000000000..f6982963180 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-04-28T11:19:56.204Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_OK_response.json new file mode 100644 index 00000000000..265db9eff68 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_if_exists_or_create_a_new_budget_returns_OK_response.json @@ -0,0 +1,53 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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\"}}" + }, + "headers": {}, + "method": "PUT", + "path": "/api/v2/cost/budget", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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\"}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "4bd39306-b23f-cbbd-cff4-3cccf8e49278" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/cost/budget/041ec283-154d-4427-987b-113f806e73f0", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "96f93125-17df-55cd-e8de-e88b25d3ecfd" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature b/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature index d6c84a584eb..4c318851014 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 4aba315c34e..c1daab38525 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/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": {