-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathCreateReferenceTable.ts
More file actions
54 lines (50 loc) · 1.33 KB
/
CreateReferenceTable.ts
File metadata and controls
54 lines (50 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* Create reference table returns "Created" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration();
const apiInstance = new v2.ReferenceTablesApi(configuration);
const params: v2.ReferenceTablesApiCreateReferenceTableRequest = {
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: "name",
type: "STRING",
},
{
name: "account_id",
type: "STRING",
},
],
primaryKeys: ["account_id"],
},
source: "S3",
tableName: "test_reference_table",
tags: ["test_tag"],
},
type: "reference_table",
},
},
};
apiInstance
.createReferenceTable(params)
.then((data: v2.TableResultV2) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));