Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
403 changes: 403 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

70 changes: 70 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6171,6 +6171,76 @@ datadog\_api\_client.v2.model.cost\_aggregation\_type module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.cost\_anomalies\_response module
--------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.cost_anomalies_response
:members:
:show-inheritance:

datadog\_api\_client.v2.model.cost\_anomalies\_response\_data module
--------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.cost_anomalies_response_data
:members:
:show-inheritance:

datadog\_api\_client.v2.model.cost\_anomalies\_response\_data\_attributes module
--------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.cost_anomalies_response_data_attributes
:members:
:show-inheritance:

datadog\_api\_client.v2.model.cost\_anomalies\_response\_data\_type module
--------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.cost_anomalies_response_data_type
:members:
:show-inheritance:

datadog\_api\_client.v2.model.cost\_anomaly module
--------------------------------------------------

.. automodule:: datadog_api_client.v2.model.cost_anomaly
:members:
:show-inheritance:

datadog\_api\_client.v2.model.cost\_anomaly\_correlated\_tags module
--------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.cost_anomaly_correlated_tags
:members:
:show-inheritance:

datadog\_api\_client.v2.model.cost\_anomaly\_dimensions module
--------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.cost_anomaly_dimensions
:members:
:show-inheritance:

datadog\_api\_client.v2.model.cost\_anomaly\_dismissal module
-------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.cost_anomaly_dismissal
:members:
:show-inheritance:

datadog\_api\_client.v2.model.cost\_anomaly\_response module
------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.cost_anomaly_response
:members:
:show-inheritance:

datadog\_api\_client.v2.model.cost\_anomaly\_response\_data module
------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.cost_anomaly_response_data
:members:
:show-inheritance:

datadog\_api\_client.v2.model.cost\_attribution\_aggregates\_body module
------------------------------------------------------------------------

Expand Down
16 changes: 16 additions & 0 deletions examples/v2/cloud-cost-management/GetCostAnomaly.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
Get cost anomaly returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
configuration.unstable_operations["get_cost_anomaly"] = True
with ApiClient(configuration) as api_client:
api_instance = CloudCostManagementApi(api_client)
response = api_instance.get_cost_anomaly(
anomaly_id="anomaly_id",
)

print(response)
14 changes: 14 additions & 0 deletions examples/v2/cloud-cost-management/ListCostAnomalies.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
List cost anomalies returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
configuration.unstable_operations["list_cost_anomalies"] = True
with ApiClient(configuration) as api_client:
api_instance = CloudCostManagementApi(api_client)
response = api_instance.list_cost_anomalies()

print(response)
2 changes: 2 additions & 0 deletions src/datadog_api_client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ def __init__(
"v2.search_security_monitoring_histsignals": False,
"v2.get_code_coverage_branch_summary": False,
"v2.get_code_coverage_commit_summary": False,
"v2.get_cost_anomaly": False,
"v2.list_cost_anomalies": False,
"v2.create_dashboard_secure_embed": False,
"v2.delete_dashboard_secure_embed": False,
"v2.get_dashboard_secure_embed": False,
Expand Down
194 changes: 194 additions & 0 deletions src/datadog_api_client/v2/api/cloud_cost_management_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
UnsetType,
unset,
)
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
from datadog_api_client.v2.model.arbitrary_rule_response import ArbitraryRuleResponse
from datadog_api_client.v2.model.arbitrary_cost_upsert_request import ArbitraryCostUpsertRequest
Expand Down Expand Up @@ -345,6 +347,29 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._get_cost_anomaly_endpoint = _Endpoint(
settings={
"response_type": (CostAnomalyResponse,),
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v2/cost/anomalies/{anomaly_id}",
"operation_id": "get_cost_anomaly",
"http_method": "GET",
"version": "v2",
},
params_map={
"anomaly_id": {
"required": True,
"openapi_types": (str,),
"attribute": "anomaly_id",
"location": "path",
},
},
headers_map={
"accept": ["application/json"],
},
api_client=api_client,
)

