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
184 changes: 133 additions & 51 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/v2/tag-rules/CreateTagRule.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
negated=False,
required=True,
rule_type=TagRuleCreateType.SURFACING,
scope="env",
scope="env:prod",
source=TagRuleSource.LOGS,
tag_key="service",
tag_value_patterns=[
"api",
"web",
],
),
type=TagRuleResourceType.TAG_RULE,
type=TagRuleResourceType.TAG_POLICY,
),
)

Expand Down
2 changes: 1 addition & 1 deletion examples/v2/tag-rules/UpdateTagRule.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
tag_value_patterns=[],
),
id="123",
type=TagRuleResourceType.TAG_RULE,
type=TagRuleResourceType.TAG_POLICY,
),
)

Expand Down
14 changes: 9 additions & 5 deletions src/datadog_api_client/v2/api/tag_rules_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class TagRulesApi:
scoped to a particular telemetry source (such as logs, spans, or metrics). Rules can be
``blocking`` (data not matching the rule is rejected) or ``surfacing`` (matching data is
highlighted but not blocked). Each rule reports a compliance ``score`` derived from how
much recent telemetry adheres to the rule.
much recent telemetry adheres to the rule. RUM supports only ``surfacing`` rules.
"""

def __init__(self, api_client=None):
Expand Down Expand Up @@ -254,7 +254,8 @@ def delete_tag_rule(
Delete a tag rule. By default the rule is soft-deleted so it can be recovered later
and so that historical score data remains queryable. Pass ``hard_delete=true`` to remove
the rule permanently.
the rule permanently. Deleting a ``blocking`` rule additionally requires the
``telemetry_rules_activate`` permission.
:param rule_id: The unique identifier of the tag rule to delete.
:type rule_id: str
Expand Down Expand Up @@ -288,7 +289,7 @@ def get_tag_rule(
:type rule_id: str
:param include: Comma-separated list of related resources to include alongside the rule. Currently the only supported value is ``score``.
:type include: TagRuleInclude, optional
:param ts_start: Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds.
:param ts_start: Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Defaults to approximately 4 hours before the current time for metrics, or 24 hours before the current time for other sources. The API clamps earlier values to this default, regardless of ``ts_end``.
:type ts_start: int, optional
:param ts_end: End of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Must be in the past and greater than ``ts_start``.
:type ts_end: int, optional
Expand Down Expand Up @@ -324,7 +325,7 @@ def get_tag_rule_score(
:param rule_id: The unique identifier of the tag rule.
:type rule_id: str
:param ts_start: Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds.
:param ts_start: Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Defaults to approximately 4 hours before the current time for metrics, or 24 hours before the current time for other sources. The API clamps earlier values to this default, regardless of ``ts_end``.
:type ts_start: int, optional
:param ts_end: End of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Must be in the past and greater than ``ts_start``.
:type ts_end: int, optional
Expand Down Expand Up @@ -365,7 +366,7 @@ def list_tag_rules(
:type include: TagRuleInclude, optional
:param filter_source: Restrict the result set to rules whose source matches the given value.
:type filter_source: TagRuleSource, optional
:param ts_start: Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Defaults to a recent window appropriate for the source.
:param ts_start: Start of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Defaults to approximately 4 hours before the current time for metrics, or 24 hours before the current time for other sources. The API clamps earlier values to this default, regardless of ``ts_end``.
:type ts_start: int, optional
:param ts_end: End of the time window used for compliance score computation, as a Unix timestamp in milliseconds. Must be in the past and greater than ``ts_start``.
:type ts_end: int, optional
Expand Down Expand Up @@ -402,6 +403,9 @@ def update_tag_rule(
Update one or more attributes of an existing tag rule. Only the fields supplied in the
request body are modified; omitted fields retain their current values. The rule's
``source`` cannot be changed after creation.
Promoting a rule from ``surfacing`` to ``blocking`` additionally requires the
``telemetry_rules_activate`` permission, and your organization must have access to
blocking rules. You can't promote RUM rules to ``blocking``.
:param rule_id: The unique identifier of the tag rule to update.
:type rule_id: str
Expand Down
60 changes: 60 additions & 0 deletions src/datadog_api_client/v2/model/gcp_project_filter_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# 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.gcp_project_filter_config_type import GCPProjectFilterConfigType


class GCPProjectFilterConfig(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.gcp_project_filter_config_type import GCPProjectFilterConfigType

return {
"filters": ([str],),
"type": (GCPProjectFilterConfigType,),
}

attribute_map = {
"filters": "filters",
"type": "type",
}

def __init__(
self_,
filters: Union[List[str], UnsetType] = unset,
type: Union[GCPProjectFilterConfigType, UnsetType] = unset,
**kwargs,
):
"""
Configuration for filtering the GCP projects that Datadog monitors by project ID or by project label.

