diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 74b9de40104c..6e1ef6826dac 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -12570,6 +12570,20 @@ components: BudgetAttributes: description: The attributes of a budget. properties: + costs: + $ref: "#/components/schemas/BudgetAttributesCosts" + description: Aggregated cost data for the budget. Present only when `actual=true` or `forecast=true` is requested. + costs_period_end: + description: The end of the period used to compute cost data, in milliseconds since epoch. + format: int64 + type: integer + costs_period_start: + description: The start of the period used to compute cost data, in milliseconds since epoch. + format: int64 + type: integer + costs_unit: + $ref: "#/components/schemas/BudgetAttributesCostsUnit" + description: The unit used for all cost values in the response. created_at: description: The timestamp when the budget was created. example: 1738258683590 @@ -12622,6 +12636,53 @@ components: example: 00000000-0a0a-0a0a-aaa0-00000000000a type: string type: object + BudgetAttributesCosts: + description: Aggregated cost data for the budget over the requested period. + properties: + actual: + description: The total actual cost. Present only when `actual=true` is requested. + format: double + nullable: true + type: number + amount: + description: The total budgeted amount over the requested period. + format: double + nullable: true + type: number + forecast: + description: The total forecast cost, with any custom forecast overrides applied. Present only when `forecast=true` is requested. + format: double + nullable: true + type: number + ootb_forecast: + description: The out-of-the-box ML forecast before custom overrides. Present only when `forecast=true` is requested. + format: double + nullable: true + type: number + type: object + BudgetAttributesCostsUnit: + description: The unit used for all cost values in the response. + properties: + family: + description: The unit family (for example, `currency`). + type: string + id: + description: The unique identifier for the unit. + type: string + name: + description: The full name of the unit. + type: string + plural: + description: The plural form of the unit name. + type: string + scale_factor: + description: The scale factor applied to raw cost values. + format: double + type: number + short_name: + description: The abbreviated unit name. + type: string + type: object BudgetValidationRequest: description: The request object for validating a budget configuration before creating or updating it. example: @@ -12787,6 +12848,9 @@ components: description: The budgeted amount for this entry. format: double type: number + costs: + $ref: "#/components/schemas/BudgetWithEntriesDataAttributesEntriesItemsCosts" + description: Cost data for this entry. Present only when `actual=true` or `forecast=true` is requested. month: description: The month this budget entry applies to, in YYYYMM format. format: int64 @@ -12797,6 +12861,36 @@ components: $ref: "#/components/schemas/BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems" type: array type: object + BudgetWithEntriesDataAttributesEntriesItemsCosts: + description: Cost data for a single budget entry. + properties: + actual: + description: The actual cost for this entry. Present only when `actual=true` is requested. + format: double + nullable: true + type: number + amount: + description: The budgeted amount for this entry. + format: double + nullable: true + type: number + custom_forecast: + description: |- + The custom forecast override for this entry. `null` when `forecast=true` is requested but no custom forecast has been set for this entry's month. A numeric value, including `0`, indicates an explicit custom forecast override. Omitted when `forecast=false` or the feature is not available for the organization. + format: double + nullable: true + type: number + forecast: + description: The final forecast for this entry, with any custom forecast override applied. Present only when `forecast=true` is requested. + format: double + nullable: true + type: number + ootb_forecast: + description: The out-of-the-box ML forecast for this entry, before custom overrides. Present only when `forecast=true` is requested. + format: double + nullable: true + type: number + type: object BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems: description: A tag filter used to scope a budget entry to specific resource tags. properties: @@ -116220,10 +116314,36 @@ paths: tags: - Cloud Cost Management get: - description: Get a budget + description: Get a budget by ID. Pass `actual=true` or `forecast=true` to include cost data in the response. Use `start` and `end` (millisecond epochs, both required) to set the cost window. When `forecast=true`, each entry also includes `ootb_forecast` (the ML forecast before overrides) and `custom_forecast` (`null` if no override is set, a number if one is). operationId: GetBudget parameters: - $ref: "#/components/parameters/BudgetID" + - description: When `true`, includes actual cost data in the response. + in: query + name: actual + required: false + schema: + type: boolean + - description: When `true`, includes forecast cost data in the response, including `ootb_forecast` and `custom_forecast` per entry. + in: query + name: forecast + required: false + schema: + type: boolean + - description: Start of the cost window in milliseconds since epoch. Must be used together with `end`. + in: query + name: start + required: false + schema: + format: int64 + type: integer + - description: End of the cost window in milliseconds since epoch. Must be used together with `start`. + in: query + name: end + required: false + schema: + format: int64 + type: integer responses: "200": content: @@ -116233,11 +116353,31 @@ paths: value: data: attributes: + costs: + actual: 850.25 + amount: 1000.0 + forecast: 1100.5 + ootb_forecast: 1100.5 + costs_period_end: 1740873600000 + costs_period_start: 1738281600000 + costs_unit: + family: currency + id: "1" + name: dollar + plural: dollars + scale_factor: 1.0 + short_name: $ created_at: 1738258683590 created_by: 00000000-0a0a-0a0a-aaa0-00000000000a end_month: 202502 entries: - amount: 500 + costs: + actual: 425.5 + amount: 500.0 + custom_forecast: + forecast: 550.25 + ootb_forecast: 550.25 month: 202501 tag_filters: - tag_key: service @@ -116254,6 +116394,10 @@ paths: schema: $ref: "#/components/schemas/BudgetWithEntries" description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" "429": $ref: "#/components/responses/TooManyRequestsResponse" security: diff --git a/examples/v2/cloud-cost-management/UpsertBudget.rb b/examples/v2/cloud-cost-management/UpsertBudget.rb index 3a8b26b52c74..9b780d27727c 100644 --- a/examples/v2/cloud-cost-management/UpsertBudget.rb +++ b/examples/v2/cloud-cost-management/UpsertBudget.rb @@ -6,11 +6,25 @@ body = DatadogAPIClient::V2::BudgetWithEntries.new({ data: DatadogAPIClient::V2::BudgetWithEntriesData.new({ attributes: DatadogAPIClient::V2::BudgetAttributes.new({ + costs: DatadogAPIClient::V2::BudgetAttributesCosts.new({ + actual: nil, + amount: nil, + forecast: nil, + ootb_forecast: nil, + }), + costs_unit: DatadogAPIClient::V2::BudgetAttributesCostsUnit.new({}), created_at: 1738258683590, created_by: "00000000-0a0a-0a0a-aaa0-00000000000a", end_month: 202502, entries: [ DatadogAPIClient::V2::BudgetWithEntriesDataAttributesEntriesItems.new({ + costs: DatadogAPIClient::V2::BudgetWithEntriesDataAttributesEntriesItemsCosts.new({ + actual: nil, + amount: nil, + custom_forecast: nil, + forecast: nil, + ootb_forecast: nil, + }), tag_filters: [ DatadogAPIClient::V2::BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems.new({}), ], diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index e0afdeb4fdc8..25719a5dec7d 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2600,6 +2600,10 @@ }, "v2.GetBudget" => { "budget_id" => "String", + "actual" => "Boolean", + "forecast" => "Boolean", + "start" => "Integer", + "_end" => "Integer", }, "v2.GetCommitmentsCommitmentList" => { "provider" => "CommitmentsProvider", diff --git a/features/v2/cloud_cost_management.feature b/features/v2/cloud_cost_management.feature index 535fe88d7c7b..42cf91400a3f 100644 --- a/features/v2/cloud_cost_management.feature +++ b/features/v2/cloud_cost_management.feature @@ -70,21 +70,21 @@ Feature: Cloud Cost Management @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": [{"tag_filters": [{}]}], "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", "type": ""}} + And body with value {"data": {"attributes": {"costs": {"actual": null, "amount": null, "forecast": null, "ootb_forecast": null}, "costs_unit": {}, "created_at": 1738258683590, "created_by": "00000000-0a0a-0a0a-aaa0-00000000000a", "end_month": 202502, "entries": [{"costs": {"actual": null, "amount": null, "custom_forecast": null, "forecast": null, "ootb_forecast": null}, "tag_filters": [{}]}], "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", "type": ""}} 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": [{"tag_filters": [{}]}], "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", "type": ""}} + And body with value {"data": {"attributes": {"costs": {"actual": null, "amount": null, "forecast": null, "ootb_forecast": null}, "costs_unit": {}, "created_at": 1738258683590, "created_by": "00000000-0a0a-0a0a-aaa0-00000000000a", "end_month": 202502, "entries": [{"costs": {"actual": null, "amount": null, "custom_forecast": null, "forecast": null, "ootb_forecast": null}, "tag_filters": [{}]}], "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", "type": ""}} 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": [{"tag_filters": [{}]}], "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", "type": ""}} + And body with value {"data": {"attributes": {"costs": {"actual": null, "amount": null, "forecast": null, "ootb_forecast": null}, "costs_unit": {}, "created_at": 1738258683590, "created_by": "00000000-0a0a-0a0a-aaa0-00000000000a", "end_month": 202502, "entries": [{"costs": {"actual": null, "amount": null, "custom_forecast": null, "forecast": null, "ootb_forecast": null}, "tag_filters": [{}]}], "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", "type": ""}} When the request is sent Then the response status is 200 OK @@ -336,6 +336,20 @@ Feature: Cloud Cost Management And the response "data.type" is equal to "ruleset" And the response "data.attributes.name" is equal to "EVP Cost Tags" + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Get 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 + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Get budget returns "Not Found" response + Given new "GetBudget" 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: Get budget returns "OK" response Given new "GetBudget" request diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index b73a3d237414..67cf88fa5aa2 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1757,6 +1757,8 @@ def overrides "v2.budget" => "Budget", "v2.budget_array" => "BudgetArray", "v2.budget_attributes" => "BudgetAttributes", + "v2.budget_attributes_costs" => "BudgetAttributesCosts", + "v2.budget_attributes_costs_unit" => "BudgetAttributesCostsUnit", "v2.budget_validation_request" => "BudgetValidationRequest", "v2.budget_validation_request_data" => "BudgetValidationRequestData", "v2.budget_validation_response" => "BudgetValidationResponse", @@ -1767,6 +1769,7 @@ def overrides "v2.budget_with_entries_data" => "BudgetWithEntriesData", "v2.budget_with_entries_data_attributes" => "BudgetWithEntriesDataAttributes", "v2.budget_with_entries_data_attributes_entries_items" => "BudgetWithEntriesDataAttributesEntriesItems", + "v2.budget_with_entries_data_attributes_entries_items_costs" => "BudgetWithEntriesDataAttributesEntriesItemsCosts", "v2.budget_with_entries_data_attributes_entries_items_tag_filters_items" => "BudgetWithEntriesDataAttributesEntriesItemsTagFiltersItems", "v2.budget_with_entries_data_type" => "BudgetWithEntriesDataType", "v2.bulk_delete_apps_datastore_items_request" => "BulkDeleteAppsDatastoreItemsRequest", 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 4462f1cb5a4a..39924d02881d 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 @@ -967,10 +967,14 @@ def get_budget(budget_id, opts = {}) # Get budget. # - # Get a budget + # Get a budget by ID. Pass `actual=true` or `forecast=true` to include cost data in the response. Use `start` and `end` (millisecond epochs, both required) to set the cost window. When `forecast=true`, each entry also includes `ootb_forecast` (the ML forecast before overrides) and `custom_forecast` (`null` if no override is set, a number if one is). # # @param budget_id [String] Budget id. # @param opts [Hash] the optional parameters + # @option opts [Boolean] :actual When `true`, includes actual cost data in the response. + # @option opts [Boolean] :forecast When `true`, includes forecast cost data in the response, including `ootb_forecast` and `custom_forecast` per entry. + # @option opts [Integer] :start Start of the cost window in milliseconds since epoch. Must be used together with `end`. + # @option opts [Integer] :_end End of the cost window in milliseconds since epoch. Must be used together with `start`. # @return [Array<(BudgetWithEntries, Integer, Hash)>] BudgetWithEntries data, response status code and response headers def get_budget_with_http_info(budget_id, opts = {}) @@ -986,6 +990,10 @@ def get_budget_with_http_info(budget_id, opts = {}) # query parameters query_params = opts[:query_params] || {} + query_params[:'actual'] = opts[:'actual'] if !opts[:'actual'].nil? + query_params[:'forecast'] = opts[:'forecast'] if !opts[:'forecast'].nil? + query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil? + query_params[:'end'] = opts[:'_end'] if !opts[:'_end'].nil? # header parameters header_params = opts[:header_params] || {} diff --git a/lib/datadog_api_client/v2/models/budget_attributes.rb b/lib/datadog_api_client/v2/models/budget_attributes.rb index 9c900f3f0fe9..35cd02a34d54 100644 --- a/lib/datadog_api_client/v2/models/budget_attributes.rb +++ b/lib/datadog_api_client/v2/models/budget_attributes.rb @@ -21,6 +21,18 @@ module DatadogAPIClient::V2 class BudgetAttributes include BaseGenericModel + # Aggregated cost data for the budget over the requested period. + attr_accessor :costs + + # The end of the period used to compute cost data, in milliseconds since epoch. + attr_accessor :costs_period_end + + # The start of the period used to compute cost data, in milliseconds since epoch. + attr_accessor :costs_period_start + + # The unit used for all cost values in the response. + attr_accessor :costs_unit + # The timestamp when the budget was created. attr_accessor :created_at @@ -60,6 +72,10 @@ class BudgetAttributes # @!visibility private def self.attribute_map { + :'costs' => :'costs', + :'costs_period_end' => :'costs_period_end', + :'costs_period_start' => :'costs_period_start', + :'costs_unit' => :'costs_unit', :'created_at' => :'created_at', :'created_by' => :'created_by', :'end_month' => :'end_month', @@ -78,6 +94,10 @@ def self.attribute_map # @!visibility private def self.openapi_types { + :'costs' => :'BudgetAttributesCosts', + :'costs_period_end' => :'Integer', + :'costs_period_start' => :'Integer', + :'costs_unit' => :'BudgetAttributesCostsUnit', :'created_at' => :'Integer', :'created_by' => :'String', :'end_month' => :'Integer', @@ -110,6 +130,22 @@ def initialize(attributes = {}) end } + if attributes.key?(:'costs') + self.costs = attributes[:'costs'] + end + + if attributes.key?(:'costs_period_end') + self.costs_period_end = attributes[:'costs_period_end'] + end + + if attributes.key?(:'costs_period_start') + self.costs_period_start = attributes[:'costs_period_start'] + end + + if attributes.key?(:'costs_unit') + self.costs_unit = attributes[:'costs_unit'] + end + if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end @@ -183,6 +219,10 @@ def to_hash def ==(o) return true if self.equal?(o) self.class == o.class && + costs == o.costs && + costs_period_end == o.costs_period_end && + costs_period_start == o.costs_period_start && + costs_unit == o.costs_unit && created_at == o.created_at && created_by == o.created_by && end_month == o.end_month && @@ -201,7 +241,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [created_at, created_by, end_month, entries, metrics_query, name, org_id, start_month, total_amount, updated_at, updated_by, additional_properties].hash + [costs, costs_period_end, costs_period_start, costs_unit, created_at, created_by, end_month, entries, metrics_query, name, org_id, start_month, total_amount, updated_at, updated_by, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/budget_attributes_costs.rb b/lib/datadog_api_client/v2/models/budget_attributes_costs.rb new file mode 100644 index 000000000000..8647145dc216 --- /dev/null +++ b/lib/datadog_api_client/v2/models/budget_attributes_costs.rb @@ -0,0 +1,146 @@ +=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 + # Aggregated cost data for the budget over the requested period. + class BudgetAttributesCosts + include BaseGenericModel + + # The total actual cost. Present only when `actual=true` is requested. + attr_accessor :actual + + # The total budgeted amount over the requested period. + attr_accessor :amount + + # The total forecast cost, with any custom forecast overrides applied. Present only when `forecast=true` is requested. + attr_accessor :forecast + + # The out-of-the-box ML forecast before custom overrides. Present only when `forecast=true` is requested. + attr_accessor :ootb_forecast + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'actual' => :'actual', + :'amount' => :'amount', + :'forecast' => :'forecast', + :'ootb_forecast' => :'ootb_forecast' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'actual' => :'Float', + :'amount' => :'Float', + :'forecast' => :'Float', + :'ootb_forecast' => :'Float' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'actual', + :'amount', + :'forecast', + :'ootb_forecast', + ]) + 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::BudgetAttributesCosts` 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?(:'actual') + self.actual = attributes[:'actual'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'forecast') + self.forecast = attributes[:'forecast'] + end + + if attributes.key?(:'ootb_forecast') + self.ootb_forecast = attributes[:'ootb_forecast'] + end + 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 && + actual == o.actual && + amount == o.amount && + forecast == o.forecast && + ootb_forecast == o.ootb_forecast && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [actual, amount, forecast, ootb_forecast, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/budget_attributes_costs_unit.rb b/lib/datadog_api_client/v2/models/budget_attributes_costs_unit.rb new file mode 100644 index 000000000000..eba47212653a --- /dev/null +++ b/lib/datadog_api_client/v2/models/budget_attributes_costs_unit.rb @@ -0,0 +1,155 @@ +=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 unit used for all cost values in the response. + class BudgetAttributesCostsUnit + include BaseGenericModel + + # The unit family (for example, `currency`). + attr_accessor :family + + # The unique identifier for the unit. + attr_accessor :id + + # The full name of the unit. + attr_accessor :name + + # The plural form of the unit name. + attr_accessor :plural + + # The scale factor applied to raw cost values. + attr_accessor :scale_factor + + # The abbreviated unit name. + attr_accessor :short_name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'family' => :'family', + :'id' => :'id', + :'name' => :'name', + :'plural' => :'plural', + :'scale_factor' => :'scale_factor', + :'short_name' => :'short_name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'family' => :'String', + :'id' => :'String', + :'name' => :'String', + :'plural' => :'String', + :'scale_factor' => :'Float', + :'short_name' => :'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::BudgetAttributesCostsUnit` 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?(:'family') + self.family = attributes[:'family'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'plural') + self.plural = attributes[:'plural'] + end + + if attributes.key?(:'scale_factor') + self.scale_factor = attributes[:'scale_factor'] + end + + if attributes.key?(:'short_name') + self.short_name = attributes[:'short_name'] + end + 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 && + family == o.family && + id == o.id && + name == o.name && + plural == o.plural && + scale_factor == o.scale_factor && + short_name == o.short_name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [family, id, name, plural, scale_factor, short_name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/budget_with_entries_data_attributes_entries_items.rb b/lib/datadog_api_client/v2/models/budget_with_entries_data_attributes_entries_items.rb index 40f85f31190e..2c2cdbbc17be 100644 --- a/lib/datadog_api_client/v2/models/budget_with_entries_data_attributes_entries_items.rb +++ b/lib/datadog_api_client/v2/models/budget_with_entries_data_attributes_entries_items.rb @@ -24,6 +24,9 @@ class BudgetWithEntriesDataAttributesEntriesItems # The budgeted amount for this entry. attr_accessor :amount + # Cost data for a single budget entry. + attr_accessor :costs + # The month this budget entry applies to, in YYYYMM format. attr_accessor :month @@ -37,6 +40,7 @@ class BudgetWithEntriesDataAttributesEntriesItems def self.attribute_map { :'amount' => :'amount', + :'costs' => :'costs', :'month' => :'month', :'tag_filters' => :'tag_filters' } @@ -47,6 +51,7 @@ def self.attribute_map def self.openapi_types { :'amount' => :'Float', + :'costs' => :'BudgetWithEntriesDataAttributesEntriesItemsCosts', :'month' => :'Integer', :'tag_filters' => :'Array' } @@ -74,6 +79,10 @@ def initialize(attributes = {}) self.amount = attributes[:'amount'] end + if attributes.key?(:'costs') + self.costs = attributes[:'costs'] + end + if attributes.key?(:'month') self.month = attributes[:'month'] end @@ -112,6 +121,7 @@ def ==(o) return true if self.equal?(o) self.class == o.class && amount == o.amount && + costs == o.costs && month == o.month && tag_filters == o.tag_filters && additional_properties == o.additional_properties @@ -121,7 +131,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [amount, month, tag_filters, additional_properties].hash + [amount, costs, month, tag_filters, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/budget_with_entries_data_attributes_entries_items_costs.rb b/lib/datadog_api_client/v2/models/budget_with_entries_data_attributes_entries_items_costs.rb new file mode 100644 index 000000000000..8cecd3750c3f --- /dev/null +++ b/lib/datadog_api_client/v2/models/budget_with_entries_data_attributes_entries_items_costs.rb @@ -0,0 +1,157 @@ +=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 + # Cost data for a single budget entry. + class BudgetWithEntriesDataAttributesEntriesItemsCosts + include BaseGenericModel + + # The actual cost for this entry. Present only when `actual=true` is requested. + attr_accessor :actual + + # The budgeted amount for this entry. + attr_accessor :amount + + # The custom forecast override for this entry. `null` when `forecast=true` is requested but no custom forecast has been set for this entry's month. A numeric value, including `0`, indicates an explicit custom forecast override. Omitted when `forecast=false` or the feature is not available for the organization. + attr_accessor :custom_forecast + + # The final forecast for this entry, with any custom forecast override applied. Present only when `forecast=true` is requested. + attr_accessor :forecast + + # The out-of-the-box ML forecast for this entry, before custom overrides. Present only when `forecast=true` is requested. + attr_accessor :ootb_forecast + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'actual' => :'actual', + :'amount' => :'amount', + :'custom_forecast' => :'custom_forecast', + :'forecast' => :'forecast', + :'ootb_forecast' => :'ootb_forecast' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'actual' => :'Float', + :'amount' => :'Float', + :'custom_forecast' => :'Float', + :'forecast' => :'Float', + :'ootb_forecast' => :'Float' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'actual', + :'amount', + :'custom_forecast', + :'forecast', + :'ootb_forecast', + ]) + 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::BudgetWithEntriesDataAttributesEntriesItemsCosts` 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?(:'actual') + self.actual = attributes[:'actual'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'custom_forecast') + self.custom_forecast = attributes[:'custom_forecast'] + end + + if attributes.key?(:'forecast') + self.forecast = attributes[:'forecast'] + end + + if attributes.key?(:'ootb_forecast') + self.ootb_forecast = attributes[:'ootb_forecast'] + end + 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 && + actual == o.actual && + amount == o.amount && + custom_forecast == o.custom_forecast && + forecast == o.forecast && + ootb_forecast == o.ootb_forecast && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [actual, amount, custom_forecast, forecast, ootb_forecast, additional_properties].hash + end + end +end