Skip to content

Commit a0963b9

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Mark Cost Attribution end_month parameter as not required (#2181)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent f5e98f5 commit a0963b9

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-10-10 19:45:55.876636",
8-
"spec_repo_commit": "049920eb"
7+
"regenerated": "2024-10-16 20:07:16.049805",
8+
"spec_repo_commit": "86072741"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-10-10 19:45:55.894524",
13-
"spec_repo_commit": "049920eb"
12+
"regenerated": "2024-10-16 20:07:16.068600",
13+
"spec_repo_commit": "86072741"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28730,7 +28730,7 @@ paths:
2873028730
for cost ending this month.'
2873128731
in: query
2873228732
name: end_month
28733-
required: true
28733+
required: false
2873428734
schema:
2873528735
format: date-time
2873628736
type: string

src/datadog_api_client/v2/api/usage_metering_api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ def __init__(self, api_client=None):
259259
"location": "query",
260260
},
261261
"end_month": {
262-
"required": True,
263262
"openapi_types": (datetime,),
264263
"attribute": "end_month",
265264
"location": "query",
@@ -627,9 +626,9 @@ def get_hourly_usage(
627626
def get_monthly_cost_attribution(
628627
self,
629628
start_month: datetime,
630-
end_month: datetime,
631629
fields: str,
632630
*,
631+
end_month: Union[datetime, UnsetType] = unset,
633632
sort_direction: Union[SortDirection, UnsetType] = unset,
634633
sort_name: Union[str, UnsetType] = unset,
635634
tag_breakdown_keys: Union[str, UnsetType] = unset,
@@ -658,14 +657,14 @@ def get_monthly_cost_attribution(
658657
659658
:param start_month: Datetime in ISO-8601 format, UTC, precise to month: ``[YYYY-MM]`` for cost beginning in this month.
660659
:type start_month: datetime
661-
:param end_month: Datetime in ISO-8601 format, UTC, precise to month: ``[YYYY-MM]`` for cost ending this month.
662-
:type end_month: datetime
663660
:param fields: Comma-separated list specifying cost types (e.g., ``<billing_dimension>_on_demand_cost`` , ``<billing_dimension>_committed_cost`` , ``<billing_dimension>_total_cost`` ) and the
664661
proportions ( ``<billing_dimension>_percentage_in_org`` , ``<billing_dimension>_percentage_in_account`` ). Use ``*`` to retrieve all fields.
665662
Example: ``infra_host_on_demand_cost,infra_host_percentage_in_account``
666663
To obtain the complete list of active billing dimensions that can be used to replace
667664
``<billing_dimension>`` in the field names, make a request to the `Get active billing dimensions API <https://docs.datadoghq.com/api/latest/usage-metering/#get-active-billing-dimensions-for-cost-attribution>`_.
668665
:type fields: str
666+
:param end_month: Datetime in ISO-8601 format, UTC, precise to month: ``[YYYY-MM]`` for cost ending this month.
667+
:type end_month: datetime, optional
669668
:param sort_direction: The direction to sort by: ``[desc, asc]``.
670669
:type sort_direction: SortDirection, optional
671670
:param sort_name: The billing dimension to sort by. Always sorted by total cost. Example: ``infra_host``.
@@ -682,7 +681,8 @@ def get_monthly_cost_attribution(
682681
kwargs: Dict[str, Any] = {}
683682
kwargs["start_month"] = start_month
684683

685-
kwargs["end_month"] = end_month
684+
if end_month is not unset:
685+
kwargs["end_month"] = end_month
686686

687687
kwargs["fields"] = fields
688688

tests/v2/features/usage_metering.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ Feature: Usage Metering
1919
Given operation "GetMonthlyCostAttribution" enabled
2020
And new "GetMonthlyCostAttribution" request
2121
And request contains "start_month" parameter with value "{{ timeISO('now - 5d') }}"
22-
And request contains "end_month" parameter with value "{{ timeISO('now - 3d') }}"
2322
And request contains "fields" parameter with value "not_a_product"
23+
And request contains "end_month" parameter with value "{{ timeISO('now - 3d') }}"
2424
When the request is sent
2525
Then the response status is 400 Bad Request
2626

@@ -29,8 +29,8 @@ Feature: Usage Metering
2929
Given operation "GetMonthlyCostAttribution" enabled
3030
And new "GetMonthlyCostAttribution" request
3131
And request contains "start_month" parameter with value "{{ timeISO('now - 5d') }}"
32-
And request contains "end_month" parameter with value "{{ timeISO('now - 3d') }}"
3332
And request contains "fields" parameter with value "infra_host_total_cost"
33+
And request contains "end_month" parameter with value "{{ timeISO('now - 3d') }}"
3434
When the request is sent
3535
Then the response status is 200 OK
3636

0 commit comments

Comments
 (0)