From ac25b542a202304485457ee5049eb3ce430d2ac4 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 20 Mar 2026 14:23:05 +0000 Subject: [PATCH] Regenerate client from commit 495a7ca of spec repo --- .generator/schemas/v1/openapi.yaml | 6 ++++++ .generator/schemas/v2/openapi.yaml | 2 +- examples/v1/logs-indexes/CreateLogsIndex.py | 1 + examples/v1/logs-indexes/UpdateLogsIndex.py | 1 + .../v1/model/logs_exclusion_filter.py | 16 +++++++++++++++- .../v2/api/restriction_policies_api.py | 6 +++--- tests/v1/features/logs_indexes.feature | 10 +++++----- 7 files changed, 32 insertions(+), 10 deletions(-) diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index a50db5d2e0..cecbe13a90 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -5734,6 +5734,12 @@ components: Scope down exclusion filter to only a subset of logs with a log query. example: "*" type: string + sample_attribute: + description: |- + Sample attribute to use for the sampling of logs going through this exclusion filter. + When set, only the logs with the specified attribute are sampled. + example: "@ci.job_id" + type: string sample_rate: description: |- Sample rate to apply to logs going through this exclusion filter, diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 035a0b3278..f917fd1115 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1048,7 +1048,7 @@ components: type: string ResourceID: description: |- - Identifier, formatted as `type:id`. Supported types: `dashboard`, `integration-service`, `integration-webhook`, `notebook`, `reference-table`, `security-rule`, `slo`, `workflow`, `app-builder-app`, `connection`, `connection-group`, `rum-application`, `cross-org-connection`, `spreadsheet`, `on-call-schedule`, `on-call-escalation-policy`, `on-call-team-routing-rules`, `logs-pipeline`. + Identifier, formatted as `type:id`. Supported types: `dashboard`, `integration-service`, `integration-webhook`, `notebook`, `powerpack`, `reference-table`, `security-rule`, `slo`, `synthetics-global-variable`, `synthetics-test`, `synthetics-private-location`, `monitor`, `workflow`, `app-builder-app`, `connection`, `connection-group`, `rum-application`, `cross-org-connection`, `spreadsheet`, `on-call-schedule`, `on-call-escalation-policy`, `on-call-team-routing-rules`, `logs-pipeline`, `case-management-project`. example: "dashboard:abc-def-ghi" in: path name: resource_id diff --git a/examples/v1/logs-indexes/CreateLogsIndex.py b/examples/v1/logs-indexes/CreateLogsIndex.py index 0fe8b31016..9f2d0f5889 100644 --- a/examples/v1/logs-indexes/CreateLogsIndex.py +++ b/examples/v1/logs-indexes/CreateLogsIndex.py @@ -21,6 +21,7 @@ LogsExclusion( filter=LogsExclusionFilter( query="*", + sample_attribute="@ci.job_id", sample_rate=1.0, ), name="payment", diff --git a/examples/v1/logs-indexes/UpdateLogsIndex.py b/examples/v1/logs-indexes/UpdateLogsIndex.py index 9922159286..8059e2c38d 100644 --- a/examples/v1/logs-indexes/UpdateLogsIndex.py +++ b/examples/v1/logs-indexes/UpdateLogsIndex.py @@ -22,6 +22,7 @@ LogsExclusion( filter=LogsExclusionFilter( query="*", + sample_attribute="@ci.job_id", sample_rate=1.0, ), name="payment", diff --git a/src/datadog_api_client/v1/model/logs_exclusion_filter.py b/src/datadog_api_client/v1/model/logs_exclusion_filter.py index ad747dcfac..992d854fa7 100644 --- a/src/datadog_api_client/v1/model/logs_exclusion_filter.py +++ b/src/datadog_api_client/v1/model/logs_exclusion_filter.py @@ -18,15 +18,23 @@ class LogsExclusionFilter(ModelNormal): def openapi_types(_): return { "query": (str,), + "sample_attribute": (str,), "sample_rate": (float,), } attribute_map = { "query": "query", + "sample_attribute": "sample_attribute", "sample_rate": "sample_rate", } - def __init__(self_, sample_rate: float, query: Union[str, UnsetType] = unset, **kwargs): + def __init__( + self_, + sample_rate: float, + query: Union[str, UnsetType] = unset, + sample_attribute: Union[str, UnsetType] = unset, + **kwargs, + ): """ Exclusion filter is defined by a query, a sampling rule, and a active/inactive toggle. @@ -34,12 +42,18 @@ def __init__(self_, sample_rate: float, query: Union[str, UnsetType] = unset, ** Scope down exclusion filter to only a subset of logs with a log query. :type query: str, optional + :param sample_attribute: Sample attribute to use for the sampling of logs going through this exclusion filter. + When set, only the logs with the specified attribute are sampled. + :type sample_attribute: str, optional + :param sample_rate: Sample rate to apply to logs going through this exclusion filter, a value of 1.0 excludes all logs matching the query. :type sample_rate: float """ if query is not unset: kwargs["query"] = query + if sample_attribute is not unset: + kwargs["sample_attribute"] = sample_attribute super().__init__(kwargs) self_.sample_rate = sample_rate diff --git a/src/datadog_api_client/v2/api/restriction_policies_api.py b/src/datadog_api_client/v2/api/restriction_policies_api.py index 75491b7379..5c3ac6c839 100644 --- a/src/datadog_api_client/v2/api/restriction_policies_api.py +++ b/src/datadog_api_client/v2/api/restriction_policies_api.py @@ -112,7 +112,7 @@ def delete_restriction_policy( Deletes the restriction policy associated with a specified resource. - :param resource_id: Identifier, formatted as ``type:id``. Supported types: ``dashboard`` , ``integration-service`` , ``integration-webhook`` , ``notebook`` , ``reference-table`` , ``security-rule`` , ``slo`` , ``workflow`` , ``app-builder-app`` , ``connection`` , ``connection-group`` , ``rum-application`` , ``cross-org-connection`` , ``spreadsheet`` , ``on-call-schedule`` , ``on-call-escalation-policy`` , ``on-call-team-routing-rules`` , ``logs-pipeline``. + :param resource_id: Identifier, formatted as ``type:id``. Supported types: ``dashboard`` , ``integration-service`` , ``integration-webhook`` , ``notebook`` , ``powerpack`` , ``reference-table`` , ``security-rule`` , ``slo`` , ``synthetics-global-variable`` , ``synthetics-test`` , ``synthetics-private-location`` , ``monitor`` , ``workflow`` , ``app-builder-app`` , ``connection`` , ``connection-group`` , ``rum-application`` , ``cross-org-connection`` , ``spreadsheet`` , ``on-call-schedule`` , ``on-call-escalation-policy`` , ``on-call-team-routing-rules`` , ``logs-pipeline`` , ``case-management-project``. :type resource_id: str :rtype: None """ @@ -129,7 +129,7 @@ def get_restriction_policy( Retrieves the restriction policy associated with a specified resource. - :param resource_id: Identifier, formatted as ``type:id``. Supported types: ``dashboard`` , ``integration-service`` , ``integration-webhook`` , ``notebook`` , ``reference-table`` , ``security-rule`` , ``slo`` , ``workflow`` , ``app-builder-app`` , ``connection`` , ``connection-group`` , ``rum-application`` , ``cross-org-connection`` , ``spreadsheet`` , ``on-call-schedule`` , ``on-call-escalation-policy`` , ``on-call-team-routing-rules`` , ``logs-pipeline``. + :param resource_id: Identifier, formatted as ``type:id``. Supported types: ``dashboard`` , ``integration-service`` , ``integration-webhook`` , ``notebook`` , ``powerpack`` , ``reference-table`` , ``security-rule`` , ``slo`` , ``synthetics-global-variable`` , ``synthetics-test`` , ``synthetics-private-location`` , ``monitor`` , ``workflow`` , ``app-builder-app`` , ``connection`` , ``connection-group`` , ``rum-application`` , ``cross-org-connection`` , ``spreadsheet`` , ``on-call-schedule`` , ``on-call-escalation-policy`` , ``on-call-team-routing-rules`` , ``logs-pipeline`` , ``case-management-project``. :type resource_id: str :rtype: RestrictionPolicyResponse """ @@ -235,7 +235,7 @@ def update_restriction_policy( - ``viewer`` , ``contributor`` , ``manager`` - :param resource_id: Identifier, formatted as ``type:id``. Supported types: ``dashboard`` , ``integration-service`` , ``integration-webhook`` , ``notebook`` , ``reference-table`` , ``security-rule`` , ``slo`` , ``workflow`` , ``app-builder-app`` , ``connection`` , ``connection-group`` , ``rum-application`` , ``cross-org-connection`` , ``spreadsheet`` , ``on-call-schedule`` , ``on-call-escalation-policy`` , ``on-call-team-routing-rules`` , ``logs-pipeline``. + :param resource_id: Identifier, formatted as ``type:id``. Supported types: ``dashboard`` , ``integration-service`` , ``integration-webhook`` , ``notebook`` , ``powerpack`` , ``reference-table`` , ``security-rule`` , ``slo`` , ``synthetics-global-variable`` , ``synthetics-test`` , ``synthetics-private-location`` , ``monitor`` , ``workflow`` , ``app-builder-app`` , ``connection`` , ``connection-group`` , ``rum-application`` , ``cross-org-connection`` , ``spreadsheet`` , ``on-call-schedule`` , ``on-call-escalation-policy`` , ``on-call-team-routing-rules`` , ``logs-pipeline`` , ``case-management-project``. :type resource_id: str :param body: Restriction policy payload :type body: RestrictionPolicyUpdateRequest diff --git a/tests/v1/features/logs_indexes.feature b/tests/v1/features/logs_indexes.feature index 8277ce4ae2..4091527029 100644 --- a/tests/v1/features/logs_indexes.feature +++ b/tests/v1/features/logs_indexes.feature @@ -11,21 +11,21 @@ Feature: Logs Indexes @generated @skip @team:DataDog/logs-backend @team:DataDog/logs-core Scenario: Create an index returns "Invalid Parameter Error" response Given new "CreateLogsIndex" request - And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_flex_logs_retention_days": 360, "num_retention_days": 15, "tags": ["team:backend", "env:production"]} + And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_attribute": "@ci.job_id", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_flex_logs_retention_days": 360, "num_retention_days": 15, "tags": ["team:backend", "env:production"]} When the request is sent Then the response status is 400 Invalid Parameter Error @generated @skip @team:DataDog/logs-backend @team:DataDog/logs-core Scenario: Create an index returns "OK" response Given new "CreateLogsIndex" request - And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_flex_logs_retention_days": 360, "num_retention_days": 15, "tags": ["team:backend", "env:production"]} + And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_attribute": "@ci.job_id", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_flex_logs_retention_days": 360, "num_retention_days": 15, "tags": ["team:backend", "env:production"]} When the request is sent Then the response status is 200 OK @generated @skip @team:DataDog/logs-backend @team:DataDog/logs-core Scenario: Create an index returns "Unprocessable Entity" response Given new "CreateLogsIndex" request - And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_flex_logs_retention_days": 360, "num_retention_days": 15, "tags": ["team:backend", "env:production"]} + And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_attribute": "@ci.job_id", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_flex_logs_retention_days": 360, "num_retention_days": 15, "tags": ["team:backend", "env:production"]} When the request is sent Then the response status is 422 Unprocessable Entity @@ -73,7 +73,7 @@ Feature: Logs Indexes Scenario: Update an index returns "Invalid Parameter Error" response Given new "UpdateLogsIndex" request And request contains "name" parameter from "REPLACE.ME" - And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "disable_daily_limit": false, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "num_flex_logs_retention_days": 360, "num_retention_days": 15, "tags": ["team:backend", "env:production"]} + And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "disable_daily_limit": false, "exclusion_filters": [{"filter": {"query": "*", "sample_attribute": "@ci.job_id", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "num_flex_logs_retention_days": 360, "num_retention_days": 15, "tags": ["team:backend", "env:production"]} When the request is sent Then the response status is 400 Invalid Parameter Error @@ -81,7 +81,7 @@ Feature: Logs Indexes Scenario: Update an index returns "OK" response Given new "UpdateLogsIndex" request And request contains "name" parameter from "REPLACE.ME" - And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "disable_daily_limit": false, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "num_flex_logs_retention_days": 360, "num_retention_days": 15, "tags": ["team:backend", "env:production"]} + And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "disable_daily_limit": false, "exclusion_filters": [{"filter": {"query": "*", "sample_attribute": "@ci.job_id", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "num_flex_logs_retention_days": 360, "num_retention_days": 15, "tags": ["team:backend", "env:production"]} When the request is sent Then the response status is 200 OK