Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29597,6 +29597,10 @@ components:
CustomCostsFileMetadata:
description: Schema of a Custom Costs metadata.
properties:
ai_provider:
description: Whether the Custom Costs file contains the costs of an AI provider.
example: false
type: boolean
billed_cost:
description: Total cost in the cost file.
example: 100.50
Expand Down Expand Up @@ -29646,6 +29650,10 @@ components:
CustomCostsFileMetadataWithContent:
description: Schema of a cost file's metadata.
properties:
ai_provider:
description: Whether the Custom Costs file contains the costs of an AI provider.
example: false
type: boolean
billed_cost:
description: Total cost in the cost file.
example: 100.50
Expand Down Expand Up @@ -162449,6 +162457,7 @@ paths:
value:
data:
- attributes:
ai_provider: false
billed_cost: 100.5
billing_currency: USD
charge_period:
Expand Down Expand Up @@ -162496,6 +162505,14 @@ paths:
put:
description: Upload a Custom Costs file.
operationId: UploadCustomCostsFile
parameters:
- description: Whether the uploaded file contains the costs of an AI provider.
in: query
name: ai_provider
required: false
schema:
default: false
type: boolean
requestBody:
content:
application/json:
Expand All @@ -162519,6 +162536,7 @@ paths:
value:
data:
attributes:
ai_provider: false
billed_cost: 100.5
billing_currency: USD
charge_period:
Expand Down Expand Up @@ -162607,6 +162625,7 @@ paths:
value:
data:
attributes:
ai_provider: false
billed_cost: 100.5
billing_currency: USD
charge_period:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Upload Custom Costs file marked as an AI provider file returns "Accepted" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new

