데이터셋 업데이트하기
https://api.datadoghq.com/api/v2/security_monitoring/datasets/{dataset_id}https://api.us3.datadoghq.com/api/v2/security_monitoring/datasets/{dataset_id}https://api.us5.datadoghq.com/api/v2/security_monitoring/datasets/{dataset_id}https://api.datadoghq.eu/api/v2/security_monitoring/datasets/{dataset_id}https://api.ap1.datadoghq.com/api/v2/security_monitoring/datasets/{dataset_id}https://api.ap2.datadoghq.com/api/v2/security_monitoring/datasets/{dataset_id}https://api.uk1.datadoghq.com/api/v2/security_monitoring/datasets/{dataset_id}https://api.ddog-gov.com/api/v2/security_monitoring/datasets/{dataset_id}https://api.us2.ddog-gov.com/api/v2/security_monitoring/datasets/{dataset_id}개요
기존 Cloud SIEM 데이터 세트를 업데이트합니다. 데이터 세트의 현재 버전은 동시 수정을 탐지하기 위해 제공될 수 있습니다.
OAuth apps require the security_monitoring_rules_write authorization scope to access this endpoint.
인수
경로 파라미터
dataset_id [required]The UUID of the dataset.
요청
Body Data (required)
data [required]Cloud SIEM 데이터 세트 업데이트를 위한 요청 본문입니다.
attributes [required]The attributes of a dataset create or update request.
definition [required]The definition of the dataset. The shape depends on the value of data_source.
Use reference_table or managed_resource for a referential dataset, or one of the
event platform sources (for example logs, audit, events, spans, rum) for
an event platform dataset.
columnsFor event platform datasets, the list of columns exposed by the dataset.
column [required]The name of the column.
type [required]The type of the column value.
data_source [required]The data source backing this dataset definition.
indexesFor event platform datasets, the list of indexes to query.
name [required]The unique name of the dataset. Must start with a lowercase letter and contain only lowercase letters, digits, and underscores (max 255 characters).
query_filterFor referential datasets, an optional filter expression applied to the table.
searchThe search clause applied to an event platform dataset.
query [required]The search query expression.
storageStorage tier the dataset reads from. Applies to event platform datasets.
table_nameFor referential datasets, the name of the underlying table.
time_windowAn optional time window that overrides the default query time range.
fromInclusive start of the time window, in milliseconds since the Unix epoch.
toExclusive end of the time window, in milliseconds since the Unix epoch.
descriptionThe description of the dataset. Maximum 255 characters.
versionThe expected current version of the dataset for optimistic concurrency control on updates. If the dataset's current version does not match, the request is rejected with a 409 Conflict.
type [required]The type of resource for a dataset update request.
datasetUpdate{
"data": {
"attributes": {
"definition": {
"columns": [
{
"column": "message",
"type": "string"
}
],
"data_source": "logs",
"indexes": [],
"name": "sample_dataset",
"query_filter": "status = 'active'",
"search": {
"query": "*"
},
"storage": "hot",
"table_name": "my_reference_table",
"time_window": {
"from": 1700000000000,
"to": 1700003600000
}
},
"description": "A sample dataset used for detection rules.",
"version": 1
},
"type": "datasetUpdate"
}
}응답
No Content
Bad Request
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Forbidden
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Not Found
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Conflict
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Too many requests
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}코드 예시
# Path parameters
export dataset_id="123e4567-e89b-12d3-a456-426614174000"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/security_monitoring/datasets/${dataset_id}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"definition": {
"columns": [
{
"column": "message",
"type": "string"
}
],
"data_source": "logs",
"indexes": [
"main"
],
"name": "sample_dataset",
"search": {
"query": "*"
}
},
"description": "An updated description for the dataset.",
"version": 1
},
"type": "datasetUpdate"
}
}
EOF# Path parameters
export dataset_id="123e4567-e89b-12d3-a456-426614174000"
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/security_monitoring/datasets/${dataset_id}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"definition": {
"columns": [
{
"column": "message",
"type": "string"
}
],
"data_source": "logs",
"indexes": [
"main"
],
"name": "sample_dataset",
"search": {
"query": "*"
}
},
"description": "An updated description for the dataset.",
"version": 1
},
"type": "datasetUpdate"
}
}
EOF# Path parameters
export dataset_id="123e4567-e89b-12d3-a456-426614174000"
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/security_monitoring/datasets/${dataset_id}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"definition": {
"columns": [
{
"column": "message",
"type": "string"
}
],
"data_source": "logs",
"indexes": [
"main"
],
"name": "sample_dataset",
"search": {
"query": "*"
}
},
"description": "An updated description for the dataset.",
"version": 1
},
"type": "datasetUpdate"
}
}
EOF# Path parameters
export dataset_id="123e4567-e89b-12d3-a456-426614174000"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/security_monitoring/datasets/${dataset_id}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"definition": {
"columns": [
{
"column": "message",
"type": "string"
}
],
"data_source": "logs",
"indexes": [
"main"
],
"name": "sample_dataset",
"search": {
"query": "*"
}
},
"description": "An updated description for the dataset.",
"version": 1
},
"type": "datasetUpdate"
}
}
EOF# Path parameters
export dataset_id="123e4567-e89b-12d3-a456-426614174000"
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/security_monitoring/datasets/${dataset_id}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"definition": {
"columns": [
{
"column": "message",
"type": "string"
}
],
"data_source": "logs",
"indexes": [
"main"
],
"name": "sample_dataset",
"search": {
"query": "*"
}
},
"description": "An updated description for the dataset.",
"version": 1
},
"type": "datasetUpdate"
}
}
EOF# Path parameters
export dataset_id="123e4567-e89b-12d3-a456-426614174000"
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/security_monitoring/datasets/${dataset_id}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"definition": {
"columns": [
{
"column": "message",
"type": "string"
}
],
"data_source": "logs",
"indexes": [
"main"
],
"name": "sample_dataset",
"search": {
"query": "*"
}
},
"description": "An updated description for the dataset.",
"version": 1
},
"type": "datasetUpdate"
}
}
EOF# Path parameters
export dataset_id="123e4567-e89b-12d3-a456-426614174000"
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/security_monitoring/datasets/${dataset_id}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"definition": {
"columns": [
{
"column": "message",
"type": "string"
}
],
"data_source": "logs",
"indexes": [
"main"
],
"name": "sample_dataset",
"search": {
"query": "*"
}
},
"description": "An updated description for the dataset.",
"version": 1
},
"type": "datasetUpdate"
}
}
EOF# Path parameters
export dataset_id="123e4567-e89b-12d3-a456-426614174000"
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/security_monitoring/datasets/${dataset_id}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"definition": {
"columns": [
{
"column": "message",
"type": "string"
}
],
"data_source": "logs",
"indexes": [
"main"
],
"name": "sample_dataset",
"search": {
"query": "*"
}
},
"description": "An updated description for the dataset.",
"version": 1
},
"type": "datasetUpdate"
}
}
EOF# Path parameters
export dataset_id="123e4567-e89b-12d3-a456-426614174000"
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/security_monitoring/datasets/${dataset_id}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"definition": {
"columns": [
{
"column": "message",
"type": "string"
}
],
"data_source": "logs",
"indexes": [
"main"
],
"name": "sample_dataset",
"search": {
"query": "*"
}
},
"description": "An updated description for the dataset.",
"version": 1
},
"type": "datasetUpdate"
}
}
EOF// Update a dataset returns "No Content" response
package main
import (
"context"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)
func main() {
body := datadogV2.SecurityMonitoringDatasetUpdateRequest{
Data: datadogV2.SecurityMonitoringDatasetUpdateData{
Attributes: datadogV2.SecurityMonitoringDatasetAttributesRequest{
Definition: datadogV2.SecurityMonitoringDatasetDefinition{
Columns: []datadogV2.SecurityMonitoringDatasetColumn{
{
Column: "message",
Type: "string",
},
},
DataSource: "logs",
Indexes: []string{},
Name: "sample_dataset",
QueryFilter: datadog.PtrString("status = 'active'"),
Search: &datadogV2.SecurityMonitoringDatasetSearch{
Query: "*",
},
Storage: datadog.PtrString("hot"),
TableName: datadog.PtrString("my_reference_table"),
TimeWindow: &datadogV2.SecurityMonitoringDatasetTimeWindow{
From: datadog.PtrInt64(1700000000000),
To: datadog.PtrInt64(1700003600000),
},
},
Description: datadog.PtrString("A sample dataset used for detection rules."),
Version: datadog.PtrInt64(1),
},
Type: datadogV2.SECURITYMONITORINGDATASETUPDATETYPE_DATASET_UPDATE,
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
configuration.SetUnstableOperationEnabled("v2.UpdateSecurityMonitoringDataset", true)
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewSecurityMonitoringApi(apiClient)
r, err := api.UpdateSecurityMonitoringDataset(ctx, "123e4567-e89b-12d3-a456-426614174000", body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.UpdateSecurityMonitoringDataset`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
Instructions
First install the library and its dependencies and then save the example to main.go and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"// Update a dataset returns "No Content" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.SecurityMonitoringApi;
import com.datadog.api.client.v2.model.SecurityMonitoringDatasetAttributesRequest;
import com.datadog.api.client.v2.model.SecurityMonitoringDatasetColumn;
import com.datadog.api.client.v2.model.SecurityMonitoringDatasetDefinition;
import com.datadog.api.client.v2.model.SecurityMonitoringDatasetSearch;
import com.datadog.api.client.v2.model.SecurityMonitoringDatasetTimeWindow;
import com.datadog.api.client.v2.model.SecurityMonitoringDatasetUpdateData;
import com.datadog.api.client.v2.model.SecurityMonitoringDatasetUpdateRequest;
import com.datadog.api.client.v2.model.SecurityMonitoringDatasetUpdateType;
import java.util.Collections;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
defaultClient.setUnstableOperationEnabled("v2.updateSecurityMonitoringDataset", true);
SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient);
SecurityMonitoringDatasetUpdateRequest body =
new SecurityMonitoringDatasetUpdateRequest()
.data(
new SecurityMonitoringDatasetUpdateData()
.attributes(
new SecurityMonitoringDatasetAttributesRequest()
.definition(
new SecurityMonitoringDatasetDefinition()
.columns(
Collections.singletonList(
new SecurityMonitoringDatasetColumn()
.column("message")
.type("string")))
.dataSource("logs")
.name("sample_dataset")
.queryFilter("status = 'active'")
.search(new SecurityMonitoringDatasetSearch().query("*"))
.storage("hot")
.tableName("my_reference_table")
.timeWindow(
new SecurityMonitoringDatasetTimeWindow()
.from(1700000000000L)
.to(1700003600000L)))
.description("A sample dataset used for detection rules.")
.version(1L))
.type(SecurityMonitoringDatasetUpdateType.DATASET_UPDATE));
try {
apiInstance.updateSecurityMonitoringDataset("123e4567-e89b-12d3-a456-426614174000", body);
} catch (ApiException e) {
System.err.println(
"Exception when calling SecurityMonitoringApi#updateSecurityMonitoringDataset");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Instructions
First install the library and its dependencies and then save the example to Example.java and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java""""
Update a dataset returns "No Content" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.security_monitoring_api import SecurityMonitoringApi
from datadog_api_client.v2.model.security_monitoring_dataset_attributes_request import (
SecurityMonitoringDatasetAttributesRequest,
)
from datadog_api_client.v2.model.security_monitoring_dataset_column import SecurityMonitoringDatasetColumn
from datadog_api_client.v2.model.security_monitoring_dataset_definition import SecurityMonitoringDatasetDefinition
from datadog_api_client.v2.model.security_monitoring_dataset_search import SecurityMonitoringDatasetSearch
from datadog_api_client.v2.model.security_monitoring_dataset_time_window import SecurityMonitoringDatasetTimeWindow
from datadog_api_client.v2.model.security_monitoring_dataset_update_data import SecurityMonitoringDatasetUpdateData
from datadog_api_client.v2.model.security_monitoring_dataset_update_request import (
SecurityMonitoringDatasetUpdateRequest,
)
from datadog_api_client.v2.model.security_monitoring_dataset_update_type import SecurityMonitoringDatasetUpdateType
body = SecurityMonitoringDatasetUpdateRequest(
data=SecurityMonitoringDatasetUpdateData(
attributes=SecurityMonitoringDatasetAttributesRequest(
definition=SecurityMonitoringDatasetDefinition(
columns=[
SecurityMonitoringDatasetColumn(
column="message",
type="string",
),
],
data_source="logs",
indexes=[],
name="sample_dataset",
query_filter="status = 'active'",
search=SecurityMonitoringDatasetSearch(
query="*",
),
storage="hot",
table_name="my_reference_table",
time_window=SecurityMonitoringDatasetTimeWindow(
_from=1700000000000,
to=1700003600000,
),
),
description="A sample dataset used for detection rules.",
version=1,
),
type=SecurityMonitoringDatasetUpdateType.DATASET_UPDATE,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
configuration.unstable_operations["update_security_monitoring_dataset"] = True
with ApiClient(configuration) as api_client:
api_instance = SecurityMonitoringApi(api_client)
api_instance.update_security_monitoring_dataset(dataset_id="123e4567-e89b-12d3-a456-426614174000", body=body)
Instructions
First install the library and its dependencies and then save the example to example.py and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"# Update a dataset returns "No Content" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
config.unstable_operations["v2.update_security_monitoring_dataset".to_sym] = true
end
api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new
body = DatadogAPIClient::V2::SecurityMonitoringDatasetUpdateRequest.new({
data: DatadogAPIClient::V2::SecurityMonitoringDatasetUpdateData.new({
attributes: DatadogAPIClient::V2::SecurityMonitoringDatasetAttributesRequest.new({
definition: DatadogAPIClient::V2::SecurityMonitoringDatasetDefinition.new({
columns: [
DatadogAPIClient::V2::SecurityMonitoringDatasetColumn.new({
column: "message",
type: "string",
}),
],
data_source: "logs",
indexes: [],
name: "sample_dataset",
query_filter: "status = 'active'",
search: DatadogAPIClient::V2::SecurityMonitoringDatasetSearch.new({
query: "*",
}),
storage: "hot",
table_name: "my_reference_table",
time_window: DatadogAPIClient::V2::SecurityMonitoringDatasetTimeWindow.new({
from: 1700000000000,
to: 1700003600000,
}),
}),
description: "A sample dataset used for detection rules.",
version: 1,
}),
type: DatadogAPIClient::V2::SecurityMonitoringDatasetUpdateType::DATASET_UPDATE,
}),
})
api_instance.update_security_monitoring_dataset("123e4567-e89b-12d3-a456-426614174000", body)
Instructions
First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"// Update a dataset returns "No Content" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;
use datadog_api_client::datadogV2::model::SecurityMonitoringDatasetAttributesRequest;
use datadog_api_client::datadogV2::model::SecurityMonitoringDatasetColumn;
use datadog_api_client::datadogV2::model::SecurityMonitoringDatasetDefinition;
use datadog_api_client::datadogV2::model::SecurityMonitoringDatasetSearch;
use datadog_api_client::datadogV2::model::SecurityMonitoringDatasetTimeWindow;
use datadog_api_client::datadogV2::model::SecurityMonitoringDatasetUpdateData;
use datadog_api_client::datadogV2::model::SecurityMonitoringDatasetUpdateRequest;
use datadog_api_client::datadogV2::model::SecurityMonitoringDatasetUpdateType;
#[tokio::main]
async fn main() {
let body =
SecurityMonitoringDatasetUpdateRequest::new(SecurityMonitoringDatasetUpdateData::new(
SecurityMonitoringDatasetAttributesRequest::new(
SecurityMonitoringDatasetDefinition::new(
"logs".to_string(),
"sample_dataset".to_string(),
)
.columns(vec![SecurityMonitoringDatasetColumn::new(
"message".to_string(),
"string".to_string(),
)])
.indexes(vec![])
.query_filter("status = 'active'".to_string())
.search(SecurityMonitoringDatasetSearch::new("*".to_string()))
.storage("hot".to_string())
.table_name("my_reference_table".to_string())
.time_window(
SecurityMonitoringDatasetTimeWindow::new()
.from(1700000000000)
.to(1700003600000),
),
)
.description("A sample dataset used for detection rules.".to_string())
.version(1),
SecurityMonitoringDatasetUpdateType::DATASET_UPDATE,
));
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.update_security_monitoring_dataset", true);
let api = SecurityMonitoringAPI::with_config(configuration);
let resp = api
.update_security_monitoring_dataset(
"123e4567-e89b-12d3-a456-426614174000".to_string(),
body,
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Instructions
First install the library and its dependencies and then save the example to src/main.rs and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run/**
* Update a dataset returns "No Content" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
configuration.unstableOperations["v2.updateSecurityMonitoringDataset"] = true;
const apiInstance = new v2.SecurityMonitoringApi(configuration);
const params: v2.SecurityMonitoringApiUpdateSecurityMonitoringDatasetRequest = {
body: {
data: {
attributes: {
definition: {
columns: [
{
column: "message",
type: "string",
},
],
dataSource: "logs",
indexes: [],
name: "sample_dataset",
queryFilter: "status = 'active'",
search: {
query: "*",
},
storage: "hot",
tableName: "my_reference_table",
timeWindow: {
from: 1700000000000,
to: 1700003600000,
},
},
description: "A sample dataset used for detection rules.",
version: 1,
},
type: "datasetUpdate",
},
},
datasetId: "123e4567-e89b-12d3-a456-426614174000",
};
apiInstance
.updateSecurityMonitoringDataset(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
Instructions
First install the library and its dependencies and then save the example to example.ts and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"