From 7a6f54efc7e5ab60ca323020861f2c92d1e77739 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 22 Jun 2026 14:31:45 +0000 Subject: [PATCH] Regenerate client from commit 27b019f of spec repo --- .generator/schemas/v2/openapi.yaml | 250 ++++++++++++++++++ .../DeleteCustomForecast.rb | 8 + .../UpsertCustomForecast.rb | 30 +++ features/scenarios_model_mapping.rb | 6 + features/v2/cloud_cost_management.feature | 48 ++++ features/v2/undo.json | 12 + lib/datadog_api_client/configuration.rb | 2 + lib/datadog_api_client/inflector.rb | 9 + .../v2/api/cloud_cost_management_api.rb | 145 ++++++++++ .../v2/models/custom_forecast_entry.rb | 167 ++++++++++++ .../custom_forecast_entry_tag_filter.rb | 144 ++++++++++ .../v2/models/custom_forecast_response.rb | 123 +++++++++ .../models/custom_forecast_response_data.rb | 165 ++++++++++++ ...ustom_forecast_response_data_attributes.rb | 230 ++++++++++++++++ .../v2/models/custom_forecast_type.rb | 26 ++ .../models/custom_forecast_upsert_request.rb | 123 +++++++++ .../custom_forecast_upsert_request_data.rb | 154 +++++++++++ ...forecast_upsert_request_data_attributes.rb | 147 ++++++++++ 18 files changed, 1789 insertions(+) create mode 100644 examples/v2/cloud-cost-management/DeleteCustomForecast.rb create mode 100644 examples/v2/cloud-cost-management/UpsertCustomForecast.rb create mode 100644 lib/datadog_api_client/v2/models/custom_forecast_entry.rb create mode 100644 lib/datadog_api_client/v2/models/custom_forecast_entry_tag_filter.rb create mode 100644 lib/datadog_api_client/v2/models/custom_forecast_response.rb create mode 100644 lib/datadog_api_client/v2/models/custom_forecast_response_data.rb create mode 100644 lib/datadog_api_client/v2/models/custom_forecast_response_data_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/custom_forecast_type.rb create mode 100644 lib/datadog_api_client/v2/models/custom_forecast_upsert_request.rb create mode 100644 lib/datadog_api_client/v2/models/custom_forecast_upsert_request_data.rb create mode 100644 lib/datadog_api_client/v2/models/custom_forecast_upsert_request_data_attributes.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 99b25f0ac87f..7696e4a9b682 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -27149,6 +27149,156 @@ components: $ref: "#/components/schemas/CustomDestinationResponseDefinition" type: array type: object + CustomForecastEntry: + description: A monthly entry of a custom budget forecast. + properties: + amount: + description: Forecast amount for the month. + example: 400 + format: double + type: number + month: + description: Month the custom forecast entry applies to, in `YYYYMM` format. + example: 202501 + format: int64 + type: integer + tag_filters: + description: Tag filters that scope this custom forecast entry to specific resources. + items: + $ref: "#/components/schemas/CustomForecastEntryTagFilter" + type: array + required: + - month + - amount + - tag_filters + type: object + CustomForecastEntryTagFilter: + description: A tag filter that scopes a custom forecast entry to specific resource tags. + properties: + tag_key: + description: The tag key to filter on. + example: service + type: string + tag_value: + description: The tag value to filter on. + example: ec2 + type: string + required: + - tag_key + - tag_value + type: object + CustomForecastResponse: + description: Response object containing the custom forecast for a budget. + properties: + data: + $ref: "#/components/schemas/CustomForecastResponseData" + required: + - data + type: object + CustomForecastResponseData: + description: Custom forecast resource wrapper in a response. + properties: + attributes: + $ref: "#/components/schemas/CustomForecastResponseDataAttributes" + id: + description: The unique identifier of the custom forecast. + example: 11111111-1111-1111-1111-111111111111 + type: string + type: + $ref: "#/components/schemas/CustomForecastType" + required: + - id + - type + - attributes + type: object + CustomForecastResponseDataAttributes: + description: Attributes of a custom forecast. + properties: + budget_uid: + description: The UUID of the budget that this custom forecast belongs to. + example: 00000000-0000-0000-0000-000000000001 + type: string + created_at: + description: Timestamp the custom forecast was created, in Unix milliseconds. + example: 1738258683590 + format: int64 + type: integer + created_by: + description: The id of the user that created the custom forecast. + example: 00000000-0a0a-0a0a-aaa0-00000000000a + type: string + entries: + description: Monthly custom forecast entries. + items: + $ref: "#/components/schemas/CustomForecastEntry" + type: array + updated_at: + description: Timestamp the custom forecast was last updated, in Unix milliseconds. + example: 1738258683590 + format: int64 + type: integer + updated_by: + description: The id of the user that last updated the custom forecast. + example: 00000000-0a0a-0a0a-aaa0-00000000000a + type: string + required: + - budget_uid + - created_at + - updated_at + - created_by + - updated_by + - entries + type: object + CustomForecastType: + default: custom_forecast + description: The type of the custom forecast resource. Must be `custom_forecast`. + enum: + - custom_forecast + example: custom_forecast + type: string + x-enum-varnames: + - CUSTOM_FORECAST + CustomForecastUpsertRequest: + description: Request body to upsert (create or replace) the custom forecast for a budget. + properties: + data: + $ref: "#/components/schemas/CustomForecastUpsertRequestData" + required: + - data + type: object + CustomForecastUpsertRequestData: + description: Custom forecast resource wrapper in an upsert request. + properties: + attributes: + $ref: "#/components/schemas/CustomForecastUpsertRequestDataAttributes" + id: + description: Unused on upsert; the resource is keyed by `budget_uid`. Send an empty string. + example: "" + type: string + type: + $ref: "#/components/schemas/CustomForecastType" + required: + - type + - attributes + type: object + CustomForecastUpsertRequestDataAttributes: + description: Attributes of a custom forecast upsert request. + properties: + budget_uid: + description: The UUID of the budget that this custom forecast belongs to. + example: 00000000-0000-0000-0000-000000000001 + type: string + entries: + description: |- + Monthly custom forecast entries. An empty list deletes any existing + custom forecast for the budget. + items: + $ref: "#/components/schemas/CustomForecastEntry" + type: array + required: + - budget_uid + - entries + type: object CustomFrameworkControl: description: Framework Control. properties: @@ -123849,6 +123999,82 @@ paths: summary: Validate CSV budget tags: - Cloud Cost Management + /api/v2/cost/budget/custom-forecast: + put: + description: |- + Create or replace the custom forecast for an existing budget. + Pass an empty `entries` list to delete the custom forecast for the budget. + operationId: UpsertCustomForecast + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + budget_uid: 00000000-0000-0000-0000-000000000001 + entries: + - amount: 400 + month: 202501 + tag_filters: + - tag_key: service + tag_value: ec2 + - amount: 450 + month: 202502 + tag_filters: + - tag_key: service + tag_value: ec2 + id: "" + type: custom_forecast + schema: + $ref: "#/components/schemas/CustomForecastUpsertRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + budget_uid: 00000000-0000-0000-0000-000000000001 + created_at: 1738258683590 + created_by: 00000000-0a0a-0a0a-aaa0-00000000000a + entries: + - amount: 400 + month: 202501 + tag_filters: + - tag_key: service + tag_value: ec2 + - amount: 450 + month: 202502 + tag_filters: + - tag_key: service + tag_value: ec2 + updated_at: 1738258683590 + updated_by: 00000000-0a0a-0a0a-aaa0-00000000000a + id: 11111111-1111-1111-1111-111111111111 + type: custom_forecast + schema: + $ref: "#/components/schemas/CustomForecastResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Create or replace a budget's custom forecast + tags: + - Cloud Cost Management + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/cost/budget/validate: post: description: Validate a budget configuration without creating or modifying it @@ -123971,6 +124197,30 @@ paths: summary: Get budget tags: - Cloud Cost Management + /api/v2/cost/budget/{budget_id}/custom-forecast: + delete: + description: Delete the custom forecast for a budget. + operationId: DeleteCustomForecast + parameters: + - $ref: "#/components/parameters/BudgetID" + responses: + "204": + description: No Content + "400": + $ref: "#/components/responses/BadRequestResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Delete a budget's custom forecast + tags: + - Cloud Cost Management + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/cost/budgets: get: description: List budgets. diff --git a/examples/v2/cloud-cost-management/DeleteCustomForecast.rb b/examples/v2/cloud-cost-management/DeleteCustomForecast.rb new file mode 100644 index 000000000000..6c6afafc8e63 --- /dev/null +++ b/examples/v2/cloud-cost-management/DeleteCustomForecast.rb @@ -0,0 +1,8 @@ +# Delete a budget's custom forecast returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.delete_custom_forecast".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new +api_instance.delete_custom_forecast("budget_id") diff --git a/examples/v2/cloud-cost-management/UpsertCustomForecast.rb b/examples/v2/cloud-cost-management/UpsertCustomForecast.rb new file mode 100644 index 000000000000..a7887bcf1f09 --- /dev/null +++ b/examples/v2/cloud-cost-management/UpsertCustomForecast.rb @@ -0,0 +1,30 @@ +# Create or replace a budget's custom forecast returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.upsert_custom_forecast".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new + +body = DatadogAPIClient::V2::CustomForecastUpsertRequest.new({ + data: DatadogAPIClient::V2::CustomForecastUpsertRequestData.new({ + attributes: DatadogAPIClient::V2::CustomForecastUpsertRequestDataAttributes.new({ + budget_uid: "00000000-0000-0000-0000-000000000001", + entries: [ + DatadogAPIClient::V2::CustomForecastEntry.new({ + amount: 400, + month: 202501, + tag_filters: [ + DatadogAPIClient::V2::CustomForecastEntryTagFilter.new({ + tag_key: "service", + tag_value: "ec2", + }), + ], + }), + ], + }), + id: "", + type: DatadogAPIClient::V2::CustomForecastType::CUSTOM_FORECAST, + }), +}) +p api_instance.upsert_custom_forecast(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 8d27a626e6cf..44890d896adc 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2699,6 +2699,9 @@ "v2.UpsertBudget" => { "body" => "BudgetWithEntries", }, + "v2.UpsertCustomForecast" => { + "body" => "CustomForecastUpsertRequest", + }, "v2.ValidateBudget" => { "body" => "BudgetValidationRequest", }, @@ -2708,6 +2711,9 @@ "v2.GetBudget" => { "budget_id" => "String", }, + "v2.DeleteCustomForecast" => { + "budget_id" => "String", + }, "v2.GetCommitmentsCommitmentList" => { "provider" => "CommitmentsProvider", "product" => "String", diff --git a/features/v2/cloud_cost_management.feature b/features/v2/cloud_cost_management.feature index 535fe88d7c7b..d9434ef40755 100644 --- a/features/v2/cloud_cost_management.feature +++ b/features/v2/cloud_cost_management.feature @@ -67,6 +67,30 @@ Feature: Cloud Cost Management And the response "data.type" is equal to "arbitrary_rule" And the response "data.attributes.rule_name" is equal to "example-arbitrary-cost-rule" + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Create or replace a budget's custom forecast returns "Bad Request" response + Given operation "UpsertCustomForecast" enabled + And new "UpsertCustomForecast" request + And body with value {"data": {"attributes": {"budget_uid": "00000000-0000-0000-0000-000000000001", "entries": [{"amount": 400, "month": 202501, "tag_filters": [{"tag_key": "service", "tag_value": "ec2"}]}]}, "id": "", "type": "custom_forecast"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Create or replace a budget's custom forecast returns "Not Found" response + Given operation "UpsertCustomForecast" enabled + And new "UpsertCustomForecast" request + And body with value {"data": {"attributes": {"budget_uid": "00000000-0000-0000-0000-000000000001", "entries": [{"amount": 400, "month": 202501, "tag_filters": [{"tag_key": "service", "tag_value": "ec2"}]}]}, "id": "", "type": "custom_forecast"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Create or replace a budget's custom forecast returns "OK" response + Given operation "UpsertCustomForecast" enabled + And new "UpsertCustomForecast" request + And body with value {"data": {"attributes": {"budget_uid": "00000000-0000-0000-0000-000000000001", "entries": [{"amount": 400, "month": 202501, "tag_filters": [{"tag_key": "service", "tag_value": "ec2"}]}]}, "id": "", "type": "custom_forecast"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/cloud-cost-management Scenario: Create or update a budget returns "Bad Request" response Given new "UpsertBudget" request @@ -211,6 +235,30 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 400 Bad Request + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Delete a budget's custom forecast returns "Bad Request" response + Given operation "DeleteCustomForecast" enabled + And new "DeleteCustomForecast" request + And request contains "budget_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Delete a budget's custom forecast returns "No Content" response + Given operation "DeleteCustomForecast" enabled + And new "DeleteCustomForecast" request + And request contains "budget_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Delete a budget's custom forecast returns "Not Found" response + Given operation "DeleteCustomForecast" enabled + And new "DeleteCustomForecast" request + And request contains "budget_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/cloud-cost-management Scenario: Delete budget returns "No Content" response Given new "DeleteBudget" request diff --git a/features/v2/undo.json b/features/v2/undo.json index a5c43f6c0f2c..00f6525933df 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1755,6 +1755,12 @@ "type": "safe" } }, + "UpsertCustomForecast": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, "ValidateBudget": { "tag": "Cloud Cost Management", "undo": { @@ -1773,6 +1779,12 @@ "type": "safe" } }, + "DeleteCustomForecast": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, "ListBudgets": { "tag": "Cloud Cost Management", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index c21dc889eb38..16ab9c7e5254 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -417,6 +417,7 @@ def initialize "v2.get_code_coverage_branch_summary": false, "v2.get_code_coverage_commit_summary": false, "v2.get_rule_based_view": false, + "v2.delete_custom_forecast": false, "v2.get_commitments_commitment_list": false, "v2.get_commitments_coverage_scalar": false, "v2.get_commitments_coverage_timeseries": false, @@ -434,6 +435,7 @@ def initialize "v2.list_cost_tag_metadata_months": false, "v2.list_cost_tag_metadata_orchestrators": false, "v2.search_cost_recommendations": false, + "v2.upsert_custom_forecast": false, "v2.create_ownership_feedback": false, "v2.get_ownership_evidence": false, "v2.get_ownership_inference": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 1912c3a1f419..8af1614c634a 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2637,6 +2637,15 @@ def overrides "v2.customer_org_disable_response_type" => "CustomerOrgDisableResponseType", "v2.customer_org_disable_status" => "CustomerOrgDisableStatus", "v2.customer_org_disable_type" => "CustomerOrgDisableType", + "v2.custom_forecast_entry" => "CustomForecastEntry", + "v2.custom_forecast_entry_tag_filter" => "CustomForecastEntryTagFilter", + "v2.custom_forecast_response" => "CustomForecastResponse", + "v2.custom_forecast_response_data" => "CustomForecastResponseData", + "v2.custom_forecast_response_data_attributes" => "CustomForecastResponseDataAttributes", + "v2.custom_forecast_type" => "CustomForecastType", + "v2.custom_forecast_upsert_request" => "CustomForecastUpsertRequest", + "v2.custom_forecast_upsert_request_data" => "CustomForecastUpsertRequestData", + "v2.custom_forecast_upsert_request_data_attributes" => "CustomForecastUpsertRequestDataAttributes", "v2.custom_framework_control" => "CustomFrameworkControl", "v2.custom_framework_data" => "CustomFrameworkData", "v2.custom_framework_data_attributes" => "CustomFrameworkDataAttributes", diff --git a/lib/datadog_api_client/v2/api/cloud_cost_management_api.rb b/lib/datadog_api_client/v2/api/cloud_cost_management_api.rb index f08216a7ad1b..3d33df0c58dc 100644 --- a/lib/datadog_api_client/v2/api/cloud_cost_management_api.rb +++ b/lib/datadog_api_client/v2/api/cloud_cost_management_api.rb @@ -827,6 +827,77 @@ def delete_custom_costs_file_with_http_info(file_id, opts = {}) return data, status_code, headers end + # Delete a budget's custom forecast. + # + # @see #delete_custom_forecast_with_http_info + def delete_custom_forecast(budget_id, opts = {}) + delete_custom_forecast_with_http_info(budget_id, opts) + nil + end + + # Delete a budget's custom forecast. + # + # Delete the custom forecast for a budget. + # + # @param budget_id [String] Budget id. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_custom_forecast_with_http_info(budget_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_custom_forecast".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_custom_forecast") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_custom_forecast")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CloudCostManagementAPI.delete_custom_forecast ...' + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling CloudCostManagementAPI.delete_custom_forecast" + end + # resource path + local_var_path = '/api/v2/cost/budget/{budget_id}/custom-forecast'.sub('{budget_id}', CGI.escape(budget_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :delete_custom_forecast, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CloudCostManagementAPI#delete_custom_forecast\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Delete tag pipeline ruleset. # # @see #delete_tag_pipelines_ruleset_with_http_info @@ -4570,6 +4641,80 @@ def upsert_cost_tag_description_by_key_with_http_info(tag_key, body, opts = {}) return data, status_code, headers end + # Create or replace a budget's custom forecast. + # + # @see #upsert_custom_forecast_with_http_info + def upsert_custom_forecast(body, opts = {}) + data, _status_code, _headers = upsert_custom_forecast_with_http_info(body, opts) + data + end + + # Create or replace a budget's custom forecast. + # + # Create or replace the custom forecast for an existing budget. + # Pass an empty `entries` list to delete the custom forecast for the budget. + # + # @param body [CustomForecastUpsertRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(CustomForecastResponse, Integer, Hash)>] CustomForecastResponse data, response status code and response headers + def upsert_custom_forecast_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.upsert_custom_forecast".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.upsert_custom_forecast") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.upsert_custom_forecast")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CloudCostManagementAPI.upsert_custom_forecast ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling CloudCostManagementAPI.upsert_custom_forecast" + end + # resource path + local_var_path = '/api/v2/cost/budget/custom-forecast' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'CustomForecastResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :upsert_custom_forecast, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Put, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CloudCostManagementAPI#upsert_custom_forecast\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Validate budget. # # @see #validate_budget_with_http_info diff --git a/lib/datadog_api_client/v2/models/custom_forecast_entry.rb b/lib/datadog_api_client/v2/models/custom_forecast_entry.rb new file mode 100644 index 000000000000..19937a4496a5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_forecast_entry.rb @@ -0,0 +1,167 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A monthly entry of a custom budget forecast. + class CustomForecastEntry + include BaseGenericModel + + # Forecast amount for the month. + attr_reader :amount + + # Month the custom forecast entry applies to, in `YYYYMM` format. + attr_reader :month + + # Tag filters that scope this custom forecast entry to specific resources. + attr_reader :tag_filters + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'amount' => :'amount', + :'month' => :'month', + :'tag_filters' => :'tag_filters' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'amount' => :'Float', + :'month' => :'Integer', + :'tag_filters' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomForecastEntry` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'month') + self.month = attributes[:'month'] + end + + if attributes.key?(:'tag_filters') + if (value = attributes[:'tag_filters']).is_a?(Array) + self.tag_filters = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @amount.nil? + return false if @month.nil? + return false if @tag_filters.nil? + true + end + + # Custom attribute writer method with validation + # @param amount [Object] Object to be assigned + # @!visibility private + def amount=(amount) + if amount.nil? + fail ArgumentError, 'invalid value for "amount", amount cannot be nil.' + end + @amount = amount + end + + # Custom attribute writer method with validation + # @param month [Object] Object to be assigned + # @!visibility private + def month=(month) + if month.nil? + fail ArgumentError, 'invalid value for "month", month cannot be nil.' + end + @month = month + end + + # Custom attribute writer method with validation + # @param tag_filters [Object] Object to be assigned + # @!visibility private + def tag_filters=(tag_filters) + if tag_filters.nil? + fail ArgumentError, 'invalid value for "tag_filters", tag_filters cannot be nil.' + end + @tag_filters = tag_filters + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + month == o.month && + tag_filters == o.tag_filters && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [amount, month, tag_filters, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_forecast_entry_tag_filter.rb b/lib/datadog_api_client/v2/models/custom_forecast_entry_tag_filter.rb new file mode 100644 index 000000000000..22aed87de7c7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_forecast_entry_tag_filter.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A tag filter that scopes a custom forecast entry to specific resource tags. + class CustomForecastEntryTagFilter + include BaseGenericModel + + # The tag key to filter on. + attr_reader :tag_key + + # The tag value to filter on. + attr_reader :tag_value + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'tag_key' => :'tag_key', + :'tag_value' => :'tag_value' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'tag_key' => :'String', + :'tag_value' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomForecastEntryTagFilter` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'tag_key') + self.tag_key = attributes[:'tag_key'] + end + + if attributes.key?(:'tag_value') + self.tag_value = attributes[:'tag_value'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @tag_key.nil? + return false if @tag_value.nil? + true + end + + # Custom attribute writer method with validation + # @param tag_key [Object] Object to be assigned + # @!visibility private + def tag_key=(tag_key) + if tag_key.nil? + fail ArgumentError, 'invalid value for "tag_key", tag_key cannot be nil.' + end + @tag_key = tag_key + end + + # Custom attribute writer method with validation + # @param tag_value [Object] Object to be assigned + # @!visibility private + def tag_value=(tag_value) + if tag_value.nil? + fail ArgumentError, 'invalid value for "tag_value", tag_value cannot be nil.' + end + @tag_value = tag_value + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + tag_key == o.tag_key && + tag_value == o.tag_value && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [tag_key, tag_value, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_forecast_response.rb b/lib/datadog_api_client/v2/models/custom_forecast_response.rb new file mode 100644 index 000000000000..be7489467c40 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_forecast_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response object containing the custom forecast for a budget. + class CustomForecastResponse + include BaseGenericModel + + # Custom forecast resource wrapper in a response. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'CustomForecastResponseData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomForecastResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_forecast_response_data.rb b/lib/datadog_api_client/v2/models/custom_forecast_response_data.rb new file mode 100644 index 000000000000..bc7e53925328 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_forecast_response_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Custom forecast resource wrapper in a response. + class CustomForecastResponseData + include BaseGenericModel + + # Attributes of a custom forecast. + attr_reader :attributes + + # The unique identifier of the custom forecast. + attr_reader :id + + # The type of the custom forecast resource. Must be `custom_forecast`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'CustomForecastResponseDataAttributes', + :'id' => :'String', + :'type' => :'CustomForecastType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomForecastResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_forecast_response_data_attributes.rb b/lib/datadog_api_client/v2/models/custom_forecast_response_data_attributes.rb new file mode 100644 index 000000000000..82cbb642ac11 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_forecast_response_data_attributes.rb @@ -0,0 +1,230 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of a custom forecast. + class CustomForecastResponseDataAttributes + include BaseGenericModel + + # The UUID of the budget that this custom forecast belongs to. + attr_reader :budget_uid + + # Timestamp the custom forecast was created, in Unix milliseconds. + attr_reader :created_at + + # The id of the user that created the custom forecast. + attr_reader :created_by + + # Monthly custom forecast entries. + attr_reader :entries + + # Timestamp the custom forecast was last updated, in Unix milliseconds. + attr_reader :updated_at + + # The id of the user that last updated the custom forecast. + attr_reader :updated_by + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'budget_uid' => :'budget_uid', + :'created_at' => :'created_at', + :'created_by' => :'created_by', + :'entries' => :'entries', + :'updated_at' => :'updated_at', + :'updated_by' => :'updated_by' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'budget_uid' => :'String', + :'created_at' => :'Integer', + :'created_by' => :'String', + :'entries' => :'Array', + :'updated_at' => :'Integer', + :'updated_by' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomForecastResponseDataAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'budget_uid') + self.budget_uid = attributes[:'budget_uid'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'created_by') + self.created_by = attributes[:'created_by'] + end + + if attributes.key?(:'entries') + if (value = attributes[:'entries']).is_a?(Array) + self.entries = value + end + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'updated_by') + self.updated_by = attributes[:'updated_by'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @budget_uid.nil? + return false if @created_at.nil? + return false if @created_by.nil? + return false if @entries.nil? + return false if @updated_at.nil? + return false if @updated_by.nil? + true + end + + # Custom attribute writer method with validation + # @param budget_uid [Object] Object to be assigned + # @!visibility private + def budget_uid=(budget_uid) + if budget_uid.nil? + fail ArgumentError, 'invalid value for "budget_uid", budget_uid cannot be nil.' + end + @budget_uid = budget_uid + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param created_by [Object] Object to be assigned + # @!visibility private + def created_by=(created_by) + if created_by.nil? + fail ArgumentError, 'invalid value for "created_by", created_by cannot be nil.' + end + @created_by = created_by + end + + # Custom attribute writer method with validation + # @param entries [Object] Object to be assigned + # @!visibility private + def entries=(entries) + if entries.nil? + fail ArgumentError, 'invalid value for "entries", entries cannot be nil.' + end + @entries = entries + end + + # Custom attribute writer method with validation + # @param updated_at [Object] Object to be assigned + # @!visibility private + def updated_at=(updated_at) + if updated_at.nil? + fail ArgumentError, 'invalid value for "updated_at", updated_at cannot be nil.' + end + @updated_at = updated_at + end + + # Custom attribute writer method with validation + # @param updated_by [Object] Object to be assigned + # @!visibility private + def updated_by=(updated_by) + if updated_by.nil? + fail ArgumentError, 'invalid value for "updated_by", updated_by cannot be nil.' + end + @updated_by = updated_by + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + budget_uid == o.budget_uid && + created_at == o.created_at && + created_by == o.created_by && + entries == o.entries && + updated_at == o.updated_at && + updated_by == o.updated_by && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [budget_uid, created_at, created_by, entries, updated_at, updated_by, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_forecast_type.rb b/lib/datadog_api_client/v2/models/custom_forecast_type.rb new file mode 100644 index 000000000000..ec2bd8355c66 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_forecast_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of the custom forecast resource. Must be `custom_forecast`. + class CustomForecastType + include BaseEnumModel + + CUSTOM_FORECAST = "custom_forecast".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/custom_forecast_upsert_request.rb b/lib/datadog_api_client/v2/models/custom_forecast_upsert_request.rb new file mode 100644 index 000000000000..9fd34bafb842 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_forecast_upsert_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request body to upsert (create or replace) the custom forecast for a budget. + class CustomForecastUpsertRequest + include BaseGenericModel + + # Custom forecast resource wrapper in an upsert request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'CustomForecastUpsertRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomForecastUpsertRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_forecast_upsert_request_data.rb b/lib/datadog_api_client/v2/models/custom_forecast_upsert_request_data.rb new file mode 100644 index 000000000000..2e2780c7e350 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_forecast_upsert_request_data.rb @@ -0,0 +1,154 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Custom forecast resource wrapper in an upsert request. + class CustomForecastUpsertRequestData + include BaseGenericModel + + # Attributes of a custom forecast upsert request. + attr_reader :attributes + + # Unused on upsert; the resource is keyed by `budget_uid`. Send an empty string. + attr_accessor :id + + # The type of the custom forecast resource. Must be `custom_forecast`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'CustomForecastUpsertRequestDataAttributes', + :'id' => :'String', + :'type' => :'CustomForecastType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomForecastUpsertRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_forecast_upsert_request_data_attributes.rb b/lib/datadog_api_client/v2/models/custom_forecast_upsert_request_data_attributes.rb new file mode 100644 index 000000000000..15a6fa52a575 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_forecast_upsert_request_data_attributes.rb @@ -0,0 +1,147 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of a custom forecast upsert request. + class CustomForecastUpsertRequestDataAttributes + include BaseGenericModel + + # The UUID of the budget that this custom forecast belongs to. + attr_reader :budget_uid + + # Monthly custom forecast entries. An empty list deletes any existing + # custom forecast for the budget. + attr_reader :entries + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'budget_uid' => :'budget_uid', + :'entries' => :'entries' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'budget_uid' => :'String', + :'entries' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CustomForecastUpsertRequestDataAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'budget_uid') + self.budget_uid = attributes[:'budget_uid'] + end + + if attributes.key?(:'entries') + if (value = attributes[:'entries']).is_a?(Array) + self.entries = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @budget_uid.nil? + return false if @entries.nil? + true + end + + # Custom attribute writer method with validation + # @param budget_uid [Object] Object to be assigned + # @!visibility private + def budget_uid=(budget_uid) + if budget_uid.nil? + fail ArgumentError, 'invalid value for "budget_uid", budget_uid cannot be nil.' + end + @budget_uid = budget_uid + end + + # Custom attribute writer method with validation + # @param entries [Object] Object to be assigned + # @!visibility private + def entries=(entries) + if entries.nil? + fail ArgumentError, 'invalid value for "entries", entries cannot be nil.' + end + @entries = entries + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + budget_uid == o.budget_uid && + entries == o.entries && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [budget_uid, entries, additional_properties].hash + end + end +end