Skip to content

Uncomment edit dataset block, add dataset limitations into endpoint descriptions #2723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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
4 changes: 2 additions & 2 deletions .generated-info
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"spec_repo_commit": "d51e9a8",
"generated": "2025-07-25 13:23:28.748"
"spec_repo_commit": "e4f653f",
"generated": "2025-07-25 14:07:32.279"
}
60 changes: 56 additions & 4 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12478,7 +12478,14 @@ components:
- type
type: object
Dataset:
description: Dataset object.
description: "Dataset object.\n\n### Datasets Constraints\n- **Tag Limit per
Dataset**:\n - Each restricted dataset supports a maximum of 10 key:value
pairs per product.\n\n- **Tag Key Rules per Telemetry Type**:\n - Only one
tag key or attribute may be used to define access within a single telemetry
type.\n - The same or different tag key may be used across different telemetry
types.\n\n- **Tag Value Uniqueness**:\n - Tag values must be unique within
a single dataset.\n - A tag value used in one dataset cannot be reused in
another dataset of the same telemetry type."
properties:
attributes:
$ref: '#/components/schemas/DatasetAttributes'
Expand Down Expand Up @@ -12556,6 +12563,14 @@ components:
required:
- data
type: object
DatasetUpdateRequest:
description: Edit request for a dataset.
properties:
data:
$ref: '#/components/schemas/Dataset'
required:
- data
type: object
Date:
description: Date as Unix timestamp in milliseconds.
example: 1722439510282
Expand Down Expand Up @@ -16083,10 +16098,9 @@ components:
type: array
product:
description: 'Name of the product the dataset is for. Possible values are
''apm'', ''rum'', ''synthetics'',
''apm'', ''rum'',

''metrics'', ''logs'', ''sd_repoinfo'', ''error_tracking'', ''cloud_cost'',
and ''ml_obs''.'
''metrics'', ''logs'', ''error_tracking'', and ''cloud_cost''.'
example: logs
type: string
required:
Expand Down Expand Up @@ -48282,6 +48296,44 @@ paths:
x-permission:
operator: OPEN
permissions: []
put:
description: Edits the dataset associated with the ID.
operationId: UpdateDataset
parameters:
- $ref: '#/components/parameters/DatasetID'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DatasetUpdateRequest'
description: Dataset payload
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/DatasetResponseSingle'
description: OK
'400':
$ref: '#/components/responses/BadRequestResponse'
'403':
$ref: '#/components/responses/NotAuthorizedResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ: []
summary: Edit a dataset
tags:
- Datasets
x-codegen-request-body-name: body
x-permission:
operator: OPEN
permissions: []
/api/v2/deletion/data/{product}:
post:
description: Creates a data deletion request by providing a query and a timeframe
Expand Down
7 changes: 7 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4841,6 +4841,13 @@ datadog\_api\_client.v2.model.dataset\_response\_single module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.dataset\_update\_request module
-------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.dataset_update_request
:members:
:show-inheritance:

datadog\_api\_client.v2.model.delete\_app\_response module
----------------------------------------------------------

Expand Down
39 changes: 39 additions & 0 deletions examples/v2/datasets/UpdateDataset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""
Edit a dataset returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.datasets_api import DatasetsApi
from datadog_api_client.v2.model.dataset import Dataset
from datadog_api_client.v2.model.dataset_attributes import DatasetAttributes
from datadog_api_client.v2.model.dataset_update_request import DatasetUpdateRequest
from datadog_api_client.v2.model.filters_per_product import FiltersPerProduct