self._get_cost_awscur_config_endpoint = _Endpoint(
settings={
"response_type": (AwsCurConfigResponse,),
Expand Down Expand Up @@ -499,6 +524,79 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._list_cost_anomalies_endpoint = _Endpoint(
settings={
"response_type": (CostAnomaliesResponse,),
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v2/cost/anomalies",
"operation_id": "list_cost_anomalies",
"http_method": "GET",
"version": "v2",
},
params_map={
"start": {
"openapi_types": (int,),
"attribute": "start",
"location": "query",
},
"end": {
"openapi_types": (int,),
"attribute": "end",
"location": "query",
},
"filter": {
"openapi_types": (str,),
"attribute": "filter",
"location": "query",
},
"min_anomalous_threshold": {
"openapi_types": (str,),
"attribute": "min_anomalous_threshold",
"location": "query",
},
"min_cost_threshold": {
"openapi_types": (str,),
"attribute": "min_cost_threshold",
"location": "query",
},
"dismissal_cause": {
"openapi_types": (str,),
"attribute": "dismissal_cause",
"location": "query",
},
"order_by": {
"openapi_types": (str,),
"attribute": "order_by",
"location": "query",
},
"order": {
"openapi_types": (str,),
"attribute": "order",
"location": "query",
},
"limit": {
"openapi_types": (int,),
"attribute": "limit",
"location": "query",
},
"offset": {
"openapi_types": (int,),
"attribute": "offset",
"location": "query",
},
"provider_ids": {
"openapi_types": ([str],),
"attribute": "provider_ids",
"location": "query",
"collection_format": "multi",
},
},
headers_map={
"accept": ["application/json"],
},
api_client=api_client,
)

self._list_cost_awscur_configs_endpoint = _Endpoint(
settings={
"response_type": (AwsCURConfigsResponse,),
Expand Down Expand Up @@ -1194,6 +1292,23 @@ def get_budget(

return self._get_budget_endpoint.call_with_http_info(**kwargs)

def get_cost_anomaly(
self,
anomaly_id: str,
) -> CostAnomalyResponse:
"""Get cost anomaly.

Get a detected Cloud Cost Management anomaly by UUID.

:param anomaly_id: The UUID of the cost anomaly.
:type anomaly_id: str
:rtype: CostAnomalyResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["anomaly_id"] = anomaly_id

return self._get_cost_anomaly_endpoint.call_with_http_info(**kwargs)

def get_cost_awscur_config(
self,
cloud_account_id: int,
Expand Down Expand Up @@ -1308,6 +1423,85 @@ def list_budgets(
kwargs: Dict[str, Any] = {}
return self._list_budgets_endpoint.call_with_http_info(**kwargs)

def list_cost_anomalies(
self,
*,
start: Union[int, UnsetType] = unset,
end: Union[int, UnsetType] = unset,
filter: Union[str, UnsetType] = unset,
min_anomalous_threshold: Union[str, UnsetType] = unset,
min_cost_threshold: Union[str, UnsetType] = unset,
dismissal_cause: Union[str, UnsetType] = unset,
order_by: Union[str, UnsetType] = unset,
order: Union[str, UnsetType] = unset,
limit: Union[int, UnsetType] = unset,
offset: Union[int, UnsetType] = unset,
provider_ids: Union[List[str], UnsetType] = unset,
) -> CostAnomaliesResponse:
"""List cost anomalies.

List detected Cloud Cost Management anomalies for the organization.

:param start: Start time as Unix milliseconds. Defaults to the start of the latest stable seven-day window.
:type start: int, optional
:param end: End time as Unix milliseconds. Defaults to the end of the latest stable seven-day window.
:type end: int, optional
:param filter: Optional JSON object mapping cost tag keys to allowed values, for example ``{"team":["payments"],"env":["prod"]}``. Filters match anomaly dimensions or correlated tags.
:type filter: str, optional
:param min_anomalous_threshold: Minimum absolute anomalous cost change to include. Numeric value; defaults to ``1``.
:type min_anomalous_threshold: str, optional
:param min_cost_threshold: Minimum absolute actual cost to include. Numeric value; defaults to ``0``.
:type min_cost_threshold: str, optional
:param dismissal_cause: Filter by resolution state. Use ``none`` for unresolved anomalies, ``all`` or ``*`` for resolved anomalies, or a comma-separated list of causes.
:type dismissal_cause: str, optional
:param order_by: Sort field. One of ``start_date`` , ``end_date`` , ``duration`` , ``max_cost`` , ``anomalous_cost`` , or ``dismissal_date``. Defaults to ``anomalous_cost``.
:type order_by: str, optional
:param order: Sort direction. One of ``asc`` or ``desc``. Defaults to ``desc``.
:type order: str, optional
:param limit: Maximum number of anomalies to return. Defaults to ``200``.
:type limit: int, optional
:param offset: Pagination offset. Defaults to ``0``.
:type offset: int, optional
:param provider_ids: Optional repeated cloud or SaaS provider filters, such as ``aws`` , ``gcp`` , ``azure`` , ``Oracle`` , ``datadog`` , ``OpenAI`` , or ``Anthropic``.
:type provider_ids: [str], optional
:rtype: CostAnomaliesResponse
"""
kwargs: Dict[str, Any] = {}
if start is not unset:
kwargs["start"] = start

if end is not unset:
kwargs["end"] = end

if filter is not unset:
kwargs["filter"] = filter

if min_anomalous_threshold is not unset:
kwargs["min_anomalous_threshold"] = min_anomalous_threshold

if min_cost_threshold is not unset:
kwargs["min_cost_threshold"] = min_cost_threshold

if dismissal_cause is not unset:
kwargs["dismissal_cause"] = dismissal_cause

if order_by is not unset:
kwargs["order_by"] = order_by

if order is not unset:
kwargs["order"] = order

if limit is not unset:
kwargs["limit"] = limit

if offset is not unset:
kwargs["offset"] = offset

if provider_ids is not unset:
kwargs["provider_ids"] = provider_ids

return self._list_cost_anomalies_endpoint.call_with_http_info(**kwargs)

def list_cost_awscur_configs(
self,
) -> AwsCURConfigsResponse:
Expand Down
42 changes: 42 additions & 0 deletions src/datadog_api_client/v2/model/cost_anomalies_response.py
Original file line number Diff line number Diff line change
@@ -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.cost_anomalies_response_data import CostAnomaliesResponseData


class CostAnomaliesResponse(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.cost_anomalies_response_data import CostAnomaliesResponseData

return {
"data": (CostAnomaliesResponseData,),
}

attribute_map = {
"data": "data",
}

def __init__(self_, data: Union[CostAnomaliesResponseData, UnsetType] = unset, **kwargs):
"""
Response object containing a list of detected Cloud Cost Management anomalies and aggregated totals.

:param data: Resource wrapper for the list of cost anomalies and aggregated totals.
:type data: CostAnomaliesResponseData, optional
"""
if data is not unset:
kwargs["data"] = data
super().__init__(kwargs)
Loading
Loading