:param filters: List of filters matched against the project field set by ``type``. Filters support the ``*`` and ``?``
wildcards, and a leading ``!`` makes a filter an exclusion. A project is skipped if it matches any
exclusion filter. When inclusion filters are set, a project must also match at least one of them.
For ``project_id`` , each filter is a project ID pattern, such as ``prod-*``. You can set up to 15,000
filters. For ``project_label`` , each filter is a label in the form ``key:value`` , such as ``env:prod*``.
You can set up to 100 filters. Keys are matched exactly, and wildcards apply only to values, so
``key:*`` matches any value.
:type filters: [str], optional

:param type: The GCP project field that the filters are matched against.
:type type: GCPProjectFilterConfigType, optional
"""
if filters is not unset:
kwargs["filters"] = filters
if type is not unset:
kwargs["type"] = type
super().__init__(kwargs)
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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 GCPProjectFilterConfigType(ModelSimple):
"""
The GCP project field that the filters are matched against.

:param value: Must be one of ["project_id", "project_label"].
:type value: str
"""

allowed_values = {
"project_id",
"project_label",
}
PROJECT_ID: ClassVar["GCPProjectFilterConfigType"]
PROJECT_LABEL: ClassVar["GCPProjectFilterConfigType"]

@cached_property
def openapi_types(_):
return {
"value": (str,),
}


GCPProjectFilterConfigType.PROJECT_ID = GCPProjectFilterConfigType("project_id")
GCPProjectFilterConfigType.PROJECT_LABEL = GCPProjectFilterConfigType("project_label")
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@
if TYPE_CHECKING:
from datadog_api_client.v2.model.gcp_metric_namespace_config import GCPMetricNamespaceConfig
from datadog_api_client.v2.model.gcp_monitored_resource_config import GCPMonitoredResourceConfig
from datadog_api_client.v2.model.gcp_project_filter_config import GCPProjectFilterConfig


class GCPSTSServiceAccountAttributes(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.gcp_metric_namespace_config import GCPMetricNamespaceConfig
from datadog_api_client.v2.model.gcp_monitored_resource_config import GCPMonitoredResourceConfig
from datadog_api_client.v2.model.gcp_project_filter_config import GCPProjectFilterConfig

return {
"account_tags": ([str],),
Expand All @@ -38,6 +40,7 @@ def openapi_types(_):
"is_security_command_center_enabled": (bool,),
"metric_namespace_configs": ([GCPMetricNamespaceConfig],),
"monitored_resource_configs": ([GCPMonitoredResourceConfig],),
"project_filter_configs": ([GCPProjectFilterConfig],),
"region_filter_configs": ([str],),
"resource_collection_enabled": (bool,),
}
Expand All @@ -56,6 +59,7 @@ def openapi_types(_):
"is_security_command_center_enabled": "is_security_command_center_enabled",
"metric_namespace_configs": "metric_namespace_configs",
"monitored_resource_configs": "monitored_resource_configs",
"project_filter_configs": "project_filter_configs",
"region_filter_configs": "region_filter_configs",
"resource_collection_enabled": "resource_collection_enabled",
}
Expand All @@ -75,6 +79,7 @@ def __init__(
is_security_command_center_enabled: Union[bool, UnsetType] = unset,
metric_namespace_configs: Union[List[GCPMetricNamespaceConfig], UnsetType] = unset,
monitored_resource_configs: Union[List[GCPMonitoredResourceConfig], UnsetType] = unset,
project_filter_configs: Union[List[GCPProjectFilterConfig], UnsetType] = unset,
region_filter_configs: Union[List[str], UnsetType] = unset,
resource_collection_enabled: Union[bool, UnsetType] = unset,
**kwargs,
Expand Down Expand Up @@ -126,6 +131,13 @@ def __init__(
:param monitored_resource_configs: Configurations for GCP monitored resources.
:type monitored_resource_configs: [GCPMonitoredResourceConfig], optional

:param project_filter_configs: Configurations that limit which GCP projects Datadog monitors, out of the projects this service
account can access. Each type can have at most one configuration. A project is monitored only if
it passes the filters of every configured type. By default, Datadog monitors every project the
service account can access. When updating a service account, omit this field to keep the current
filters, or send an empty list to remove them.
:type project_filter_configs: [GCPProjectFilterConfig], optional

:param region_filter_configs: Configurations for GCP location filtering, such as region, multi-region, or zone. Only monitored resources that match the specified regions are imported into Datadog. By default, Datadog collects from all locations.
:type region_filter_configs: [str], optional

Expand Down Expand Up @@ -158,6 +170,8 @@ def __init__(
kwargs["metric_namespace_configs"] = metric_namespace_configs
if monitored_resource_configs is not unset:
kwargs["monitored_resource_configs"] = monitored_resource_configs
if project_filter_configs is not unset:
kwargs["project_filter_configs"] = project_filter_configs
if region_filter_configs is not unset:
kwargs["region_filter_configs"] = region_filter_configs
if resource_collection_enabled is not unset:
Expand Down
1 change: 1 addition & 0 deletions src/datadog_api_client/v2/model/tag_rule_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def __init__(
:param rule_type: How the rule is enforced. ``blocking`` rejects telemetry that violates the rule.
``surfacing`` only highlights non-compliant telemetry without blocking it.
RUM supports only ``surfacing`` rules.
:type rule_type: TagRuleType
:param scope: The scope the rule applies within.
Expand Down
23 changes: 16 additions & 7 deletions src/datadog_api_client/v2/model/tag_rule_create_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

class TagRuleCreateAttributes(ModelNormal):
validations = {
"tag_key": {},
"tag_value_patterns": {
"max_items": 30,
"min_items": 1,
},
}
Expand Down Expand Up @@ -68,9 +70,11 @@ def __init__(
**kwargs,
):
"""
Attributes that can be supplied when creating a tag rule.
Attributes that can be supplied when creating a tag rule. If ``tag_value_patterns``
contains ``*`` , set ``required`` and ``negated`` to different values. If both are ``false`` ,
the rule has no effect. If both are ``true`` , no value can satisfy the rule.