body = DatasetUpdateRequest(
data=Dataset(
attributes=DatasetAttributes(
created_at=None,
name="Security Audit Dataset",
principals=[
"role:86245fce-0a4e-11f0-92bd-da7ad0900002",
],
product_filters=[
FiltersPerProduct(
filters=[
"@application.id:ABCD",
],
product="logs",
),
],
),
id="123e4567-e89b-12d3-a456-426614174000",
type="dataset",
),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = DatasetsApi(api_client)
response = api_instance.update_dataset(dataset_id="dataset_id", body=body)

print(response)
49 changes: 49 additions & 0 deletions src/datadog_api_client/v2/api/datasets_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from datadog_api_client.v2.model.dataset_response_multi import DatasetResponseMulti
from datadog_api_client.v2.model.dataset_response_single import DatasetResponseSingle
from datadog_api_client.v2.model.dataset_create_request import DatasetCreateRequest
from datadog_api_client.v2.model.dataset_update_request import DatasetUpdateRequest


class DatasetsApi:
Expand Down Expand Up @@ -106,6 +107,32 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._update_dataset_endpoint = _Endpoint(
settings={
"response_type": (DatasetResponseSingle,),
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v2/datasets/{dataset_id}",
"operation_id": "update_dataset",
"http_method": "PUT",
"version": "v2",
},
params_map={
"dataset_id": {
"required": True,
"openapi_types": (str,),
"attribute": "dataset_id",
"location": "path",
},
"body": {
"required": True,
"openapi_types": (DatasetUpdateRequest,),
"location": "body",
},
},
headers_map={"accept": ["application/json"], "content_type": ["application/json"]},
api_client=api_client,
)

def create_dataset(
self,
body: DatasetCreateRequest,
Expand Down Expand Up @@ -168,3 +195,25 @@ def get_dataset(
kwargs["dataset_id"] = dataset_id

return self._get_dataset_endpoint.call_with_http_info(**kwargs)

def update_dataset(
self,
dataset_id: str,
body: DatasetUpdateRequest,
) -> DatasetResponseSingle:
"""Edit a dataset.

Edits the dataset associated with the ID.

:param dataset_id: The ID of a defined dataset.
:type dataset_id: str
:param body: Dataset payload
:type body: DatasetUpdateRequest
:rtype: DatasetResponseSingle
"""
kwargs: Dict[str, Any] = {}
kwargs["dataset_id"] = dataset_id

kwargs["body"] = body

return self._update_dataset_endpoint.call_with_http_info(**kwargs)
19 changes: 19 additions & 0 deletions src/datadog_api_client/v2/model/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@ def __init__(self_, attributes: DatasetAttributes, type: str, id: Union[str, Uns
"""
Dataset object.

**Datasets Constraints**

*
**Tag Limit per Dataset** :

* Each restricted dataset supports a maximum of 10 key:value pairs per product.

*
**Tag Key Rules per Telemetry Type** :

* Only one tag key or attribute may be used to define access within a single telemetry type.
* The same or different tag key may be used across different telemetry types.

*
**Tag Value Uniqueness** :

* Tag values must be unique within a single dataset.
* A tag value used in one dataset cannot be reused in another dataset of the same telemetry type.

:param attributes: Dataset metadata and configuration(s).
:type attributes: DatasetAttributes

Expand Down
19 changes: 19 additions & 0 deletions src/datadog_api_client/v2/model/dataset_create_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,25 @@ def __init__(self_, data: Dataset, **kwargs):
Create request for a dataset.

:param data: Dataset object.

**Datasets Constraints**

*
**Tag Limit per Dataset** :

* Each restricted dataset supports a maximum of 10 key:value pairs per product.

*
**Tag Key Rules per Telemetry Type** :

* Only one tag key or attribute may be used to define access within a single telemetry type.
* The same or different tag key may be used across different telemetry types.

*
**Tag Value Uniqueness** :

* Tag values must be unique within a single dataset.
* A tag value used in one dataset cannot be reused in another dataset of the same telemetry type.
:type data: Dataset
"""
super().__init__(kwargs)
Expand Down
19 changes: 19 additions & 0 deletions src/datadog_api_client/v2/model/dataset_response_single.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,25 @@ def __init__(self_, data: Dataset, **kwargs):
Response containing a single dataset object.

:param data: Dataset object.

**Datasets Constraints**

*
**Tag Limit per Dataset** :

* Each restricted dataset supports a maximum of 10 key:value pairs per product.

*
**Tag Key Rules per Telemetry Type** :

* Only one tag key or attribute may be used to define access within a single telemetry type.
* The same or different tag key may be used across different telemetry types.

*
**Tag Value Uniqueness** :

* Tag values must be unique within a single dataset.
* A tag value used in one dataset cannot be reused in another dataset of the same telemetry type.
:type data: Dataset
"""
super().__init__(kwargs)
Expand Down
59 changes: 59 additions & 0 deletions src/datadog_api_client/v2/model/dataset_update_request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# 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.dataset import Dataset


class DatasetUpdateRequest(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.dataset import Dataset

return {
"data": (Dataset,),
}

attribute_map = {
"data": "data",
}

def __init__(self_, data: Dataset, **kwargs):
"""
Edit request for a dataset.

:param data: Dataset object.

**Datasets Constraints**

*
**Tag Limit per Dataset** :

* Each restricted dataset supports a maximum of 10 key:value pairs per product.

*
**Tag Key Rules per Telemetry Type** :

* Only one tag key or attribute may be used to define access within a single telemetry type.
* The same or different tag key may be used across different telemetry types.

*
**Tag Value Uniqueness** :

* Tag values must be unique within a single dataset.
* A tag value used in one dataset cannot be reused in another dataset of the same telemetry type.
:type data: Dataset
"""
super().__init__(kwargs)

self_.data = data
4 changes: 2 additions & 2 deletions src/datadog_api_client/v2/model/filters_per_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def __init__(self_, filters: List[str], product: str, **kwargs):
per telemetry type.
:type filters: [str]

:param product: Name of the product the dataset is for. Possible values are 'apm', 'rum', 'synthetics',
'metrics', 'logs', 'sd_repoinfo', 'error_tracking', 'cloud_cost', and 'ml_obs'.
:param product: Name of the product the dataset is for. Possible values are 'apm', 'rum',
'metrics', 'logs', 'error_tracking', and 'cloud_cost'.
:type product: str
"""
super().__init__(kwargs)
Expand Down
2 changes: 2 additions & 0 deletions src/datadog_api_client/v2/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,7 @@
from datadog_api_client.v2.model.dataset_create_request import DatasetCreateRequest
from datadog_api_client.v2.model.dataset_response_multi import DatasetResponseMulti
from datadog_api_client.v2.model.dataset_response_single import DatasetResponseSingle
from datadog_api_client.v2.model.dataset_update_request import DatasetUpdateRequest
from datadog_api_client.v2.model.delete_app_response import DeleteAppResponse
from datadog_api_client.v2.model.delete_app_response_data import DeleteAppResponseData
from datadog_api_client.v2.model.delete_apps_request import DeleteAppsRequest
Expand Down Expand Up @@ -4340,6 +4341,7 @@
"DatasetCreateRequest",
"DatasetResponseMulti",
"DatasetResponseSingle",
"DatasetUpdateRequest",
"DeleteAppResponse",
"DeleteAppResponseData",
"DeleteAppsRequest",
Expand Down
Loading
Loading