From 0a1e9c10db9b77424600759e756259a41e00e2b7 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 12 Nov 2026 19:41:12 +0000 Subject: [PATCH] Regenerate client from commit 3030a9b of spec repo --- .generator/schemas/v2/openapi.yaml | 670 +++++++++++++++++- .../v2/agent-health/GetAgentHealthIssue.py | 18 + .../v2/agent-health/ListAgentHealthIssues.py | 16 + src/datadog_api_client/configuration.py | 2 + .../v2/api/agent_health_api.py | 203 +++++- .../v2/model/agent_health_issue_attributes.py | 132 ++++ .../v2/model/agent_health_issue_data.py | 54 ++ .../agent_health_issue_detail_attributes.py | 146 ++++ .../model/agent_health_issue_detail_data.py | 56 ++ .../model/agent_health_issue_resource_type.py | 35 + .../v2/model/agent_health_issue_response.py | 40 ++ .../v2/model/agent_health_issues_response.py | 48 ++ .../agent_health_issues_response_meta.py | 40 ++ .../agent_health_issues_response_page.py | 39 + .../v2/model/agent_health_remediation.py | 64 ++ .../model/agent_health_remediation_script.py | 72 ++ .../v2/model/agent_health_remediation_step.py | 43 ++ src/datadog_api_client/v2/models/__init__.py | 24 + tests/v2/features/agent_health.feature | 53 +- tests/v2/features/undo.json | 12 + 20 files changed, 1760 insertions(+), 7 deletions(-) create mode 100644 examples/v2/agent-health/GetAgentHealthIssue.py create mode 100644 examples/v2/agent-health/ListAgentHealthIssues.py create mode 100644 src/datadog_api_client/v2/model/agent_health_issue_attributes.py create mode 100644 src/datadog_api_client/v2/model/agent_health_issue_data.py create mode 100644 src/datadog_api_client/v2/model/agent_health_issue_detail_attributes.py create mode 100644 src/datadog_api_client/v2/model/agent_health_issue_detail_data.py create mode 100644 src/datadog_api_client/v2/model/agent_health_issue_resource_type.py create mode 100644 src/datadog_api_client/v2/model/agent_health_issue_response.py create mode 100644 src/datadog_api_client/v2/model/agent_health_issues_response.py create mode 100644 src/datadog_api_client/v2/model/agent_health_issues_response_meta.py create mode 100644 src/datadog_api_client/v2/model/agent_health_issues_response_page.py create mode 100644 src/datadog_api_client/v2/model/agent_health_remediation.py create mode 100644 src/datadog_api_client/v2/model/agent_health_remediation_script.py create mode 100644 src/datadog_api_client/v2/model/agent_health_remediation_step.py diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 89b899e5cc..2344a3ee52 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -6390,6 +6390,416 @@ components: type: string x-enum-varnames: - AGENT_HEALTH_ISSUES + AgentHealthIssueAttributes: + description: Attributes of 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" + 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" + properties: + category: + description: The category of the issue, such as `configuration`. Omitted when not set. + example: configuration + type: string + description: + description: The description of the issue. Omitted when empty. + example: The Agent configuration file contains an invalid value. + type: string + 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 + 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 + 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`. + example: my-hostname + type: string + resource_kind: + description: >- + The kind of affected resource. Known values are `host`, `deployment`, `cluster`, `cluster_agent`, and `otel`. + example: host + type: string + resource_type: + description: The type of the affected resource. Omitted when empty. + example: host + type: string + severity: + description: The severity of the issue. Known values are `low`, `medium`, `high`, and `unknown`. + example: high + type: string + state: + description: The state of the issue. Only issues with state `open` are returned. + example: open + type: string + tags: + $ref: "#/components/schemas/AgentHealthIssueTags" + title: + description: The title of the issue. Omitted when empty. + example: Invalid Agent configuration + type: string + updated_at: + description: The time the issue was last updated, in RFC 3339 format. Omitted when empty. + example: "2026-11-09T08:00:00Z" + format: date-time + type: string + required: + - issue_type + - issue_name + - severity + - state + - resource_kind + - resource_id + type: object + AgentHealthIssueData: + description: An open Agent Health issue. + 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 + 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" + type: array + AgentHealthIssueDetailAttributes: + description: Attributes of an open Agent Health issue, including available remediation. + example: + 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 + remediation: + script: + content: "..." + filename: fix.sh + language: bash + language_version: "5" + requires_root: true + 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" + properties: + category: + description: The category of the issue, such as `configuration`. Omitted when not set. + example: configuration + type: string + description: + description: The description of the issue. Omitted when empty. + example: The Agent configuration file contains an invalid value. + type: string + 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 + 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`. + example: my-hostname + type: string + resource_kind: + description: >- + The kind of affected resource. Known values are `host`, `deployment`, `cluster`, `cluster_agent`, and `otel`. + example: host + type: string + resource_type: + description: The type of the affected resource. Omitted when empty. + example: host + type: string + severity: + description: The severity of the issue. Known values are `low`, `medium`, `high`, and `unknown`. + example: high + type: string + state: + description: The state of the issue. Only issues with state `open` are returned. + example: open + type: string + tags: + $ref: "#/components/schemas/AgentHealthIssueTags" + title: + description: The title of the issue. Omitted when empty. + example: Invalid Agent configuration + type: string + updated_at: + description: The time the issue was last updated, in RFC 3339 format. Omitted when empty. + example: "2026-11-09T08:00:00Z" + format: date-time + type: string + required: + - issue_type + - issue_name + - severity + - state + - resource_kind + - resource_id + type: object + AgentHealthIssueDetailData: + description: An open Agent Health issue with available remediation. + 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 + remediation: + script: + content: "..." + filename: fix.sh + language: bash + language_version: "5" + requires_root: true + 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" + id: invalid-config:4828e7d6c704c4a3 + type: agent_health_issues + properties: + attributes: + $ref: "#/components/schemas/AgentHealthIssueDetailAttributes" + 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 + AgentHealthIssueResourceType: + description: The Agent Health issue resource type. + enum: + - agent_health_issues + example: agent_health_issues + type: string + x-enum-varnames: + - AGENT_HEALTH_ISSUES + AgentHealthIssueResponse: + description: A response containing an open Agent Health issue and available remediation. + properties: + data: + $ref: "#/components/schemas/AgentHealthIssueDetailData" + required: + - data + type: object + AgentHealthIssueTags: + description: Tags associated with the issue. Omitted when empty. + example: + - env:prod + items: + description: A tag associated with the issue. + type: string + type: array + AgentHealthIssuesResponse: + description: A paginated response containing open Agent Health issues. + properties: + data: + $ref: "#/components/schemas/AgentHealthIssueDataArray" + meta: + $ref: "#/components/schemas/AgentHealthIssuesResponseMeta" + required: + - data + - meta + type: object + AgentHealthIssuesResponseMeta: + description: Pagination metadata for the matching Agent Health issues. + example: + page: + total_count: 3 + total_filtered_count: 1 + properties: + page: + $ref: "#/components/schemas/AgentHealthIssuesResponsePage" + required: + - page + type: object + AgentHealthIssuesResponsePage: + description: Pagination counts for the Agent Health issues. + example: + total_count: 3 + total_filtered_count: 1 + properties: + 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 + format: int64 + type: integer + required: + - total_count + - total_filtered_count + type: object + AgentHealthRemediation: + description: Remediation for the issue. Omitted when no remediation is available. + example: + script: + content: "..." + filename: fix.sh + language: bash + language_version: "5" + requires_root: true + steps: + - order: 1 + text: Open datadog.yaml + summary: Fix the invalid configuration value. + properties: + script: + $ref: "#/components/schemas/AgentHealthRemediationScript" + steps: + $ref: "#/components/schemas/AgentHealthRemediationSteps" + summary: + description: A summary of how to remediate the issue. + example: Fix the invalid configuration value. + type: string + type: object + AgentHealthRemediationScript: + description: A script that can be used to remediate the issue. + properties: + content: + description: The content of the script. + example: "..." + type: string + filename: + description: The filename of the script. + example: fix.sh + type: string + language: + description: The language of the script. + example: bash + type: string + language_version: + description: The language version used by the script. + example: "5" + type: string + requires_root: + description: Whether the script requires root privileges. + example: true + type: boolean + type: object + AgentHealthRemediationStep: + description: A step to remediate the issue. + properties: + order: + description: The order in which to perform the step. + example: 1 + format: int64 + type: integer + text: + description: The instructions for the step. + example: Open datadog.yaml + type: string + type: object + AgentHealthRemediationSteps: + description: Steps to remediate the issue. + example: + - order: 1 + text: Open datadog.yaml + items: + $ref: "#/components/schemas/AgentHealthRemediationStep" + type: array AgentTrigger: description: "Trigger a workflow from an agent via the MCP execute tool. Workflow can be executed from Bits Chat, Bits Agent Builder, Claude Code, Codex, Cursor, and any other coding agent using the Datadog MCP." properties: @@ -157946,6 +158356,263 @@ paths: summary: List active Agent Health issues tags: - Agent Health + /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. + + 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 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 + in: query + name: page[number] + required: false + schema: + default: 0 + format: int64 + maximum: 1000000 + minimum: 0 + type: integer + - 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. + Blank entries are ignored; an all-blank filter is treated as absent. + example: high,medium + in: query + name: filter[severity] + required: false + schema: + maxLength: 12850 + type: string + - description: |- + Filter by a comma-separated list of exact `category` 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. + example: configuration + in: query + name: filter[category] + required: false + schema: + maxLength: 12850 + type: string + - description: |- + Filter by a comma-separated list of exact `issue_type` 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. + example: invalid_config + in: query + name: filter[issue_type] + required: false + schema: + maxLength: 12850 + type: string + - description: |- + Filter by a comma-separated list of exact `resource_kind` 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. + example: host,deployment + in: query + name: filter[resource_kind] + required: false + schema: + maxLength: 12850 + type: string + - description: |- + Filter by a comma-separated list of exact `resource_id` 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. + example: my-hostname + in: query + name: filter[resource_id] + required: false + schema: + maxLength: 12850 + type: string + responses: + "200": + content: + application/json: + examples: + 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 + meta: + page: + total_count: 3 + total_filtered_count: 1 + schema: + $ref: "#/components/schemas/AgentHealthIssuesResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - hosts_read + summary: List Agent Health issues + tags: + - Agent Health + x-permission: + operator: OR + permissions: + - hosts_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/agenthealth/issues/{issue_id}: + get: + description: |- + Get an Agent Health issue and its available remediation in your organization. + Only open issues are returned. The `remediation` attribute is omitted when + the issue has no remediation. + + Returns `404` if the issue does not exist, is not open, belongs to another + organization, or you do not have access to its data. This response does not + reveal whether the issue exists. Returns `403` if you lack the `hosts_read` permission. + operationId: GetAgentHealthIssue + parameters: + - description: |- + The unique identifier of the issue. It can contain `:` and must be percent-encoded + by clients when included in the path. + example: invalid-config:4828e7d6c704c4a3 + in: path + name: issue_id + required: true + schema: + type: string + responses: + "200": + content: + application/json: + examples: + 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 + remediation: + script: + content: "..." + filename: fix.sh + language: bash + language_version: "5" + requires_root: true + 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" + id: invalid-config:4828e7d6c704c4a3 + type: agent_health_issues + schema: + $ref: "#/components/schemas/AgentHealthIssueResponse" + description: OK + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - hosts_read + summary: Get an Agent Health issue + tags: + - Agent Health + x-permission: + operator: OR + permissions: + - hosts_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/agentless_scanning/accounts/aws: get: description: Fetches the scan options configured for AWS accounts. @@ -273676,7 +274343,8 @@ tags: externalDocs: url: https://docs.datadoghq.com/actions/datastore name: Actions Datastores - - description: View Agent Health issues reported for node Agents and Cluster Agents. + - description: >- + List open Agent Health issues across your organization and get an issue with its available remediation. Issues are reported by node Agents, Cluster Agents, and OpenTelemetry collectors. The meaning of `resource_id` depends on `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`. name: Agent Health - description: >- Manage Agent Observability spans, data, projects, datasets, dataset records, experiments, prompts, and annotations. diff --git a/examples/v2/agent-health/GetAgentHealthIssue.py b/examples/v2/agent-health/GetAgentHealthIssue.py new file mode 100644 index 0000000000..3bdcecf079 --- /dev/null +++ b/examples/v2/agent-health/GetAgentHealthIssue.py @@ -0,0 +1,18 @@ +""" +Get an Agent Health issue returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.agent_health_api import AgentHealthApi + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["get_agent_health_issue"] = True +with ApiClient(configuration) as api_client: + api_instance = AgentHealthApi(api_client) + response = api_instance.get_agent_health_issue( + issue_id="issue_id", + ) + + print(response) diff --git a/examples/v2/agent-health/ListAgentHealthIssues.py b/examples/v2/agent-health/ListAgentHealthIssues.py new file mode 100644 index 0000000000..79f46e4f4b --- /dev/null +++ b/examples/v2/agent-health/ListAgentHealthIssues.py @@ -0,0 +1,16 @@ +""" +List Agent Health issues returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.agent_health_api import AgentHealthApi + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["list_agent_health_issues"] = True +with ApiClient(configuration) as api_client: + api_instance = AgentHealthApi(api_client) + response = api_instance.list_agent_health_issues() + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 2f5b980616..2c5832c8eb 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -341,6 +341,8 @@ def __init__( "v2.get_execution_policy": False, "v2.list_execution_policies": False, "v2.update_execution_policy": False, + "v2.get_agent_health_issue": False, + "v2.list_agent_health_issues": False, "v2.evaluate_ai_guard_request": False, "v2.create_annotation": False, "v2.delete_annotation": False, 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 f4264c2dda..0736a17724 100644 --- a/src/datadog_api_client/v2/api/agent_health_api.py +++ b/src/datadog_api_client/v2/api/agent_health_api.py @@ -13,11 +13,13 @@ ) 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_issue_response import AgentHealthIssueResponse class AgentHealthApi: """ - View Agent Health issues reported for node Agents and Cluster Agents. + List open Agent Health issues across your organization and get an issue with its available remediation. Issues are reported by node Agents, Cluster Agents, and OpenTelemetry collectors. The meaning of ``resource_id`` depends on ``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``. """ def __init__(self, api_client=None): @@ -25,6 +27,29 @@ def __init__(self, api_client=None): api_client = ApiClient(Configuration()) self.api_client = api_client + self._get_agent_health_issue_endpoint = _Endpoint( + settings={ + "response_type": (AgentHealthIssueResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/agenthealth/issues/{issue_id}", + "operation_id": "get_agent_health_issue", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "issue_id": { + "required": True, + "openapi_types": (str,), + "attribute": "issue_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_agent_health_host_issues_endpoint = _Endpoint( settings={ "response_type": (AgentHealthHostIssuesResponse,), @@ -53,6 +78,105 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_agent_health_issues_endpoint = _Endpoint( + settings={ + "response_type": (AgentHealthIssuesResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/agenthealth/issues", + "operation_id": "list_agent_health_issues", + "http_method": "GET", + "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]", + "location": "query", + }, + "filter_severity": { + "validation": { + "max_length": 12850, + }, + "openapi_types": (str,), + "attribute": "filter[severity]", + "location": "query", + }, + "filter_category": { + "validation": { + "max_length": 12850, + }, + "openapi_types": (str,), + "attribute": "filter[category]", + "location": "query", + }, + "filter_issue_type": { + "validation": { + "max_length": 12850, + }, + "openapi_types": (str,), + "attribute": "filter[issue_type]", + "location": "query", + }, + "filter_resource_kind": { + "validation": { + "max_length": 12850, + }, + "openapi_types": (str,), + "attribute": "filter[resource_kind]", + "location": "query", + }, + "filter_resource_id": { + "validation": { + "max_length": 12850, + }, + "openapi_types": (str,), + "attribute": "filter[resource_id]", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + def get_agent_health_issue( + self, + issue_id: str, + ) -> AgentHealthIssueResponse: + """Get an Agent Health issue. + + Get an Agent Health issue and its available remediation in your organization. + Only open issues are returned. The ``remediation`` attribute is omitted when + the issue has no remediation. + + Returns ``404`` if the issue does not exist, is not open, belongs to another + organization, or you do not have access to its data. This response does not + reveal whether the issue exists. Returns ``403`` if you lack the ``hosts_read`` permission. + + :param issue_id: The unique identifier of the issue. It can contain ``:`` and must be percent-encoded + by clients when included in the path. + :type issue_id: str + :rtype: AgentHealthIssueResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["issue_id"] = issue_id + + return self._get_agent_health_issue_endpoint.call_with_http_info(**kwargs) + def list_agent_health_host_issues( self, resource_id: str, @@ -76,3 +200,80 @@ def list_agent_health_host_issues( kwargs["agent_type"] = agent_type return self._list_agent_health_host_issues_endpoint.call_with_http_info(**kwargs) + + def list_agent_health_issues( + self, + *, + page_size: Union[int, UnsetType] = unset, + page_number: Union[int, UnsetType] = unset, + filter_severity: Union[str, UnsetType] = unset, + filter_category: Union[str, UnsetType] = unset, + filter_issue_type: Union[str, UnsetType] = unset, + filter_resource_kind: Union[str, UnsetType] = unset, + filter_resource_id: Union[str, UnsetType] = unset, + ) -> 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. + + 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 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 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. + :type filter_severity: str, optional + :param filter_category: Filter by a comma-separated list of exact ``category`` 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. + :type filter_category: str, optional + :param filter_issue_type: Filter by a comma-separated list of exact ``issue_type`` 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. + :type filter_issue_type: str, optional + :param filter_resource_kind: Filter by a comma-separated list of exact ``resource_kind`` 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. + :type filter_resource_kind: str, optional + :param filter_resource_id: Filter by a comma-separated list of exact ``resource_id`` 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. + :type filter_resource_id: str, optional + :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 filter_severity is not unset: + kwargs["filter_severity"] = filter_severity + + if filter_category is not unset: + kwargs["filter_category"] = filter_category + + if filter_issue_type is not unset: + kwargs["filter_issue_type"] = filter_issue_type + + if filter_resource_kind is not unset: + kwargs["filter_resource_kind"] = filter_resource_kind + + if filter_resource_id is not unset: + kwargs["filter_resource_id"] = filter_resource_id + + return self._list_agent_health_issues_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/model/agent_health_issue_attributes.py b/src/datadog_api_client/v2/model/agent_health_issue_attributes.py new file mode 100644 index 0000000000..ca0323b9a0 --- /dev/null +++ b/src/datadog_api_client/v2/model/agent_health_issue_attributes.py @@ -0,0 +1,132 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + unset, + UnsetType, +) + + +class AgentHealthIssueAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "category": (str,), + "description": (str,), + "first_seen_at": (datetime,), + "issue_name": (str,), + "issue_type": (str,), + "resource_id": (str,), + "resource_kind": (str,), + "resource_type": (str,), + "severity": (str,), + "state": (str,), + "tags": ([str],), + "title": (str,), + "updated_at": (datetime,), + } + + attribute_map = { + "category": "category", + "description": "description", + "first_seen_at": "first_seen_at", + "issue_name": "issue_name", + "issue_type": "issue_type", + "resource_id": "resource_id", + "resource_kind": "resource_kind", + "resource_type": "resource_type", + "severity": "severity", + "state": "state", + "tags": "tags", + "title": "title", + "updated_at": "updated_at", + } + + def __init__( + self_, + 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, + first_seen_at: Union[datetime, UnsetType] = unset, + resource_type: Union[str, UnsetType] = unset, + tags: Union[List[str], UnsetType] = unset, + title: Union[str, UnsetType] = unset, + updated_at: Union[datetime, UnsetType] = unset, + **kwargs, + ): + """ + Attributes of an open Agent Health issue. + + :param category: The category of the issue, such as ``configuration``. Omitted when not set. + :type category: str, optional + + :param description: The description of the issue. Omitted when empty. + :type description: str, 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 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 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 + + :param resource_kind: The kind of affected resource. Known values are ``host`` , ``deployment`` , ``cluster`` , ``cluster_agent`` , and ``otel``. + :type resource_kind: str + + :param resource_type: The type of the affected resource. Omitted when empty. + :type resource_type: str, optional + + :param severity: The severity of the issue. Known values are ``low`` , ``medium`` , ``high`` , and ``unknown``. + :type severity: str + + :param state: The state of the issue. Only issues with state ``open`` are returned. + :type state: str + + :param tags: Tags associated with the issue. Omitted when empty. + :type tags: [str], optional + + :param title: The title of the issue. Omitted when empty. + :type title: str, optional + + :param updated_at: The time the issue was last updated, in RFC 3339 format. Omitted when empty. + :type updated_at: datetime, optional + """ + if category is not unset: + kwargs["category"] = category + if description is not unset: + kwargs["description"] = description + if first_seen_at is not unset: + kwargs["first_seen_at"] = first_seen_at + if resource_type is not unset: + kwargs["resource_type"] = resource_type + if tags is not unset: + kwargs["tags"] = tags + if title is not unset: + kwargs["title"] = title + if updated_at is not unset: + kwargs["updated_at"] = updated_at + super().__init__(kwargs) + + self_.issue_name = issue_name + self_.issue_type = issue_type + self_.resource_id = resource_id + self_.resource_kind = resource_kind + self_.severity = severity + self_.state = state 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 new file mode 100644 index 0000000000..490c713077 --- /dev/null +++ b/src/datadog_api_client/v2/model/agent_health_issue_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.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_detail_attributes.py b/src/datadog_api_client/v2/model/agent_health_issue_detail_attributes.py new file mode 100644 index 0000000000..cb1ef6e7ad --- /dev/null +++ b/src/datadog_api_client/v2/model/agent_health_issue_detail_attributes.py @@ -0,0 +1,146 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.agent_health_remediation import AgentHealthRemediation + + +class AgentHealthIssueDetailAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.agent_health_remediation import AgentHealthRemediation + + return { + "category": (str,), + "description": (str,), + "first_seen_at": (datetime,), + "issue_name": (str,), + "issue_type": (str,), + "remediation": (AgentHealthRemediation,), + "resource_id": (str,), + "resource_kind": (str,), + "resource_type": (str,), + "severity": (str,), + "state": (str,), + "tags": ([str],), + "title": (str,), + "updated_at": (datetime,), + } + + attribute_map = { + "category": "category", + "description": "description", + "first_seen_at": "first_seen_at", + "issue_name": "issue_name", + "issue_type": "issue_type", + "remediation": "remediation", + "resource_id": "resource_id", + "resource_kind": "resource_kind", + "resource_type": "resource_type", + "severity": "severity", + "state": "state", + "tags": "tags", + "title": "title", + "updated_at": "updated_at", + } + + def __init__( + self_, + 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, + 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, + updated_at: Union[datetime, UnsetType] = unset, + **kwargs, + ): + """ + Attributes of an open Agent Health issue, including available remediation. + + :param category: The category of the issue, such as ``configuration``. Omitted when not set. + :type category: str, optional + + :param description: The description of the issue. Omitted when empty. + :type description: str, 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 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 + + :param resource_kind: The kind of affected resource. Known values are ``host`` , ``deployment`` , ``cluster`` , ``cluster_agent`` , and ``otel``. + :type resource_kind: str + + :param resource_type: The type of the affected resource. Omitted when empty. + :type resource_type: str, optional + + :param severity: The severity of the issue. Known values are ``low`` , ``medium`` , ``high`` , and ``unknown``. + :type severity: str + + :param state: The state of the issue. Only issues with state ``open`` are returned. + :type state: str + + :param tags: Tags associated with the issue. Omitted when empty. + :type tags: [str], optional + + :param title: The title of the issue. Omitted when empty. + :type title: str, optional + + :param updated_at: The time the issue was last updated, in RFC 3339 format. Omitted when empty. + :type updated_at: datetime, optional + """ + if category is not unset: + kwargs["category"] = category + if description is not unset: + kwargs["description"] = description + 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: + kwargs["tags"] = tags + if title is not unset: + kwargs["title"] = title + if updated_at is not unset: + kwargs["updated_at"] = updated_at + super().__init__(kwargs) + + self_.issue_name = issue_name + self_.issue_type = issue_type + self_.resource_id = resource_id + self_.resource_kind = resource_kind + self_.severity = severity + self_.state = state diff --git a/src/datadog_api_client/v2/model/agent_health_issue_detail_data.py b/src/datadog_api_client/v2/model/agent_health_issue_detail_data.py new file mode 100644 index 0000000000..e25e3e395c --- /dev/null +++ b/src/datadog_api_client/v2/model/agent_health_issue_detail_data.py @@ -0,0 +1,56 @@ +# 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_detail_attributes import AgentHealthIssueDetailAttributes + from datadog_api_client.v2.model.agent_health_issue_resource_type import AgentHealthIssueResourceType + + +class AgentHealthIssueDetailData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.agent_health_issue_detail_attributes import AgentHealthIssueDetailAttributes + from datadog_api_client.v2.model.agent_health_issue_resource_type import AgentHealthIssueResourceType + + return { + "attributes": (AgentHealthIssueDetailAttributes,), + "id": (str,), + "type": (AgentHealthIssueResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: AgentHealthIssueDetailAttributes, id: str, type: AgentHealthIssueResourceType, **kwargs + ): + """ + An open Agent Health issue with available remediation. + + :param attributes: Attributes of an open Agent Health issue, including available remediation. + :type attributes: AgentHealthIssueDetailAttributes + + :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_resource_type.py b/src/datadog_api_client/v2/model/agent_health_issue_resource_type.py new file mode 100644 index 0000000000..d6f90197f7 --- /dev/null +++ b/src/datadog_api_client/v2/model/agent_health_issue_resource_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 AgentHealthIssueResourceType(ModelSimple): + """ + The Agent Health issue resource type. + + :param value: If omitted defaults to "agent_health_issues". Must be one of ["agent_health_issues"]. + :type value: str + """ + + allowed_values = { + "agent_health_issues", + } + AGENT_HEALTH_ISSUES: ClassVar["AgentHealthIssueResourceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +AgentHealthIssueResourceType.AGENT_HEALTH_ISSUES = AgentHealthIssueResourceType("agent_health_issues") diff --git a/src/datadog_api_client/v2/model/agent_health_issue_response.py b/src/datadog_api_client/v2/model/agent_health_issue_response.py new file mode 100644 index 0000000000..bbaa13444b --- /dev/null +++ b/src/datadog_api_client/v2/model/agent_health_issue_response.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.agent_health_issue_detail_data import AgentHealthIssueDetailData + + +class AgentHealthIssueResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.agent_health_issue_detail_data import AgentHealthIssueDetailData + + return { + "data": (AgentHealthIssueDetailData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: AgentHealthIssueDetailData, **kwargs): + """ + A response containing an open Agent Health issue and available remediation. + + :param data: An open Agent Health issue with available remediation. + :type data: AgentHealthIssueDetailData + """ + super().__init__(kwargs) + + self_.data = data 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 new file mode 100644 index 0000000000..6b56092f34 --- /dev/null +++ b/src/datadog_api_client/v2/model/agent_health_issues_response.py @@ -0,0 +1,48 @@ +# 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_data import AgentHealthIssueData + 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_issues_response_meta import AgentHealthIssuesResponseMeta + + return { + "data": ([AgentHealthIssueData],), + "meta": (AgentHealthIssuesResponseMeta,), + } + + attribute_map = { + "data": "data", + "meta": "meta", + } + + def __init__(self_, data: List[AgentHealthIssueData], meta: AgentHealthIssuesResponseMeta, **kwargs): + """ + A paginated response containing open Agent Health issues. + + :param data: The open Agent Health issues on this page. + :type data: [AgentHealthIssueData] + + :param meta: Pagination metadata for the matching Agent Health issues. + :type meta: AgentHealthIssuesResponseMeta + """ + 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 new file mode 100644 index 0000000000..e7fc723d46 --- /dev/null +++ b/src/datadog_api_client/v2/model/agent_health_issues_response_meta.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.agent_health_issues_response_page import AgentHealthIssuesResponsePage + + +class AgentHealthIssuesResponseMeta(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.agent_health_issues_response_page import AgentHealthIssuesResponsePage + + return { + "page": (AgentHealthIssuesResponsePage,), + } + + attribute_map = { + "page": "page", + } + + def __init__(self_, page: AgentHealthIssuesResponsePage, **kwargs): + """ + Pagination metadata for the matching Agent Health issues. + + :param page: Pagination counts for the Agent Health issues. + :type page: AgentHealthIssuesResponsePage + """ + super().__init__(kwargs) + + self_.page = page 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 new file mode 100644 index 0000000000..e792507af1 --- /dev/null +++ b/src/datadog_api_client/v2/model/agent_health_issues_response_page.py @@ -0,0 +1,39 @@ +# 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 ( + ModelNormal, + cached_property, +) + + +class AgentHealthIssuesResponsePage(ModelNormal): + @cached_property + def openapi_types(_): + return { + "total_count": (int,), + "total_filtered_count": (int,), + } + + attribute_map = { + "total_count": "total_count", + "total_filtered_count": "total_filtered_count", + } + + def __init__(self_, total_count: int, total_filtered_count: int, **kwargs): + """ + Pagination counts for the Agent Health issues. + + :param total_count: The total number of open issues in the organization, ignoring filters. + :type total_count: int + + :param total_filtered_count: The total number of open issues matching the filters, across all pages. + :type total_filtered_count: int + """ + super().__init__(kwargs) + + 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 new file mode 100644 index 0000000000..9cd1bc178b --- /dev/null +++ b/src/datadog_api_client/v2/model/agent_health_remediation.py @@ -0,0 +1,64 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.agent_health_remediation_script import AgentHealthRemediationScript + from datadog_api_client.v2.model.agent_health_remediation_step import AgentHealthRemediationStep + + +class AgentHealthRemediation(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.agent_health_remediation_script import AgentHealthRemediationScript + from datadog_api_client.v2.model.agent_health_remediation_step import AgentHealthRemediationStep + + return { + "script": (AgentHealthRemediationScript,), + "steps": ([AgentHealthRemediationStep],), + "summary": (str,), + } + + attribute_map = { + "script": "script", + "steps": "steps", + "summary": "summary", + } + + def __init__( + self_, + script: Union[AgentHealthRemediationScript, UnsetType] = unset, + steps: Union[List[AgentHealthRemediationStep], UnsetType] = unset, + summary: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Remediation for the issue. Omitted when no remediation is available. + + :param script: A script that can be used to remediate the issue. + :type script: AgentHealthRemediationScript, optional + + :param steps: Steps to remediate the issue. + :type steps: [AgentHealthRemediationStep], optional + + :param summary: A summary of how to remediate the issue. + :type summary: str, optional + """ + if script is not unset: + kwargs["script"] = script + if steps is not unset: + kwargs["steps"] = steps + if summary is not unset: + kwargs["summary"] = summary + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/agent_health_remediation_script.py b/src/datadog_api_client/v2/model/agent_health_remediation_script.py new file mode 100644 index 0000000000..34b70cdcfb --- /dev/null +++ b/src/datadog_api_client/v2/model/agent_health_remediation_script.py @@ -0,0 +1,72 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class AgentHealthRemediationScript(ModelNormal): + @cached_property + def openapi_types(_): + return { + "content": (str,), + "filename": (str,), + "language": (str,), + "language_version": (str,), + "requires_root": (bool,), + } + + attribute_map = { + "content": "content", + "filename": "filename", + "language": "language", + "language_version": "language_version", + "requires_root": "requires_root", + } + + def __init__( + self_, + content: Union[str, UnsetType] = unset, + filename: Union[str, UnsetType] = unset, + language: Union[str, UnsetType] = unset, + language_version: Union[str, UnsetType] = unset, + requires_root: Union[bool, UnsetType] = unset, + **kwargs, + ): + """ + A script that can be used to remediate the issue. + + :param content: The content of the script. + :type content: str, optional + + :param filename: The filename of the script. + :type filename: str, optional + + :param language: The language of the script. + :type language: str, optional + + :param language_version: The language version used by the script. + :type language_version: str, optional + + :param requires_root: Whether the script requires root privileges. + :type requires_root: bool, optional + """ + if content is not unset: + kwargs["content"] = content + if filename is not unset: + kwargs["filename"] = filename + if language is not unset: + kwargs["language"] = language + if language_version is not unset: + kwargs["language_version"] = language_version + if requires_root is not unset: + kwargs["requires_root"] = requires_root + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/agent_health_remediation_step.py b/src/datadog_api_client/v2/model/agent_health_remediation_step.py new file mode 100644 index 0000000000..86031e18be --- /dev/null +++ b/src/datadog_api_client/v2/model/agent_health_remediation_step.py @@ -0,0 +1,43 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class AgentHealthRemediationStep(ModelNormal): + @cached_property + def openapi_types(_): + return { + "order": (int,), + "text": (str,), + } + + attribute_map = { + "order": "order", + "text": "text", + } + + def __init__(self_, order: Union[int, UnsetType] = unset, text: Union[str, UnsetType] = unset, **kwargs): + """ + A step to remediate the issue. + + :param order: The order in which to perform the step. + :type order: int, optional + + :param text: The instructions for the step. + :type text: str, optional + """ + if order is not unset: + kwargs["order"] = order + if text is not unset: + kwargs["text"] = text + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 023c204e6e..54ad4c8cc6 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -268,6 +268,18 @@ 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_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_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_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 +from datadog_api_client.v2.model.agent_health_remediation import AgentHealthRemediation +from datadog_api_client.v2.model.agent_health_remediation_script import AgentHealthRemediationScript +from datadog_api_client.v2.model.agent_health_remediation_step import AgentHealthRemediationStep from datadog_api_client.v2.model.agent_trigger import AgentTrigger from datadog_api_client.v2.model.agent_trigger_wrapper import AgentTriggerWrapper from datadog_api_client.v2.model.aggregated_long_tasks_by_invoker_type import AggregatedLongTasksByInvokerType @@ -14180,6 +14192,18 @@ "AgentHealthHostIssuesData", "AgentHealthHostIssuesResponse", "AgentHealthHostIssuesType", + "AgentHealthIssueAttributes", + "AgentHealthIssueData", + "AgentHealthIssueDetailAttributes", + "AgentHealthIssueDetailData", + "AgentHealthIssueResourceType", + "AgentHealthIssueResponse", + "AgentHealthIssuesResponse", + "AgentHealthIssuesResponseMeta", + "AgentHealthIssuesResponsePage", + "AgentHealthRemediation", + "AgentHealthRemediationScript", + "AgentHealthRemediationStep", "AgentTrigger", "AgentTriggerWrapper", "AggregatedLongTasksByInvokerType", diff --git a/tests/v2/features/agent_health.feature b/tests/v2/features/agent_health.feature index 0e0dc268c7..20143df780 100644 --- a/tests/v2/features/agent_health.feature +++ b/tests/v2/features/agent_health.feature @@ -1,21 +1,64 @@ @endpoint(agent-health) @endpoint(agent-health-v2) Feature: Agent Health - View Agent Health issues reported for node Agents and Cluster Agents. + List open Agent Health issues across your organization and get an issue + with its available remediation. Issues are reported by node Agents, + Cluster Agents, and OpenTelemetry collectors. The meaning of `resource_id` + depends on `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`. Background: Given a valid "apiKeyAuth" key in the system And an instance of "AgentHealth" API - And new "ListAgentHealthHostIssues" request - And request contains "resource_id" parameter with value "123e4567-e89b-12d3-a456-426614174000" + + @skip @team:ddoghq/fleet-remediation + Scenario: Get an Agent Health issue returns "Not Found" response + Given a valid "appKeyAuth" key in the system + And operation "GetAgentHealthIssue" enabled + And new "GetAgentHealthIssue" request + And request contains "issue_id" parameter with value "does-not-exist" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/fleet-remediation + Scenario: Get an Agent Health issue returns "OK" response + Given a valid "appKeyAuth" key in the system + And operation "GetAgentHealthIssue" enabled + And new "GetAgentHealthIssue" request + And request contains "issue_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @skip @team:ddoghq/fleet-remediation + Scenario: List Agent Health issues returns "Bad Request" response + 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 + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:ddoghq/fleet-remediation + Scenario: List Agent Health issues returns "OK" response + Given a valid "appKeyAuth" key in the system + And operation "ListAgentHealthIssues" enabled + And new "ListAgentHealthIssues" request + When the request is sent + Then the response status is 200 OK @skip @team:ddoghq/fleet-remediation Scenario: List active Agent Health issues returns "Bad Request" response - Given request contains "agent_type" parameter with value "process" + Given new "ListAgentHealthHostIssues" request + And request contains "resource_id" parameter with value "123e4567-e89b-12d3-a456-426614174000" + And request contains "agent_type" parameter with value "process" When the request is sent Then the response status is 400 Bad Request @skip @team:ddoghq/fleet-remediation Scenario: List active Agent Health issues returns "OK" response - Given request contains "agent_type" parameter with value "node" + Given new "ListAgentHealthHostIssues" request + And request contains "resource_id" parameter with value "123e4567-e89b-12d3-a456-426614174000" + And request contains "agent_type" parameter with value "node" When the request is sent Then the response status is 200 OK diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 993492a315..011eb27d88 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -245,6 +245,18 @@ "type": "safe" } }, + "ListAgentHealthIssues": { + "tag": "Agent Health", + "undo": { + "type": "safe" + } + }, + "GetAgentHealthIssue": { + "tag": "Agent Health", + "undo": { + "type": "safe" + } + }, "ListAwsScanOptions": { "tag": "Agentless Scanning", "undo": {