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.
attributes [required]
object
Dataset metadata and configurations.
name [required]
string
Name of the dataset.
principals [required]
[string]
List of access principals, formatted as principal_type:id. Principal can be 'team' or 'role'.
product_filters [required]
[object]
List of product-specific filters.
filters [required]
[string]
Defines the list of tag-based filters used to restrict access to telemetry data for a specific product.
These filters act as access control rules. Each filter must follow the tag query syntax used by
Datadog (such as @tag.key:value), and only one tag or attribute may be used to define the access strategy
per telemetry type.
product [required]
string
Name of the product the dataset is for. Possible values are 'apm', 'rum',
'metrics', 'logs', 'error_tracking', 'cloud_cost', and 'sd_repoinfo'.
type [required]
enum
Resource type, always set to dataset.
Allowed enum values: 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.
attributes
object
Dataset metadata and configuration(s).
created_at
date-time
Timestamp when the dataset was created.
created_by
uuid
Unique ID of the user who created the dataset.
name
string
Name of the dataset.
principals
[string]
List of access principals, formatted as principal_type:id. Principal can be 'team' or 'role'.
product_filters
[object]
List of product-specific filters.
filters [required]
[string]
Defines the list of tag-based filters used to restrict access to telemetry data for a specific product.
These filters act as access control rules. Each filter must follow the tag query syntax used by
Datadog (such as @tag.key:value), and only one tag or attribute may be used to define the access strategy
per telemetry type.
product [required]
string
Name of the product the dataset is for. Possible values are 'apm', 'rum',
'metrics', 'logs', 'error_tracking', 'cloud_cost', and 'sd_repoinfo'.
id
string
Unique identifier for the dataset.
type
enum
Resource type, always set to dataset.
Allowed enum values: dataset
// Edit a dataset returns "OK" responsepackagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){// there is a valid "dataset" in the systemDatasetDataID:=os.Getenv("DATASET_DATA_ID")body:=datadogV2.DatasetUpdateRequest{Data:datadogV2.DatasetRequest{Attributes:datadogV2.DatasetAttributesRequest{Name:"Security Audit Dataset",Principals:[]string{"role:94172442-be03-11e9-a77a-3b7612558ac1",},ProductFilters:[]datadogV2.FiltersPerProduct{{Filters:[]string{"@application.id:1234",},Product:"metrics",},},},Type:datadogV2.DATASETTYPE_DATASET,},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()configuration.SetUnstableOperationEnabled("v2.UpdateDataset",true)apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewDatasetsApi(apiClient)resp,r,err:=api.UpdateDataset(ctx,DatasetDataID,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `DatasetsApi.UpdateDataset`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `DatasetsApi.UpdateDataset`:\n%s\n",responseContent)}
// Edit a dataset returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.DatasetsApi;importcom.datadog.api.client.v2.model.DatasetAttributesRequest;importcom.datadog.api.client.v2.model.DatasetRequest;importcom.datadog.api.client.v2.model.DatasetResponseSingle;importcom.datadog.api.client.v2.model.DatasetType;importcom.datadog.api.client.v2.model.DatasetUpdateRequest;importcom.datadog.api.client.v2.model.FiltersPerProduct;importjava.util.Collections;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();defaultClient.setUnstableOperationEnabled("v2.updateDataset",true);DatasetsApiapiInstance=newDatasetsApi(defaultClient);// there is a valid "dataset" in the systemStringDATASET_DATA_ID=System.getenv("DATASET_DATA_ID");DatasetUpdateRequestbody=newDatasetUpdateRequest().data(newDatasetRequest().attributes(newDatasetAttributesRequest().name("Security Audit Dataset").principals(Collections.singletonList("role:94172442-be03-11e9-a77a-3b7612558ac1")).productFilters(Collections.singletonList(newFiltersPerProduct().filters(Collections.singletonList("@application.id:1234")).product("metrics")))).type(DatasetType.DATASET));try{DatasetResponseSingleresult=apiInstance.updateDataset(DATASET_DATA_ID,body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling DatasetsApi#updateDataset");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Edit a dataset returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.datasets_apiimportDatasetsApifromdatadog_api_client.v2.model.dataset_attributes_requestimportDatasetAttributesRequestfromdatadog_api_client.v2.model.dataset_requestimportDatasetRequestfromdatadog_api_client.v2.model.dataset_typeimportDatasetTypefromdatadog_api_client.v2.model.dataset_update_requestimportDatasetUpdateRequestfromdatadog_api_client.v2.model.filters_per_productimportFiltersPerProduct# there is a valid "dataset" in the systemDATASET_DATA_ID=environ["DATASET_DATA_ID"]body=DatasetUpdateRequest(data=DatasetRequest(attributes=DatasetAttributesRequest(name="Security Audit Dataset",principals=["role:94172442-be03-11e9-a77a-3b7612558ac1",],product_filters=[FiltersPerProduct(filters=["@application.id:1234",],product="metrics",),],),type=DatasetType.DATASET,),)configuration=Configuration()configuration.unstable_operations["update_dataset"]=TruewithApiClient(configuration)asapi_client:api_instance=DatasetsApi(api_client)response=api_instance.update_dataset(dataset_id=DATASET_DATA_ID,body=body)print(response)
# Edit a dataset returns "OK" responserequire"datadog_api_client"DatadogAPIClient.configuredo|config|config.unstable_operations["v2.update_dataset".to_sym]=trueendapi_instance=DatadogAPIClient::V2::DatasetsAPI.new# there is a valid "dataset" in the systemDATASET_DATA_ID=ENV["DATASET_DATA_ID"]body=DatadogAPIClient::V2::DatasetUpdateRequest.new({data:DatadogAPIClient::V2::DatasetRequest.new({attributes:DatadogAPIClient::V2::DatasetAttributesRequest.new({name:"Security Audit Dataset",principals:["role:94172442-be03-11e9-a77a-3b7612558ac1",],product_filters:[DatadogAPIClient::V2::FiltersPerProduct.new({filters:["@application.id:1234",],product:"metrics",}),],}),type:DatadogAPIClient::V2::DatasetType::DATASET,}),})papi_instance.update_dataset(DATASET_DATA_ID,body)
// Edit a dataset returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_datasets::DatasetsAPI;usedatadog_api_client::datadogV2::model::DatasetAttributesRequest;usedatadog_api_client::datadogV2::model::DatasetRequest;usedatadog_api_client::datadogV2::model::DatasetType;usedatadog_api_client::datadogV2::model::DatasetUpdateRequest;usedatadog_api_client::datadogV2::model::FiltersPerProduct;#[tokio::main]asyncfnmain(){// there is a valid "dataset" in the system
letdataset_data_id=std::env::var("DATASET_DATA_ID").unwrap();letbody=DatasetUpdateRequest::new(DatasetRequest::new(DatasetAttributesRequest::new("Security Audit Dataset".to_string(),vec!["role:94172442-be03-11e9-a77a-3b7612558ac1".to_string()],vec![FiltersPerProduct::new(vec!["@application.id:1234".to_string()],"metrics".to_string(),)],),DatasetType::DATASET,));letmutconfiguration=datadog::Configuration::new();configuration.set_unstable_operation_enabled("v2.UpdateDataset",true);letapi=DatasetsAPI::with_config(configuration);letresp=api.update_dataset(dataset_data_id.clone(),body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Edit a dataset returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();configuration.unstableOperations["v2.updateDataset"]=true;constapiInstance=newv2.DatasetsApi(configuration);// there is a valid "dataset" in the system
constDATASET_DATA_ID=process.env.DATASET_DATA_IDasstring;constparams: v2.DatasetsApiUpdateDatasetRequest={body:{data:{attributes:{name:"Security Audit Dataset",principals:["role:94172442-be03-11e9-a77a-3b7612558ac1"],productFilters:[{filters:["@application.id:1234"],product:"metrics",},],},type:"dataset",},},datasetId: DATASET_DATA_ID,};apiInstance.updateDataset(params).then((data: v2.DatasetResponseSingle)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));