diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 5b0100ae0e..3346060e64 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1461,6 +1461,13 @@ components: required: true schema: type: string + TagKey: + description: The Cloud Cost Management tag key. Tag keys can contain forward slashes (for example, `kubernetes/instance`). + in: path + name: tag_key + required: true + schema: + type: string ToTimestamp: description: The ending timestamp for the SLO status query in epoch seconds. in: query @@ -15600,6 +15607,41 @@ components: type: string x-enum-varnames: - COST_BY_ORG + CostTag: + description: A Cloud Cost Management tag. + properties: + attributes: + $ref: "#/components/schemas/CostTagAttributes" + id: + description: The tag identifier, equal to its `key:value` representation. + example: providername:aws + type: string + type: + $ref: "#/components/schemas/CostTagType" + required: + - attributes + - id + - type + type: object + CostTagAttributes: + description: Attributes of a Cloud Cost Management tag. + properties: + sources: + description: List of sources that define this tag. + example: + - focus + items: + description: A tag source. + type: string + type: array + value: + description: The tag value in `key:value` format. + example: providername:aws + type: string + required: + - sources + - value + type: object CostTagDescription: description: A Cloud Cost Management tag key description, either cross-cloud or scoped to a single cloud provider. properties: @@ -15692,6 +15734,153 @@ components: required: - data type: object + CostTagKey: + description: A Cloud Cost Management tag key. + properties: + attributes: + $ref: "#/components/schemas/CostTagKeyAttributes" + id: + description: The tag key identifier. + example: providername + type: string + type: + $ref: "#/components/schemas/CostTagKeyType" + required: + - attributes + - id + - type + type: object + CostTagKeyAttributes: + description: Attributes of a Cloud Cost Management tag key. + properties: + details: + $ref: "#/components/schemas/CostTagKeyDetails" + sources: + description: List of sources that define this tag key. + example: + - focus + items: + description: A tag key source. + type: string + type: array + value: + description: The tag key name. + example: providername + type: string + required: + - sources + - value + type: object + CostTagKeyDetails: + description: Additional details for a Cloud Cost Management tag key, including its description and example tag values. + properties: + description: + description: Description of the tag key. + example: The cloud provider name reported for the cost line item. + type: string + tag_values: + description: Example tag values observed for this tag key. + example: + - aws + - gcp + - azure + items: + description: A tag value observed for this tag key. + type: string + type: array + required: + - description + - tag_values + type: object + CostTagKeyResponse: + description: A single Cloud Cost Management tag key. + example: + data: + attributes: + details: + description: The cloud provider name reported for the cost line item. + tag_values: + - aws + - gcp + - azure + sources: + - focus + value: providername + id: providername + type: cost_tag_key + properties: + data: + $ref: "#/components/schemas/CostTagKey" + required: + - data + type: object + CostTagKeyType: + default: cost_tag_key + description: Type of the Cloud Cost Management tag key resource. + enum: + - cost_tag_key + example: cost_tag_key + type: string + x-enum-varnames: + - COST_TAG_KEY + CostTagKeysResponse: + description: A list of Cloud Cost Management tag keys. + example: + data: + - attributes: + sources: + - focus + value: providername + id: providername + type: cost_tag_key + - attributes: + sources: [] + value: service + id: service + type: cost_tag_key + properties: + data: + description: The list of Cloud Cost Management tag keys. + items: + $ref: "#/components/schemas/CostTagKey" + type: array + required: + - data + type: object + CostTagType: + default: cost_tag + description: Type of the Cloud Cost Management tag resource. + enum: + - cost_tag + example: cost_tag + type: string + x-enum-varnames: + - COST_TAG + CostTagsResponse: + description: A list of Cloud Cost Management tags. + example: + data: + - attributes: + sources: + - focus + value: providername:aws + id: providername:aws + type: cost_tag + - attributes: + sources: + - focus + value: providername:gcp + id: providername:gcp + type: cost_tag + properties: + data: + description: The list of Cloud Cost Management tags. + items: + $ref: "#/components/schemas/CostTag" + type: array + required: + - data + type: object CoverageSummaryAttributes: description: Attributes object for code coverage summary response. properties: @@ -97149,6 +97338,235 @@ paths: operator: OR permissions: - cloud_cost_management_read + /api/v2/cost/tag_keys: + get: + description: List Cloud Cost Management tag keys. + operationId: ListCostTagKeys + parameters: + - description: The Cloud Cost Management metric to scope the tag keys to. When omitted, returns tag keys across all metrics. + in: query + name: filter[metric] + schema: + type: string + - description: |- + Filter to return only tag keys that appear with the given `key:value` tag values. For example, `filter[tags]=providername:aws` returns tag keys found on the same cost data, such as `is_aws_ec2_compute` and `aws_instance_type`. + in: query + name: filter[tags] + schema: + items: + type: string + type: array + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + sources: + - focus + value: providername + id: providername + type: cost_tag_key + - attributes: + sources: [] + value: service + id: service + type: cost_tag_key + schema: + $ref: "#/components/schemas/CostTagKeysResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "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 Cloud Cost Management tag keys + tags: + - Cloud Cost Management + "x-permission": + operator: OR + permissions: + - cloud_cost_management_read + /api/v2/cost/tag_keys/{tag_key}: + get: + description: Get details for a specific Cloud Cost Management tag key, including example tag values and description. + operationId: GetCostTagKey + parameters: + - $ref: "#/components/parameters/TagKey" + - description: The Cloud Cost Management metric to scope the tag key details to. When omitted, returns details across all metrics. + in: query + name: filter[metric] + schema: + type: string + - description: |- + Controls the size of the internal tag value search scope. This does **not** restrict the number of example tag values returned in the response. Defaults to 50, maximum 10000. + in: query + name: page[size] + schema: + default: 50 + format: int32 + maximum: 10000 + type: integer + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + details: + description: The cloud provider name reported for the cost line item. + tag_values: + - aws + - gcp + - azure + sources: + - focus + value: providername + id: providername + type: cost_tag_key + schema: + $ref: "#/components/schemas/CostTagKeyResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_read + summary: Get a Cloud Cost Management tag key + tags: + - Cloud Cost Management + "x-permission": + operator: OR + permissions: + - cloud_cost_management_read + /api/v2/cost/tags: + get: + description: List Cloud Cost Management tags for a given metric. + operationId: ListCostTags + parameters: + - description: The Cloud Cost Management metric to scope the tags to. When omitted, returns tags across all metrics. + in: query + name: filter[metric] + schema: + type: string + - description: A substring used to filter the returned tags by name. + in: query + name: filter[match] + schema: + type: string + - description: |- + Filter to return only tags that appear with the given `key:value` tag values. For example, `filter[tags]=providername:aws` returns tags found on the same cost data, such as `aws_instance_type:t3.micro` and `aws_instance_type:m5.large`. + in: query + name: filter[tags] + schema: + items: + type: string + type: array + - description: Restrict the returned tags to those whose key matches one of the given tag keys. + in: query + name: filter[tag_keys] + schema: + items: + type: string + type: array + - description: |- + Controls the size of the internal tag search scope. This does **not** restrict the number of tags returned in the response. Defaults to 50, maximum 10000. + in: query + name: page[size] + schema: + default: 50 + format: int32 + maximum: 10000 + type: integer + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + sources: + - focus + value: providername:aws + id: providername:aws + type: cost_tag + - attributes: + sources: + - focus + value: providername:gcp + id: providername:gcp + type: cost_tag + schema: + $ref: "#/components/schemas/CostTagsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "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 Cloud Cost Management tags + tags: + - Cloud Cost Management + "x-permission": + operator: OR + permissions: + - cloud_cost_management_read /api/v2/cost_by_tag/active_billing_dimensions: get: description: |- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index ee5c6f20ab..2dae4897c5 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -6220,6 +6220,20 @@ datadog\_api\_client.v2.model.cost\_by\_org\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.cost\_tag module +---------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.cost_tag + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.cost\_tag\_attributes module +---------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.cost_tag_attributes + :members: + :show-inheritance: + datadog\_api\_client.v2.model.cost\_tag\_description module ----------------------------------------------------------- @@ -6255,6 +6269,62 @@ datadog\_api\_client.v2.model.cost\_tag\_descriptions\_response module :members: :show-inheritance: +datadog\_api\_client.v2.model.cost\_tag\_key module +--------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.cost_tag_key + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.cost\_tag\_key\_attributes module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.cost_tag_key_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.cost\_tag\_key\_details module +------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.cost_tag_key_details + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.cost\_tag\_key\_response module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.cost_tag_key_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.cost\_tag\_key\_type module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.cost_tag_key_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.cost\_tag\_keys\_response module +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.cost_tag_keys_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.cost\_tag\_type module +---------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.cost_tag_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.cost\_tags\_response module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.cost_tags_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.coverage\_summary\_attributes module ------------------------------------------------------------------ diff --git a/examples/v2/cloud-cost-management/GetCostTagKey.py b/examples/v2/cloud-cost-management/GetCostTagKey.py new file mode 100644 index 0000000000..182d189268 --- /dev/null +++ b/examples/v2/cloud-cost-management/GetCostTagKey.py @@ -0,0 +1,15 @@ +""" +Get a Cloud Cost Management tag key 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_cost_tag_key( + tag_key="tag_key", + ) + + print(response) diff --git a/examples/v2/cloud-cost-management/ListCostTagKeys.py b/examples/v2/cloud-cost-management/ListCostTagKeys.py new file mode 100644 index 0000000000..8c1457e253 --- /dev/null +++ b/examples/v2/cloud-cost-management/ListCostTagKeys.py @@ -0,0 +1,13 @@ +""" +List Cloud Cost Management tag keys 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_cost_tag_keys() + + print(response) diff --git a/examples/v2/cloud-cost-management/ListCostTags.py b/examples/v2/cloud-cost-management/ListCostTags.py new file mode 100644 index 0000000000..f678a4f617 --- /dev/null +++ b/examples/v2/cloud-cost-management/ListCostTags.py @@ -0,0 +1,13 @@ +""" +List Cloud Cost Management tags 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_cost_tags() + + 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 1c66232eae..28c0627883 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 @@ -41,6 +41,9 @@ from datadog_api_client.v2.model.gcp_usage_cost_config_patch_request import GCPUsageCostConfigPatchRequest from datadog_api_client.v2.model.oci_configs_response import OCIConfigsResponse from datadog_api_client.v2.model.cost_tag_descriptions_response import CostTagDescriptionsResponse +from datadog_api_client.v2.model.cost_tag_keys_response import CostTagKeysResponse +from datadog_api_client.v2.model.cost_tag_key_response import CostTagKeyResponse +from datadog_api_client.v2.model.cost_tags_response import CostTagsResponse from datadog_api_client.v2.model.ruleset_resp_array import RulesetRespArray from datadog_api_client.v2.model.ruleset_resp import RulesetResp from datadog_api_client.v2.model.create_ruleset_request import CreateRulesetRequest @@ -414,6 +417,42 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_cost_tag_key_endpoint = _Endpoint( + settings={ + "response_type": (CostTagKeyResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/tag_keys/{tag_key}", + "operation_id": "get_cost_tag_key", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "tag_key": { + "required": True, + "openapi_types": (str,), + "attribute": "tag_key", + "location": "path", + }, + "filter_metric": { + "openapi_types": (str,), + "attribute": "filter[metric]", + "location": "query", + }, + "page_size": { + "validation": { + "inclusive_maximum": 10000, + }, + "openapi_types": (int,), + "attribute": "page[size]", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._get_custom_allocation_rule_endpoint = _Endpoint( settings={ "response_type": (ArbitraryRuleResponse,), @@ -585,6 +624,81 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_cost_tag_keys_endpoint = _Endpoint( + settings={ + "response_type": (CostTagKeysResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/tag_keys", + "operation_id": "list_cost_tag_keys", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "filter_metric": { + "openapi_types": (str,), + "attribute": "filter[metric]", + "location": "query", + }, + "filter_tags": { + "openapi_types": ([str],), + "attribute": "filter[tags]", + "location": "query", + "collection_format": "multi", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._list_cost_tags_endpoint = _Endpoint( + settings={ + "response_type": (CostTagsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/tags", + "operation_id": "list_cost_tags", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "filter_metric": { + "openapi_types": (str,), + "attribute": "filter[metric]", + "location": "query", + }, + "filter_match": { + "openapi_types": (str,), + "attribute": "filter[match]", + "location": "query", + }, + "filter_tags": { + "openapi_types": ([str],), + "attribute": "filter[tags]", + "location": "query", + "collection_format": "multi", + }, + "filter_tag_keys": { + "openapi_types": ([str],), + "attribute": "filter[tag_keys]", + "location": "query", + "collection_format": "multi", + }, + "page_size": { + "validation": { + "inclusive_maximum": 10000, + }, + "openapi_types": (int,), + "attribute": "page[size]", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_custom_allocation_rules_endpoint = _Endpoint( settings={ "response_type": (ArbitraryRuleResponseArray,), @@ -1245,6 +1359,36 @@ def get_cost_gcp_usage_cost_config( return self._get_cost_gcp_usage_cost_config_endpoint.call_with_http_info(**kwargs) + def get_cost_tag_key( + self, + tag_key: str, + *, + filter_metric: Union[str, UnsetType] = unset, + page_size: Union[int, UnsetType] = unset, + ) -> CostTagKeyResponse: + """Get a Cloud Cost Management tag key. + + Get details for a specific Cloud Cost Management tag key, including example tag values and description. + + :param tag_key: The Cloud Cost Management tag key. Tag keys can contain forward slashes (for example, ``kubernetes/instance`` ). + :type tag_key: str + :param filter_metric: The Cloud Cost Management metric to scope the tag key details to. When omitted, returns details across all metrics. + :type filter_metric: str, optional + :param page_size: Controls the size of the internal tag value search scope. This does **not** restrict the number of example tag values returned in the response. Defaults to 50, maximum 10000. + :type page_size: int, optional + :rtype: CostTagKeyResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["tag_key"] = tag_key + + if filter_metric is not unset: + kwargs["filter_metric"] = filter_metric + + if page_size is not unset: + kwargs["page_size"] = page_size + + return self._get_cost_tag_key_endpoint.call_with_http_info(**kwargs) + def get_custom_allocation_rule( self, rule_id: int, @@ -1375,6 +1519,74 @@ def list_cost_tag_descriptions( return self._list_cost_tag_descriptions_endpoint.call_with_http_info(**kwargs) + def list_cost_tag_keys( + self, + *, + filter_metric: Union[str, UnsetType] = unset, + filter_tags: Union[List[str], UnsetType] = unset, + ) -> CostTagKeysResponse: + """List Cloud Cost Management tag keys. + + List Cloud Cost Management tag keys. + + :param filter_metric: The Cloud Cost Management metric to scope the tag keys to. When omitted, returns tag keys across all metrics. + :type filter_metric: str, optional + :param filter_tags: Filter to return only tag keys that appear with the given ``key:value`` tag values. For example, ``filter[tags]=providername:aws`` returns tag keys found on the same cost data, such as ``is_aws_ec2_compute`` and ``aws_instance_type``. + :type filter_tags: [str], optional + :rtype: CostTagKeysResponse + """ + kwargs: Dict[str, Any] = {} + if filter_metric is not unset: + kwargs["filter_metric"] = filter_metric + + if filter_tags is not unset: + kwargs["filter_tags"] = filter_tags + + return self._list_cost_tag_keys_endpoint.call_with_http_info(**kwargs) + + def list_cost_tags( + self, + *, + filter_metric: Union[str, UnsetType] = unset, + filter_match: Union[str, UnsetType] = unset, + filter_tags: Union[List[str], UnsetType] = unset, + filter_tag_keys: Union[List[str], UnsetType] = unset, + page_size: Union[int, UnsetType] = unset, + ) -> CostTagsResponse: + """List Cloud Cost Management tags. + + List Cloud Cost Management tags for a given metric. + + :param filter_metric: The Cloud Cost Management metric to scope the tags to. When omitted, returns tags across all metrics. + :type filter_metric: str, optional + :param filter_match: A substring used to filter the returned tags by name. + :type filter_match: str, optional + :param filter_tags: Filter to return only tags that appear with the given ``key:value`` tag values. For example, ``filter[tags]=providername:aws`` returns tags found on the same cost data, such as ``aws_instance_type:t3.micro`` and ``aws_instance_type:m5.large``. + :type filter_tags: [str], optional + :param filter_tag_keys: Restrict the returned tags to those whose key matches one of the given tag keys. + :type filter_tag_keys: [str], optional + :param page_size: Controls the size of the internal tag search scope. This does **not** restrict the number of tags returned in the response. Defaults to 50, maximum 10000. + :type page_size: int, optional + :rtype: CostTagsResponse + """ + kwargs: Dict[str, Any] = {} + if filter_metric is not unset: + kwargs["filter_metric"] = filter_metric + + if filter_match is not unset: + kwargs["filter_match"] = filter_match + + if filter_tags is not unset: + kwargs["filter_tags"] = filter_tags + + if filter_tag_keys is not unset: + kwargs["filter_tag_keys"] = filter_tag_keys + + if page_size is not unset: + kwargs["page_size"] = page_size + + return self._list_cost_tags_endpoint.call_with_http_info(**kwargs) + def list_custom_allocation_rules( self, ) -> ArbitraryRuleResponseArray: diff --git a/src/datadog_api_client/v2/model/cost_tag.py b/src/datadog_api_client/v2/model/cost_tag.py new file mode 100644 index 0000000000..db9dd96b20 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_tag.py @@ -0,0 +1,54 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_tag_attributes import CostTagAttributes + from datadog_api_client.v2.model.cost_tag_type import CostTagType + + +class CostTag(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_tag_attributes import CostTagAttributes + from datadog_api_client.v2.model.cost_tag_type import CostTagType + + return { + "attributes": (CostTagAttributes,), + "id": (str,), + "type": (CostTagType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: CostTagAttributes, id: str, type: CostTagType, **kwargs): + """ + A Cloud Cost Management tag. + + :param attributes: Attributes of a Cloud Cost Management tag. + :type attributes: CostTagAttributes + + :param id: The tag identifier, equal to its ``key:value`` representation. + :type id: str + + :param type: Type of the Cloud Cost Management tag resource. + :type type: CostTagType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/cost_tag_attributes.py b/src/datadog_api_client/v2/model/cost_tag_attributes.py new file mode 100644 index 0000000000..afa7fe1cb0 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_tag_attributes.py @@ -0,0 +1,40 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class CostTagAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "sources": ([str],), + "value": (str,), + } + + attribute_map = { + "sources": "sources", + "value": "value", + } + + def __init__(self_, sources: List[str], value: str, **kwargs): + """ + Attributes of a Cloud Cost Management tag. + + :param sources: List of sources that define this tag. + :type sources: [str] + + :param value: The tag value in ``key:value`` format. + :type value: str + """ + super().__init__(kwargs) + + self_.sources = sources + self_.value = value diff --git a/src/datadog_api_client/v2/model/cost_tag_key.py b/src/datadog_api_client/v2/model/cost_tag_key.py new file mode 100644 index 0000000000..ce2f957fc0 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_tag_key.py @@ -0,0 +1,54 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_tag_key_attributes import CostTagKeyAttributes + from datadog_api_client.v2.model.cost_tag_key_type import CostTagKeyType + + +class CostTagKey(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_tag_key_attributes import CostTagKeyAttributes + from datadog_api_client.v2.model.cost_tag_key_type import CostTagKeyType + + return { + "attributes": (CostTagKeyAttributes,), + "id": (str,), + "type": (CostTagKeyType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: CostTagKeyAttributes, id: str, type: CostTagKeyType, **kwargs): + """ + A Cloud Cost Management tag key. + + :param attributes: Attributes of a Cloud Cost Management tag key. + :type attributes: CostTagKeyAttributes + + :param id: The tag key identifier. + :type id: str + + :param type: Type of the Cloud Cost Management tag key resource. + :type type: CostTagKeyType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/cost_tag_key_attributes.py b/src/datadog_api_client/v2/model/cost_tag_key_attributes.py new file mode 100644 index 0000000000..5e05ad10ac --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_tag_key_attributes.py @@ -0,0 +1,55 @@ +# 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.cost_tag_key_details import CostTagKeyDetails + + +class CostTagKeyAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_tag_key_details import CostTagKeyDetails + + return { + "details": (CostTagKeyDetails,), + "sources": ([str],), + "value": (str,), + } + + attribute_map = { + "details": "details", + "sources": "sources", + "value": "value", + } + + def __init__(self_, sources: List[str], value: str, details: Union[CostTagKeyDetails, UnsetType] = unset, **kwargs): + """ + Attributes of a Cloud Cost Management tag key. + + :param details: Additional details for a Cloud Cost Management tag key, including its description and example tag values. + :type details: CostTagKeyDetails, optional + + :param sources: List of sources that define this tag key. + :type sources: [str] + + :param value: The tag key name. + :type value: str + """ + if details is not unset: + kwargs["details"] = details + super().__init__(kwargs) + + self_.sources = sources + self_.value = value diff --git a/src/datadog_api_client/v2/model/cost_tag_key_details.py b/src/datadog_api_client/v2/model/cost_tag_key_details.py new file mode 100644 index 0000000000..fcbecd2e93 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_tag_key_details.py @@ -0,0 +1,40 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class CostTagKeyDetails(ModelNormal): + @cached_property + def openapi_types(_): + return { + "description": (str,), + "tag_values": ([str],), + } + + attribute_map = { + "description": "description", + "tag_values": "tag_values", + } + + def __init__(self_, description: str, tag_values: List[str], **kwargs): + """ + Additional details for a Cloud Cost Management tag key, including its description and example tag values. + + :param description: Description of the tag key. + :type description: str + + :param tag_values: Example tag values observed for this tag key. + :type tag_values: [str] + """ + super().__init__(kwargs) + + self_.description = description + self_.tag_values = tag_values diff --git a/src/datadog_api_client/v2/model/cost_tag_key_response.py b/src/datadog_api_client/v2/model/cost_tag_key_response.py new file mode 100644 index 0000000000..bf4534cb63 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_tag_key_response.py @@ -0,0 +1,40 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_tag_key import CostTagKey + + +class CostTagKeyResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_tag_key import CostTagKey + + return { + "data": (CostTagKey,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: CostTagKey, **kwargs): + """ + A single Cloud Cost Management tag key. + + :param data: A Cloud Cost Management tag key. + :type data: CostTagKey + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/cost_tag_key_type.py b/src/datadog_api_client/v2/model/cost_tag_key_type.py new file mode 100644 index 0000000000..5345a4b960 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_tag_key_type.py @@ -0,0 +1,35 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class CostTagKeyType(ModelSimple): + """ + Type of the Cloud Cost Management tag key resource. + + :param value: If omitted defaults to "cost_tag_key". Must be one of ["cost_tag_key"]. + :type value: str + """ + + allowed_values = { + "cost_tag_key", + } + COST_TAG_KEY: ClassVar["CostTagKeyType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CostTagKeyType.COST_TAG_KEY = CostTagKeyType("cost_tag_key") diff --git a/src/datadog_api_client/v2/model/cost_tag_keys_response.py b/src/datadog_api_client/v2/model/cost_tag_keys_response.py new file mode 100644 index 0000000000..af737b840f --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_tag_keys_response.py @@ -0,0 +1,40 @@ +# 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, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_tag_key import CostTagKey + + +class CostTagKeysResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_tag_key import CostTagKey + + return { + "data": ([CostTagKey],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[CostTagKey], **kwargs): + """ + A list of Cloud Cost Management tag keys. + + :param data: The list of Cloud Cost Management tag keys. + :type data: [CostTagKey] + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/cost_tag_type.py b/src/datadog_api_client/v2/model/cost_tag_type.py new file mode 100644 index 0000000000..a3036ccd29 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_tag_type.py @@ -0,0 +1,35 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class CostTagType(ModelSimple): + """ + Type of the Cloud Cost Management tag resource. + + :param value: If omitted defaults to "cost_tag". Must be one of ["cost_tag"]. + :type value: str + """ + + allowed_values = { + "cost_tag", + } + COST_TAG: ClassVar["CostTagType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CostTagType.COST_TAG = CostTagType("cost_tag") diff --git a/src/datadog_api_client/v2/model/cost_tags_response.py b/src/datadog_api_client/v2/model/cost_tags_response.py new file mode 100644 index 0000000000..faaa1a670d --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_tags_response.py @@ -0,0 +1,40 @@ +# 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, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_tag import CostTag + + +class CostTagsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_tag import CostTag + + return { + "data": ([CostTag],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[CostTag], **kwargs): + """ + A list of Cloud Cost Management tags. + + :param data: The list of Cloud Cost Management tags. + :type data: [CostTag] + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index b3538f3fd0..e420ba9189 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -1171,11 +1171,21 @@ from datadog_api_client.v2.model.cost_by_org_attributes import CostByOrgAttributes from datadog_api_client.v2.model.cost_by_org_response import CostByOrgResponse from datadog_api_client.v2.model.cost_by_org_type import CostByOrgType +from datadog_api_client.v2.model.cost_tag import CostTag +from datadog_api_client.v2.model.cost_tag_attributes import CostTagAttributes from datadog_api_client.v2.model.cost_tag_description import CostTagDescription from datadog_api_client.v2.model.cost_tag_description_attributes import CostTagDescriptionAttributes from datadog_api_client.v2.model.cost_tag_description_source import CostTagDescriptionSource from datadog_api_client.v2.model.cost_tag_description_type import CostTagDescriptionType from datadog_api_client.v2.model.cost_tag_descriptions_response import CostTagDescriptionsResponse +from datadog_api_client.v2.model.cost_tag_key import CostTagKey +from datadog_api_client.v2.model.cost_tag_key_attributes import CostTagKeyAttributes +from datadog_api_client.v2.model.cost_tag_key_details import CostTagKeyDetails +from datadog_api_client.v2.model.cost_tag_key_response import CostTagKeyResponse +from datadog_api_client.v2.model.cost_tag_key_type import CostTagKeyType +from datadog_api_client.v2.model.cost_tag_keys_response import CostTagKeysResponse +from datadog_api_client.v2.model.cost_tag_type import CostTagType +from datadog_api_client.v2.model.cost_tags_response import CostTagsResponse from datadog_api_client.v2.model.coverage_summary_attributes import CoverageSummaryAttributes from datadog_api_client.v2.model.coverage_summary_codeowner_stats import CoverageSummaryCodeownerStats from datadog_api_client.v2.model.coverage_summary_data import CoverageSummaryData @@ -8462,11 +8472,21 @@ "CostByOrgAttributes", "CostByOrgResponse", "CostByOrgType", + "CostTag", + "CostTagAttributes", "CostTagDescription", "CostTagDescriptionAttributes", "CostTagDescriptionSource", "CostTagDescriptionType", "CostTagDescriptionsResponse", + "CostTagKey", + "CostTagKeyAttributes", + "CostTagKeyDetails", + "CostTagKeyResponse", + "CostTagKeyType", + "CostTagKeysResponse", + "CostTagType", + "CostTagsResponse", "CoverageSummaryAttributes", "CoverageSummaryCodeownerStats", "CoverageSummaryData", diff --git a/tests/v2/features/cloud_cost_management.feature b/tests/v2/features/cloud_cost_management.feature index bf9f695d40..fdaf32850e 100644 --- a/tests/v2/features/cloud_cost_management.feature +++ b/tests/v2/features/cloud_cost_management.feature @@ -250,6 +250,27 @@ Feature: Cloud Cost Management And the response "data.type" is equal to "gcp_uc_config" And the response "data.attributes.account_id" is equal to "123456_ABCDEF_123ABC" + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Get a Cloud Cost Management tag key returns "Bad Request" response + Given new "GetCostTagKey" request + And request contains "tag_key" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Get a Cloud Cost Management tag key returns "Not Found" response + Given new "GetCostTagKey" request + And request contains "tag_key" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Get a Cloud Cost Management tag key returns "OK" response + Given new "GetCostTagKey" request + And request contains "tag_key" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @team:DataDog/cloud-cost-management Scenario: Get a budget returns "Not Found" response Given new "GetBudget" request @@ -325,6 +346,30 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/cloud-cost-management + Scenario: List Cloud Cost Management tag keys returns "Bad Request" response + Given new "ListCostTagKeys" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: List Cloud Cost Management tag keys returns "OK" response + Given new "ListCostTagKeys" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: List Cloud Cost Management tags returns "Bad Request" response + Given new "ListCostTags" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: List Cloud Cost Management tags returns "OK" response + Given new "ListCostTags" request + When the request is sent + Then the response status is 200 OK + @replay-only @team:DataDog/cloud-cost-management Scenario: List Custom Costs Files returns "OK" response Given new "ListCustomCostsFiles" request diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 3d8451720f..b2d6f99f26 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1476,6 +1476,24 @@ "type": "safe" } }, + "ListCostTagKeys": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, + "GetCostTagKey": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, + "ListCostTags": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, "GetActiveBillingDimensions": { "tag": "Usage Metering", "undo": {