diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index bf4011c155..053bf03433 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -4062,6 +4062,86 @@ components: type: string type: array type: object + AccountFilters: + description: The account filters for a cloud account. + properties: + attributes: + $ref: "#/components/schemas/AccountFiltersAttributes" + id: + description: The ID of the cloud account. + example: "123456789123" + type: string + type: + $ref: "#/components/schemas/AccountFiltersType" + required: + - attributes + - type + type: object + AccountFiltersAttributes: + description: Attributes for the account filters of a cloud account. + properties: + account_filters: + $ref: "#/components/schemas/AccountFilteringConfig" + account_id: + description: The cloud account ID. + example: "123456789123" + type: string + cloud: + description: The cloud provider of the account, for example `aws`, `aws_cur2`, or `oci`. + example: "aws_cur2" + type: string + type: object + AccountFiltersPatchData: + description: Account filters patch data. + properties: + attributes: + $ref: "#/components/schemas/AccountFiltersPatchRequestAttributes" + type: + $ref: "#/components/schemas/AccountFiltersPatchRequestType" + required: + - attributes + - type + type: object + AccountFiltersPatchRequest: + description: Account filters patch request. + properties: + data: + $ref: "#/components/schemas/AccountFiltersPatchData" + required: + - data + type: object + AccountFiltersPatchRequestAttributes: + description: Attributes for an account filters patch request. + properties: + account_filters: + $ref: "#/components/schemas/AccountFilteringConfig" + required: + - account_filters + type: object + AccountFiltersPatchRequestType: + default: account_filters_patch_request + description: Type of account filters patch request. + enum: + - account_filters_patch_request + example: account_filters_patch_request + type: string + x-enum-varnames: + - ACCOUNT_FILTERS_PATCH_REQUEST + AccountFiltersResponse: + description: Response containing the account filters for a cloud account. + properties: + data: + $ref: "#/components/schemas/AccountFilters" + type: object + AccountFiltersType: + default: account_filters + description: Type of account filters. + enum: + - account_filters + example: account_filters + type: string + x-enum-varnames: + - ACCOUNT_FILTERS ActionConnectionAttributes: description: The definition of `ActionConnectionAttributes` object. properties: @@ -126466,6 +126546,182 @@ paths: "x-permission": operator: OPEN permissions: [] + /api/v2/cost/account_filters/{cloud_account_id}: + get: + description: Get the account filters for a cloud account (AWS CUR 1.0/2.0, OCI, and other clouds). + operationId: GetCostAccountFilters + parameters: + - $ref: "#/components/parameters/CloudAccountID" + responses: + "200": + content: + application/json: + examples: + default: + summary: Include new accounts and exclude specific accounts + value: + data: + attributes: + account_filters: + excluded_accounts: + - "123456789123" + - "123456789143" + include_new_accounts: true + account_id: "123456789123" + cloud: aws_cur2 + id: "123" + type: account_filters + include_accounts: + summary: Exclude new accounts and include specific accounts + value: + data: + attributes: + account_filters: + include_new_accounts: false + included_accounts: + - "123456789123" + - "123456789143" + account_id: "123456789123" + cloud: aws_cur2 + id: "123" + type: account_filters + schema: + $ref: "#/components/schemas/AccountFiltersResponse" + 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 account filters + tags: + - Cloud Cost Management + "x-permission": + operator: OR + permissions: + - cloud_cost_management_read + patch: + description: Update the account filters for a cloud account (AWS CUR 1.0/2.0, OCI, and other clouds). + operationId: UpdateCostAccountFilters + parameters: + - $ref: "#/components/parameters/CloudAccountID" + requestBody: + content: + application/json: + examples: + default: + summary: Exclude new accounts and include specific accounts + value: + data: + attributes: + account_filters: + include_new_accounts: false + included_accounts: + - "123456789123" + - "123456789143" + type: account_filters_patch_request + exclude_accounts: + summary: Include new accounts and exclude specific accounts + value: + data: + attributes: + account_filters: + excluded_accounts: + - "123456789123" + - "123456789143" + include_new_accounts: true + type: account_filters_patch_request + schema: + $ref: "#/components/schemas/AccountFiltersPatchRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + summary: Exclude new accounts and include specific accounts + value: + data: + attributes: + account_filters: + include_new_accounts: false + included_accounts: + - "123456789123" + - "123456789143" + account_id: "123456789123" + cloud: aws_cur2 + id: "123" + type: account_filters + exclude_accounts: + summary: Include new accounts and exclude specific accounts + value: + data: + attributes: + account_filters: + excluded_accounts: + - "123456789123" + - "123456789143" + include_new_accounts: true + account_id: "123456789123" + cloud: aws_cur2 + id: "123" + type: account_filters + schema: + $ref: "#/components/schemas/AccountFiltersResponse" + 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_write + summary: Update account filters + tags: + - Cloud Cost Management + "x-permission": + operator: OR + permissions: + - cloud_cost_management_write /api/v2/cost/anomalies: get: description: List detected Cloud Cost Management anomalies for the organization. diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 7c885d5bb0..83d9099007 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -39,6 +39,62 @@ datadog\_api\_client.v2.model.account\_filtering\_config module :members: :show-inheritance: +datadog\_api\_client.v2.model.account\_filters module +----------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.account_filters + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.account\_filters\_attributes module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.account_filters_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.account\_filters\_patch\_data module +------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.account_filters_patch_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.account\_filters\_patch\_request module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.account_filters_patch_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.account\_filters\_patch\_request\_attributes module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.account_filters_patch_request_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.account\_filters\_patch\_request\_type module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.account_filters_patch_request_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.account\_filters\_response module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.account_filters_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.account\_filters\_type module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.account_filters_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.action\_connection\_attributes module ------------------------------------------------------------------- diff --git a/examples/v2/cloud-cost-management/GetCostAccountFilters.py b/examples/v2/cloud-cost-management/GetCostAccountFilters.py new file mode 100644 index 0000000000..9fbc7ac966 --- /dev/null +++ b/examples/v2/cloud-cost-management/GetCostAccountFilters.py @@ -0,0 +1,15 @@ +""" +Get account filters 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_account_filters( + cloud_account_id=9223372036854775807, + ) + + print(response) diff --git a/examples/v2/cloud-cost-management/UpdateCostAccountFilters.py b/examples/v2/cloud-cost-management/UpdateCostAccountFilters.py new file mode 100644 index 0000000000..2a79bc063e --- /dev/null +++ b/examples/v2/cloud-cost-management/UpdateCostAccountFilters.py @@ -0,0 +1,37 @@ +""" +Update account filters returns "OK" 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.account_filtering_config import AccountFilteringConfig +from datadog_api_client.v2.model.account_filters_patch_data import AccountFiltersPatchData +from datadog_api_client.v2.model.account_filters_patch_request import AccountFiltersPatchRequest +from datadog_api_client.v2.model.account_filters_patch_request_attributes import AccountFiltersPatchRequestAttributes +from datadog_api_client.v2.model.account_filters_patch_request_type import AccountFiltersPatchRequestType + +body = AccountFiltersPatchRequest( + data=AccountFiltersPatchData( + attributes=AccountFiltersPatchRequestAttributes( + account_filters=AccountFilteringConfig( + excluded_accounts=[ + "123456789123", + "123456789143", + ], + include_new_accounts=True, + included_accounts=[ + "123456789123", + "123456789143", + ], + ), + ), + type=AccountFiltersPatchRequestType.ACCOUNT_FILTERS_PATCH_REQUEST, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + response = api_instance.update_cost_account_filters(cloud_account_id=9223372036854775807, 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 7ffeef2f98..f5922c4530 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 @@ -11,6 +11,8 @@ UnsetType, unset, ) +from datadog_api_client.v2.model.account_filters_response import AccountFiltersResponse +from datadog_api_client.v2.model.account_filters_patch_request import AccountFiltersPatchRequest from datadog_api_client.v2.model.cost_anomalies_response import CostAnomaliesResponse from datadog_api_client.v2.model.cost_anomaly_response import CostAnomalyResponse from datadog_api_client.v2.model.arbitrary_rule_response_array import ArbitraryRuleResponseArray @@ -855,6 +857,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_cost_account_filters_endpoint = _Endpoint( + settings={ + "response_type": (AccountFiltersResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/account_filters/{cloud_account_id}", + "operation_id": "get_cost_account_filters", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "cloud_account_id": { + "required": True, + "openapi_types": (int,), + "attribute": "cloud_account_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._get_cost_anomaly_endpoint = _Endpoint( settings={ "response_type": (CostAnomalyResponse,), @@ -1718,6 +1743,32 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._update_cost_account_filters_endpoint = _Endpoint( + settings={ + "response_type": (AccountFiltersResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/account_filters/{cloud_account_id}", + "operation_id": "update_cost_account_filters", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "cloud_account_id": { + "required": True, + "openapi_types": (int,), + "attribute": "cloud_account_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (AccountFiltersPatchRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._update_cost_awscur_config_endpoint = _Endpoint( settings={ "response_type": (AwsCURConfigsResponse,), @@ -2634,6 +2685,23 @@ def get_commitments_utilization_timeseries( return self._get_commitments_utilization_timeseries_endpoint.call_with_http_info(**kwargs) + def get_cost_account_filters( + self, + cloud_account_id: int, + ) -> AccountFiltersResponse: + """Get account filters. + + Get the account filters for a cloud account (AWS CUR 1.0/2.0, OCI, and other clouds). + + :param cloud_account_id: Cloud Account id. + :type cloud_account_id: int + :rtype: AccountFiltersResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["cloud_account_id"] = cloud_account_id + + return self._get_cost_account_filters_endpoint.call_with_http_info(**kwargs) + def get_cost_anomaly( self, anomaly_id: str, @@ -3379,6 +3447,27 @@ def search_cost_recommendations( return self._search_cost_recommendations_endpoint.call_with_http_info(**kwargs) + def update_cost_account_filters( + self, + cloud_account_id: int, + body: AccountFiltersPatchRequest, + ) -> AccountFiltersResponse: + """Update account filters. + + Update the account filters for a cloud account (AWS CUR 1.0/2.0, OCI, and other clouds). + + :param cloud_account_id: Cloud Account id. + :type cloud_account_id: int + :type body: AccountFiltersPatchRequest + :rtype: AccountFiltersResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["cloud_account_id"] = cloud_account_id + + kwargs["body"] = body + + return self._update_cost_account_filters_endpoint.call_with_http_info(**kwargs) + def update_cost_awscur_config( self, cloud_account_id: int, diff --git a/src/datadog_api_client/v2/model/account_filters.py b/src/datadog_api_client/v2/model/account_filters.py new file mode 100644 index 0000000000..3e28729ef0 --- /dev/null +++ b/src/datadog_api_client/v2/model/account_filters.py @@ -0,0 +1,63 @@ +# 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.account_filters_attributes import AccountFiltersAttributes + from datadog_api_client.v2.model.account_filters_type import AccountFiltersType + + +class AccountFilters(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.account_filters_attributes import AccountFiltersAttributes + from datadog_api_client.v2.model.account_filters_type import AccountFiltersType + + return { + "attributes": (AccountFiltersAttributes,), + "id": (str,), + "type": (AccountFiltersType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: AccountFiltersAttributes, + type: AccountFiltersType, + id: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + The account filters for a cloud account. + + :param attributes: Attributes for the account filters of a cloud account. + :type attributes: AccountFiltersAttributes + + :param id: The ID of the cloud account. + :type id: str, optional + + :param type: Type of account filters. + :type type: AccountFiltersType + """ + if id is not unset: + kwargs["id"] = id + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/account_filters_attributes.py b/src/datadog_api_client/v2/model/account_filters_attributes.py new file mode 100644 index 0000000000..c349f24d56 --- /dev/null +++ b/src/datadog_api_client/v2/model/account_filters_attributes.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.account_filtering_config import AccountFilteringConfig + + +class AccountFiltersAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.account_filtering_config import AccountFilteringConfig + + return { + "account_filters": (AccountFilteringConfig,), + "account_id": (str,), + "cloud": (str,), + } + + attribute_map = { + "account_filters": "account_filters", + "account_id": "account_id", + "cloud": "cloud", + } + + def __init__( + self_, + account_filters: Union[AccountFilteringConfig, UnsetType] = unset, + account_id: Union[str, UnsetType] = unset, + cloud: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Attributes for the account filters of a cloud account. + + :param account_filters: The account filtering configuration. + :type account_filters: AccountFilteringConfig, optional + + :param account_id: The cloud account ID. + :type account_id: str, optional + + :param cloud: The cloud provider of the account, for example ``aws`` , ``aws_cur2`` , or ``oci``. + :type cloud: str, optional + """ + if account_filters is not unset: + kwargs["account_filters"] = account_filters + if account_id is not unset: + kwargs["account_id"] = account_id + if cloud is not unset: + kwargs["cloud"] = cloud + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/account_filters_patch_data.py b/src/datadog_api_client/v2/model/account_filters_patch_data.py new file mode 100644 index 0000000000..7d4f644d69 --- /dev/null +++ b/src/datadog_api_client/v2/model/account_filters_patch_data.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.account_filters_patch_request_attributes import ( + AccountFiltersPatchRequestAttributes, + ) + from datadog_api_client.v2.model.account_filters_patch_request_type import AccountFiltersPatchRequestType + + +class AccountFiltersPatchData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.account_filters_patch_request_attributes import ( + AccountFiltersPatchRequestAttributes, + ) + from datadog_api_client.v2.model.account_filters_patch_request_type import AccountFiltersPatchRequestType + + return { + "attributes": (AccountFiltersPatchRequestAttributes,), + "type": (AccountFiltersPatchRequestType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, attributes: AccountFiltersPatchRequestAttributes, type: AccountFiltersPatchRequestType, **kwargs + ): + """ + Account filters patch data. + + :param attributes: Attributes for an account filters patch request. + :type attributes: AccountFiltersPatchRequestAttributes + + :param type: Type of account filters patch request. + :type type: AccountFiltersPatchRequestType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/account_filters_patch_request.py b/src/datadog_api_client/v2/model/account_filters_patch_request.py new file mode 100644 index 0000000000..e4b4770d4d --- /dev/null +++ b/src/datadog_api_client/v2/model/account_filters_patch_request.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.account_filters_patch_data import AccountFiltersPatchData + + +class AccountFiltersPatchRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.account_filters_patch_data import AccountFiltersPatchData + + return { + "data": (AccountFiltersPatchData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: AccountFiltersPatchData, **kwargs): + """ + Account filters patch request. + + :param data: Account filters patch data. + :type data: AccountFiltersPatchData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/account_filters_patch_request_attributes.py b/src/datadog_api_client/v2/model/account_filters_patch_request_attributes.py new file mode 100644 index 0000000000..a12ed5f5c9 --- /dev/null +++ b/src/datadog_api_client/v2/model/account_filters_patch_request_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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.account_filtering_config import AccountFilteringConfig + + +class AccountFiltersPatchRequestAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.account_filtering_config import AccountFilteringConfig + + return { + "account_filters": (AccountFilteringConfig,), + } + + attribute_map = { + "account_filters": "account_filters", + } + + def __init__(self_, account_filters: AccountFilteringConfig, **kwargs): + """ + Attributes for an account filters patch request. + + :param account_filters: The account filtering configuration. + :type account_filters: AccountFilteringConfig + """ + super().__init__(kwargs) + + self_.account_filters = account_filters diff --git a/src/datadog_api_client/v2/model/account_filters_patch_request_type.py b/src/datadog_api_client/v2/model/account_filters_patch_request_type.py new file mode 100644 index 0000000000..76318e9a62 --- /dev/null +++ b/src/datadog_api_client/v2/model/account_filters_patch_request_type.py @@ -0,0 +1,37 @@ +# 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 AccountFiltersPatchRequestType(ModelSimple): + """ + Type of account filters patch request. + + :param value: If omitted defaults to "account_filters_patch_request". Must be one of ["account_filters_patch_request"]. + :type value: str + """ + + allowed_values = { + "account_filters_patch_request", + } + ACCOUNT_FILTERS_PATCH_REQUEST: ClassVar["AccountFiltersPatchRequestType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +AccountFiltersPatchRequestType.ACCOUNT_FILTERS_PATCH_REQUEST = AccountFiltersPatchRequestType( + "account_filters_patch_request" +) diff --git a/src/datadog_api_client/v2/model/account_filters_response.py b/src/datadog_api_client/v2/model/account_filters_response.py new file mode 100644 index 0000000000..260187830e --- /dev/null +++ b/src/datadog_api_client/v2/model/account_filters_response.py @@ -0,0 +1,42 @@ +# 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.account_filters import AccountFilters + + +class AccountFiltersResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.account_filters import AccountFilters + + return { + "data": (AccountFilters,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[AccountFilters, UnsetType] = unset, **kwargs): + """ + Response containing the account filters for a cloud account. + + :param data: The account filters for a cloud account. + :type data: AccountFilters, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/account_filters_type.py b/src/datadog_api_client/v2/model/account_filters_type.py new file mode 100644 index 0000000000..a542ad6828 --- /dev/null +++ b/src/datadog_api_client/v2/model/account_filters_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 AccountFiltersType(ModelSimple): + """ + Type of account filters. + + :param value: If omitted defaults to "account_filters". Must be one of ["account_filters"]. + :type value: str + """ + + allowed_values = { + "account_filters", + } + ACCOUNT_FILTERS: ClassVar["AccountFiltersType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +AccountFiltersType.ACCOUNT_FILTERS = AccountFiltersType("account_filters") diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 9252d9ce79..cac0812e4d 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -168,6 +168,14 @@ from datadog_api_client.v2.model.access_token_owner_type import AccessTokenOwnerType from datadog_api_client.v2.model.access_tokens_type import AccessTokensType from datadog_api_client.v2.model.account_filtering_config import AccountFilteringConfig +from datadog_api_client.v2.model.account_filters import AccountFilters +from datadog_api_client.v2.model.account_filters_attributes import AccountFiltersAttributes +from datadog_api_client.v2.model.account_filters_patch_data import AccountFiltersPatchData +from datadog_api_client.v2.model.account_filters_patch_request import AccountFiltersPatchRequest +from datadog_api_client.v2.model.account_filters_patch_request_attributes import AccountFiltersPatchRequestAttributes +from datadog_api_client.v2.model.account_filters_patch_request_type import AccountFiltersPatchRequestType +from datadog_api_client.v2.model.account_filters_response import AccountFiltersResponse +from datadog_api_client.v2.model.account_filters_type import AccountFiltersType from datadog_api_client.v2.model.action_connection_attributes import ActionConnectionAttributes from datadog_api_client.v2.model.action_connection_attributes_update import ActionConnectionAttributesUpdate from datadog_api_client.v2.model.action_connection_data import ActionConnectionData @@ -9924,6 +9932,14 @@ "AccessTokenOwnerType", "AccessTokensType", "AccountFilteringConfig", + "AccountFilters", + "AccountFiltersAttributes", + "AccountFiltersPatchData", + "AccountFiltersPatchRequest", + "AccountFiltersPatchRequestAttributes", + "AccountFiltersPatchRequestType", + "AccountFiltersResponse", + "AccountFiltersType", "ActionConnectionAttributes", "ActionConnectionAttributesUpdate", "ActionConnectionData", diff --git a/tests/v2/features/cloud_cost_management.feature b/tests/v2/features/cloud_cost_management.feature index 0288644613..a8693074a7 100644 --- a/tests/v2/features/cloud_cost_management.feature +++ b/tests/v2/features/cloud_cost_management.feature @@ -408,6 +408,27 @@ Feature: Cloud Cost Management And the response "data.type" is equal to "ruleset" And the response "data.attributes.name" is equal to "EVP Cost Tags" + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Get account filters returns "Bad Request" response + Given new "GetCostAccountFilters" request + And request contains "cloud_account_id" 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 account filters returns "Not Found" response + Given new "GetCostAccountFilters" request + And request contains "cloud_account_id" 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 account filters returns "OK" response + Given new "GetCostAccountFilters" request + And request contains "cloud_account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/cloud-cost-management Scenario: Get budget returns "Bad Request" response Given new "GetBudget" request @@ -962,6 +983,30 @@ Feature: Cloud Cost Management Then the response status is 200 OK And the response "data.attributes.account_id" is equal to "123456_A123BC_12AB34" + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Update account filters returns "Bad Request" response + Given new "UpdateCostAccountFilters" request + And request contains "cloud_account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"account_filters": {"excluded_accounts": ["123456789123", "123456789143"], "include_new_accounts": true, "included_accounts": ["123456789123", "123456789143"]}}, "type": "account_filters_patch_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Update account filters returns "Not Found" response + Given new "UpdateCostAccountFilters" request + And request contains "cloud_account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"account_filters": {"excluded_accounts": ["123456789123", "123456789143"], "include_new_accounts": true, "included_accounts": ["123456789123", "123456789143"]}}, "type": "account_filters_patch_request"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Update account filters returns "OK" response + Given new "UpdateCostAccountFilters" request + And request contains "cloud_account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"account_filters": {"excluded_accounts": ["123456789123", "123456789143"], "include_new_accounts": true, "included_accounts": ["123456789123", "123456789143"]}}, "type": "account_filters_patch_request"}} + When the request is sent + Then the response status is 200 OK + @replay-only @team:DataDog/cloud-cost-management Scenario: Update custom allocation rule returns "OK" response Given new "UpdateCustomAllocationRule" request diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 9261678554..6551ae7167 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1622,6 +1622,18 @@ "type": "safe" } }, + "GetCostAccountFilters": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, + "UpdateCostAccountFilters": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, "ListCostAnomalies": { "tag": "Cloud Cost Management", "undo": {