|
11 | 11 | UnsetType, |
12 | 12 | unset, |
13 | 13 | ) |
| 14 | +from datadog_api_client.v2.model.cost_anomalies_response import CostAnomaliesResponse |
| 15 | +from datadog_api_client.v2.model.cost_anomaly_response import CostAnomalyResponse |
14 | 16 | from datadog_api_client.v2.model.arbitrary_rule_response_array import ArbitraryRuleResponseArray |
15 | 17 | from datadog_api_client.v2.model.arbitrary_rule_response import ArbitraryRuleResponse |
16 | 18 | from datadog_api_client.v2.model.arbitrary_cost_upsert_request import ArbitraryCostUpsertRequest |
@@ -345,6 +347,29 @@ def __init__(self, api_client=None): |
345 | 347 | api_client=api_client, |
346 | 348 | ) |
347 | 349 |
|
| 350 | + self._get_cost_anomaly_endpoint = _Endpoint( |
| 351 | + settings={ |
| 352 | + "response_type": (CostAnomalyResponse,), |
| 353 | + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], |
| 354 | + "endpoint_path": "/api/v2/cost/anomalies/{anomaly_id}", |
| 355 | + "operation_id": "get_cost_anomaly", |
| 356 | + "http_method": "GET", |
| 357 | + "version": "v2", |
| 358 | + }, |
| 359 | + params_map={ |
| 360 | + "anomaly_id": { |
| 361 | + "required": True, |
| 362 | + "openapi_types": (str,), |
| 363 | + "attribute": "anomaly_id", |
| 364 | + "location": "path", |
| 365 | + }, |
| 366 | + }, |
| 367 | + headers_map={ |
| 368 | + "accept": ["application/json"], |
| 369 | + }, |
| 370 | + api_client=api_client, |
| 371 | + ) |
| 372 | + |
348 | 373 | self._get_cost_awscur_config_endpoint = _Endpoint( |
349 | 374 | settings={ |
350 | 375 | "response_type": (AwsCurConfigResponse,), |
@@ -499,6 +524,79 @@ def __init__(self, api_client=None): |
499 | 524 | api_client=api_client, |
500 | 525 | ) |
501 | 526 |
|
| 527 | + self._list_cost_anomalies_endpoint = _Endpoint( |
| 528 | + settings={ |
| 529 | + "response_type": (CostAnomaliesResponse,), |
| 530 | + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], |
| 531 | + "endpoint_path": "/api/v2/cost/anomalies", |
| 532 | + "operation_id": "list_cost_anomalies", |
| 533 | + "http_method": "GET", |
| 534 | + "version": "v2", |
| 535 | + }, |
| 536 | + params_map={ |
| 537 | + "start": { |
| 538 | + "openapi_types": (int,), |
| 539 | + "attribute": "start", |
| 540 | + "location": "query", |
| 541 | + }, |
| 542 | + "end": { |
| 543 | + "openapi_types": (int,), |
| 544 | + "attribute": "end", |
| 545 | + "location": "query", |
| 546 | + }, |
| 547 | + "filter": { |
| 548 | + "openapi_types": (str,), |
| 549 | + "attribute": "filter", |
| 550 | + "location": "query", |
| 551 | + }, |
| 552 | + "min_anomalous_threshold": { |
| 553 | + "openapi_types": (str,), |
| 554 | + "attribute": "min_anomalous_threshold", |
| 555 | + "location": "query", |
| 556 | + }, |
| 557 | + "min_cost_threshold": { |
| 558 | + "openapi_types": (str,), |
| 559 | + "attribute": "min_cost_threshold", |
| 560 | + "location": "query", |
| 561 | + }, |
| 562 | + "dismissal_cause": { |
| 563 | + "openapi_types": (str,), |
| 564 | + "attribute": "dismissal_cause", |
| 565 | + "location": "query", |
| 566 | + }, |
| 567 | + "order_by": { |
| 568 | + "openapi_types": (str,), |
| 569 | + "attribute": "order_by", |
| 570 | + "location": "query", |
| 571 | + }, |
| 572 | + "order": { |
| 573 | + "openapi_types": (str,), |
| 574 | + "attribute": "order", |
| 575 | + "location": "query", |
| 576 | + }, |
| 577 | + "limit": { |
| 578 | + "openapi_types": (int,), |
| 579 | + "attribute": "limit", |
| 580 | + "location": "query", |
| 581 | + }, |
| 582 | + "offset": { |
| 583 | + "openapi_types": (int,), |
| 584 | + "attribute": "offset", |
| 585 | + "location": "query", |
| 586 | + }, |
| 587 | + "provider_ids": { |
| 588 | + "openapi_types": ([str],), |
| 589 | + "attribute": "provider_ids", |
| 590 | + "location": "query", |
| 591 | + "collection_format": "multi", |
| 592 | + }, |
| 593 | + }, |
| 594 | + headers_map={ |
| 595 | + "accept": ["application/json"], |
| 596 | + }, |
| 597 | + api_client=api_client, |
| 598 | + ) |
| 599 | + |
502 | 600 | self._list_cost_awscur_configs_endpoint = _Endpoint( |
503 | 601 | settings={ |
504 | 602 | "response_type": (AwsCURConfigsResponse,), |
@@ -1194,6 +1292,23 @@ def get_budget( |
1194 | 1292 |
|
1195 | 1293 | return self._get_budget_endpoint.call_with_http_info(**kwargs) |
1196 | 1294 |
|
| 1295 | + def get_cost_anomaly( |
| 1296 | + self, |
| 1297 | + anomaly_id: str, |
| 1298 | + ) -> CostAnomalyResponse: |
| 1299 | + """Get cost anomaly. |
| 1300 | +
|
| 1301 | + Get a detected Cloud Cost Management anomaly by UUID. |
| 1302 | +
|
| 1303 | + :param anomaly_id: The UUID of the cost anomaly. |
| 1304 | + :type anomaly_id: str |
| 1305 | + :rtype: CostAnomalyResponse |
| 1306 | + """ |
| 1307 | + kwargs: Dict[str, Any] = {} |
| 1308 | + kwargs["anomaly_id"] = anomaly_id |
| 1309 | + |
| 1310 | + return self._get_cost_anomaly_endpoint.call_with_http_info(**kwargs) |
| 1311 | + |
1197 | 1312 | def get_cost_awscur_config( |
1198 | 1313 | self, |
1199 | 1314 | cloud_account_id: int, |
@@ -1308,6 +1423,85 @@ def list_budgets( |
1308 | 1423 | kwargs: Dict[str, Any] = {} |
1309 | 1424 | return self._list_budgets_endpoint.call_with_http_info(**kwargs) |
1310 | 1425 |
|
| 1426 | + def list_cost_anomalies( |
| 1427 | + self, |
| 1428 | + *, |
| 1429 | + start: Union[int, UnsetType] = unset, |
| 1430 | + end: Union[int, UnsetType] = unset, |
| 1431 | + filter: Union[str, UnsetType] = unset, |
| 1432 | + min_anomalous_threshold: Union[str, UnsetType] = unset, |
| 1433 | + min_cost_threshold: Union[str, UnsetType] = unset, |
| 1434 | + dismissal_cause: Union[str, UnsetType] = unset, |
| 1435 | + order_by: Union[str, UnsetType] = unset, |
| 1436 | + order: Union[str, UnsetType] = unset, |
| 1437 | + limit: Union[int, UnsetType] = unset, |
| 1438 | + offset: Union[int, UnsetType] = unset, |
| 1439 | + provider_ids: Union[List[str], UnsetType] = unset, |
| 1440 | + ) -> CostAnomaliesResponse: |
| 1441 | + """List cost anomalies. |
| 1442 | +
|
| 1443 | + List detected Cloud Cost Management anomalies for the organization. |
| 1444 | +
|
| 1445 | + :param start: Start time as Unix milliseconds. Defaults to the start of the latest stable seven-day window. |
| 1446 | + :type start: int, optional |
| 1447 | + :param end: End time as Unix milliseconds. Defaults to the end of the latest stable seven-day window. |
| 1448 | + :type end: int, optional |
| 1449 | + :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. |
| 1450 | + :type filter: str, optional |
| 1451 | + :param min_anomalous_threshold: Minimum absolute anomalous cost change to include. Numeric value; defaults to ``1``. |
| 1452 | + :type min_anomalous_threshold: str, optional |
| 1453 | + :param min_cost_threshold: Minimum absolute actual cost to include. Numeric value; defaults to ``0``. |
| 1454 | + :type min_cost_threshold: str, optional |
| 1455 | + :param dismissal_cause: Filter by resolution state. Use ``none`` for unresolved anomalies, ``all`` or ``*`` for resolved anomalies, or a comma-separated list of causes. |
| 1456 | + :type dismissal_cause: str, optional |
| 1457 | + :param order_by: Sort field. One of ``start_date`` , ``end_date`` , ``duration`` , ``max_cost`` , ``anomalous_cost`` , or ``dismissal_date``. Defaults to ``anomalous_cost``. |
| 1458 | + :type order_by: str, optional |
| 1459 | + :param order: Sort direction. One of ``asc`` or ``desc``. Defaults to ``desc``. |
| 1460 | + :type order: str, optional |
| 1461 | + :param limit: Maximum number of anomalies to return. Defaults to ``200``. |
| 1462 | + :type limit: int, optional |
| 1463 | + :param offset: Pagination offset. Defaults to ``0``. |
| 1464 | + :type offset: int, optional |
| 1465 | + :param provider_ids: Optional repeated cloud or SaaS provider filters, such as ``aws`` , ``gcp`` , ``azure`` , ``Oracle`` , ``datadog`` , ``OpenAI`` , or ``Anthropic``. |
| 1466 | + :type provider_ids: [str], optional |
| 1467 | + :rtype: CostAnomaliesResponse |
| 1468 | + """ |
| 1469 | + kwargs: Dict[str, Any] = {} |
| 1470 | + if start is not unset: |
| 1471 | + kwargs["start"] = start |
| 1472 | + |
| 1473 | + if end is not unset: |
| 1474 | + kwargs["end"] = end |
| 1475 | + |
| 1476 | + if filter is not unset: |
| 1477 | + kwargs["filter"] = filter |
| 1478 | + |
| 1479 | + if min_anomalous_threshold is not unset: |
| 1480 | + kwargs["min_anomalous_threshold"] = min_anomalous_threshold |
| 1481 | + |
| 1482 | + if min_cost_threshold is not unset: |
| 1483 | + kwargs["min_cost_threshold"] = min_cost_threshold |
| 1484 | + |
| 1485 | + if dismissal_cause is not unset: |
| 1486 | + kwargs["dismissal_cause"] = dismissal_cause |
| 1487 | + |
| 1488 | + if order_by is not unset: |
| 1489 | + kwargs["order_by"] = order_by |
| 1490 | + |
| 1491 | + if order is not unset: |
| 1492 | + kwargs["order"] = order |
| 1493 | + |
| 1494 | + if limit is not unset: |
| 1495 | + kwargs["limit"] = limit |
| 1496 | + |
| 1497 | + if offset is not unset: |
| 1498 | + kwargs["offset"] = offset |
| 1499 | + |
| 1500 | + if provider_ids is not unset: |
| 1501 | + kwargs["provider_ids"] = provider_ids |
| 1502 | + |
| 1503 | + return self._list_cost_anomalies_endpoint.call_with_http_info(**kwargs) |
| 1504 | + |
1311 | 1505 | def list_cost_awscur_configs( |
1312 | 1506 | self, |
1313 | 1507 | ) -> AwsCURConfigsResponse: |
|
0 commit comments