body = [
DatadogAPIClient::V2::CustomCostsFileLineItem.new({
provider_name: "my_ai_provider",
charge_period_start: "2026-10-01",
charge_period_end: "2026-10-31",
charge_description: "my_description",
billed_cost: 250,
billing_currency: "USD",
}),
]
opts = {
ai_provider: true,
}
p api_instance.upload_custom_costs_file(body, opts)
1 change: 1 addition & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3051,6 +3051,7 @@
"sort" => "String",
},
"v2.UploadCustomCostsFile" => {
"ai_provider" => "Boolean",
"body" => "Array<CustomCostsFileLineItem>",
},
"v2.DeleteCustomCostsFile" => {
Expand Down
9 changes: 9 additions & 0 deletions features/v2/cloud_cost_management.feature
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,15 @@ Feature: Cloud Cost Management
Then the response status is 202 Accepted
And the response "data.attributes.name" is equal to "data.json"

@team:ddoghq/cloud-cost-management
Scenario: Upload Custom Costs file marked as an AI provider file returns "Accepted" response
Given new "UploadCustomCostsFile" request
And request contains "ai_provider" parameter with value true
And body with value [{"ProviderName": "my_ai_provider", "ChargePeriodStart": "2026-10-01", "ChargePeriodEnd": "2026-10-31", "ChargeDescription": "my_description", "BilledCost": 250, "BillingCurrency": "USD"}]
When the request is sent
Then the response status is 202 Accepted
And the response "data.attributes.ai_provider" is equal to true

@generated @skip @team:ddoghq/cloud-cost-management
Scenario: Upload Custom Costs file returns "Accepted" response
Given new "UploadCustomCostsFile" request
Expand Down
7 changes: 7 additions & 0 deletions generated-test/test-runner-data/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4431,6 +4431,13 @@
"scenario": "Upload Custom Costs File returns \"Accepted\" response",
"version": "v2"
},
{
"feature": "Cloud Cost Management",
"feature_file": "../../features/v2/cloud_cost_management.feature",
"file": "v2/cloud-cost-management/upload-custom-costs-file-marked-as-an-ai-provider-file-returns-accepted-response.json",
"scenario": "Upload Custom Costs file marked as an AI provider file returns \"Accepted\" response",
"version": "v2"
},
{
"feature": "Cloud Cost Management",
"feature_file": "../../features/v2/cloud_cost_management.feature",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"api": "CloudCostManagement",
"expected_status": 202,
"feature": "Cloud Cost Management",
"id": "v2/Cloud Cost Management/Upload Custom Costs file marked as an AI provider file returns \"Accepted\" response",
"operation_id": "UploadCustomCostsFile",
"request": {
"body": {
"schema": {
"format": null,
"items": {
"format": null,
"ref": "CustomCostsFileLineItem",
"type": "object"
},
"ref": "CustomCostsFileUploadRequest",
"type": "array"
},
"source": "inline",
"value": [
{
"BilledCost": 250,
"BillingCurrency": "USD",
"ChargeDescription": "my_description",
"ChargePeriodEnd": "2026-10-31",
"ChargePeriodStart": "2026-10-01",
"ProviderName": "my_ai_provider"
}
]
},
"content_type": "application/json",
"method": "PUT",
"pagination": false,
"parameters": [
{
"explode": null,
"in": "query",
"name": "ai_provider",
"required": false,
"schema": {
"format": null,
"ref": null,
"type": "boolean"
},
"source": {
"type": "literal",
"value": true
},
"style": null
}
],
"path": "/api/v2/cost/custom_costs"
},
"scenario": "Upload Custom Costs file marked as an AI provider file returns \"Accepted\" response",
"schema_version": 1,
"version": "v2"
}
45 changes: 45 additions & 0 deletions generated-test/test-server-data/v2/cloud-cost-management.json
Original file line number Diff line number Diff line change
Expand Up @@ -2240,6 +2240,51 @@
"scenario": "Upload Custom Costs File returns \"Accepted\" response",
"version": "v2"
},
{
"feature": "Cloud Cost Management",
"frozen_at": "2026-11-02T15:43:51.566Z",
"interactions": [
{
"request": {
"body": {
"type": "json",
"value": [
{
"BilledCost": 250,
"BillingCurrency": "USD",
"ChargeDescription": "my_description",
"ChargePeriodEnd": "2026-10-31",
"ChargePeriodStart": "2026-10-01",
"ProviderName": "my_ai_provider"
}
]
},
"content_type": "application/json",
"method": "PUT",
"path": "/api/v2/cost/custom_costs",
"query": [
[
"ai_provider",
"true"
]
]
},
"response": {
"body": {
"encoding": "text",
"value": "{\"data\":{\"id\":\"495fb2db-ee1e-4656-8914-6db06370bf74\",\"type\":\"cost_metadata\",\"attributes\":{\"ai_provider\":true,\"billed_cost\":250,\"billing_currency\":\"USD\",\"charge_period\":{\"start\":1790812800000,\"end\":1793404800000},\"name\":\"data.json\",\"provider_names\":[\"my_ai_provider\"],\"status\":\"UPLOADING\",\"uploaded_at\":1793634232151,\"uploaded_by\":{\"name\":\"C\u00e9dric Van Rompay\",\"icon\":\"https://secure.gravatar.com/avatar/fb5991514ab909a799dd362ad990f4f8?d=retro\\u0026s=48\",\"email\":\"cedric.vanrompay@datadoghq.com\"}}},\"meta\":{\"version\":\"1.0\"}}"
},
"headers": {
"content-type": "application/vnd.api+json"
},
"reason": "Accepted",
"status": 202
}
}
],
"scenario": "Upload Custom Costs file marked as an AI provider file returns \"Accepted\" response",
"version": "v2"
},
{
"feature": "Cloud Cost Management",
"frozen_at": "2025-08-13T18:09:22.298Z",
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog_api_client/v2/api/cloud_cost_management_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5098,6 +5098,7 @@ def upload_custom_costs_file(body, opts = {})
#
# @param body [Array<CustomCostsFileLineItem>]
# @param opts [Hash] the optional parameters
# @option opts [Boolean] :ai_provider Whether the uploaded file contains the costs of an AI provider.
# @return [Array<(CustomCostsFileUploadResponse, Integer, Hash)>] CustomCostsFileUploadResponse data, response status code and response headers
def upload_custom_costs_file_with_http_info(body, opts = {})

Expand All @@ -5113,6 +5114,7 @@ def upload_custom_costs_file_with_http_info(body, opts = {})

# query parameters
query_params = opts[:query_params] || {}
query_params[:'ai_provider'] = opts[:'ai_provider'] if !opts[:'ai_provider'].nil?

# header parameters
header_params = opts[:header_params] || {}
Expand Down
12 changes: 11 additions & 1 deletion lib/datadog_api_client/v2/models/custom_costs_file_metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ module DatadogAPIClient::V2
class CustomCostsFileMetadata
include BaseGenericModel

# Whether the Custom Costs file contains the costs of an AI provider.
attr_accessor :ai_provider

# Total cost in the cost file.
attr_accessor :billed_cost

Expand Down Expand Up @@ -51,6 +54,7 @@ class CustomCostsFileMetadata
# @!visibility private
def self.attribute_map
{
:'ai_provider' => :'ai_provider',
:'billed_cost' => :'billed_cost',
:'billing_currency' => :'billing_currency',
:'charge_period' => :'charge_period',
Expand All @@ -66,6 +70,7 @@ def self.attribute_map
# @!visibility private
def self.openapi_types
{
:'ai_provider' => :'Boolean',
:'billed_cost' => :'Float',
:'billing_currency' => :'String',
:'charge_period' => :'CustomCostsFileUsageChargePeriod',
Expand Down Expand Up @@ -95,6 +100,10 @@ def initialize(attributes = {})
end
}

if attributes.key?(:'ai_provider')
self.ai_provider = attributes[:'ai_provider']
end

if attributes.key?(:'billed_cost')
self.billed_cost = attributes[:'billed_cost']
end
Expand Down Expand Up @@ -156,6 +165,7 @@ def to_hash
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
ai_provider == o.ai_provider &&
billed_cost == o.billed_cost &&
billing_currency == o.billing_currency &&
charge_period == o.charge_period &&
Expand All @@ -171,7 +181,7 @@ def ==(o)
# @return [Integer] Hash code
# @!visibility private
def hash
[billed_cost, billing_currency, charge_period, name, provider_names, status, uploaded_at, uploaded_by, additional_properties].hash
[ai_provider, billed_cost, billing_currency, charge_period, name, provider_names, status, uploaded_at, uploaded_by, additional_properties].hash
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ module DatadogAPIClient::V2
class CustomCostsFileMetadataWithContent
include BaseGenericModel

# Whether the Custom Costs file contains the costs of an AI provider.
attr_accessor :ai_provider

# Total cost in the cost file.
attr_accessor :billed_cost

Expand Down Expand Up @@ -54,6 +57,7 @@ class CustomCostsFileMetadataWithContent
# @!visibility private
def self.attribute_map
{
:'ai_provider' => :'ai_provider',
:'billed_cost' => :'billed_cost',
:'billing_currency' => :'billing_currency',
:'charge_period' => :'charge_period',
Expand All @@ -70,6 +74,7 @@ def self.attribute_map
# @!visibility private
def self.openapi_types
{
:'ai_provider' => :'Boolean',
:'billed_cost' => :'Float',
:'billing_currency' => :'String',
:'charge_period' => :'CustomCostsFileUsageChargePeriod',
Expand Down Expand Up @@ -100,6 +105,10 @@ def initialize(attributes = {})
end
}

if attributes.key?(:'ai_provider')
self.ai_provider = attributes[:'ai_provider']
end

if attributes.key?(:'billed_cost')
self.billed_cost = attributes[:'billed_cost']
end
Expand Down Expand Up @@ -167,6 +176,7 @@ def to_hash
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
ai_provider == o.ai_provider &&
billed_cost == o.billed_cost &&
billing_currency == o.billing_currency &&
charge_period == o.charge_period &&
Expand All @@ -183,7 +193,7 @@ def ==(o)
# @return [Integer] Hash code
# @!visibility private
def hash
[billed_cost, billing_currency, charge_period, content, name, provider_names, status, uploaded_at, uploaded_by, additional_properties].hash
[ai_provider, billed_cost, billing_currency, charge_period, content, name, provider_names, status, uploaded_at, uploaded_by, additional_properties].hash
end
end
end
Loading