:param enabled: Whether the rule is currently enforced. Defaults to ``true`` for newly created rules.
:param enabled: The API ignores this value on creation and always enables new rules. To disable a rule, use the "Update a tag rule" endpoint.
:type enabled: bool, optional

:param name: Human-readable name for the tag rule.
Expand All @@ -86,18 +90,23 @@ def __init__(
creation time.
:type rule_type: TagRuleCreateType

:param scope: The scope the rule applies within. Typically an environment, team, or
organization-level identifier used to limit where the rule is enforced.
:param scope: The scope the rule applies within. For logs and spans, use a search query, such
as ``env:prod`` , or ``*`` to match all telemetry. For metrics, use a metric selector
with an optional tag filter, such as ``system.cpu.*{env:prod}``. A metric wildcard
is allowed only once, at the end of the metric selector.
:type scope: str

:param source: The telemetry source that a tag rule applies to.
:type source: TagRuleSource

:param tag_key: The tag key that the rule governs (for example, ``service`` ).
:param tag_key: The tag key that the rule governs (for example, ``service`` ). Allowed characters
are ASCII letters, digits, underscores, hyphens, periods, and slashes. The keys
``host`` and ``device`` are not supported in any letter case.
:type tag_key: str

:param tag_value_patterns: One or more patterns that valid values for the tag key must match. At least one
pattern is required.
:param tag_value_patterns: Between 1 and 30 non-empty patterns that valid values for the tag key must match.
Allowed characters are ASCII letters, digits, underscores, colons, hyphens,
periods, commas, slashes, and asterisks.
:type tag_value_patterns: [str]
"""
if enabled is not unset:
Expand Down
6 changes: 4 additions & 2 deletions src/datadog_api_client/v2/model/tag_rule_create_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ def __init__(self_, attributes: TagRuleCreateAttributes, type: TagRuleResourceTy
"""
Data object for creating a tag rule.

:param attributes: Attributes that can be supplied when creating a tag rule.
:param attributes: Attributes that can be supplied when creating a tag rule. If ``tag_value_patterns``
contains ``*`` , set ``required`` and ``negated`` to different values. If both are ``false`` ,
the rule has no effect. If both are ``true`` , no value can satisfy the rule.
:type attributes: TagRuleCreateAttributes

:param type: JSON:API resource type for a tag rule.
:param type: JSON:API resource type for a tag rule. Requests accept ``tag_rule`` or ``tag_policy`` ; responses use ``tag_policy``.
:type type: TagRuleResourceType
"""
super().__init__(kwargs)
Expand Down
2 changes: 1 addition & 1 deletion src/datadog_api_client/v2/model/tag_rule_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(
:param relationships: Related resources for a tag rule. Only present when the corresponding ``include`` query parameter is supplied.
:type relationships: TagRuleRelationships, optional

:param type: JSON:API resource type for a tag rule.
:param type: JSON:API resource type for a tag rule. Requests accept ``tag_rule`` or ``tag_policy`` ; responses use ``tag_policy``.
:type type: TagRuleResourceType
"""
if relationships is not unset:
Expand Down
7 changes: 5 additions & 2 deletions src/datadog_api_client/v2/model/tag_rule_resource_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@

class TagRuleResourceType(ModelSimple):
"""
JSON:API resource type for a tag rule.
JSON:API resource type for a tag rule. Requests accept `tag_rule` or `tag_policy`; responses use `tag_policy`.

:param value: If omitted defaults to "tag_rule". Must be one of ["tag_rule"].
:param value: Must be one of ["tag_rule", "tag_policy"].
:type value: str
"""

allowed_values = {
"tag_rule",
"tag_policy",
}
TAG_RULE: ClassVar["TagRuleResourceType"]
TAG_POLICY: ClassVar["TagRuleResourceType"]

@cached_property
def openapi_types(_):
Expand All @@ -33,3 +35,4 @@ def openapi_types(_):


TagRuleResourceType.TAG_RULE = TagRuleResourceType("tag_rule")
TagRuleResourceType.TAG_POLICY = TagRuleResourceType("tag_policy")
2 changes: 1 addition & 1 deletion src/datadog_api_client/v2/model/tag_rule_score_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __init__(self_, attributes: TagRuleScoreAttributes, id: str, type: TagRuleSc
:param id: The unique identifier of the compliance score resource.
:type id: str

:param type: JSON:API resource type for a tag rule compliance score.
:param type: JSON:API resource type for a tag rule compliance score. Responses use ``tag_policy_score``.
:type type: TagRuleScoreResourceType
"""
super().__init__(kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self_, id: str, type: TagRuleScoreResourceType, **kwargs):
:param id: The unique identifier of the related compliance score resource.
:type id: str

:param type: JSON:API resource type for a tag rule compliance score.
:param type: JSON:API resource type for a tag rule compliance score. Responses use ``tag_policy_score``.
:type type: TagRuleScoreResourceType
"""
super().__init__(kwargs)
Expand Down
Loading
Loading