Skip to content

Commit c715b8f

Browse files
dd-octo-sts[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit e676f0f of spec repo (#4302)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent b0dfc8c commit c715b8f

15 files changed

Lines changed: 623 additions & 0 deletions

‎.generator/schemas/v2/openapi.yaml‎

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34932,6 +34932,49 @@ components:
3493234932
description: Type of the Custom Costs file metadata.
3493334933
type: string
3493434934
type: object
34935+
CustomCostsFileUpdateAttributes:
34936+
description: Attributes of a Custom Costs file that can be updated.
34937+
properties:
34938+
ai_provider:
34939+
description: Whether the Custom Costs file contains the costs of an AI provider.
34940+
example: true
34941+
type: boolean
34942+
required:
34943+
- ai_provider
34944+
type: object
34945+
CustomCostsFileUpdateData:
34946+
description: Custom Costs file to update.
34947+
properties:
34948+
attributes:
34949+
$ref: "#/components/schemas/CustomCostsFileUpdateAttributes"
34950+
id:
34951+
description: ID of the Custom Costs file.
34952+
example: "00000000-0000-0000-0000-000000000007"
34953+
type: string
34954+
type:
34955+
$ref: "#/components/schemas/CustomCostsFileUpdateType"
34956+
required:
34957+
- id
34958+
- type
34959+
- attributes
34960+
type: object
34961+
CustomCostsFileUpdateRequest:
34962+
description: Request for updating a Custom Costs file.
34963+
properties:
34964+
data:
34965+
$ref: "#/components/schemas/CustomCostsFileUpdateData"
34966+
required:
34967+
- data
34968+
type: object
34969+
CustomCostsFileUpdateType:
34970+
default: cost_metadata
34971+
description: Type of the Custom Costs file resource.
34972+
enum:
34973+
- cost_metadata
34974+
example: cost_metadata
34975+
type: string
34976+
x-enum-varnames:
34977+
- COST_METADATA
3493534978
CustomCostsFileUploadRequest:
3493634979
description: Request for uploading a Custom Costs file.
3493734980
items:
@@ -172651,6 +172694,72 @@ paths:
172651172694
summary: Get Custom Costs file
172652172695
tags:
172653172696
- Cloud Cost Management
172697+
patch:
172698+
description: >-
172699+
Mark whether a Custom Costs file holds AI provider costs. Datadog then recomputes the costs for the months that the file covers.
172700+
operationId: UpdateCustomCostsFile
172701+
parameters:
172702+
- $ref: "#/components/parameters/FileID"
172703+
requestBody:
172704+
content:
172705+
application/json:
172706+
examples:
172707+
default:
172708+
value:
172709+
data:
172710+
attributes:
172711+
ai_provider: true
172712+
id: 00000000-0000-0000-0000-000000000007
172713+
type: cost_metadata
172714+
schema:
172715+
$ref: "#/components/schemas/CustomCostsFileUpdateRequest"
172716+
required: true
172717+
responses:
172718+
"200":
172719+
content:
172720+
application/json:
172721+
examples:
172722+
default:
172723+
value:
172724+
data:
172725+
attributes:
172726+
billed_cost: 100.5
172727+
billing_currency: USD
172728+
charge_period:
172729+
end: 1706745600000
172730+
start: 1704067200000
172731+
name: my_file.json
172732+
provider_names:
172733+
- my_provider
172734+
status: ACTIVE
172735+
uploaded_at: 1704067200000
172736+
id: 00000000-0000-0000-0000-000000000007
172737+
type: cost_metadata
172738+
meta:
172739+
version: "1.0"
172740+
schema:
172741+
$ref: "#/components/schemas/CustomCostsFileUploadResponse"
172742+
description: OK
172743+
"404":
172744+
content:
172745+
application/json:
172746+
schema:
172747+
$ref: "#/components/schemas/JSONAPIErrorResponse"
172748+
description: Not Found
172749+
"429":
172750+
$ref: "#/components/responses/TooManyRequestsResponse"
172751+
security:
172752+
- apiKeyAuth: []
172753+
appKeyAuth: []
172754+
- AuthZ:
172755+
- cloud_cost_management_write
172756+
summary: Update Custom Costs file
172757+
tags:
172758+
- Cloud Cost Management
172759+
"x-permission":
172760+
operator: OR
172761+
permissions:
172762+
- cloud_cost_management_write
172654172763
/api/v2/cost/gcp_uc_config:
172655172764
get:
172656172765
description: List the Google Cloud Usage Cost configs.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
Update Custom Costs file returns "OK" response
3+
"""
4+
5+
from os import environ
6+
from datadog_api_client import ApiClient, Configuration
7+
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi
8+
from datadog_api_client.v2.model.custom_costs_file_update_attributes import CustomCostsFileUpdateAttributes
9+
from datadog_api_client.v2.model.custom_costs_file_update_data import CustomCostsFileUpdateData
10+
from datadog_api_client.v2.model.custom_costs_file_update_request import CustomCostsFileUpdateRequest
11+
from datadog_api_client.v2.model.custom_costs_file_update_type import CustomCostsFileUpdateType
12+
13+
# there is a valid "custom_costs_file" in the system
14+
CUSTOM_COSTS_FILE_DATA_ID = environ["CUSTOM_COSTS_FILE_DATA_ID"]
15+
16+
body = CustomCostsFileUpdateRequest(
17+
data=CustomCostsFileUpdateData(
18+
attributes=CustomCostsFileUpdateAttributes(
19+
ai_provider=True,
20+
),
21+
id=CUSTOM_COSTS_FILE_DATA_ID,
22+
type=CustomCostsFileUpdateType.COST_METADATA,
23+
),
24+
)
25+
26+
configuration = Configuration()
27+
configuration.access_token = environ["DD_BEARER_TOKEN"]
28+
with ApiClient(configuration) as api_client:
29+
api_instance = CloudCostManagementApi(api_client)
30+
response = api_instance.update_custom_costs_file(file_id=CUSTOM_COSTS_FILE_DATA_ID, body=body)
31+
32+
print(response)

‎src/datadog_api_client/v2/api/cloud_cost_management_api.py‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
from datadog_api_client.v2.model.custom_costs_file_upload_response import CustomCostsFileUploadResponse
5858
from datadog_api_client.v2.model.custom_costs_file_line_item import CustomCostsFileLineItem
5959
from datadog_api_client.v2.model.custom_costs_file_get_response import CustomCostsFileGetResponse
60+
from datadog_api_client.v2.model.custom_costs_file_update_request import CustomCostsFileUpdateRequest
6061
from datadog_api_client.v2.model.gcp_usage_cost_configs_response import GCPUsageCostConfigsResponse
6162
from datadog_api_client.v2.model.gcp_usage_cost_config_response import GCPUsageCostConfigResponse
6263
from datadog_api_client.v2.model.gcp_usage_cost_config_post_request import GCPUsageCostConfigPostRequest
@@ -1989,6 +1990,32 @@ def __init__(self, api_client=None):
19891990
api_client=api_client,
19901991
)
19911992

1993+
self._update_custom_costs_file_endpoint = _Endpoint(
1994+
settings={
1995+
"response_type": (CustomCostsFileUploadResponse,),
1996+
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
1997+
"endpoint_path": "/api/v2/cost/custom_costs/{file_id}",
1998+
"operation_id": "update_custom_costs_file",
1999+
"http_method": "PATCH",
2000+
"version": "v2",
2001+
},
2002+
params_map={
2003+
"file_id": {
2004+
"required": True,
2005+
"openapi_types": (str,),
2006+
"attribute": "file_id",
2007+
"location": "path",
2008+
},
2009+
"body": {
2010+
"required": True,
2011+
"openapi_types": (CustomCostsFileUpdateRequest,),
2012+
"location": "body",
2013+
},
2014+
},
2015+
headers_map={"accept": ["application/json"], "content_type": ["application/json"]},
2016+
api_client=api_client,
2017+
)
2018+
19922019
self._update_tag_pipelines_ruleset_endpoint = _Endpoint(
19932020
settings={
19942021
"response_type": (RulesetResp,),
@@ -3807,6 +3834,27 @@ def update_custom_allocation_rule(
38073834

38083835
return self._update_custom_allocation_rule_endpoint.call_with_http_info(**kwargs)
38093836

3837+
def update_custom_costs_file(
3838+
self,
3839+
file_id: str,
3840+
body: CustomCostsFileUpdateRequest,
3841+
) -> CustomCostsFileUploadResponse:
3842+
"""Update Custom Costs file.
3843+
3844+
Mark whether a Custom Costs file holds AI provider costs. Datadog then recomputes the costs for the months that the file covers.
3845+
3846+
:param file_id: File ID.
3847+
:type file_id: str
3848+
:type body: CustomCostsFileUpdateRequest
3849+
:rtype: CustomCostsFileUploadResponse
3850+
"""
3851+
kwargs: Dict[str, Any] = {}
3852+
kwargs["file_id"] = file_id
3853+
3854+
kwargs["body"] = body
3855+
3856+
return self._update_custom_costs_file_endpoint.call_with_http_info(**kwargs)
3857+
38103858
def update_tag_pipelines_ruleset(
38113859
self,
38123860
ruleset_id: str,
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
ModelNormal,
9+
cached_property,
10+
)
11+
12+
13+
class CustomCostsFileUpdateAttributes(ModelNormal):
14+
@cached_property
15+
def openapi_types(_):
16+
return {
17+
"ai_provider": (bool,),
18+
}
19+
20+
attribute_map = {
21+
"ai_provider": "ai_provider",
22+
}
23+
24+
def __init__(self_, ai_provider: bool, **kwargs):
25+
"""
26+
Attributes of a Custom Costs file that can be updated.
27+
28+
:param ai_provider: Whether the Custom Costs file contains the costs of an AI provider.
29+
:type ai_provider: bool
30+
"""
31+
super().__init__(kwargs)
32+
33+
self_.ai_provider = ai_provider
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
from typing import TYPE_CHECKING
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
)
12+
13+
14+
if TYPE_CHECKING:
15+
from datadog_api_client.v2.model.custom_costs_file_update_attributes import CustomCostsFileUpdateAttributes
16+
from datadog_api_client.v2.model.custom_costs_file_update_type import CustomCostsFileUpdateType
17+
18+
19+
class CustomCostsFileUpdateData(ModelNormal):
20+
@cached_property
21+
def openapi_types(_):
22+
from datadog_api_client.v2.model.custom_costs_file_update_attributes import CustomCostsFileUpdateAttributes
23+
from datadog_api_client.v2.model.custom_costs_file_update_type import CustomCostsFileUpdateType
24+
25+
return {
26+
"attributes": (CustomCostsFileUpdateAttributes,),
27+
"id": (str,),
28+
"type": (CustomCostsFileUpdateType,),
29+
}
30+
31+
attribute_map = {
32+
"attributes": "attributes",
33+
"id": "id",
34+
"type": "type",
35+
}
36+
37+
def __init__(
38+
self_, attributes: CustomCostsFileUpdateAttributes, id: str, type: CustomCostsFileUpdateType, **kwargs
39+
):
40+
"""
41+
Custom Costs file to update.
42+
43+
:param attributes: Attributes of a Custom Costs file that can be updated.
44+
:type attributes: CustomCostsFileUpdateAttributes
45+
46+
:param id: ID of the Custom Costs file.
47+
:type id: str
48+
49+
:param type: Type of the Custom Costs file resource.
50+
:type type: CustomCostsFileUpdateType
51+
"""
52+
super().__init__(kwargs)
53+
54+
self_.attributes = attributes
55+
self_.id = id
56+
self_.type = type
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
from typing import TYPE_CHECKING
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
)
12+
13+
14+
if TYPE_CHECKING:
15+
from datadog_api_client.v2.model.custom_costs_file_update_data import CustomCostsFileUpdateData
16+
17+
18+
class CustomCostsFileUpdateRequest(ModelNormal):
19+
@cached_property
20+
def openapi_types(_):
21+
from datadog_api_client.v2.model.custom_costs_file_update_data import CustomCostsFileUpdateData
22+
23+
return {
24+
"data": (CustomCostsFileUpdateData,),
25+
}
26+
27+
attribute_map = {
28+
"data": "data",
29+
}
30+
31+
def __init__(self_, data: CustomCostsFileUpdateData, **kwargs):
32+
"""
33+
Request for updating a Custom Costs file.
34+
35+
:param data: Custom Costs file to update.
36+
:type data: CustomCostsFileUpdateData
37+
"""
38+
super().__init__(kwargs)
39+
40+
self_.data = data
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 CustomCostsFileUpdateType(ModelSimple):
16+
"""
17+
Type of the Custom Costs file resource.
18+
19+
:param value: If omitted defaults to "cost_metadata". Must be one of ["cost_metadata"].
20+
:type value: str
21+
"""
22+
23+
allowed_values = {
24+
"cost_metadata",
25+
}
26+
COST_METADATA: ClassVar["CustomCostsFileUpdateType"]
27+
28+
@cached_property
29+
def openapi_types(_):
30+
return {
31+
"value": (str,),
32+
}
33+
34+
35+
CustomCostsFileUpdateType.COST_METADATA = CustomCostsFileUpdateType("cost_metadata")

0 commit comments

Comments
 (0)