diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 7a9926c3d3..3247596a53 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -6451,14 +6451,14 @@ components: type: string x-enum-varnames: - AGENT_HEALTH_ISSUES - AgentHealthIssueAttributes: - description: Attributes of an open Agent Health issue. + AgentHealthIssue: + description: An open Agent Health issue. example: category: configuration description: The Agent configuration file contains an invalid value. first_seen_at: "2026-11-01T10:00:00Z" + id: invalid-config:4828e7d6c704c4a3 issue_name: Invalid Config - issue_type: invalid_config resource_id: my-hostname resource_kind: host resource_type: host @@ -6477,19 +6477,29 @@ components: description: The description of the issue. Omitted when empty. example: The Agent configuration file contains an invalid value. type: string + extra: + additionalProperties: {} + description: >- + Free-form, issue-type-specific context. Keys are not part of the stable schema. Omitted when empty. + example: + agent_hostname: i-0ea3e96bf45c427e6 + client_library: java + type: object first_seen_at: description: The time the issue was first seen, in RFC 3339 format. Omitted when empty. example: "2026-11-01T10:00:00Z" format: date-time type: string + id: + description: The unique identifier of the issue. + example: invalid-config:4828e7d6c704c4a3 + type: string issue_name: description: The human-readable name of the issue. example: Invalid Config type: string - issue_type: - description: The machine-readable type of the issue. - example: invalid_config - type: string + remediation: + $ref: "#/components/schemas/AgentHealthRemediation" resource_id: description: >- The identifier of the affected resource, interpreted according to `resource_kind`: hostname for `host`, DaemonSet UID for `deployment` (node Agent), cluster UUID for `cluster`, hostname of the host running the Cluster Agent for `cluster_agent`, or OpenTelemetry collector ID for `otel`. @@ -6524,22 +6534,21 @@ components: format: date-time type: string required: - - issue_type + - id - issue_name - severity - state - resource_kind - resource_id type: object - AgentHealthIssueData: - description: An open Agent Health issue. + AgentHealthIssueArray: + description: The open issues in a group. example: - attributes: - category: configuration + - category: configuration description: The Agent configuration file contains an invalid value. first_seen_at: "2026-11-01T10:00:00Z" + id: invalid-config:4828e7d6c704c4a3 issue_name: Invalid Config - issue_type: invalid_config resource_id: my-hostname resource_kind: host resource_type: host @@ -6549,44 +6558,8 @@ components: - env:prod title: Invalid Agent configuration updated_at: "2026-11-09T08:00:00Z" - id: invalid-config:4828e7d6c704c4a3 - type: agent_health_issues - properties: - attributes: - $ref: "#/components/schemas/AgentHealthIssueAttributes" - id: - description: The unique identifier of the issue. - example: invalid-config:4828e7d6c704c4a3 - type: string - type: - $ref: "#/components/schemas/AgentHealthIssueResourceType" - required: - - id - - type - - attributes - type: object - AgentHealthIssueDataArray: - description: The open Agent Health issues on this page. - example: - - attributes: - category: configuration - description: The Agent configuration file contains an invalid value. - first_seen_at: "2026-11-01T10:00:00Z" - issue_name: Invalid Config - issue_type: invalid_config - resource_id: my-hostname - resource_kind: host - resource_type: host - severity: high - state: open - tags: - - env:prod - title: Invalid Agent configuration - updated_at: "2026-11-09T08:00:00Z" - id: invalid-config:4828e7d6c704c4a3 - type: agent_health_issues items: - $ref: "#/components/schemas/AgentHealthIssueData" + $ref: "#/components/schemas/AgentHealthIssue" type: array AgentHealthIssueDetailAttributes: description: Attributes of an open Agent Health issue, including available remediation. @@ -6597,6 +6570,7 @@ components: issue_name: Invalid Config issue_type: invalid_config remediation: + ai_prompt: Help me fix the invalid configuration value in datadog.yaml. script: content: "..." filename: fix.sh @@ -6691,6 +6665,7 @@ components: issue_name: Invalid Config issue_type: invalid_config remediation: + ai_prompt: Help me fix the invalid configuration value in datadog.yaml. script: content: "..." filename: fix.sh @@ -6726,6 +6701,43 @@ components: - type - attributes type: object + AgentHealthIssueGroup: + description: A group of open Agent Health issues that share an issue type. + example: + issue_type: invalid_config + issues: + - id: invalid-config:4828e7d6c704c4a3 + issue_name: Invalid Config + resource_id: my-hostname + resource_kind: host + severity: high + state: open + properties: + issue_type: + description: >- + The machine-readable type shared by the issues in this group. Issues with no type are grouped under `unknown`. + example: invalid_config + type: string + issues: + $ref: "#/components/schemas/AgentHealthIssueArray" + required: + - issue_type + - issues + type: object + AgentHealthIssueGroupArray: + description: Open Agent Health issues grouped by issue type. + example: + - issue_type: invalid_config + issues: + - id: invalid-config:4828e7d6c704c4a3 + issue_name: Invalid Config + resource_id: my-hostname + resource_kind: host + severity: high + state: open + items: + $ref: "#/components/schemas/AgentHealthIssueGroup" + type: array AgentHealthIssueResourceType: description: The Agent Health issue resource type. enum: @@ -6750,23 +6762,33 @@ components: description: A tag associated with the issue. type: string type: array + AgentHealthIssuesCountBy: + description: The dimension to aggregate issue counts by. Only `issue_type` is supported. + enum: + - issue_type + example: issue_type + type: string + x-enum-varnames: + - ISSUE_TYPE AgentHealthIssuesResponse: - description: A paginated response containing open Agent Health issues. + description: A response containing open Agent Health issues grouped by issue type. properties: data: - $ref: "#/components/schemas/AgentHealthIssueDataArray" + $ref: "#/components/schemas/AgentHealthIssueGroupArray" meta: $ref: "#/components/schemas/AgentHealthIssuesResponseMeta" required: - data - - meta type: object AgentHealthIssuesResponseMeta: - description: Pagination metadata for the matching Agent Health issues. + description: >- + Aggregate counts for the matching Agent Health issues. Present only when `count_by=issue_type` is requested. example: page: - total_count: 3 - total_filtered_count: 1 + counts_by_issue_type: + invalid_config: 8382 + read-only_filesystem_error: 82 + total_count: 25526 properties: page: $ref: "#/components/schemas/AgentHealthIssuesResponsePage" @@ -6774,28 +6796,35 @@ components: - page type: object AgentHealthIssuesResponsePage: - description: Pagination counts for the Agent Health issues. + description: Counts for the matching Agent Health issues. example: - total_count: 3 - total_filtered_count: 1 + counts_by_issue_type: + invalid_config: 8382 + read-only_filesystem_error: 82 + total_count: 25526 properties: + counts_by_issue_type: + additionalProperties: + format: int64 + type: integer + description: The number of returned open issues in each issue-type group. + example: + invalid_config: 8382 + read-only_filesystem_error: 82 + type: object total_count: - description: The total number of open issues in the organization, ignoring filters. - example: 3 - format: int64 - type: integer - total_filtered_count: - description: The total number of open issues matching the filters, across all pages. - example: 1 + description: The total number of open issues matching the filters. + example: 25526 format: int64 type: integer required: - total_count - - total_filtered_count + - counts_by_issue_type type: object AgentHealthRemediation: description: Remediation for the issue. Omitted when no remediation is available. example: + ai_prompt: Help me fix the invalid configuration value in datadog.yaml. script: content: "..." filename: fix.sh @@ -6807,6 +6836,10 @@ components: text: Open datadog.yaml summary: Fix the invalid configuration value. properties: + ai_prompt: + description: A suggested prompt for an AI assistant to help remediate the issue. + example: Help me fix the invalid configuration value in datadog.yaml. + type: string script: $ref: "#/components/schemas/AgentHealthRemediationScript" steps: @@ -159368,43 +159401,31 @@ paths: /api/v2/agenthealth/issues: get: description: |- - List Agent Health issues across your organization. Only open issues are returned. - Returns `403` if you lack the `hosts_read` permission. + List open Agent Health issues across your organization, grouped by issue type. + Only open issues are returned. Returns `403` if you lack the `hosts_read` permission. - Results use a stable order: severity rank (`high`, `medium`, `low`, then other values), - then `first_seen_at` descending with missing timestamps last, then issue ID ascending. - Use `page[size]` and the zero-based `page[number]` to paginate. Invalid page values - return a `400` JSON:API error response. `meta.page.total_filtered_count` is the number - of issues matching the filters, and `meta.page.total_count` the number of open issues - in the organization. + Each group in `data` holds the issues for one `issue_type`; issues with no type are + grouped under `unknown`. Within a group, issues use a stable order: severity rank + (`high`, `medium`, `low`, then other values), then `first_seen_at` descending with + missing timestamps last, then issue ID ascending. + + Set `count_by=issue_type` to include `meta.page`, where `total_count` is the number of + open issues matching the filters and `counts_by_issue_type` holds the per-type counts. + `meta` is omitted when `count_by` is not requested. Each filter accepts up to 50 comma-separated exact values of at most 256 characters each, combined with OR within a filter and AND across filters. Blank entries are ignored; an all-blank filter is treated as absent. operationId: ListAgentHealthIssues parameters: - - description: The number of issues to return per page, from 1 to 100. Defaults to 25. - example: 25 - in: query - name: page[size] - required: false - schema: - default: 25 - format: int64 - maximum: 100 - minimum: 1 - type: integer - - description: The zero-based page number, from 0 to 1000000. Defaults to 0. - example: 0 + - description: >- + Set to `issue_type` to include `meta.page` with `total_count` and per-issue-type counts. Omitted by default so the endpoint skips the extra count query. Only `issue_type` is supported. + example: issue_type in: query - name: page[number] + name: count_by required: false schema: - default: 0 - format: int64 - maximum: 1000000 - minimum: 0 - type: integer + $ref: "#/components/schemas/AgentHealthIssuesCountBy" - description: |- Filter by a comma-separated list of exact `severity` values, up to 50 values of at most 256 characters each. Values are combined with OR within this filter and AND across filters. @@ -159468,27 +159489,35 @@ paths: default: value: data: - - attributes: - category: configuration - description: The Agent configuration file contains an invalid value. - first_seen_at: "2026-11-01T10:00:00Z" - issue_name: Invalid Config - issue_type: invalid_config - resource_id: my-hostname - resource_kind: host - resource_type: host - severity: high - state: open - tags: - - env:prod - title: Invalid Agent configuration - updated_at: "2026-11-09T08:00:00Z" - id: invalid-config:4828e7d6c704c4a3 - type: agent_health_issues + - issue_type: invalid_config + issues: + - category: configuration + description: The Agent configuration file contains an invalid value. + extra: + agent_hostname: i-0ea3e96bf45c427e6 + first_seen_at: "2026-11-01T10:00:00Z" + id: invalid-config:4828e7d6c704c4a3 + issue_name: Invalid Config + remediation: + ai_prompt: Help me fix the invalid configuration value in datadog.yaml. + steps: + - order: 1 + text: Open datadog.yaml + summary: Fix the invalid configuration value. + resource_id: my-hostname + resource_kind: host + resource_type: host + severity: high + state: open + tags: + - env:prod + title: Invalid Agent configuration + updated_at: "2026-11-09T08:00:00Z" meta: page: - total_count: 3 - total_filtered_count: 1 + counts_by_issue_type: + invalid_config: 8382 + total_count: 25526 schema: $ref: "#/components/schemas/AgentHealthIssuesResponse" description: OK @@ -159563,6 +159592,7 @@ paths: issue_name: Invalid Config issue_type: invalid_config remediation: + ai_prompt: Help me fix the invalid configuration value in datadog.yaml. script: content: "..." filename: fix.sh diff --git a/src/datadog_api_client/v2/api/agent_health_api.py b/src/datadog_api_client/v2/api/agent_health_api.py index 0736a17724..def768f3b1 100644 --- a/src/datadog_api_client/v2/api/agent_health_api.py +++ b/src/datadog_api_client/v2/api/agent_health_api.py @@ -14,6 +14,7 @@ from datadog_api_client.v2.model.agent_health_host_issues_response import AgentHealthHostIssuesResponse from datadog_api_client.v2.model.agent_health_agent_type import AgentHealthAgentType from datadog_api_client.v2.model.agent_health_issues_response import AgentHealthIssuesResponse +from datadog_api_client.v2.model.agent_health_issues_count_by import AgentHealthIssuesCountBy from datadog_api_client.v2.model.agent_health_issue_response import AgentHealthIssueResponse @@ -88,22 +89,9 @@ def __init__(self, api_client=None): "version": "v2", }, params_map={ - "page_size": { - "validation": { - "inclusive_maximum": 100, - "inclusive_minimum": 1, - }, - "openapi_types": (int,), - "attribute": "page[size]", - "location": "query", - }, - "page_number": { - "validation": { - "inclusive_maximum": 1000000, - "inclusive_minimum": 0, - }, - "openapi_types": (int,), - "attribute": "page[number]", + "count_by": { + "openapi_types": (AgentHealthIssuesCountBy,), + "attribute": "count_by", "location": "query", }, "filter_severity": { @@ -204,8 +192,7 @@ def list_agent_health_host_issues( def list_agent_health_issues( self, *, - page_size: Union[int, UnsetType] = unset, - page_number: Union[int, UnsetType] = unset, + count_by: Union[AgentHealthIssuesCountBy, UnsetType] = unset, filter_severity: Union[str, UnsetType] = unset, filter_category: Union[str, UnsetType] = unset, filter_issue_type: Union[str, UnsetType] = unset, @@ -214,24 +201,24 @@ def list_agent_health_issues( ) -> AgentHealthIssuesResponse: """List Agent Health issues. - List Agent Health issues across your organization. Only open issues are returned. - Returns ``403`` if you lack the ``hosts_read`` permission. + List open Agent Health issues across your organization, grouped by issue type. + Only open issues are returned. Returns ``403`` if you lack the ``hosts_read`` permission. - Results use a stable order: severity rank ( ``high`` , ``medium`` , ``low`` , then other values), - then ``first_seen_at`` descending with missing timestamps last, then issue ID ascending. - Use ``page[size]`` and the zero-based ``page[number]`` to paginate. Invalid page values - return a ``400`` JSON:API error response. ``meta.page.total_filtered_count`` is the number - of issues matching the filters, and ``meta.page.total_count`` the number of open issues - in the organization. + Each group in ``data`` holds the issues for one ``issue_type`` ; issues with no type are + grouped under ``unknown``. Within a group, issues use a stable order: severity rank + ( ``high`` , ``medium`` , ``low`` , then other values), then ``first_seen_at`` descending with + missing timestamps last, then issue ID ascending. + + Set ``count_by=issue_type`` to include ``meta.page`` , where ``total_count`` is the number of + open issues matching the filters and ``counts_by_issue_type`` holds the per-type counts. + ``meta`` is omitted when ``count_by`` is not requested. Each filter accepts up to 50 comma-separated exact values of at most 256 characters each, combined with OR within a filter and AND across filters. Blank entries are ignored; an all-blank filter is treated as absent. - :param page_size: The number of issues to return per page, from 1 to 100. Defaults to 25. - :type page_size: int, optional - :param page_number: The zero-based page number, from 0 to 1000000. Defaults to 0. - :type page_number: int, optional + :param count_by: Set to ``issue_type`` to include ``meta.page`` with ``total_count`` and per-issue-type counts. Omitted by default so the endpoint skips the extra count query. Only ``issue_type`` is supported. + :type count_by: AgentHealthIssuesCountBy, optional :param filter_severity: Filter by a comma-separated list of exact ``severity`` values, up to 50 values of at most 256 characters each. Values are combined with OR within this filter and AND across filters. Blank entries are ignored; an all-blank filter is treated as absent. @@ -255,11 +242,8 @@ def list_agent_health_issues( :rtype: AgentHealthIssuesResponse """ kwargs: Dict[str, Any] = {} - if page_size is not unset: - kwargs["page_size"] = page_size - - if page_number is not unset: - kwargs["page_number"] = page_number + if count_by is not unset: + kwargs["count_by"] = count_by if filter_severity is not unset: kwargs["filter_severity"] = filter_severity diff --git a/src/datadog_api_client/v2/model/agent_health_issue_attributes.py b/src/datadog_api_client/v2/model/agent_health_issue.py similarity index 71% rename from src/datadog_api_client/v2/model/agent_health_issue_attributes.py rename to src/datadog_api_client/v2/model/agent_health_issue.py index ca0323b9a0..ac7ca1de9f 100644 --- a/src/datadog_api_client/v2/model/agent_health_issue_attributes.py +++ b/src/datadog_api_client/v2/model/agent_health_issue.py @@ -3,26 +3,52 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import List, Union +from typing import Any, Dict, List, Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, cached_property, + date, datetime, + none_type, unset, UnsetType, + UUID, ) -class AgentHealthIssueAttributes(ModelNormal): +if TYPE_CHECKING: + from datadog_api_client.v2.model.agent_health_remediation import AgentHealthRemediation + + +class AgentHealthIssue(ModelNormal): @cached_property def openapi_types(_): + from datadog_api_client.v2.model.agent_health_remediation import AgentHealthRemediation + return { "category": (str,), "description": (str,), + "extra": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + }, + ), "first_seen_at": (datetime,), + "id": (str,), "issue_name": (str,), - "issue_type": (str,), + "remediation": (AgentHealthRemediation,), "resource_id": (str,), "resource_kind": (str,), "resource_type": (str,), @@ -36,9 +62,11 @@ def openapi_types(_): attribute_map = { "category": "category", "description": "description", + "extra": "extra", "first_seen_at": "first_seen_at", + "id": "id", "issue_name": "issue_name", - "issue_type": "issue_type", + "remediation": "remediation", "resource_id": "resource_id", "resource_kind": "resource_kind", "resource_type": "resource_type", @@ -51,15 +79,17 @@ def openapi_types(_): def __init__( self_, + id: str, issue_name: str, - issue_type: str, resource_id: str, resource_kind: str, severity: str, state: str, category: Union[str, UnsetType] = unset, description: Union[str, UnsetType] = unset, + extra: Union[Dict[str, Any], UnsetType] = unset, first_seen_at: Union[datetime, UnsetType] = unset, + remediation: Union[AgentHealthRemediation, UnsetType] = unset, resource_type: Union[str, UnsetType] = unset, tags: Union[List[str], UnsetType] = unset, title: Union[str, UnsetType] = unset, @@ -67,7 +97,7 @@ def __init__( **kwargs, ): """ - Attributes of an open Agent Health issue. + An open Agent Health issue. :param category: The category of the issue, such as ``configuration``. Omitted when not set. :type category: str, optional @@ -75,14 +105,20 @@ def __init__( :param description: The description of the issue. Omitted when empty. :type description: str, optional + :param extra: Free-form, issue-type-specific context. Keys are not part of the stable schema. Omitted when empty. + :type extra: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)}, optional + :param first_seen_at: The time the issue was first seen, in RFC 3339 format. Omitted when empty. :type first_seen_at: datetime, optional + :param id: The unique identifier of the issue. + :type id: str + :param issue_name: The human-readable name of the issue. :type issue_name: str - :param issue_type: The machine-readable type of the issue. - :type issue_type: str + :param remediation: Remediation for the issue. Omitted when no remediation is available. + :type remediation: AgentHealthRemediation, optional :param resource_id: The identifier of the affected resource, interpreted according to ``resource_kind`` : hostname for ``host`` , DaemonSet UID for ``deployment`` (node Agent), cluster UUID for ``cluster`` , hostname of the host running the Cluster Agent for ``cluster_agent`` , or OpenTelemetry collector ID for ``otel``. :type resource_id: str @@ -112,8 +148,12 @@ def __init__( kwargs["category"] = category if description is not unset: kwargs["description"] = description + if extra is not unset: + kwargs["extra"] = extra if first_seen_at is not unset: kwargs["first_seen_at"] = first_seen_at + if remediation is not unset: + kwargs["remediation"] = remediation if resource_type is not unset: kwargs["resource_type"] = resource_type if tags is not unset: @@ -124,8 +164,8 @@ def __init__( kwargs["updated_at"] = updated_at super().__init__(kwargs) + self_.id = id self_.issue_name = issue_name - self_.issue_type = issue_type self_.resource_id = resource_id self_.resource_kind = resource_kind self_.severity = severity diff --git a/src/datadog_api_client/v2/model/agent_health_issue_data.py b/src/datadog_api_client/v2/model/agent_health_issue_data.py deleted file mode 100644 index 490c713077..0000000000 --- a/src/datadog_api_client/v2/model/agent_health_issue_data.py +++ /dev/null @@ -1,54 +0,0 @@ -# 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.agent_health_issue_attributes import AgentHealthIssueAttributes - from datadog_api_client.v2.model.agent_health_issue_resource_type import AgentHealthIssueResourceType - - -class AgentHealthIssueData(ModelNormal): - @cached_property - def openapi_types(_): - from datadog_api_client.v2.model.agent_health_issue_attributes import AgentHealthIssueAttributes - from datadog_api_client.v2.model.agent_health_issue_resource_type import AgentHealthIssueResourceType - - return { - "attributes": (AgentHealthIssueAttributes,), - "id": (str,), - "type": (AgentHealthIssueResourceType,), - } - - attribute_map = { - "attributes": "attributes", - "id": "id", - "type": "type", - } - - def __init__(self_, attributes: AgentHealthIssueAttributes, id: str, type: AgentHealthIssueResourceType, **kwargs): - """ - An open Agent Health issue. - - :param attributes: Attributes of an open Agent Health issue. - :type attributes: AgentHealthIssueAttributes - - :param id: The unique identifier of the issue. - :type id: str - - :param type: The Agent Health issue resource type. - :type type: AgentHealthIssueResourceType - """ - super().__init__(kwargs) - - self_.attributes = attributes - self_.id = id - self_.type = type diff --git a/src/datadog_api_client/v2/model/agent_health_issue_group.py b/src/datadog_api_client/v2/model/agent_health_issue_group.py new file mode 100644 index 0000000000..5374102922 --- /dev/null +++ b/src/datadog_api_client/v2/model/agent_health_issue_group.py @@ -0,0 +1,46 @@ +# 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.agent_health_issue import AgentHealthIssue + + +class AgentHealthIssueGroup(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.agent_health_issue import AgentHealthIssue + + return { + "issue_type": (str,), + "issues": ([AgentHealthIssue],), + } + + attribute_map = { + "issue_type": "issue_type", + "issues": "issues", + } + + def __init__(self_, issue_type: str, issues: List[AgentHealthIssue], **kwargs): + """ + A group of open Agent Health issues that share an issue type. + + :param issue_type: The machine-readable type shared by the issues in this group. Issues with no type are grouped under ``unknown``. + :type issue_type: str + + :param issues: The open issues in a group. + :type issues: [AgentHealthIssue] + """ + super().__init__(kwargs) + + self_.issue_type = issue_type + self_.issues = issues diff --git a/src/datadog_api_client/v2/model/agent_health_issues_count_by.py b/src/datadog_api_client/v2/model/agent_health_issues_count_by.py new file mode 100644 index 0000000000..77c221cd38 --- /dev/null +++ b/src/datadog_api_client/v2/model/agent_health_issues_count_by.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 AgentHealthIssuesCountBy(ModelSimple): + """ + The dimension to aggregate issue counts by. Only `issue_type` is supported. + + :param value: If omitted defaults to "issue_type". Must be one of ["issue_type"]. + :type value: str + """ + + allowed_values = { + "issue_type", + } + ISSUE_TYPE: ClassVar["AgentHealthIssuesCountBy"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +AgentHealthIssuesCountBy.ISSUE_TYPE = AgentHealthIssuesCountBy("issue_type") diff --git a/src/datadog_api_client/v2/model/agent_health_issues_response.py b/src/datadog_api_client/v2/model/agent_health_issues_response.py index 6b56092f34..fa2fd94b68 100644 --- a/src/datadog_api_client/v2/model/agent_health_issues_response.py +++ b/src/datadog_api_client/v2/model/agent_health_issues_response.py @@ -3,27 +3,29 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import List, TYPE_CHECKING +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.agent_health_issue_data import AgentHealthIssueData + from datadog_api_client.v2.model.agent_health_issue_group import AgentHealthIssueGroup from datadog_api_client.v2.model.agent_health_issues_response_meta import AgentHealthIssuesResponseMeta class AgentHealthIssuesResponse(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.agent_health_issue_data import AgentHealthIssueData + from datadog_api_client.v2.model.agent_health_issue_group import AgentHealthIssueGroup from datadog_api_client.v2.model.agent_health_issues_response_meta import AgentHealthIssuesResponseMeta return { - "data": ([AgentHealthIssueData],), + "data": ([AgentHealthIssueGroup],), "meta": (AgentHealthIssuesResponseMeta,), } @@ -32,17 +34,23 @@ def openapi_types(_): "meta": "meta", } - def __init__(self_, data: List[AgentHealthIssueData], meta: AgentHealthIssuesResponseMeta, **kwargs): + def __init__( + self_, + data: List[AgentHealthIssueGroup], + meta: Union[AgentHealthIssuesResponseMeta, UnsetType] = unset, + **kwargs, + ): """ - A paginated response containing open Agent Health issues. + A response containing open Agent Health issues grouped by issue type. - :param data: The open Agent Health issues on this page. - :type data: [AgentHealthIssueData] + :param data: Open Agent Health issues grouped by issue type. + :type data: [AgentHealthIssueGroup] - :param meta: Pagination metadata for the matching Agent Health issues. - :type meta: AgentHealthIssuesResponseMeta + :param meta: Aggregate counts for the matching Agent Health issues. Present only when ``count_by=issue_type`` is requested. + :type meta: AgentHealthIssuesResponseMeta, optional """ + if meta is not unset: + kwargs["meta"] = meta super().__init__(kwargs) self_.data = data - self_.meta = meta diff --git a/src/datadog_api_client/v2/model/agent_health_issues_response_meta.py b/src/datadog_api_client/v2/model/agent_health_issues_response_meta.py index e7fc723d46..76e4e7b06c 100644 --- a/src/datadog_api_client/v2/model/agent_health_issues_response_meta.py +++ b/src/datadog_api_client/v2/model/agent_health_issues_response_meta.py @@ -30,9 +30,9 @@ def openapi_types(_): def __init__(self_, page: AgentHealthIssuesResponsePage, **kwargs): """ - Pagination metadata for the matching Agent Health issues. + Aggregate counts for the matching Agent Health issues. Present only when ``count_by=issue_type`` is requested. - :param page: Pagination counts for the Agent Health issues. + :param page: Counts for the matching Agent Health issues. :type page: AgentHealthIssuesResponsePage """ super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/agent_health_issues_response_page.py b/src/datadog_api_client/v2/model/agent_health_issues_response_page.py index e792507af1..d6a0dfc36f 100644 --- a/src/datadog_api_client/v2/model/agent_health_issues_response_page.py +++ b/src/datadog_api_client/v2/model/agent_health_issues_response_page.py @@ -3,6 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations +from typing import Dict from datadog_api_client.model_utils import ( ModelNormal, @@ -14,26 +15,26 @@ class AgentHealthIssuesResponsePage(ModelNormal): @cached_property def openapi_types(_): return { + "counts_by_issue_type": ({str: (int,)},), "total_count": (int,), - "total_filtered_count": (int,), } attribute_map = { + "counts_by_issue_type": "counts_by_issue_type", "total_count": "total_count", - "total_filtered_count": "total_filtered_count", } - def __init__(self_, total_count: int, total_filtered_count: int, **kwargs): + def __init__(self_, counts_by_issue_type: Dict[str, int], total_count: int, **kwargs): """ - Pagination counts for the Agent Health issues. + Counts for the matching Agent Health issues. - :param total_count: The total number of open issues in the organization, ignoring filters. - :type total_count: int + :param counts_by_issue_type: The number of returned open issues in each issue-type group. + :type counts_by_issue_type: {str: (int,)} - :param total_filtered_count: The total number of open issues matching the filters, across all pages. - :type total_filtered_count: int + :param total_count: The total number of open issues matching the filters. + :type total_count: int """ super().__init__(kwargs) + self_.counts_by_issue_type = counts_by_issue_type self_.total_count = total_count - self_.total_filtered_count = total_filtered_count diff --git a/src/datadog_api_client/v2/model/agent_health_remediation.py b/src/datadog_api_client/v2/model/agent_health_remediation.py index 9cd1bc178b..1a569d707c 100644 --- a/src/datadog_api_client/v2/model/agent_health_remediation.py +++ b/src/datadog_api_client/v2/model/agent_health_remediation.py @@ -25,12 +25,14 @@ def openapi_types(_): from datadog_api_client.v2.model.agent_health_remediation_step import AgentHealthRemediationStep return { + "ai_prompt": (str,), "script": (AgentHealthRemediationScript,), "steps": ([AgentHealthRemediationStep],), "summary": (str,), } attribute_map = { + "ai_prompt": "ai_prompt", "script": "script", "steps": "steps", "summary": "summary", @@ -38,6 +40,7 @@ def openapi_types(_): def __init__( self_, + ai_prompt: Union[str, UnsetType] = unset, script: Union[AgentHealthRemediationScript, UnsetType] = unset, steps: Union[List[AgentHealthRemediationStep], UnsetType] = unset, summary: Union[str, UnsetType] = unset, @@ -46,6 +49,9 @@ def __init__( """ Remediation for the issue. Omitted when no remediation is available. + :param ai_prompt: A suggested prompt for an AI assistant to help remediate the issue. + :type ai_prompt: str, optional + :param script: A script that can be used to remediate the issue. :type script: AgentHealthRemediationScript, optional @@ -55,6 +61,8 @@ def __init__( :param summary: A summary of how to remediate the issue. :type summary: str, optional """ + if ai_prompt is not unset: + kwargs["ai_prompt"] = ai_prompt if script is not unset: kwargs["script"] = script if steps is not unset: diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 24dc39251c..eec390e984 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -268,12 +268,13 @@ from datadog_api_client.v2.model.agent_health_host_issues_data import AgentHealthHostIssuesData from datadog_api_client.v2.model.agent_health_host_issues_response import AgentHealthHostIssuesResponse from datadog_api_client.v2.model.agent_health_host_issues_type import AgentHealthHostIssuesType -from datadog_api_client.v2.model.agent_health_issue_attributes import AgentHealthIssueAttributes -from datadog_api_client.v2.model.agent_health_issue_data import AgentHealthIssueData +from datadog_api_client.v2.model.agent_health_issue import AgentHealthIssue from datadog_api_client.v2.model.agent_health_issue_detail_attributes import AgentHealthIssueDetailAttributes from datadog_api_client.v2.model.agent_health_issue_detail_data import AgentHealthIssueDetailData +from datadog_api_client.v2.model.agent_health_issue_group import AgentHealthIssueGroup from datadog_api_client.v2.model.agent_health_issue_resource_type import AgentHealthIssueResourceType from datadog_api_client.v2.model.agent_health_issue_response import AgentHealthIssueResponse +from datadog_api_client.v2.model.agent_health_issues_count_by import AgentHealthIssuesCountBy from datadog_api_client.v2.model.agent_health_issues_response import AgentHealthIssuesResponse from datadog_api_client.v2.model.agent_health_issues_response_meta import AgentHealthIssuesResponseMeta from datadog_api_client.v2.model.agent_health_issues_response_page import AgentHealthIssuesResponsePage @@ -14243,12 +14244,13 @@ "AgentHealthHostIssuesData", "AgentHealthHostIssuesResponse", "AgentHealthHostIssuesType", - "AgentHealthIssueAttributes", - "AgentHealthIssueData", + "AgentHealthIssue", "AgentHealthIssueDetailAttributes", "AgentHealthIssueDetailData", + "AgentHealthIssueGroup", "AgentHealthIssueResourceType", "AgentHealthIssueResponse", + "AgentHealthIssuesCountBy", "AgentHealthIssuesResponse", "AgentHealthIssuesResponseMeta", "AgentHealthIssuesResponsePage", diff --git a/tests/v2/features/agent_health.feature b/tests/v2/features/agent_health.feature index 20143df780..64eae1a5d3 100644 --- a/tests/v2/features/agent_health.feature +++ b/tests/v2/features/agent_health.feature @@ -35,7 +35,7 @@ Feature: Agent Health Given a valid "appKeyAuth" key in the system And operation "ListAgentHealthIssues" enabled And new "ListAgentHealthIssues" request - And request contains "page[size]" parameter with value 1000 + And request contains "count_by" parameter with value "invalid" When the request is sent Then the response status is 400 Bad Request