Skip to content

Commit 0f0854d

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add cost_aggregation parameter to GetEstimatedCostByOrg (#3146)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent e7344e3 commit 0f0854d

5 files changed

Lines changed: 47 additions & 0 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13902,6 +13902,13 @@ components:
1390213902
data:
1390313903
$ref: "#/components/schemas/ConvertJobResultsToSignalsData"
1390413904
type: object
13905+
CostAggregationType:
13906+
description: "Controls how costs are aggregated when using `start_date`. The `cumulative` option returns month-to-date running totals."
13907+
enum:
13908+
- cumulative
13909+
type: string
13910+
x-enum-varnames:
13911+
- CUMULATIVE
1390513912
CostAttributionAggregates:
1390613913
description: An array of available aggregates.
1390713914
items:
@@ -108698,6 +108705,12 @@ paths:
108698108705
schema:
108699108706
format: date-time
108700108707
type: string
108708+
- description: "Controls how costs are aggregated when using `start_date`. The `cumulative` option returns month-to-date running totals."
108709+
in: query
108710+
name: cost_aggregation
108711+
required: false
108712+
schema:
108713+
$ref: "#/components/schemas/CostAggregationType"
108701108714
- description: "Boolean to specify whether to include accounts connected to the current account as partner customers in the Datadog partner network program. Defaults to `false`."
108702108715
in: query
108703108716
name: include_connected_accounts

features/scenarios_model_mapping.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,6 +1955,7 @@
19551955
"end_month" => "Time",
19561956
"start_date" => "Time",
19571957
"end_date" => "Time",
1958+
"cost_aggregation" => "CostAggregationType",
19581959
"include_connected_accounts" => "Boolean",
19591960
},
19601961
"v2.GetHistoricalCostByOrg" => {

lib/datadog_api_client/inflector.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,6 +1822,7 @@ def overrides
18221822
"v2.convert_job_results_to_signals_data" => "ConvertJobResultsToSignalsData",
18231823
"v2.convert_job_results_to_signals_data_type" => "ConvertJobResultsToSignalsDataType",
18241824
"v2.convert_job_results_to_signals_request" => "ConvertJobResultsToSignalsRequest",
1825+
"v2.cost_aggregation_type" => "CostAggregationType",
18251826
"v2.cost_attribution_aggregates_body" => "CostAttributionAggregatesBody",
18261827
"v2.cost_attribution_type" => "CostAttributionType",
18271828
"v2.cost_by_org" => "CostByOrg",

lib/datadog_api_client/v2/api/usage_metering_api.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,18 @@ def get_estimated_cost_by_org(opts = {})
250250
# @option opts [Time] :end_month Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for cost ending this month.
251251
# @option opts [Time] :start_date Datetime in ISO-8601 format, UTC, precise to day: `[YYYY-MM-DD]` for cost beginning this day. **Either start_month or start_date should be specified, but not both.** (start_date cannot go beyond two months in the past). Provide an `end_date` to view day-over-day cumulative cost.
252252
# @option opts [Time] :end_date Datetime in ISO-8601 format, UTC, precise to day: `[YYYY-MM-DD]` for cost ending this day.
253+
# @option opts [CostAggregationType] :cost_aggregation Controls how costs are aggregated when using `start_date`. The `cumulative` option returns month-to-date running totals.
253254
# @option opts [Boolean] :include_connected_accounts Boolean to specify whether to include accounts connected to the current account as partner customers in the Datadog partner network program. Defaults to `false`.
254255
# @return [Array<(CostByOrgResponse, Integer, Hash)>] CostByOrgResponse data, response status code and response headers
255256
def get_estimated_cost_by_org_with_http_info(opts = {})
256257

257258
if @api_client.config.debugging
258259
@api_client.config.logger.debug 'Calling API: UsageMeteringAPI.get_estimated_cost_by_org ...'
259260
end
261+
allowable_values = ['cumulative']
262+
if @api_client.config.client_side_validation && opts[:'cost_aggregation'] && !allowable_values.include?(opts[:'cost_aggregation'])
263+
fail ArgumentError, "invalid value for \"cost_aggregation\", must be one of #{allowable_values}"
264+
end
260265
# resource path
261266
local_var_path = '/api/v2/usage/estimated_cost'
262267

@@ -267,6 +272,7 @@ def get_estimated_cost_by_org_with_http_info(opts = {})
267272
query_params[:'end_month'] = opts[:'end_month'] if !opts[:'end_month'].nil?
268273
query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?
269274
query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?
275+
query_params[:'cost_aggregation'] = opts[:'cost_aggregation'] if !opts[:'cost_aggregation'].nil?
270276
query_params[:'include_connected_accounts'] = opts[:'include_connected_accounts'] if !opts[:'include_connected_accounts'].nil?
271277

272278
# header parameters
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
=begin
2+
#Datadog API V2 Collection
3+
4+
#Collection of all Datadog Public endpoints.
5+
6+
The version of the OpenAPI document: 1.0
7+
Contact: support@datadoghq.com
8+
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
9+
10+
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
11+
This product includes software developed at Datadog (https://www.datadoghq.com/).
12+
Copyright 2020-Present Datadog, Inc.
13+
14+
=end
15+
16+
require 'date'
17+
require 'time'
18+
19+
module DatadogAPIClient::V2
20+
# Controls how costs are aggregated when using `start_date`. The `cumulative` option returns month-to-date running totals.
21+
class CostAggregationType
22+
include BaseEnumModel
23+
24+
CUMULATIVE = "cumulative".freeze
25+
end
26+
end

0 commit comments

Comments
 (0)