Skip to content

Commit 8f15dcc

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

File tree

5 files changed

+69
-0
lines changed

5 files changed

+69
-0
lines changed

.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

docs/datadog_api_client.v2.model.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5772,6 +5772,13 @@ datadog\_api\_client.v2.model.convert\_job\_results\_to\_signals\_request module
57725772
:members:
57735773
:show-inheritance:
57745774

5775+
datadog\_api\_client.v2.model.cost\_aggregation\_type module
5776+
------------------------------------------------------------
5777+
5778+
.. automodule:: datadog_api_client.v2.model.cost_aggregation_type
5779+
:members:
5780+
:show-inheritance:
5781+
57755782
datadog\_api\_client.v2.model.cost\_attribution\_aggregates\_body module
57765783
------------------------------------------------------------------------
57775784

src/datadog_api_client/v2/api/usage_metering_api.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
)
2222
from datadog_api_client.v2.model.billing_dimensions_mapping_response import BillingDimensionsMappingResponse
2323
from datadog_api_client.v2.model.cost_by_org_response import CostByOrgResponse
24+
from datadog_api_client.v2.model.cost_aggregation_type import CostAggregationType
2425
from datadog_api_client.v2.model.hourly_usage_response import HourlyUsageResponse
2526
from datadog_api_client.v2.model.usage_lambda_traced_invocations_response import UsageLambdaTracedInvocationsResponse
2627
from datadog_api_client.v2.model.usage_observability_pipelines_response import UsageObservabilityPipelinesResponse
@@ -153,6 +154,11 @@ def __init__(self, api_client=None):
153154
"attribute": "end_date",
154155
"location": "query",
155156
},
157+
"cost_aggregation": {
158+
"openapi_types": (CostAggregationType,),
159+
"attribute": "cost_aggregation",
160+
"location": "query",
161+
},
156162
"include_connected_accounts": {
157163
"openapi_types": (bool,),
158164
"attribute": "include_connected_accounts",
@@ -536,6 +542,7 @@ def get_estimated_cost_by_org(
536542
end_month: Union[datetime, UnsetType] = unset,
537543
start_date: Union[datetime, UnsetType] = unset,
538544
end_date: Union[datetime, UnsetType] = unset,
545+
cost_aggregation: Union[CostAggregationType, UnsetType] = unset,
539546
include_connected_accounts: Union[bool, UnsetType] = unset,
540547
) -> CostByOrgResponse:
541548
"""Get estimated cost across your account.
@@ -557,6 +564,8 @@ def get_estimated_cost_by_org(
557564
:type start_date: datetime, optional
558565
:param end_date: Datetime in ISO-8601 format, UTC, precise to day: ``[YYYY-MM-DD]`` for cost ending this day.
559566
:type end_date: datetime, optional
567+
:param cost_aggregation: Controls how costs are aggregated when using ``start_date``. The ``cumulative`` option returns month-to-date running totals.
568+
:type cost_aggregation: CostAggregationType, optional
560569
:param 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``.
561570
:type include_connected_accounts: bool, optional
562571
:rtype: CostByOrgResponse
@@ -577,6 +586,9 @@ def get_estimated_cost_by_org(
577586
if end_date is not unset:
578587
kwargs["end_date"] = end_date
579588

589+
if cost_aggregation is not unset:
590+
kwargs["cost_aggregation"] = cost_aggregation
591+
580592
if include_connected_accounts is not unset:
581593
kwargs["include_connected_accounts"] = include_connected_accounts
582594

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
7+
from datadog_api_client.model_utils import (
8+
ModelSimple,
9+
cached_property,
10+
)
11+
12+
from typing import ClassVar
13+
14+
15+
class CostAggregationType(ModelSimple):
16+
"""
17+
Controls how costs are aggregated when using `start_date`. The `cumulative` option returns month-to-date running totals.
18+
19+
:param value: If omitted defaults to "cumulative". Must be one of ["cumulative"].
20+
:type value: str
21+
"""
22+
23+
allowed_values = {
24+
"cumulative",
25+
}
26+
CUMULATIVE: ClassVar["CostAggregationType"]
27+
28+
@cached_property
29+
def openapi_types(_):
30+
return {
31+
"value": (str,),
32+
}
33+
34+
35+
CostAggregationType.CUMULATIVE = CostAggregationType("cumulative")

src/datadog_api_client/v2/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,7 @@
10951095
from datadog_api_client.v2.model.convert_job_results_to_signals_data import ConvertJobResultsToSignalsData
10961096
from datadog_api_client.v2.model.convert_job_results_to_signals_data_type import ConvertJobResultsToSignalsDataType
10971097
from datadog_api_client.v2.model.convert_job_results_to_signals_request import ConvertJobResultsToSignalsRequest
1098+
from datadog_api_client.v2.model.cost_aggregation_type import CostAggregationType
10981099
from datadog_api_client.v2.model.cost_attribution_aggregates_body import CostAttributionAggregatesBody
10991100
from datadog_api_client.v2.model.cost_attribution_tag_names import CostAttributionTagNames
11001101
from datadog_api_client.v2.model.cost_attribution_type import CostAttributionType
@@ -7453,6 +7454,7 @@
74537454
"ConvertJobResultsToSignalsData",
74547455
"ConvertJobResultsToSignalsDataType",
74557456
"ConvertJobResultsToSignalsRequest",
7457+
"CostAggregationType",
74567458
"CostAttributionAggregatesBody",
74577459
"CostAttributionTagNames",
74587460
"CostAttributionType",

0 commit comments

Comments
 (0)