참조 표 업데이트
https://api.datadoghq.com/api/v2/reference-tables/tables/{id}https://api.us3.datadoghq.com/api/v2/reference-tables/tables/{id}https://api.us5.datadoghq.com/api/v2/reference-tables/tables/{id}https://api.datadoghq.eu/api/v2/reference-tables/tables/{id}https://api.ap1.datadoghq.com/api/v2/reference-tables/tables/{id}https://api.ap2.datadoghq.com/api/v2/reference-tables/tables/{id}https://api.uk1.datadoghq.com/api/v2/reference-tables/tables/{id}https://api.ddog-gov.com/api/v2/reference-tables/tables/{id}https://api.us2.ddog-gov.com/api/v2/reference-tables/tables/{id}개요
ID를 사용하여 Reference Table을 업데이트합니다. 테이블의 데이터, 설명 및 태그를 업데이트할 수 있습니다. 참고: 테이블 생성 후에는 소스 유형을 변경할 수 없습니다. 데이터 업데이트의 경우: source:LOCAL_FILE 유형의 기존 테이블은 먼저 POST api/v2/reference-tables/uploads를 호출하여 업로드 ID를 얻은 다음 제공된 각 URL에 CSV 데이터 청크를 PUT하고, 마지막으로 file_metadata의 upload_id를 사용하여 이 PATCH 엔드포인트를 호출합니다. source: 유형이 S3, GCS 또는 AZURE인 기존 테이블의 경우, 동일한 유형의 클라우드 스토리지에 있는 CSV 파일을 가리키는 업데이트된 access_details를 file_metadata에 제공합니다.
인수
경로 파라미터
id [required]Unique identifier of the reference table to update
요청
Body Data (required)
data기존 Reference Table을 업데이트하기 위한 요청 본문입니다.
attributesAttributes that define the updates to the reference table's configuration and properties.
descriptionOptional text describing the purpose or contents of this reference table.
file_metadataMetadata specifying where and how to access the reference table's data file.
Object 1Cloud storage file metadata for patch requests. Allows partial updates of access_details and sync_enabled.
access_detailsCloud storage access configuration for the reference table data file.
aws_detailAmazon Web Services S3 storage access configuration.
aws_account_idAWS account ID where the S3 bucket is located.
aws_bucket_nameS3 bucket containing the CSV file.
file_pathThe relative file path from the S3 bucket root to the CSV file.
azure_detailAzure Blob Storage access configuration.
azure_client_idAzure service principal (application) client ID with permissions to read from the container.
azure_container_nameAzure Blob Storage container containing the CSV file.
azure_storage_account_nameAzure storage account where the container is located.
azure_tenant_idAzure Active Directory tenant ID.
file_pathThe relative file path from the Azure container root to the CSV file.
gcp_detailGoogle Cloud Platform storage access configuration.
file_pathThe relative file path from the GCS bucket root to the CSV file.
gcp_bucket_nameGCP bucket containing the CSV file.
gcp_project_idGCP project ID where the bucket is located.
gcp_service_account_emailService account email with read permissions for the GCS bucket.
sync_enabledWhether this table is synced automatically.
Object 2Local file metadata for patch requests using upload ID.
upload_id [required]The upload ID.
schemaSchema defining the updates to the structure and columns of the reference table. Schema fields cannot be deleted or renamed.
fields [required]The schema fields. Maximum of 200 columns.
name [required]The field name.
type [required]The field type for reference table schema fields.
STRING, INT32primary_keys [required]List of field names that serve as primary keys for the table. Only one primary key is supported, and it is used as an ID to retrieve rows. Primary keys cannot be changed after table creation.
tagsTags for organizing and filtering reference tables.
type [required]Reference table resource type.
reference_tablereference_table{
"data": {
"attributes": {
"description": "example description",
"file_metadata": {
"access_details": {
"aws_detail": {
"aws_account_id": "123456789000",
"aws_bucket_name": "example-data-bucket",
"file_path": "reference-tables/users.csv"
},
"azure_detail": {
"azure_client_id": "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb",
"azure_container_name": "reference-data",
"azure_storage_account_name": "examplestorageaccount",
"azure_tenant_id": "cccccccc-4444-5555-6666-dddddddddddd",
"file_path": "tables/users.csv"
},
"gcp_detail": {
"file_path": "data/reference_tables/users.csv",
"gcp_bucket_name": "example-data-bucket",
"gcp_project_id": "example-gcp-project-12345",
"gcp_service_account_email": "example-service@example-gcp-project-12345.iam.gserviceaccount.com"
}
},
"sync_enabled": false
},
"schema": {
"fields": [
{
"name": "field_1",
"type": "STRING"
}
],
"primary_keys": [
"field_1"
]
},
"tags": [
"tag_1",
"tag_2"
]
},
"type": "reference_table"
}
}응답
OK
Bad Request
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Forbidden
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Too many requests
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}코드 예시
# Path parameters
export id="CHANGE_ME"
# 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/reference-tables/tables/${id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "this is a cloud table generated via a cloud bucket sync",
"file_metadata": {
"access_details": {
"aws_detail": {
"aws_account_id": "test-account-id",
"aws_bucket_name": "test-bucket",
"file_path": "test_rt.csv"
}
},
"sync_enabled": true
},
"schema": {
"fields": [
{
"name": "id",
"type": "INT32"
},
{
"name": "name",
"type": "STRING"
}
],
"primary_keys": [
"id"
]
},
"tags": [
"test_tag"
]
},
"type": "reference_table"
}
}
EOF# Path parameters
export id="CHANGE_ME"
# 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/reference-tables/tables/${id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "this is a cloud table generated via a cloud bucket sync",
"file_metadata": {
"access_details": {
"aws_detail": {
"aws_account_id": "test-account-id",
"aws_bucket_name": "test-bucket",
"file_path": "test_rt.csv"
}
},
"sync_enabled": true
},
"schema": {
"fields": [
{
"name": "id",
"type": "INT32"
},
{
"name": "name",
"type": "STRING"
}
],
"primary_keys": [
"id"
]
},
"tags": [
"test_tag"
]
},
"type": "reference_table"
}
}
EOF# Path parameters
export id="CHANGE_ME"
# 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/reference-tables/tables/${id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "this is a cloud table generated via a cloud bucket sync",
"file_metadata": {
"access_details": {
"aws_detail": {
"aws_account_id": "test-account-id",
"aws_bucket_name": "test-bucket",
"file_path": "test_rt.csv"
}
},
"sync_enabled": true
},
"schema": {
"fields": [
{
"name": "id",
"type": "INT32"
},
{
"name": "name",
"type": "STRING"
}
],
"primary_keys": [
"id"
]
},
"tags": [
"test_tag"
]
},
"type": "reference_table"
}
}
EOF# Path parameters
export id="CHANGE_ME"
# 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/reference-tables/tables/${id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "this is a cloud table generated via a cloud bucket sync",
"file_metadata": {
"access_details": {
"aws_detail": {
"aws_account_id": "test-account-id",
"aws_bucket_name": "test-bucket",
"file_path": "test_rt.csv"
}
},
"sync_enabled": true
},
"schema": {
"fields": [
{
"name": "id",
"type": "INT32"
},
{
"name": "name",
"type": "STRING"
}
],
"primary_keys": [
"id"
]
},
"tags": [
"test_tag"
]
},
"type": "reference_table"
}
}
EOF# Path parameters
export id="CHANGE_ME"
# 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/reference-tables/tables/${id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "this is a cloud table generated via a cloud bucket sync",
"file_metadata": {
"access_details": {
"aws_detail": {
"aws_account_id": "test-account-id",
"aws_bucket_name": "test-bucket",
"file_path": "test_rt.csv"
}
},
"sync_enabled": true
},
"schema": {
"fields": [
{
"name": "id",
"type": "INT32"
},
{
"name": "name",
"type": "STRING"
}
],
"primary_keys": [
"id"
]
},
"tags": [
"test_tag"
]
},
"type": "reference_table"
}
}
EOF# Path parameters
export id="CHANGE_ME"
# 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/reference-tables/tables/${id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "this is a cloud table generated via a cloud bucket sync",
"file_metadata": {
"access_details": {
"aws_detail": {
"aws_account_id": "test-account-id",
"aws_bucket_name": "test-bucket",
"file_path": "test_rt.csv"
}
},
"sync_enabled": true
},
"schema": {
"fields": [
{
"name": "id",
"type": "INT32"
},
{
"name": "name",
"type": "STRING"
}
],
"primary_keys": [
"id"
]
},
"tags": [
"test_tag"
]
},
"type": "reference_table"
}
}
EOF# Path parameters
export id="CHANGE_ME"
# 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/reference-tables/tables/${id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "this is a cloud table generated via a cloud bucket sync",
"file_metadata": {
"access_details": {
"aws_detail": {
"aws_account_id": "test-account-id",
"aws_bucket_name": "test-bucket",
"file_path": "test_rt.csv"
}
},
"sync_enabled": true
},
"schema": {
"fields": [
{
"name": "id",
"type": "INT32"
},
{
"name": "name",
"type": "STRING"
}
],
"primary_keys": [
"id"
]
},
"tags": [
"test_tag"
]
},
"type": "reference_table"
}
}
EOF# Path parameters
export id="CHANGE_ME"
# 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/reference-tables/tables/${id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "this is a cloud table generated via a cloud bucket sync",
"file_metadata": {
"access_details": {
"aws_detail": {
"aws_account_id": "test-account-id",
"aws_bucket_name": "test-bucket",
"file_path": "test_rt.csv"
}
},
"sync_enabled": true
},
"schema": {
"fields": [
{
"name": "id",
"type": "INT32"
},
{
"name": "name",
"type": "STRING"
}
],
"primary_keys": [
"id"
]
},
"tags": [
"test_tag"
]
},
"type": "reference_table"
}
}
EOF# Path parameters
export id="CHANGE_ME"
# 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/reference-tables/tables/${id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "this is a cloud table generated via a cloud bucket sync",
"file_metadata": {
"access_details": {
"aws_detail": {
"aws_account_id": "test-account-id",
"aws_bucket_name": "test-bucket",
"file_path": "test_rt.csv"
}
},
"sync_enabled": true
},
"schema": {
"fields": [
{
"name": "id",
"type": "INT32"
},
{
"name": "name",
"type": "STRING"
}
],
"primary_keys": [
"id"
]
},
"tags": [
"test_tag"
]
},
"type": "reference_table"
}
}
EOF// Update reference table returns "OK" 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.PatchTableRequest{
Data: &datadogV2.PatchTableRequestData{
Attributes: &datadogV2.PatchTableRequestDataAttributes{
Description: datadog.PtrString("this is a cloud table generated via a cloud bucket sync"),
FileMetadata: &datadogV2.PatchTableRequestDataAttributesFileMetadata{
PatchTableRequestDataAttributesFileMetadataCloudStorage: &datadogV2.PatchTableRequestDataAttributesFileMetadataCloudStorage{
AccessDetails: &datadogV2.PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails{
AwsDetail: &datadogV2.PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail{
AwsAccountId: datadog.PtrString("test-account-id"),
AwsBucketName: datadog.PtrString("test-bucket"),
FilePath: datadog.PtrString("test_rt.csv"),
},
},
SyncEnabled: datadog.PtrBool(true),
}},
Schema: &datadogV2.PatchTableRequestDataAttributesSchema{
Fields: []datadogV2.PatchTableRequestDataAttributesSchemaFieldsItems{
{
Name: "id",
Type: datadogV2.REFERENCETABLESCHEMAFIELDTYPE_INT32,
},
{
Name: "name",
Type: datadogV2.REFERENCETABLESCHEMAFIELDTYPE_STRING,
},
},
PrimaryKeys: []string{
"id",
},
},
Tags: []string{
"test_tag",
},
},
Type: datadogV2.PATCHTABLEREQUESTDATATYPE_REFERENCE_TABLE,
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewReferenceTablesApi(apiClient)
r, err := api.UpdateReferenceTable(ctx, "id", body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ReferenceTablesApi.UpdateReferenceTable`: %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 reference table returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.ReferenceTablesApi;
import com.datadog.api.client.v2.model.PatchTableRequest;
import com.datadog.api.client.v2.model.PatchTableRequestData;
import com.datadog.api.client.v2.model.PatchTableRequestDataAttributes;
import com.datadog.api.client.v2.model.PatchTableRequestDataAttributesFileMetadata;
import com.datadog.api.client.v2.model.PatchTableRequestDataAttributesFileMetadataCloudStorage;
import com.datadog.api.client.v2.model.PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails;
import com.datadog.api.client.v2.model.PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail;
import com.datadog.api.client.v2.model.PatchTableRequestDataAttributesSchema;
import com.datadog.api.client.v2.model.PatchTableRequestDataAttributesSchemaFieldsItems;
import com.datadog.api.client.v2.model.PatchTableRequestDataType;
import com.datadog.api.client.v2.model.ReferenceTableSchemaFieldType;
import java.util.Arrays;
import java.util.Collections;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
ReferenceTablesApi apiInstance = new ReferenceTablesApi(defaultClient);
PatchTableRequest body =
new PatchTableRequest()
.data(
new PatchTableRequestData()
.attributes(
new PatchTableRequestDataAttributes()
.description("this is a cloud table generated via a cloud bucket sync")
.fileMetadata(
new PatchTableRequestDataAttributesFileMetadata(
new PatchTableRequestDataAttributesFileMetadataCloudStorage()
.accessDetails(
new PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails()
.awsDetail(
new PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail()
.awsAccountId("test-account-id")
.awsBucketName("test-bucket")
.filePath("test_rt.csv")))
.syncEnabled(true)))
.schema(
new PatchTableRequestDataAttributesSchema()
.fields(
Arrays.asList(
new PatchTableRequestDataAttributesSchemaFieldsItems()
.name("id")
.type(ReferenceTableSchemaFieldType.INT32),
new PatchTableRequestDataAttributesSchemaFieldsItems()
.name("name")
.type(ReferenceTableSchemaFieldType.STRING)))
.primaryKeys(Collections.singletonList("id")))
.tags(Collections.singletonList("test_tag")))
.type(PatchTableRequestDataType.REFERENCE_TABLE));
try {
apiInstance.updateReferenceTable("id", body);
} catch (ApiException e) {
System.err.println("Exception when calling ReferenceTablesApi#updateReferenceTable");
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 reference table returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.reference_tables_api import ReferenceTablesApi
from datadog_api_client.v2.model.patch_table_request import PatchTableRequest
from datadog_api_client.v2.model.patch_table_request_data import PatchTableRequestData
from datadog_api_client.v2.model.patch_table_request_data_attributes import PatchTableRequestDataAttributes
from datadog_api_client.v2.model.patch_table_request_data_attributes_file_metadata_cloud_storage import (
PatchTableRequestDataAttributesFileMetadataCloudStorage,
)
from datadog_api_client.v2.model.patch_table_request_data_attributes_file_metadata_one_of_access_details import (
PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails,
)
from datadog_api_client.v2.model.patch_table_request_data_attributes_file_metadata_one_of_access_details_aws_detail import (
PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail,
)
from datadog_api_client.v2.model.patch_table_request_data_attributes_schema import PatchTableRequestDataAttributesSchema
from datadog_api_client.v2.model.patch_table_request_data_attributes_schema_fields_items import (
PatchTableRequestDataAttributesSchemaFieldsItems,
)
from datadog_api_client.v2.model.patch_table_request_data_type import PatchTableRequestDataType
from datadog_api_client.v2.model.reference_table_schema_field_type import ReferenceTableSchemaFieldType
body = PatchTableRequest(
data=PatchTableRequestData(
attributes=PatchTableRequestDataAttributes(
description="this is a cloud table generated via a cloud bucket sync",
file_metadata=PatchTableRequestDataAttributesFileMetadataCloudStorage(
access_details=PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails(
aws_detail=PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail(
aws_account_id="test-account-id",
aws_bucket_name="test-bucket",
file_path="test_rt.csv",
),
),
sync_enabled=True,
),
schema=PatchTableRequestDataAttributesSchema(
fields=[
PatchTableRequestDataAttributesSchemaFieldsItems(
name="id",
type=ReferenceTableSchemaFieldType.INT32,
),
PatchTableRequestDataAttributesSchemaFieldsItems(
name="name",
type=ReferenceTableSchemaFieldType.STRING,
),
],
primary_keys=[
"id",
],
),
tags=[
"test_tag",
],
),
type=PatchTableRequestDataType.REFERENCE_TABLE,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = ReferenceTablesApi(api_client)
api_instance.update_reference_table(id="id", 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 reference table returns "OK" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::ReferenceTablesAPI.new
body = DatadogAPIClient::V2::PatchTableRequest.new({
data: DatadogAPIClient::V2::PatchTableRequestData.new({
attributes: DatadogAPIClient::V2::PatchTableRequestDataAttributes.new({
description: "this is a cloud table generated via a cloud bucket sync",
file_metadata: DatadogAPIClient::V2::PatchTableRequestDataAttributesFileMetadataCloudStorage.new({
access_details: DatadogAPIClient::V2::PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails.new({
aws_detail: DatadogAPIClient::V2::PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail.new({
aws_account_id: "test-account-id",
aws_bucket_name: "test-bucket",
file_path: "test_rt.csv",
}),
}),
sync_enabled: true,
}),
schema: DatadogAPIClient::V2::PatchTableRequestDataAttributesSchema.new({
fields: [
DatadogAPIClient::V2::PatchTableRequestDataAttributesSchemaFieldsItems.new({
name: "id",
type: DatadogAPIClient::V2::ReferenceTableSchemaFieldType::INT32,
}),
DatadogAPIClient::V2::PatchTableRequestDataAttributesSchemaFieldsItems.new({
name: "name",
type: DatadogAPIClient::V2::ReferenceTableSchemaFieldType::STRING,
}),
],
primary_keys: [
"id",
],
}),
tags: [
"test_tag",
],
}),
type: DatadogAPIClient::V2::PatchTableRequestDataType::REFERENCE_TABLE,
}),
})
p api_instance.update_reference_table("id", 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 reference table returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_reference_tables::ReferenceTablesAPI;
use datadog_api_client::datadogV2::model::PatchTableRequest;
use datadog_api_client::datadogV2::model::PatchTableRequestData;
use datadog_api_client::datadogV2::model::PatchTableRequestDataAttributes;
use datadog_api_client::datadogV2::model::PatchTableRequestDataAttributesFileMetadata;
use datadog_api_client::datadogV2::model::PatchTableRequestDataAttributesFileMetadataCloudStorage;
use datadog_api_client::datadogV2::model::PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails;
use datadog_api_client::datadogV2::model::PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail;
use datadog_api_client::datadogV2::model::PatchTableRequestDataAttributesSchema;
use datadog_api_client::datadogV2::model::PatchTableRequestDataAttributesSchemaFieldsItems;
use datadog_api_client::datadogV2::model::PatchTableRequestDataType;
use datadog_api_client::datadogV2::model::ReferenceTableSchemaFieldType;
#[tokio::main]
async fn main() {
let body =
PatchTableRequest
::new().data(
PatchTableRequestData::new(
PatchTableRequestDataType::REFERENCE_TABLE,
).attributes(
PatchTableRequestDataAttributes::new()
.description("this is a cloud table generated via a cloud bucket sync".to_string())
.file_metadata(
PatchTableRequestDataAttributesFileMetadata
::PatchTableRequestDataAttributesFileMetadataCloudStorage(
Box::new(
PatchTableRequestDataAttributesFileMetadataCloudStorage::new()
.access_details(
PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails
::new().aws_detail(
PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail
::new()
.aws_account_id("test-account-id".to_string())
.aws_bucket_name("test-bucket".to_string())
.file_path("test_rt.csv".to_string()),
),
)
.sync_enabled(true),
),
),
)
.schema(
PatchTableRequestDataAttributesSchema::new(
vec![
PatchTableRequestDataAttributesSchemaFieldsItems::new(
"id".to_string(),
ReferenceTableSchemaFieldType::INT32,
),
PatchTableRequestDataAttributesSchemaFieldsItems::new(
"name".to_string(),
ReferenceTableSchemaFieldType::STRING,
)
],
vec!["id".to_string()],
),
)
.tags(vec!["test_tag".to_string()]),
),
);
let configuration = datadog::Configuration::new();
let api = ReferenceTablesAPI::with_config(configuration);
let resp = api.update_reference_table("id".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 reference table returns "OK" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
const apiInstance = new v2.ReferenceTablesApi(configuration);
const params: v2.ReferenceTablesApiUpdateReferenceTableRequest = {
body: {
data: {
attributes: {
description: "this is a cloud table generated via a cloud bucket sync",
fileMetadata: {
accessDetails: {
awsDetail: {
awsAccountId: "test-account-id",
awsBucketName: "test-bucket",
filePath: "test_rt.csv",
},
},
syncEnabled: true,
},
schema: {
fields: [
{
name: "id",
type: "INT32",
},
{
name: "name",
type: "STRING",
},
],
primaryKeys: ["id"],
},
tags: ["test_tag"],
},
type: "reference_table",
},
},
id: "id",
};
apiInstance
.updateReferenceTable(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"