|
| 1 | +# Create reference table returns "Created" response |
| 2 | + |
| 3 | +require "datadog_api_client" |
| 4 | +api_instance = DatadogAPIClient::V2::ReferenceTablesAPI.new |
| 5 | + |
| 6 | +body = DatadogAPIClient::V2::CreateTableRequest.new({ |
| 7 | + data: DatadogAPIClient::V2::CreateTableRequestData.new({ |
| 8 | + attributes: DatadogAPIClient::V2::CreateTableRequestDataAttributes.new({ |
| 9 | + description: "this is a cloud table generated via a cloud bucket sync", |
| 10 | + file_metadata: DatadogAPIClient::V2::CreateTableRequestDataAttributesFileMetadataCloudStorage.new({ |
| 11 | + access_details: DatadogAPIClient::V2::CreateTableRequestDataAttributesFileMetadataOneOfAccessDetails.new({ |
| 12 | + aws_detail: DatadogAPIClient::V2::CreateTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail.new({ |
| 13 | + aws_account_id: "test-account-id", |
| 14 | + aws_bucket_name: "test-bucket", |
| 15 | + file_path: "test_rt.csv", |
| 16 | + }), |
| 17 | + }), |
| 18 | + sync_enabled: true, |
| 19 | + }), |
| 20 | + schema: DatadogAPIClient::V2::CreateTableRequestDataAttributesSchema.new({ |
| 21 | + fields: [ |
| 22 | + DatadogAPIClient::V2::CreateTableRequestDataAttributesSchemaFieldsItems.new({ |
| 23 | + name: "name", |
| 24 | + type: DatadogAPIClient::V2::ReferenceTableSchemaFieldType::STRING, |
| 25 | + }), |
| 26 | + DatadogAPIClient::V2::CreateTableRequestDataAttributesSchemaFieldsItems.new({ |
| 27 | + name: "account_id", |
| 28 | + type: DatadogAPIClient::V2::ReferenceTableSchemaFieldType::STRING, |
| 29 | + }), |
| 30 | + ], |
| 31 | + primary_keys: [ |
| 32 | + "account_id", |
| 33 | + ], |
| 34 | + }), |
| 35 | + source: DatadogAPIClient::V2::ReferenceTableCreateSourceType::S3, |
| 36 | + table_name: "test_reference_table", |
| 37 | + tags: [ |
| 38 | + "test_tag", |
| 39 | + ], |
| 40 | + }), |
| 41 | + type: DatadogAPIClient::V2::CreateTableRequestDataType::REFERENCE_TABLE, |
| 42 | + }), |
| 43 | +}) |
| 44 | +p api_instance.create_reference_table(body) |
0 commit comments