diff --git a/.apigentools-info b/.apigentools-info index 8979f32dc6..0478ae5f0e 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-07-25 18:59:19.120986", - "spec_repo_commit": "ccf15bee" + "regenerated": "2024-07-26 15:05:43.814419", + "spec_repo_commit": "bdcf730e" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-07-25 18:59:19.143047", - "spec_repo_commit": "ccf15bee" + "regenerated": "2024-07-26 15:05:43.831282", + "spec_repo_commit": "bdcf730e" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d921feb377..69457eb477 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -216,6 +216,13 @@ components: required: true schema: type: string + FileID: + description: File ID. + in: path + name: file_id + required: true + schema: + type: string GCPSTSServiceAccountID: description: Your GCP STS enabled service account's unique ID. in: path @@ -5516,6 +5523,234 @@ components: nullable: true type: string type: object + CustomCostGetResponseMeta: + description: Meta for the response from the Get Custom Costs endpoints. + properties: + version: + description: Version of Custom Costs file + type: string + type: object + CustomCostListResponseMeta: + description: Meta for the response from the List Custom Costs endpoints. + properties: + total_filtered_count: + description: Number of Custom Costs files returned by the List Custom Costs + endpoint + format: int64 + type: integer + version: + description: Version of Custom Costs file + type: string + type: object + CustomCostUploadResponseMeta: + description: Meta for the response from the Upload Custom Costs endpoints. + properties: + version: + description: Version of Custom Costs file + type: string + type: object + CustomCostsFileGetResponse: + description: Response for Get Custom Costs files. + properties: + data: + $ref: '#/components/schemas/CustomCostsFileMetadataWithContentHighLevel' + meta: + $ref: '#/components/schemas/CustomCostGetResponseMeta' + type: object + CustomCostsFileLineItem: + description: Line item details from a Custom Costs file. + properties: + BilledCost: + description: Total cost in the cost file. + example: 100.5 + format: double + type: number + BillingCurrency: + description: Currency used in the Custom Costs file. + example: USD + type: string + ChargeDescription: + description: Description for the line item cost. + example: Monthly usage charge for my service + type: string + ChargePeriodEnd: + description: End date of the usage charge. + example: '2023-02-28' + pattern: ^\d{4}-\d{2}-\d{2}$ + type: string + ChargePeriodStart: + description: Start date of the usage charge. + example: '2023-02-01' + pattern: ^\d{4}-\d{2}-\d{2}$ + type: string + ProviderName: + description: Name of the provider for the line item. + type: string + Tags: + additionalProperties: + type: string + description: Additional tags for the line item. + type: object + type: object + CustomCostsFileListResponse: + description: Response for List Custom Costs files. + properties: + data: + description: List of Custom Costs files. + items: + $ref: '#/components/schemas/CustomCostsFileMetadataHighLevel' + type: array + meta: + $ref: '#/components/schemas/CustomCostListResponseMeta' + type: object + CustomCostsFileMetadata: + description: Schema of a Custom Costs metadata. + properties: + billed_cost: + description: Total cost in the cost file. + example: 100.5 + format: double + type: number + billing_currency: + description: Currency used in the Custom Costs file. + example: USD + type: string + charge_period: + $ref: '#/components/schemas/CustomCostsFileUsageChargePeriod' + name: + description: Name of the Custom Costs file. + example: my_file.json + type: string + provider_names: + description: Providers contained in the Custom Costs file. + items: + description: Name of the provider. + example: my_provider + type: string + type: array + status: + description: Status of the Custom Costs file. + example: active + type: string + uploaded_at: + description: Timestamp, in millisecond, of the upload time of the Custom + Costs file. + example: 1704067200000 + format: double + type: number + uploaded_by: + $ref: '#/components/schemas/CustomCostsUser' + type: object + CustomCostsFileMetadataHighLevel: + description: JSON API format for a Custom Costs file. + properties: + attributes: + $ref: '#/components/schemas/CustomCostsFileMetadata' + id: + description: ID of the Custom Costs metadata. + type: string + type: + description: Type of the Custom Costs file metadata. + type: string + type: object + CustomCostsFileMetadataWithContent: + description: Schema of a cost file's metadata. + properties: + billed_cost: + description: Total cost in the cost file. + example: 100.5 + format: double + type: number + billing_currency: + description: Currency used in the Custom Costs file. + example: USD + type: string + charge_period: + $ref: '#/components/schemas/CustomCostsFileUsageChargePeriod' + content: + description: Detail of the line items from the Custom Costs file. + items: + $ref: '#/components/schemas/CustomCostsFileLineItem' + type: array + name: + description: Name of the Custom Costs file. + example: my_file.json + type: string + provider_names: + description: Providers contained in the Custom Costs file. + items: + description: Name of a provider. + example: my_provider + type: string + type: array + status: + description: Status of the Custom Costs file. + example: active + type: string + uploaded_at: + description: Timestamp in millisecond of the upload time of the Custom Costs + file. + example: 1704067200000 + format: double + type: number + uploaded_by: + $ref: '#/components/schemas/CustomCostsUser' + type: object + CustomCostsFileMetadataWithContentHighLevel: + description: JSON API format of for a Custom Costs file with content. + properties: + attributes: + $ref: '#/components/schemas/CustomCostsFileMetadataWithContent' + id: + description: ID of the Custom Costs metadata. + type: string + type: + description: Type of the Custom Costs file metadata. + type: string + type: object + CustomCostsFileUploadRequest: + description: Request for uploading a Custom Costs file. + items: + $ref: '#/components/schemas/CustomCostsFileLineItem' + type: array + CustomCostsFileUploadResponse: + description: Response for Uploaded Custom Costs files. + properties: + data: + $ref: '#/components/schemas/CustomCostsFileMetadataHighLevel' + meta: + $ref: '#/components/schemas/CustomCostUploadResponseMeta' + type: object + CustomCostsFileUsageChargePeriod: + description: Usage charge period of a Custom Costs file. + properties: + end: + description: End of the usage of the Custom Costs file. + example: 1706745600000 + format: double + type: number + start: + description: Start of the usage of the Custom Costs file. + example: 1704067200000 + format: double + type: number + type: object + CustomCostsUser: + description: Metadata of the user that has uploaded the Custom Costs file. + properties: + email: + description: The name of the Custom Costs file. + example: email.test@datadohq.com + type: string + icon: + description: The name of the Custom Costs file. + example: icon.png + type: string + name: + description: Name of the user. + example: Test User + type: string + type: object CustomDestinationAttributeTagsRestrictionListType: default: ALLOW_LIST description: 'How `forward_tags_restriction_list` parameter should be interpreted. @@ -26224,6 +26459,118 @@ paths: summary: Update Cloud Cost Management Azure config tags: - Cloud Cost Management + /api/v2/cost/custom_costs: + get: + description: List the Custom Costs files. + operationId: ListCustomCostsFiles + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CustomCostsFileListResponse' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_read + summary: List Custom Costs files + tags: + - Cloud Cost Management + put: + description: Upload a Custom Costs file. + operationId: UploadCustomCostsFile + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CustomCostsFileUploadRequest' + required: true + responses: + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/CustomCostsFileUploadResponse' + description: Accepted + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_write + summary: Upload Custom Costs file + tags: + - Cloud Cost Management + /api/v2/cost/custom_costs/{file_id}: + delete: + description: Delete the specified Custom Costs file. + operationId: DeleteCustomCostsFile + parameters: + - $ref: '#/components/parameters/FileID' + responses: + '204': + description: No Content + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_write + summary: Delete Custom Costs file + tags: + - Cloud Cost Management + get: + description: Fetch the specified Custom Costs file. + operationId: GetCustomCostsFile + parameters: + - $ref: '#/components/parameters/FileID' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CustomCostsFileGetResponse' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_read + summary: Get Custom Costs file + tags: + - Cloud Cost Management /api/v2/cost/enabled: get: description: Get the Cloud Cost Management activity. diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 3d03f67aa0..4be27d8aa9 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -2192,6 +2192,97 @@ creator :members: :show-inheritance: +custom\_cost\_get\_response\_meta +--------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_cost_get_response_meta + :members: + :show-inheritance: + +custom\_cost\_list\_response\_meta +---------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_cost_list_response_meta + :members: + :show-inheritance: + +custom\_cost\_upload\_response\_meta +------------------------------------ + +.. automodule:: datadog_api_client.v2.model.custom_cost_upload_response_meta + :members: + :show-inheritance: + +custom\_costs\_file\_get\_response +---------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_costs_file_get_response + :members: + :show-inheritance: + +custom\_costs\_file\_line\_item +------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_costs_file_line_item + :members: + :show-inheritance: + +custom\_costs\_file\_list\_response +----------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_costs_file_list_response + :members: + :show-inheritance: + +custom\_costs\_file\_metadata +----------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_costs_file_metadata + :members: + :show-inheritance: + +custom\_costs\_file\_metadata\_high\_level +------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.custom_costs_file_metadata_high_level + :members: + :show-inheritance: + +custom\_costs\_file\_metadata\_with\_content +-------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_costs_file_metadata_with_content + :members: + :show-inheritance: + +custom\_costs\_file\_metadata\_with\_content\_high\_level +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_costs_file_metadata_with_content_high_level + :members: + :show-inheritance: + +custom\_costs\_file\_upload\_response +------------------------------------- + +.. automodule:: datadog_api_client.v2.model.custom_costs_file_upload_response + :members: + :show-inheritance: + +custom\_costs\_file\_usage\_charge\_period +------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.custom_costs_file_usage_charge_period + :members: + :show-inheritance: + +custom\_costs\_user +------------------- + +.. automodule:: datadog_api_client.v2.model.custom_costs_user + :members: + :show-inheritance: + custom\_destination\_attribute\_tags\_restriction\_list\_type ------------------------------------------------------------- diff --git a/examples/v2/cloud-cost-management/DeleteCustomCostsFile.py b/examples/v2/cloud-cost-management/DeleteCustomCostsFile.py new file mode 100644 index 0000000000..d3c6f666cd --- /dev/null +++ b/examples/v2/cloud-cost-management/DeleteCustomCostsFile.py @@ -0,0 +1,13 @@ +""" +Delete Custom Costs file returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + api_instance.delete_custom_costs_file( + file_id="file_id", + ) diff --git a/examples/v2/cloud-cost-management/DeleteCustomCostsFile_372970393.py b/examples/v2/cloud-cost-management/DeleteCustomCostsFile_372970393.py new file mode 100644 index 0000000000..e99401e18b --- /dev/null +++ b/examples/v2/cloud-cost-management/DeleteCustomCostsFile_372970393.py @@ -0,0 +1,13 @@ +""" +Delete Custom Costs File returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + api_instance.delete_custom_costs_file( + file_id="9d055d22-a838-4e9f-bc34-a4f9ab66280c", + ) diff --git a/examples/v2/cloud-cost-management/GetCustomCostsFile.py b/examples/v2/cloud-cost-management/GetCustomCostsFile.py new file mode 100644 index 0000000000..88ebf65c79 --- /dev/null +++ b/examples/v2/cloud-cost-management/GetCustomCostsFile.py @@ -0,0 +1,15 @@ +""" +Get Custom Costs file returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + response = api_instance.get_custom_costs_file( + file_id="file_id", + ) + + print(response) diff --git a/examples/v2/cloud-cost-management/GetCustomCostsFile_1307381576.py b/examples/v2/cloud-cost-management/GetCustomCostsFile_1307381576.py new file mode 100644 index 0000000000..8d8cd9c3da --- /dev/null +++ b/examples/v2/cloud-cost-management/GetCustomCostsFile_1307381576.py @@ -0,0 +1,15 @@ +""" +Get Custom Costs File returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + response = api_instance.get_custom_costs_file( + file_id="9d055d22-a838-4e9f-bc34-a4f9ab66280c", + ) + + print(response) diff --git a/examples/v2/cloud-cost-management/ListCustomCostsFiles.py b/examples/v2/cloud-cost-management/ListCustomCostsFiles.py new file mode 100644 index 0000000000..82b060a6ac --- /dev/null +++ b/examples/v2/cloud-cost-management/ListCustomCostsFiles.py @@ -0,0 +1,13 @@ +""" +List Custom Costs files returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + response = api_instance.list_custom_costs_files() + + print(response) diff --git a/examples/v2/cloud-cost-management/ListCustomCostsFiles_1968771127.py b/examples/v2/cloud-cost-management/ListCustomCostsFiles_1968771127.py new file mode 100644 index 0000000000..d8dd9a56c8 --- /dev/null +++ b/examples/v2/cloud-cost-management/ListCustomCostsFiles_1968771127.py @@ -0,0 +1,13 @@ +""" +List Custom Costs Files returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + response = api_instance.list_custom_costs_files() + + print(response) diff --git a/examples/v2/cloud-cost-management/UploadCustomCostsFile.py b/examples/v2/cloud-cost-management/UploadCustomCostsFile.py new file mode 100644 index 0000000000..3f0d5c2510 --- /dev/null +++ b/examples/v2/cloud-cost-management/UploadCustomCostsFile.py @@ -0,0 +1,24 @@ +""" +Upload Custom Costs file returns "Accepted" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi +from datadog_api_client.v2.model.custom_costs_file_line_item import CustomCostsFileLineItem + +body = [ + CustomCostsFileLineItem( + billed_cost=100.5, + billing_currency="USD", + charge_description="Monthly usage charge for my service", + charge_period_end="2023-02-28", + charge_period_start="2023-02-01", + ), +] + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + response = api_instance.upload_custom_costs_file(body=body) + + print(response) diff --git a/examples/v2/cloud-cost-management/UploadCustomCostsFile_4125168396.py b/examples/v2/cloud-cost-management/UploadCustomCostsFile_4125168396.py new file mode 100644 index 0000000000..95935e54bd --- /dev/null +++ b/examples/v2/cloud-cost-management/UploadCustomCostsFile_4125168396.py @@ -0,0 +1,28 @@ +""" +Upload Custom Costs File returns "Accepted" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi +from datadog_api_client.v2.model.custom_costs_file_line_item import CustomCostsFileLineItem + +body = [ + CustomCostsFileLineItem( + provider_name="my_provider", + charge_period_start="2023-05-06", + charge_period_end="2023-06-06", + charge_description="my_description", + billed_cost=250.0, + billing_currency="USD", + tags=dict( + key="value", + ), + ), +] + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + response = api_instance.upload_custom_costs_file(body=body) + + print(response) diff --git a/src/datadog_api_client/v2/api/cloud_cost_management_api.py b/src/datadog_api_client/v2/api/cloud_cost_management_api.py index bc8f692176..91f573cbd2 100644 --- a/src/datadog_api_client/v2/api/cloud_cost_management_api.py +++ b/src/datadog_api_client/v2/api/cloud_cost_management_api.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Any, Dict +from typing import Any, Dict, List import warnings from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint @@ -17,6 +17,10 @@ from datadog_api_client.v2.model.azure_uc_config_pairs_response import AzureUCConfigPairsResponse from datadog_api_client.v2.model.azure_uc_config_post_request import AzureUCConfigPostRequest from datadog_api_client.v2.model.azure_uc_config_patch_request import AzureUCConfigPatchRequest +from datadog_api_client.v2.model.custom_costs_file_list_response import CustomCostsFileListResponse +from datadog_api_client.v2.model.custom_costs_file_upload_response import CustomCostsFileUploadResponse +from datadog_api_client.v2.model.custom_costs_file_line_item import CustomCostsFileLineItem +from datadog_api_client.v2.model.custom_costs_file_get_response import CustomCostsFileGetResponse from datadog_api_client.v2.model.cloud_cost_activity_response import CloudCostActivityResponse @@ -116,6 +120,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._delete_custom_costs_file_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/custom_costs/{file_id}", + "operation_id": "delete_custom_costs_file", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "file_id": { + "required": True, + "openapi_types": (str,), + "attribute": "file_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + self._get_cloud_cost_activity_endpoint = _Endpoint( settings={ "response_type": (CloudCostActivityResponse,), @@ -132,6 +159,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_custom_costs_file_endpoint = _Endpoint( + settings={ + "response_type": (CustomCostsFileGetResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/custom_costs/{file_id}", + "operation_id": "get_custom_costs_file", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "file_id": { + "required": True, + "openapi_types": (str,), + "attribute": "file_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_aws_related_accounts_endpoint = _Endpoint( settings={ "response_type": (AWSRelatedAccountsResponse,), @@ -187,6 +237,22 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_custom_costs_files_endpoint = _Endpoint( + settings={ + "response_type": (CustomCostsFileListResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/custom_costs", + "operation_id": "list_custom_costs_files", + "http_method": "GET", + "version": "v2", + }, + params_map={}, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._update_cost_awscur_config_endpoint = _Endpoint( settings={ "response_type": (AwsCURConfigsResponse,), @@ -239,6 +305,27 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._upload_custom_costs_file_endpoint = _Endpoint( + settings={ + "response_type": (CustomCostsFileUploadResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/custom_costs", + "operation_id": "upload_custom_costs_file", + "http_method": "PUT", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": ([CustomCostsFileLineItem],), + "location": "body", + "collection_format": "multi", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + def create_cost_awscur_config( self, body: AwsCURConfigPostRequest, @@ -305,6 +392,23 @@ def delete_cost_azure_uc_config( return self._delete_cost_azure_uc_config_endpoint.call_with_http_info(**kwargs) + def delete_custom_costs_file( + self, + file_id: str, + ) -> None: + """Delete Custom Costs file. + + Delete the specified Custom Costs file. + + :param file_id: File ID. + :type file_id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["file_id"] = file_id + + return self._delete_custom_costs_file_endpoint.call_with_http_info(**kwargs) + def get_cloud_cost_activity( self, ) -> CloudCostActivityResponse: @@ -317,6 +421,23 @@ def get_cloud_cost_activity( kwargs: Dict[str, Any] = {} return self._get_cloud_cost_activity_endpoint.call_with_http_info(**kwargs) + def get_custom_costs_file( + self, + file_id: str, + ) -> CustomCostsFileGetResponse: + """Get Custom Costs file. + + Fetch the specified Custom Costs file. + + :param file_id: File ID. + :type file_id: str + :rtype: CustomCostsFileGetResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["file_id"] = file_id + + return self._get_custom_costs_file_endpoint.call_with_http_info(**kwargs) + def list_aws_related_accounts( self, filter_management_account_id: str, @@ -359,6 +480,18 @@ def list_cost_azure_uc_configs( kwargs: Dict[str, Any] = {} return self._list_cost_azure_uc_configs_endpoint.call_with_http_info(**kwargs) + def list_custom_costs_files( + self, + ) -> CustomCostsFileListResponse: + """List Custom Costs files. + + List the Custom Costs files. + + :rtype: CustomCostsFileListResponse + """ + kwargs: Dict[str, Any] = {} + return self._list_custom_costs_files_endpoint.call_with_http_info(**kwargs) + def update_cost_awscur_config( self, cloud_account_id: str, @@ -400,3 +533,19 @@ def update_cost_azure_uc_configs( kwargs["body"] = body return self._update_cost_azure_uc_configs_endpoint.call_with_http_info(**kwargs) + + def upload_custom_costs_file( + self, + body: List[CustomCostsFileLineItem], + ) -> CustomCostsFileUploadResponse: + """Upload Custom Costs file. + + Upload a Custom Costs file. + + :type body: [CustomCostsFileLineItem] + :rtype: CustomCostsFileUploadResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._upload_custom_costs_file_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/model/custom_cost_get_response_meta.py b/src/datadog_api_client/v2/model/custom_cost_get_response_meta.py new file mode 100644 index 0000000000..a786a14be1 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_cost_get_response_meta.py @@ -0,0 +1,36 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class CustomCostGetResponseMeta(ModelNormal): + @cached_property + def openapi_types(_): + return { + "version": (str,), + } + + attribute_map = { + "version": "version", + } + + def __init__(self_, version: Union[str, UnsetType] = unset, **kwargs): + """ + Meta for the response from the Get Custom Costs endpoints. + + :param version: Version of Custom Costs file + :type version: str, optional + """ + if version is not unset: + kwargs["version"] = version + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_cost_list_response_meta.py b/src/datadog_api_client/v2/model/custom_cost_list_response_meta.py new file mode 100644 index 0000000000..b3085ceb15 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_cost_list_response_meta.py @@ -0,0 +1,45 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class CustomCostListResponseMeta(ModelNormal): + @cached_property + def openapi_types(_): + return { + "total_filtered_count": (int,), + "version": (str,), + } + + attribute_map = { + "total_filtered_count": "total_filtered_count", + "version": "version", + } + + def __init__( + self_, total_filtered_count: Union[int, UnsetType] = unset, version: Union[str, UnsetType] = unset, **kwargs + ): + """ + Meta for the response from the List Custom Costs endpoints. + + :param total_filtered_count: Number of Custom Costs files returned by the List Custom Costs endpoint + :type total_filtered_count: int, optional + + :param version: Version of Custom Costs file + :type version: str, optional + """ + if total_filtered_count is not unset: + kwargs["total_filtered_count"] = total_filtered_count + if version is not unset: + kwargs["version"] = version + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_cost_upload_response_meta.py b/src/datadog_api_client/v2/model/custom_cost_upload_response_meta.py new file mode 100644 index 0000000000..07f305c716 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_cost_upload_response_meta.py @@ -0,0 +1,36 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class CustomCostUploadResponseMeta(ModelNormal): + @cached_property + def openapi_types(_): + return { + "version": (str,), + } + + attribute_map = { + "version": "version", + } + + def __init__(self_, version: Union[str, UnsetType] = unset, **kwargs): + """ + Meta for the response from the Upload Custom Costs endpoints. + + :param version: Version of Custom Costs file + :type version: str, optional + """ + if version is not unset: + kwargs["version"] = version + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_costs_file_get_response.py b/src/datadog_api_client/v2/model/custom_costs_file_get_response.py new file mode 100644 index 0000000000..51b14910c4 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_costs_file_get_response.py @@ -0,0 +1,60 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_costs_file_metadata_with_content_high_level import ( + CustomCostsFileMetadataWithContentHighLevel, + ) + from datadog_api_client.v2.model.custom_cost_get_response_meta import CustomCostGetResponseMeta + + +class CustomCostsFileGetResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_costs_file_metadata_with_content_high_level import ( + CustomCostsFileMetadataWithContentHighLevel, + ) + from datadog_api_client.v2.model.custom_cost_get_response_meta import CustomCostGetResponseMeta + + return { + "data": (CustomCostsFileMetadataWithContentHighLevel,), + "meta": (CustomCostGetResponseMeta,), + } + + attribute_map = { + "data": "data", + "meta": "meta", + } + + def __init__( + self_, + data: Union[CustomCostsFileMetadataWithContentHighLevel, UnsetType] = unset, + meta: Union[CustomCostGetResponseMeta, UnsetType] = unset, + **kwargs, + ): + """ + Response for Get Custom Costs files. + + :param data: JSON API format of for a Custom Costs file with content. + :type data: CustomCostsFileMetadataWithContentHighLevel, optional + + :param meta: Meta for the response from the Get Custom Costs endpoints. + :type meta: CustomCostGetResponseMeta, optional + """ + if data is not unset: + kwargs["data"] = data + if meta is not unset: + kwargs["meta"] = meta + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_costs_file_line_item.py b/src/datadog_api_client/v2/model/custom_costs_file_line_item.py new file mode 100644 index 0000000000..f59d5a0880 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_costs_file_line_item.py @@ -0,0 +1,93 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Dict, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class CustomCostsFileLineItem(ModelNormal): + validations = { + "charge_period_end": {}, + "charge_period_start": {}, + } + + @cached_property + def openapi_types(_): + return { + "billed_cost": (float,), + "billing_currency": (str,), + "charge_description": (str,), + "charge_period_end": (str,), + "charge_period_start": (str,), + "provider_name": (str,), + "tags": ({str: (str,)},), + } + + attribute_map = { + "billed_cost": "BilledCost", + "billing_currency": "BillingCurrency", + "charge_description": "ChargeDescription", + "charge_period_end": "ChargePeriodEnd", + "charge_period_start": "ChargePeriodStart", + "provider_name": "ProviderName", + "tags": "Tags", + } + + def __init__( + self_, + billed_cost: Union[float, UnsetType] = unset, + billing_currency: Union[str, UnsetType] = unset, + charge_description: Union[str, UnsetType] = unset, + charge_period_end: Union[str, UnsetType] = unset, + charge_period_start: Union[str, UnsetType] = unset, + provider_name: Union[str, UnsetType] = unset, + tags: Union[Dict[str, str], UnsetType] = unset, + **kwargs, + ): + """ + Line item details from a Custom Costs file. + + :param billed_cost: Total cost in the cost file. + :type billed_cost: float, optional + + :param billing_currency: Currency used in the Custom Costs file. + :type billing_currency: str, optional + + :param charge_description: Description for the line item cost. + :type charge_description: str, optional + + :param charge_period_end: End date of the usage charge. + :type charge_period_end: str, optional + + :param charge_period_start: Start date of the usage charge. + :type charge_period_start: str, optional + + :param provider_name: Name of the provider for the line item. + :type provider_name: str, optional + + :param tags: Additional tags for the line item. + :type tags: {str: (str,)}, optional + """ + if billed_cost is not unset: + kwargs["billed_cost"] = billed_cost + if billing_currency is not unset: + kwargs["billing_currency"] = billing_currency + if charge_description is not unset: + kwargs["charge_description"] = charge_description + if charge_period_end is not unset: + kwargs["charge_period_end"] = charge_period_end + if charge_period_start is not unset: + kwargs["charge_period_start"] = charge_period_start + if provider_name is not unset: + kwargs["provider_name"] = provider_name + if tags is not unset: + kwargs["tags"] = tags + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_costs_file_list_response.py b/src/datadog_api_client/v2/model/custom_costs_file_list_response.py new file mode 100644 index 0000000000..2e8f71a575 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_costs_file_list_response.py @@ -0,0 +1,56 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_costs_file_metadata_high_level import CustomCostsFileMetadataHighLevel + from datadog_api_client.v2.model.custom_cost_list_response_meta import CustomCostListResponseMeta + + +class CustomCostsFileListResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_costs_file_metadata_high_level import CustomCostsFileMetadataHighLevel + from datadog_api_client.v2.model.custom_cost_list_response_meta import CustomCostListResponseMeta + + return { + "data": ([CustomCostsFileMetadataHighLevel],), + "meta": (CustomCostListResponseMeta,), + } + + attribute_map = { + "data": "data", + "meta": "meta", + } + + def __init__( + self_, + data: Union[List[CustomCostsFileMetadataHighLevel], UnsetType] = unset, + meta: Union[CustomCostListResponseMeta, UnsetType] = unset, + **kwargs, + ): + """ + Response for List Custom Costs files. + + :param data: List of Custom Costs files. + :type data: [CustomCostsFileMetadataHighLevel], optional + + :param meta: Meta for the response from the List Custom Costs endpoints. + :type meta: CustomCostListResponseMeta, optional + """ + if data is not unset: + kwargs["data"] = data + if meta is not unset: + kwargs["meta"] = meta + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_costs_file_metadata.py b/src/datadog_api_client/v2/model/custom_costs_file_metadata.py new file mode 100644 index 0000000000..67bca32cdf --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_costs_file_metadata.py @@ -0,0 +1,104 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_costs_file_usage_charge_period import CustomCostsFileUsageChargePeriod + from datadog_api_client.v2.model.custom_costs_user import CustomCostsUser + + +class CustomCostsFileMetadata(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_costs_file_usage_charge_period import CustomCostsFileUsageChargePeriod + from datadog_api_client.v2.model.custom_costs_user import CustomCostsUser + + return { + "billed_cost": (float,), + "billing_currency": (str,), + "charge_period": (CustomCostsFileUsageChargePeriod,), + "name": (str,), + "provider_names": ([str],), + "status": (str,), + "uploaded_at": (float,), + "uploaded_by": (CustomCostsUser,), + } + + attribute_map = { + "billed_cost": "billed_cost", + "billing_currency": "billing_currency", + "charge_period": "charge_period", + "name": "name", + "provider_names": "provider_names", + "status": "status", + "uploaded_at": "uploaded_at", + "uploaded_by": "uploaded_by", + } + + def __init__( + self_, + billed_cost: Union[float, UnsetType] = unset, + billing_currency: Union[str, UnsetType] = unset, + charge_period: Union[CustomCostsFileUsageChargePeriod, UnsetType] = unset, + name: Union[str, UnsetType] = unset, + provider_names: Union[List[str], UnsetType] = unset, + status: Union[str, UnsetType] = unset, + uploaded_at: Union[float, UnsetType] = unset, + uploaded_by: Union[CustomCostsUser, UnsetType] = unset, + **kwargs, + ): + """ + Schema of a Custom Costs metadata. + + :param billed_cost: Total cost in the cost file. + :type billed_cost: float, optional + + :param billing_currency: Currency used in the Custom Costs file. + :type billing_currency: str, optional + + :param charge_period: Usage charge period of a Custom Costs file. + :type charge_period: CustomCostsFileUsageChargePeriod, optional + + :param name: Name of the Custom Costs file. + :type name: str, optional + + :param provider_names: Providers contained in the Custom Costs file. + :type provider_names: [str], optional + + :param status: Status of the Custom Costs file. + :type status: str, optional + + :param uploaded_at: Timestamp, in millisecond, of the upload time of the Custom Costs file. + :type uploaded_at: float, optional + + :param uploaded_by: Metadata of the user that has uploaded the Custom Costs file. + :type uploaded_by: CustomCostsUser, optional + """ + if billed_cost is not unset: + kwargs["billed_cost"] = billed_cost + if billing_currency is not unset: + kwargs["billing_currency"] = billing_currency + if charge_period is not unset: + kwargs["charge_period"] = charge_period + if name is not unset: + kwargs["name"] = name + if provider_names is not unset: + kwargs["provider_names"] = provider_names + if status is not unset: + kwargs["status"] = status + if uploaded_at is not unset: + kwargs["uploaded_at"] = uploaded_at + if uploaded_by is not unset: + kwargs["uploaded_by"] = uploaded_by + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_costs_file_metadata_high_level.py b/src/datadog_api_client/v2/model/custom_costs_file_metadata_high_level.py new file mode 100644 index 0000000000..a29d296b94 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_costs_file_metadata_high_level.py @@ -0,0 +1,62 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_costs_file_metadata import CustomCostsFileMetadata + + +class CustomCostsFileMetadataHighLevel(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_costs_file_metadata import CustomCostsFileMetadata + + return { + "attributes": (CustomCostsFileMetadata,), + "id": (str,), + "type": (str,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: Union[CustomCostsFileMetadata, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + type: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + JSON API format for a Custom Costs file. + + :param attributes: Schema of a Custom Costs metadata. + :type attributes: CustomCostsFileMetadata, optional + + :param id: ID of the Custom Costs metadata. + :type id: str, optional + + :param type: Type of the Custom Costs file metadata. + :type type: str, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if id is not unset: + kwargs["id"] = id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_costs_file_metadata_with_content.py b/src/datadog_api_client/v2/model/custom_costs_file_metadata_with_content.py new file mode 100644 index 0000000000..7e7c5311ec --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_costs_file_metadata_with_content.py @@ -0,0 +1,114 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_costs_file_usage_charge_period import CustomCostsFileUsageChargePeriod + from datadog_api_client.v2.model.custom_costs_file_line_item import CustomCostsFileLineItem + from datadog_api_client.v2.model.custom_costs_user import CustomCostsUser + + +class CustomCostsFileMetadataWithContent(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_costs_file_usage_charge_period import CustomCostsFileUsageChargePeriod + from datadog_api_client.v2.model.custom_costs_file_line_item import CustomCostsFileLineItem + from datadog_api_client.v2.model.custom_costs_user import CustomCostsUser + + return { + "billed_cost": (float,), + "billing_currency": (str,), + "charge_period": (CustomCostsFileUsageChargePeriod,), + "content": ([CustomCostsFileLineItem],), + "name": (str,), + "provider_names": ([str],), + "status": (str,), + "uploaded_at": (float,), + "uploaded_by": (CustomCostsUser,), + } + + attribute_map = { + "billed_cost": "billed_cost", + "billing_currency": "billing_currency", + "charge_period": "charge_period", + "content": "content", + "name": "name", + "provider_names": "provider_names", + "status": "status", + "uploaded_at": "uploaded_at", + "uploaded_by": "uploaded_by", + } + + def __init__( + self_, + billed_cost: Union[float, UnsetType] = unset, + billing_currency: Union[str, UnsetType] = unset, + charge_period: Union[CustomCostsFileUsageChargePeriod, UnsetType] = unset, + content: Union[List[CustomCostsFileLineItem], UnsetType] = unset, + name: Union[str, UnsetType] = unset, + provider_names: Union[List[str], UnsetType] = unset, + status: Union[str, UnsetType] = unset, + uploaded_at: Union[float, UnsetType] = unset, + uploaded_by: Union[CustomCostsUser, UnsetType] = unset, + **kwargs, + ): + """ + Schema of a cost file's metadata. + + :param billed_cost: Total cost in the cost file. + :type billed_cost: float, optional + + :param billing_currency: Currency used in the Custom Costs file. + :type billing_currency: str, optional + + :param charge_period: Usage charge period of a Custom Costs file. + :type charge_period: CustomCostsFileUsageChargePeriod, optional + + :param content: Detail of the line items from the Custom Costs file. + :type content: [CustomCostsFileLineItem], optional + + :param name: Name of the Custom Costs file. + :type name: str, optional + + :param provider_names: Providers contained in the Custom Costs file. + :type provider_names: [str], optional + + :param status: Status of the Custom Costs file. + :type status: str, optional + + :param uploaded_at: Timestamp in millisecond of the upload time of the Custom Costs file. + :type uploaded_at: float, optional + + :param uploaded_by: Metadata of the user that has uploaded the Custom Costs file. + :type uploaded_by: CustomCostsUser, optional + """ + if billed_cost is not unset: + kwargs["billed_cost"] = billed_cost + if billing_currency is not unset: + kwargs["billing_currency"] = billing_currency + if charge_period is not unset: + kwargs["charge_period"] = charge_period + if content is not unset: + kwargs["content"] = content + if name is not unset: + kwargs["name"] = name + if provider_names is not unset: + kwargs["provider_names"] = provider_names + if status is not unset: + kwargs["status"] = status + if uploaded_at is not unset: + kwargs["uploaded_at"] = uploaded_at + if uploaded_by is not unset: + kwargs["uploaded_by"] = uploaded_by + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_costs_file_metadata_with_content_high_level.py b/src/datadog_api_client/v2/model/custom_costs_file_metadata_with_content_high_level.py new file mode 100644 index 0000000000..8cf24d746e --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_costs_file_metadata_with_content_high_level.py @@ -0,0 +1,64 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_costs_file_metadata_with_content import CustomCostsFileMetadataWithContent + + +class CustomCostsFileMetadataWithContentHighLevel(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_costs_file_metadata_with_content import ( + CustomCostsFileMetadataWithContent, + ) + + return { + "attributes": (CustomCostsFileMetadataWithContent,), + "id": (str,), + "type": (str,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: Union[CustomCostsFileMetadataWithContent, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + type: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + JSON API format of for a Custom Costs file with content. + + :param attributes: Schema of a cost file's metadata. + :type attributes: CustomCostsFileMetadataWithContent, optional + + :param id: ID of the Custom Costs metadata. + :type id: str, optional + + :param type: Type of the Custom Costs file metadata. + :type type: str, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if id is not unset: + kwargs["id"] = id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_costs_file_upload_response.py b/src/datadog_api_client/v2/model/custom_costs_file_upload_response.py new file mode 100644 index 0000000000..ab92a5a6f9 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_costs_file_upload_response.py @@ -0,0 +1,56 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.custom_costs_file_metadata_high_level import CustomCostsFileMetadataHighLevel + from datadog_api_client.v2.model.custom_cost_upload_response_meta import CustomCostUploadResponseMeta + + +class CustomCostsFileUploadResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.custom_costs_file_metadata_high_level import CustomCostsFileMetadataHighLevel + from datadog_api_client.v2.model.custom_cost_upload_response_meta import CustomCostUploadResponseMeta + + return { + "data": (CustomCostsFileMetadataHighLevel,), + "meta": (CustomCostUploadResponseMeta,), + } + + attribute_map = { + "data": "data", + "meta": "meta", + } + + def __init__( + self_, + data: Union[CustomCostsFileMetadataHighLevel, UnsetType] = unset, + meta: Union[CustomCostUploadResponseMeta, UnsetType] = unset, + **kwargs, + ): + """ + Response for Uploaded Custom Costs files. + + :param data: JSON API format for a Custom Costs file. + :type data: CustomCostsFileMetadataHighLevel, optional + + :param meta: Meta for the response from the Upload Custom Costs endpoints. + :type meta: CustomCostUploadResponseMeta, optional + """ + if data is not unset: + kwargs["data"] = data + if meta is not unset: + kwargs["meta"] = meta + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_costs_file_usage_charge_period.py b/src/datadog_api_client/v2/model/custom_costs_file_usage_charge_period.py new file mode 100644 index 0000000000..276c949f11 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_costs_file_usage_charge_period.py @@ -0,0 +1,43 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class CustomCostsFileUsageChargePeriod(ModelNormal): + @cached_property + def openapi_types(_): + return { + "end": (float,), + "start": (float,), + } + + attribute_map = { + "end": "end", + "start": "start", + } + + def __init__(self_, end: Union[float, UnsetType] = unset, start: Union[float, UnsetType] = unset, **kwargs): + """ + Usage charge period of a Custom Costs file. + + :param end: End of the usage of the Custom Costs file. + :type end: float, optional + + :param start: Start of the usage of the Custom Costs file. + :type start: float, optional + """ + if end is not unset: + kwargs["end"] = end + if start is not unset: + kwargs["start"] = start + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/custom_costs_user.py b/src/datadog_api_client/v2/model/custom_costs_user.py new file mode 100644 index 0000000000..b6b127b2e0 --- /dev/null +++ b/src/datadog_api_client/v2/model/custom_costs_user.py @@ -0,0 +1,56 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class CustomCostsUser(ModelNormal): + @cached_property + def openapi_types(_): + return { + "email": (str,), + "icon": (str,), + "name": (str,), + } + + attribute_map = { + "email": "email", + "icon": "icon", + "name": "name", + } + + def __init__( + self_, + email: Union[str, UnsetType] = unset, + icon: Union[str, UnsetType] = unset, + name: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Metadata of the user that has uploaded the Custom Costs file. + + :param email: The name of the Custom Costs file. + :type email: str, optional + + :param icon: The name of the Custom Costs file. + :type icon: str, optional + + :param name: Name of the user. + :type name: str, optional + """ + if email is not unset: + kwargs["email"] = email + if icon is not unset: + kwargs["icon"] = icon + if name is not unset: + kwargs["name"] = name + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index d09cd92593..47e62bc8ed 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -359,6 +359,21 @@ from datadog_api_client.v2.model.create_rule_response import CreateRuleResponse from datadog_api_client.v2.model.create_rule_response_data import CreateRuleResponseData from datadog_api_client.v2.model.creator import Creator +from datadog_api_client.v2.model.custom_cost_get_response_meta import CustomCostGetResponseMeta +from datadog_api_client.v2.model.custom_cost_list_response_meta import CustomCostListResponseMeta +from datadog_api_client.v2.model.custom_cost_upload_response_meta import CustomCostUploadResponseMeta +from datadog_api_client.v2.model.custom_costs_file_get_response import CustomCostsFileGetResponse +from datadog_api_client.v2.model.custom_costs_file_line_item import CustomCostsFileLineItem +from datadog_api_client.v2.model.custom_costs_file_list_response import CustomCostsFileListResponse +from datadog_api_client.v2.model.custom_costs_file_metadata import CustomCostsFileMetadata +from datadog_api_client.v2.model.custom_costs_file_metadata_high_level import CustomCostsFileMetadataHighLevel +from datadog_api_client.v2.model.custom_costs_file_metadata_with_content import CustomCostsFileMetadataWithContent +from datadog_api_client.v2.model.custom_costs_file_metadata_with_content_high_level import ( + CustomCostsFileMetadataWithContentHighLevel, +) +from datadog_api_client.v2.model.custom_costs_file_upload_response import CustomCostsFileUploadResponse +from datadog_api_client.v2.model.custom_costs_file_usage_charge_period import CustomCostsFileUsageChargePeriod +from datadog_api_client.v2.model.custom_costs_user import CustomCostsUser from datadog_api_client.v2.model.custom_destination_attribute_tags_restriction_list_type import ( CustomDestinationAttributeTagsRestrictionListType, ) @@ -2151,6 +2166,19 @@ "CreateRuleResponse", "CreateRuleResponseData", "Creator", + "CustomCostGetResponseMeta", + "CustomCostListResponseMeta", + "CustomCostUploadResponseMeta", + "CustomCostsFileGetResponse", + "CustomCostsFileLineItem", + "CustomCostsFileListResponse", + "CustomCostsFileMetadata", + "CustomCostsFileMetadataHighLevel", + "CustomCostsFileMetadataWithContent", + "CustomCostsFileMetadataWithContentHighLevel", + "CustomCostsFileUploadResponse", + "CustomCostsFileUsageChargePeriod", + "CustomCostsUser", "CustomDestinationAttributeTagsRestrictionListType", "CustomDestinationCreateRequest", "CustomDestinationCreateRequestAttributes", diff --git a/tests/v2/cassettes/test_scenarios/test_delete_custom_costs_file_returns_no_content_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_custom_costs_file_returns_no_content_response.frozen new file mode 100644 index 0000000000..0d8912bb1d --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_custom_costs_file_returns_no_content_response.frozen @@ -0,0 +1 @@ +2024-07-22T12:40:43.508Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_delete_custom_costs_file_returns_no_content_response.yaml b/tests/v2/cassettes/test_scenarios/test_delete_custom_costs_file_returns_no_content_response.yaml new file mode 100644 index 0000000000..537ab6b133 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_custom_costs_file_returns_no_content_response.yaml @@ -0,0 +1,18 @@ +interactions: +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/cost/custom_costs/9d055d22-a838-4e9f-bc34-a4f9ab66280c + response: + body: + string: '' + headers: + content-type: + - application/vnd.api+json + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_custom_costs_file_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_custom_costs_file_returns_ok_response.frozen new file mode 100644 index 0000000000..198bbdbc3d --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_custom_costs_file_returns_ok_response.frozen @@ -0,0 +1 @@ +2024-07-22T12:06:05.860Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_custom_costs_file_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_custom_costs_file_returns_ok_response.yaml new file mode 100644 index 0000000000..4092ee9950 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_custom_costs_file_returns_ok_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/cost/custom_costs/9d055d22-a838-4e9f-bc34-a4f9ab66280c + response: + body: + string: '{"data":{"id":"9d055d22-a838-4e9f-bc34-a4f9ab66280c","type":"cost_metadata","attributes":{"billed_cost":250,"billing_currency":"USD","charge_period":{"start":1683331200000,"end":1686009600000},"content":[{"BilledCost":250,"BillingCurrency":"USD","ChargeDescription":"my_description","Tags":{"key":"value"},"ProviderName":"my_provider","ChargePeriodStart":"2023-05-06","ChargePeriodEnd":"2023-06-06"}],"name":"data.json","provider_names":["my_provider"],"status":"ACTIVE","uploaded_at":1721322924169,"uploaded_by":{"name":"Julien + Hemery","icon":"https://secure.gravatar.com/avatar/f12684c6ebe1bdd70c36789c5270aac0?d=retro\u0026s=48","email":"julien.hemery@datadoghq.com"}}},"meta":{"version":"1.0"}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_list_custom_costs_files_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_list_custom_costs_files_returns_ok_response.frozen new file mode 100644 index 0000000000..14e85f57fe --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_custom_costs_files_returns_ok_response.frozen @@ -0,0 +1 @@ +2024-07-22T12:06:38.368Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_list_custom_costs_files_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_list_custom_costs_files_returns_ok_response.yaml new file mode 100644 index 0000000000..66560a55b9 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_custom_costs_files_returns_ok_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/cost/custom_costs + response: + body: + string: '{"data":[{"id":"9d055d22-a838-4e9f-bc34-a4f9ab66280c","type":"cost_metadata","attributes":{"billed_cost":250,"billing_currency":"USD","charge_period":{"start":1683331200000,"end":1686009600000},"name":"data.json","provider_names":["my_provider"],"status":"ACTIVE","uploaded_at":1721322924169,"uploaded_by":{"name":"Julien + Hemery","icon":"https://secure.gravatar.com/avatar/f12684c6ebe1bdd70c36789c5270aac0?d=retro\u0026s=48","email":"julien.hemery@datadoghq.com"}}}],"meta":{"version":"1.0","total_filtered_count":766}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_upload_custom_costs_file_returns_accepted_response.frozen b/tests/v2/cassettes/test_scenarios/test_upload_custom_costs_file_returns_accepted_response.frozen new file mode 100644 index 0000000000..1a10998b74 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_upload_custom_costs_file_returns_accepted_response.frozen @@ -0,0 +1 @@ +2024-07-18T17:15:23.344Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_upload_custom_costs_file_returns_accepted_response.yaml b/tests/v2/cassettes/test_scenarios/test_upload_custom_costs_file_returns_accepted_response.yaml new file mode 100644 index 0000000000..91f0b54b28 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_upload_custom_costs_file_returns_accepted_response.yaml @@ -0,0 +1,21 @@ +interactions: +- request: + body: '[{"BilledCost":250,"BillingCurrency":"USD","ChargeDescription":"my_description","ChargePeriodEnd":"2023-06-06","ChargePeriodStart":"2023-05-06","ProviderName":"my_provider","Tags":{"key":"value"}}]' + headers: + accept: + - application/json + content-type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/cost/custom_costs + response: + body: + string: '{"data":{"id":"9d055d22-a838-4e9f-bc34-a4f9ab66280c","type":"cost_metadata","attributes":{"billed_cost":250,"billing_currency":"USD","charge_period":{"start":1683331200000,"end":1686009600000},"name":"data.json","provider_names":["my_provider"],"status":"UPLOADING","uploaded_at":1721322923888,"uploaded_by":{"name":"Julien + Hemery","icon":"https://secure.gravatar.com/avatar/f12684c6ebe1bdd70c36789c5270aac0?d=retro\u0026s=48","email":"julien.hemery@datadoghq.com"}}},"meta":{"version":"1.0"}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 202 + message: Accepted +version: 1 diff --git a/tests/v2/features/cloud_cost_management.feature b/tests/v2/features/cloud_cost_management.feature index 867531c0a9..e72eaddea8 100644 --- a/tests/v2/features/cloud_cost_management.feature +++ b/tests/v2/features/cloud_cost_management.feature @@ -88,6 +88,36 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 404 Not Found + @replay-only @team:Datadog/cloud-cost-management + Scenario: Delete Custom Costs File returns "No Content" response + Given new "DeleteCustomCostsFile" request + And request contains "file_id" parameter with value "9d055d22-a838-4e9f-bc34-a4f9ab66280c" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:Datadog/cloud-cost-management + Scenario: Delete Custom Costs file returns "No Content" response + Given new "DeleteCustomCostsFile" request + And request contains "file_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @replay-only @team:Datadog/cloud-cost-management + Scenario: Get Custom Costs File returns "OK" response + Given new "GetCustomCostsFile" request + And request contains "file_id" parameter with value "9d055d22-a838-4e9f-bc34-a4f9ab66280c" + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.name" is equal to "data.json" + And the response "data.attributes.content[0].ChargeDescription" is equal to "my_description" + + @generated @skip @team:Datadog/cloud-cost-management + Scenario: Get Custom Costs file returns "OK" response + Given new "GetCustomCostsFile" request + And request contains "file_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @replay-only @team:Datadog/cloud-cost-management Scenario: List Cloud Cost Management AWS CUR configs returns "OK" response Given new "ListCostAWSCURConfigs" request @@ -102,6 +132,19 @@ Feature: Cloud Cost Management Then the response status is 200 OK And the response "data[0].attributes.configs[0].export_name" is equal to "test_export_name" + @replay-only @team:Datadog/cloud-cost-management + Scenario: List Custom Costs Files returns "OK" response + Given new "ListCustomCostsFiles" request + When the request is sent + Then the response status is 200 OK + And the response "data[0].attributes.name" is equal to "data.json" + + @generated @skip @team:Datadog/cloud-cost-management + Scenario: List Custom Costs files returns "OK" response + Given new "ListCustomCostsFiles" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:Datadog/cloud-cost-management Scenario: List related AWS accounts returns "Bad Request" response Given new "ListAWSRelatedAccounts" request @@ -142,3 +185,18 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 200 OK And the response "data.type" is equal to "azure_uc_configs" + + @replay-only @team:Datadog/cloud-cost-management + Scenario: Upload Custom Costs File returns "Accepted" response + Given new "UploadCustomCostsFile" request + And body with value [{ "ProviderName": "my_provider", "ChargePeriodStart": "2023-05-06", "ChargePeriodEnd": "2023-06-06","ChargeDescription": "my_description","BilledCost": 250,"BillingCurrency": "USD","Tags": {"key": "value"}}] + When the request is sent + Then the response status is 202 Accepted + And the response "data.attributes.name" is equal to "data.json" + + @generated @skip @team:Datadog/cloud-cost-management + Scenario: Upload Custom Costs file returns "Accepted" response + Given new "UploadCustomCostsFile" request + And body with value [{"BilledCost": 100.5, "BillingCurrency": "USD", "ChargeDescription": "Monthly usage charge for my service", "ChargePeriodEnd": "2023-02-28", "ChargePeriodStart": "2023-02-01"}] + When the request is sent + Then the response status is 202 Accepted diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 170f9c4e65..c97bab6f78 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -419,6 +419,30 @@ "type": "idempotent" } }, + "ListCustomCostsFiles": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, + "UploadCustomCostsFile": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, + "DeleteCustomCostsFile": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, + "GetCustomCostsFile": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, "GetCloudCostActivity": { "tag": "Cloud Cost Management", "undo": {