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

Filter by extension

Filter by extension

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

Large diffs are not rendered by default.

54 changes: 19 additions & 35 deletions src/datadog_api_client/v2/api/agent_health_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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,
Expand All @@ -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.
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,),
Expand All @@ -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",
Expand All @@ -51,38 +79,46 @@ 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,
updated_at: Union[datetime, UnsetType] = unset,
**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

: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
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down
54 changes: 0 additions & 54 deletions src/datadog_api_client/v2/model/agent_health_issue_data.py

This file was deleted.

46 changes: 46 additions & 0 deletions src/datadog_api_client/v2/model/agent_health_issue_group.py
Original file line number Diff line number Diff line change
@@ -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
35 changes: 35 additions & 0 deletions src/datadog_api_client/v2/model/agent_health_issues_count_by.py
Original file line number Diff line number Diff line change
@@ -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")
Loading
Loading